fix: NPC국 생성 시, 평균 기술력을 받아오지 못하는 문제 수정
This commit is contained in:
@@ -129,15 +129,7 @@ class RaiseNPCNation extends \sammo\Event\Action
|
|||||||
|
|
||||||
public function calcAvgTech(): int
|
public function calcAvgTech(): int
|
||||||
{
|
{
|
||||||
$techSum = 0;
|
[$techSum, $nationCnt] = DB::db()->queryFirstList('SELECT sum(tech), COUNT(tech) FROM nation WHERE level > 0') ?? [0, 0];
|
||||||
$nationCnt = 0;
|
|
||||||
foreach (\sammo\getAllNationStaticInfo() as $nation) {
|
|
||||||
if ($nation['level'] == 0) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
$techSum += $nation['tech'];
|
|
||||||
$nationCnt += 1;
|
|
||||||
}
|
|
||||||
if ($nationCnt == 0) {
|
if ($nationCnt == 0) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -182,7 +174,7 @@ class RaiseNPCNation extends \sammo\Event\Action
|
|||||||
|
|
||||||
foreach (pickGeneralFromPool(DB::db(), 0, $genCnt - 1) as $pickedNPC) {
|
foreach (pickGeneralFromPool(DB::db(), 0, $genCnt - 1) as $pickedNPC) {
|
||||||
//대충 10년후부터 6년마다 절반?
|
//대충 10년후부터 6년마다 절반?
|
||||||
$deadYear = $deadYearMin + Util::toInt(60 * (1 - log(Util::randRange(1, 1024), 2)/10));
|
$deadYear = $deadYearMin + Util::toInt(60 * (1 - log(Util::randRange(1, 1024), 2) / 10));
|
||||||
$newNPC = $pickedNPC->getGeneralBuilder();
|
$newNPC = $pickedNPC->getGeneralBuilder();
|
||||||
$newNPC->setNationID($nationID)
|
$newNPC->setNationID($nationID)
|
||||||
->setCityID($cityID)
|
->setCityID($cityID)
|
||||||
|
|||||||
Reference in New Issue
Block a user