diff --git a/hwe/sammo/Command/General/che_징병.php b/hwe/sammo/Command/General/che_징병.php index f5e993aa..e5cbdd0d 100644 --- a/hwe/sammo/Command/General/che_징병.php +++ b/hwe/sammo/Command/General/che_징병.php @@ -48,7 +48,7 @@ class che_징병 extends Command\GeneralCommand{ if(!key_exists('crewType', $this->arg)){ return false; } - if(!key_exists('amount', $this->arg)){ + if(!key_exists('amountCrew', $this->arg)){ return false; } $crewType = $this->arg['crewType']; @@ -69,7 +69,7 @@ class che_징병 extends Command\GeneralCommand{ } $this->arg = [ 'crewType'=>$crewType, - 'amount'=>$amount + 'amountCrew'=>$amount ]; return true; } @@ -89,7 +89,7 @@ class che_징병 extends Command\GeneralCommand{ if($reqCrewType->id == $currCrewType->id){ $maxCrew -= $general->getVar('crew'); } - $reqCrew = Util::valueFit($this->arg['amount'], 100, $maxCrew); + $reqCrew = Util::valueFit($this->arg['amountCrew'], 100, $maxCrew); $this->reqCrew = $reqCrew; $this->reqCrewType = $reqCrewType; $this->currCrewType = $currCrewType; diff --git a/hwe/sammo/General.php b/hwe/sammo/General.php index 85b8efd4..7417b551 100644 --- a/hwe/sammo/General.php +++ b/hwe/sammo/General.php @@ -237,13 +237,13 @@ class General implements iAction{ function kill($db){ $gameStor = KVStorage::getStorage($db, 'game_env'); - $generalID = $this->getRaw('no'); + $generalID = $this->getID(); $logger = $this->getLogger(); $generalName = $this->getName(); // 군주였으면 유지 이음 - if($this->getRaw('level') == 12) { + if($this->getVar('level') == 12) { nextRuler($this); } @@ -261,7 +261,7 @@ class General implements iAction{ ], 'gen3=%i', $generalID); // 부대 처리 - $troopID = $this->getRaw('troop'); + $troopID = $this->getVar('troop'); $troopLeaderID = $db->queryFirstField('SELECT `no` FROM troop WHERE troop=%i', $troopID); if($troopLeaderID == $generalID){ //부대장일 경우 diff --git a/hwe/sammo/GeneralAI.php b/hwe/sammo/GeneralAI.php index e34f0a23..2a948180 100644 --- a/hwe/sammo/GeneralAI.php +++ b/hwe/sammo/GeneralAI.php @@ -321,20 +321,20 @@ class GeneralAI{ $types = []; foreach(GameUnitConst::byType(GameUnitConst::T_FOOTMAN) as $crewtype){ if($crewtype->isValid($cities, $regions, $relYear, $tech)){ - $score = $dex[GameConst::T_FOOTMAN] * $crewtype->pickScore($tech); + $score = $dex[GameUnitConst::T_FOOTMAN] * $crewtype->pickScore($tech); $types[] = [$crewtype->id, $score]; } } foreach(GameUnitConst::byType(GameUnitConst::T_ARCHER) as $crewtype){ if($crewtype->isValid($cities, $regions, $relYear, $tech)){ - $score = $dex[GameConst::T_ARCHER] * $crewtype->pickScore($tech); + $score = $dex[GameUnitConst::T_ARCHER] * $crewtype->pickScore($tech); $types[] = [$crewtype->id, $score]; } } foreach(GameUnitConst::byType(GameUnitConst::T_CAVALRY) as $crewtype){ if($crewtype->isValid($cities, $regions, $relYear, $tech)){ - $score = $dex[GameConst::T_CAVALRY] * $crewtype->pickScore($tech); - $types[] = [$crewtype->id, $dex[GameConst::T_CAVALRY] + 500]; + $score = $dex[GameUnitConst::T_CAVALRY] * $crewtype->pickScore($tech); + $types[] = [$crewtype->id, $dex[GameUnitConst::T_CAVALRY] + 500]; } } foreach($types as [$crewtype, $score]){ @@ -346,7 +346,7 @@ class GeneralAI{ $types = []; foreach(GameUnitConst::byType(GameUnitConst::T_WIZARD) as $crewtype){ if($crewtype->isValid($cities, $regions, $relYear, $tech)){ - $score = $dex[GameConst::T_WIZARD] * $crewtype->pickScore($tech); + $score = $dex[GameUnitConst::T_WIZARD] * $crewtype->pickScore($tech); $types[] = [$crewtype->id, $score]; } } @@ -1345,7 +1345,7 @@ class GeneralAI{ $sumLeadershipInCity = $db->queryFirstField('SELECT sum(leader) FROM general WHERE nation = %i AND city = %i AND leader > 40', $nationID, $cityID); if( $city['pop'] > 30000 + $general->getLeadership(false) * 100 * 1.3 && - Util::bool(($city['pop'] - 30000) / $sumLeadershipInCity * 100) + Util::randBool(($city['pop'] - 30000) / $sumLeadershipInCity * 100) ){ return $this->chooseRecruitCrewType(); } diff --git a/hwe/sammo/TextDecoration/DyingMessage.php b/hwe/sammo/TextDecoration/DyingMessage.php index 592c27fa..0163ac69 100644 --- a/hwe/sammo/TextDecoration/DyingMessage.php +++ b/hwe/sammo/TextDecoration/DyingMessage.php @@ -101,7 +101,7 @@ class DyingMessage{ function __construct($name, ?int $npc = null) { if(static::$messages === null){ - static::buildMessageList(); + static::initMessageList(); } if($name instanceof General){ $this->_constructWithObj($name); @@ -112,17 +112,17 @@ class DyingMessage{ } public function getText():string{ - $name = $this->general->getName(); - $npc = $this->general->getVar('npc'); + $name = $this->name ; + $npc = $this->npc; if($npc == 0){ - $text = Util::choiceRandom(static::$messages); + $text = Util::choiceRandom(static::$messages??[]); } else if($npc == 2 || $npc == 6){ - $text = Util::choiceRandom(static::$scenarioNPCMessages); + $text = Util::choiceRandom(static::$scenarioNPCMessages??[]); } else if($npc == 3 || $npc == 4){ - $text = Util::choiceRandom(static::$utilNPCMessages); + $text = Util::choiceRandom(static::$utilNPCMessages??[]); } else{ $text = static::$defaultMessage; @@ -131,5 +131,6 @@ class DyingMessage{ $text = str_replace(':name:', $name, $text); JosaUtil::batch($text, $name); + return $text; } } \ No newline at end of file diff --git a/src/sammo/JosaUtil.php b/src/sammo/JosaUtil.php index 91f9d612..3a2e9270 100644 --- a/src/sammo/JosaUtil.php +++ b/src/sammo/JosaUtil.php @@ -610,7 +610,7 @@ class JosaUtil{ $search = []; $replace = []; - foreach(static::DEFAULT_POSTPOSITION as [$wJong, $woJong]){ + foreach(static::DEFAULT_POSTPOSITION as $wJong => $woJong){ $value = JosaUtil::pick($key, $wJong); $search[] = "{$prefix}{$wJong}{$postfix}"; $replace[] = $value;