basic elect leader
@@ -977,6 +977,45 @@ class Tribe
977
977
}
978
978
}
979
979
980
$hasLeader = false;
981
foreach ($this->getKobolds() as $kobold) {
982
if ($kobold->isLeader()) {
983
$hasLeader = true;
984
break;
985
}
986
}
987
988
if (!$hasLeader) {
989
$adultCandidates = array_filter($this->getKobolds(), function ($kobold) {
990
return $kobold->getAgeCategory() === 'adult';
991
});
992
993
if (!empty($adultCandidates)) {
994
usort($adultCandidates, function ($a, $b) {
995
return $b->getAge() <=> $a->getAge();
996
});
997
998
$newLeader = $adultCandidates[0];
999
$newLeader->setLeader();
1000
1001
$leaderName = $newLeader->getName();
1002
$leaderStories = [
1003
"With no chieftain to guide the camp, the elders called a gathering. Voices rose and fell until a clear choice emerged, and {$leaderName} was named to lead. The tribe settled as the new chieftain accepted the duty.",
1004
"The tribe woke to a quiet worry with no leader among them. By sundown the council had met, and {$leaderName} was chosen to carry the tribe's future. The fires burned steady as the new chieftain took the mantle.",
1005
"Without a chieftain, the camp felt adrift. The oldest adults met in counsel and agreed that {$leaderName} should lead. The tribe marked the choice with a solemn vow and returned to their work with purpose.",
1006
"A leaderless tribe called for order, so the elders gathered the adults to decide. After careful words and long thought, {$leaderName} was raised as chieftain. A quiet cheer moved through the dens as the tribe accepted the new guide.",
1007
"As the month closed, the tribe turned to its oldest adults for direction. The council placed the burden of leadership on {$leaderName}. The camp steadied as the new chieftain promised to protect the tribe.",
1008
"The fires crackled while the elders spoke of who should lead. In the end, {$leaderName} stood before the tribe as the chosen chieftain. The tribe nodded as one, and a new season of leadership began.",
1009
"A tribe without a leader cannot last, so the adults met to decide. They chose {$leaderName} to take the chieftain's role. The camp settled into a calm rhythm as the new leader's voice carried.",
1010
"With no chieftain among them, the tribe held a council beneath the evening sky. The decision came in favor of {$leaderName}, who accepted the weight of leadership. The tribe returned to their huts with renewed confidence.",
1011
"The tribe convened an elders' circle to fill the empty seat of leadership. After debate and silence, {$leaderName} was named chieftain. The camp honored the choice and moved forward together.",
1012
"Leadership was needed, and the tribe did not delay. The oldest adults agreed that {$leaderName} should guide them, and the tribe affirmed the decision. The new chieftain's first night ended with a calm and steady watch."
1013
];
1014
1015
$foodStory .= "\n" . $leaderStories[array_rand($leaderStories)] . "\n";
1016
}
1017
}
1018
980
1019
$this->save();
981
1020
982
1021
return $foodStory;
@@ -977,6 +977,45 @@ class Tribe977
}977
}978
}978
}979
979
980
$hasLeader = false;981
foreach ($this->getKobolds() as $kobold) {982
if ($kobold->isLeader()) {983
$hasLeader = true;984
break;985
}986
}987
988
if (!$hasLeader) {989
$adultCandidates = array_filter($this->getKobolds(), function ($kobold) {990
return $kobold->getAgeCategory() === 'adult';991
});992
993
if (!empty($adultCandidates)) {994
usort($adultCandidates, function ($a, $b) {995
return $b->getAge() <=> $a->getAge();996
});997
998
$newLeader = $adultCandidates[0];999
$newLeader->setLeader();1000
1001
$leaderName = $newLeader->getName();1002
$leaderStories = [1003
"With no chieftain to guide the camp, the elders called a gathering. Voices rose and fell until a clear choice emerged, and {$leaderName} was named to lead. The tribe settled as the new chieftain accepted the duty.",1004
"The tribe woke to a quiet worry with no leader among them. By sundown the council had met, and {$leaderName} was chosen to carry the tribe's future. The fires burned steady as the new chieftain took the mantle.",1005
"Without a chieftain, the camp felt adrift. The oldest adults met in counsel and agreed that {$leaderName} should lead. The tribe marked the choice with a solemn vow and returned to their work with purpose.",1006
"A leaderless tribe called for order, so the elders gathered the adults to decide. After careful words and long thought, {$leaderName} was raised as chieftain. A quiet cheer moved through the dens as the tribe accepted the new guide.",1007
"As the month closed, the tribe turned to its oldest adults for direction. The council placed the burden of leadership on {$leaderName}. The camp steadied as the new chieftain promised to protect the tribe.",1008
"The fires crackled while the elders spoke of who should lead. In the end, {$leaderName} stood before the tribe as the chosen chieftain. The tribe nodded as one, and a new season of leadership began.",1009
"A tribe without a leader cannot last, so the adults met to decide. They chose {$leaderName} to take the chieftain's role. The camp settled into a calm rhythm as the new leader's voice carried.",1010
"With no chieftain among them, the tribe held a council beneath the evening sky. The decision came in favor of {$leaderName}, who accepted the weight of leadership. The tribe returned to their huts with renewed confidence.",1011
"The tribe convened an elders' circle to fill the empty seat of leadership. After debate and silence, {$leaderName} was named chieftain. The camp honored the choice and moved forward together.",1012
"Leadership was needed, and the tribe did not delay. The oldest adults agreed that {$leaderName} should guide them, and the tribe affirmed the decision. The new chieftain's first night ended with a calm and steady watch."1013
];1014
1015
$foodStory .= "\n" . $leaderStories[array_rand($leaderStories)] . "\n";1016
}1017
}1018
980
$this->save();1019
$this->save();981
1020
982
return $foodStory;1021
return $foodStory;