From b7048a44227418cb92981c1595818192d7a5a0ca Mon Sep 17 00:00:00 2001 From: Hide_D Date: Sun, 17 Apr 2022 21:17:18 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20NPC=EA=B5=AD=20=EC=83=9D=EC=84=B1=20?= =?UTF-8?q?=EC=8B=9C,=20=ED=8F=89=EA=B7=A0=20=EA=B8=B0=EC=88=A0=EB=A0=A5?= =?UTF-8?q?=EC=9D=84=20=EB=B0=9B=EC=95=84=EC=98=A4=EC=A7=80=20=EB=AA=BB?= =?UTF-8?q?=ED=95=98=EB=8A=94=20=EB=AC=B8=EC=A0=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/sammo/Event/Action/RaiseNPCNation.php | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/hwe/sammo/Event/Action/RaiseNPCNation.php b/hwe/sammo/Event/Action/RaiseNPCNation.php index 8cdbd53e..74605c5b 100644 --- a/hwe/sammo/Event/Action/RaiseNPCNation.php +++ b/hwe/sammo/Event/Action/RaiseNPCNation.php @@ -129,15 +129,7 @@ class RaiseNPCNation extends \sammo\Event\Action public function calcAvgTech(): int { - $techSum = 0; - $nationCnt = 0; - foreach (\sammo\getAllNationStaticInfo() as $nation) { - if ($nation['level'] == 0) { - continue; - } - $techSum += $nation['tech']; - $nationCnt += 1; - } + [$techSum, $nationCnt] = DB::db()->queryFirstList('SELECT sum(tech), COUNT(tech) FROM nation WHERE level > 0') ?? [0, 0]; if ($nationCnt == 0) { return 0; } @@ -182,7 +174,7 @@ class RaiseNPCNation extends \sammo\Event\Action foreach (pickGeneralFromPool(DB::db(), 0, $genCnt - 1) as $pickedNPC) { //대충 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->setNationID($nationID) ->setCityID($cityID)