npcCount = $npcCount; } protected function generateNPC($env, int $cnt){ $pickTypeList = ['무'=>1, '지'=>1]; $age = Util::randRangeInt(20, 25); $birthYear = $env['year'] - $age; $deathYear = $env['year'] + Util::randRangeInt(10, 50); $result = []; foreach(pickGeneralFromPool(DB::db(), 0, $cnt) as $pickedNPC){ $newNPC = $pickedNPC->getGeneralBuilder(); $newNPC->setNationID(0) ->setNPCType(3) ->setMoney(1000, 1000) ->setExpDed(0, 0) ->setLifeSpan($birthYear, $deathYear) ->fillRandomStat($pickTypeList) ->fillRemainSpecAsZero($env); $newNPC->build($env); $pickedNPC->occupyGeneralName(); $result[] = [ $newNPC->getGeneralName(), $newNPC->getGeneralID() ]; } return $result; } public function run($env=null){ if($this->npcCount <= 0){ return [__CLASS__, []]; } $result = $this->generateNPC($env, $this->npcCount); $logger = new \sammo\ActionLogger(0, 0, $env['year'], $env['month']); $genCnt = count($result); if($genCnt == 1){ $npcName = $result[0][0]; $josaRa = \sammo\JosaUtil::pick($npcName, '라'); $logger->pushGlobalActionLog("$npcName{$josaRa}는 장수가 등장하였습니다."); } else{ $logger->pushGlobalActionLog("장수 {$genCnt}명이 등장하였습니다."); } $logger->pushGlobalHistoryLog("장수 {$genCnt}명이 등장했습니다.", \sammo\ActionLogger::NOTICE_YEAR_MONTH); $logger->flush(); return [__CLASS__, $result]; } }