diff --git a/hwe/b_myBossInfo.php b/hwe/b_myBossInfo.php index 80370a1c..1e08f01a 100644 --- a/hwe/b_myBossInfo.php +++ b/hwe/b_myBossInfo.php @@ -17,7 +17,7 @@ TurnExecutionHelper::executeAllCommand(); $query = "select no,nation,officer_level from general where owner='{$userID}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $me = MYDB_fetch_array($result); -$nationID = $nationID; +$nationID = $me['nation']; $meLevel = $me['officer_level']; if($meLevel == 0) { @@ -140,8 +140,8 @@ $eaglestr = join(', ', array_map(function($arr){ ?> - query('SELECT city,name,level,region,officer4set,officer3set,officer2set from city where nation=$i order by region,level desc,binary(name)', $nationID) as $city) { +foreach($db->query('SELECT city,name,level,region,officer4set,officer3set,officer2set from city where nation=%i order by region,level desc,binary(name)', $nationID) as $city) { $cityID = $city['city']; $cityOfficerList = $officerList[$cityID]??[]; ?> diff --git a/hwe/sammo/AutorunNationPolicy.php b/hwe/sammo/AutorunNationPolicy.php index abf38b99..ea40431f 100644 --- a/hwe/sammo/AutorunNationPolicy.php +++ b/hwe/sammo/AutorunNationPolicy.php @@ -55,12 +55,12 @@ class AutorunNationPolicy { 'NPC후방발령', 'NPC포상', - 'NPC몰수', 'NPC전방발령', '유저장내정발령', 'NPC내정발령', + 'NPC몰수', ]; //순서는 중요하지 않음 @@ -128,7 +128,9 @@ class AutorunNationPolicy { public $reqNPCWarGold = 5000; public $reqNPCWarRice = 5000; public $reqNPCDevelGold = 1000; - public $reqNPCDevelRice = 0; + public $reqNPCDevelRice = 500; + + public $minimumResourceActionAmount = 1000; public $minNPCWarLeadership = 40; public $minWarCrew = 1500; diff --git a/hwe/sammo/Command/BaseCommand.php b/hwe/sammo/Command/BaseCommand.php index 01a98e50..d74cba25 100644 --- a/hwe/sammo/Command/BaseCommand.php +++ b/hwe/sammo/Command/BaseCommand.php @@ -258,6 +258,11 @@ abstract class BaseCommand{ } public function testReservable():?string{ + if(!$this->isArgValid()){ + $this->reasonNotReservable = '인자가 올바르지 않습니다.'; + $this->reservable = false; + return $this->reasonNotReservable; + } if($this->reservableConstraints === null){ return null; } @@ -288,8 +293,10 @@ abstract class BaseCommand{ public function testRunnable():?string{ if(!$this->isArgValid()){ - throw new \InvalidArgumentException('인자가 제대로 설정되지 않았습니다'.\sammo\Json::encode($this->arg)); - } + $this->reasonNotReservable = '인자가 올바르지 않습니다.'; + $this->reservable = false; + return $this->reasonNotReservable; + } if($this->runnableConstraints === null){ throw new \InvalidArgumentException('runnableConstraits가 제대로 설정되지 않았습니다'); } diff --git a/hwe/sammo/Command/General/che_군량매매.php b/hwe/sammo/Command/General/che_군량매매.php index 2618bf94..f5ba8650 100644 --- a/hwe/sammo/Command/General/che_군량매매.php +++ b/hwe/sammo/Command/General/che_군량매매.php @@ -35,14 +35,14 @@ class che_군량매매 extends Command\GeneralCommand{ } $buyRice = boolval($buyRice); $amount = $this->arg['amount']??null; - if(is_float($amount)){ - $amount = Util::toInt($amount); - } - else if(!is_int($amount)){ + if(!is_numeric($amount)){ return false; } + $amount = Util::round($amount, -2); $amount = Util::valueFit($amount, 100, GameConst::$maxResourceActionAmount); - + if($amount <= 0){ + return false; + } $this->arg = [ 'buyRice'=>$buyRice, 'amount'=>$amount diff --git a/hwe/sammo/Command/General/che_증여.php b/hwe/sammo/Command/General/che_증여.php index 0628717d..c078eb5a 100644 --- a/hwe/sammo/Command/General/che_증여.php +++ b/hwe/sammo/Command/General/che_증여.php @@ -43,13 +43,14 @@ class che_증여 extends Command\GeneralCommand{ $isGold = $this->arg['isGold']; $amount = $this->arg['amount']; $destGeneralID = $this->arg['destGeneralID']; - if(is_float($amount)){ - $amount = Util::toInt($amount); - } - else if(!is_int($amount)){ + if(!is_numeric($amount)){ return false; } + $amount = Util::round($amount, -2); $amount = Util::valueFit($amount, 100, GameConst::$maxResourceActionAmount); + if($amount <= 0){ + return false; + } if(!is_bool($isGold)){ return false; } diff --git a/hwe/sammo/Command/General/che_헌납.php b/hwe/sammo/Command/General/che_헌납.php index 916f16d9..a56a39b8 100644 --- a/hwe/sammo/Command/General/che_헌납.php +++ b/hwe/sammo/Command/General/che_헌납.php @@ -38,12 +38,10 @@ class che_헌납 extends Command\GeneralCommand{ } $isGold = $this->arg['isGold']; $amount = $this->arg['amount']; - if(is_float($amount)){ - $amount = Util::toInt($amount); - } - else if(!is_int($amount)){ + if(!is_numeric($amount)){ return false; } + $amount = Util::round($amount, -2); $amount = Util::valueFit($amount, 100, GameConst::$maxResourceActionAmount); if(!is_bool($isGold)){ return false; diff --git a/hwe/sammo/Command/Nation/che_몰수.php b/hwe/sammo/Command/Nation/che_몰수.php index 50fff12f..91a677e0 100644 --- a/hwe/sammo/Command/Nation/che_몰수.php +++ b/hwe/sammo/Command/Nation/che_몰수.php @@ -44,13 +44,14 @@ class che_몰수 extends Command\NationCommand{ $isGold = $this->arg['isGold']; $amount = $this->arg['amount']; $destGeneralID = $this->arg['destGeneralID']; - if(is_float($amount)){ - $amount = Util::toInt($amount); - } - else if(!is_int($amount)){ + if(!is_numeric($amount)){ return false; } + $amount = Util::round($amount, -2); $amount = Util::valueFit($amount, 100, GameConst::$maxResourceActionAmount); + if($amount <= 0){ + return false; + } if(!is_bool($isGold)){ return false; } @@ -140,8 +141,7 @@ class che_몰수 extends Command\NationCommand{ $amount = Util::valueFit( $amount, 0, - ($destGeneral->getVar($resKey) - - ($isGold?GameConst::$generalMinimumGold:GameConst::$generalMinimumRice)) + $destGeneral->getVar($resKey) ); $amountText = number_format($amount, 0); diff --git a/hwe/sammo/Command/Nation/che_발령.php b/hwe/sammo/Command/Nation/che_발령.php index b2a8d3fb..31aa0481 100644 --- a/hwe/sammo/Command/Nation/che_발령.php +++ b/hwe/sammo/Command/Nation/che_발령.php @@ -17,7 +17,7 @@ use function \sammo\{ getDomesticExpLevelBonus, CriticalRatioDomestic, CriticalScoreEx, - function cutTurn + cutTurn }; use \sammo\Constraint\Constraint; diff --git a/hwe/sammo/Command/Nation/che_포상.php b/hwe/sammo/Command/Nation/che_포상.php index 6b53aedf..4184b69a 100644 --- a/hwe/sammo/Command/Nation/che_포상.php +++ b/hwe/sammo/Command/Nation/che_포상.php @@ -41,13 +41,14 @@ class che_포상 extends Command\NationCommand{ $isGold = $this->arg['isGold']; $amount = $this->arg['amount']; $destGeneralID = $this->arg['destGeneralID']; - if(is_float($amount)){ - $amount = Util::toInt($amount); - } - else if(!is_int($amount)){ + if(!is_numeric($amount)){ return false; } + $amount = Util::round($amount, -2); $amount = Util::valueFit($amount, 100, GameConst::$maxResourceActionAmount); + if($amount <= 0){ + return false; + } if(!is_bool($isGold)){ return false; } diff --git a/hwe/sammo/GeneralAI.php b/hwe/sammo/GeneralAI.php index 099617f8..6d4592e3 100644 --- a/hwe/sammo/GeneralAI.php +++ b/hwe/sammo/GeneralAI.php @@ -139,9 +139,9 @@ class GeneralAI protected function calcGenType(General $general) { - $leadership = $general->getLeadership(); - $strength = Util::valueFit($general->getStrength(), 1); - $intel = Util::valueFit($general->getIntel(), 1); + $leadership = $general->getLeadership(false); + $strength = Util::valueFit($general->getStrength(false), 1); + $intel = Util::valueFit($general->getIntel(false), 1); //무장 if ($strength >= $intel) { @@ -241,6 +241,9 @@ class GeneralAI protected function do부대전방발령(LastTurn $lastTurn): ?NationCommand { + if(!$this->nation['capital']){ + return null; + } if(!$this->frontCities){ return null; } @@ -343,6 +346,9 @@ class GeneralAI protected function do부대후방발령(LastTurn $lastTurn): ?NationCommand { + if(!$this->nation['capital']){ + return null; + } if(!$this->frontCities){ return null; } @@ -430,6 +436,9 @@ class GeneralAI protected function do부대유저장후방발령(LastTurn $lastTurn): ?NationCommand { + if(!$this->nation['capital']){ + return null; + } if($this->dipState !== self::d전쟁){ return null; } @@ -536,6 +545,9 @@ class GeneralAI } protected function do유저장후방발령(LastTurn $lastTurn): ?NationCommand { + if(!$this->nation['capital']){ + return null; + } if($this->dipState !== self::d전쟁){ return null; } @@ -605,6 +617,9 @@ class GeneralAI protected function do유저장구출발령(LastTurn $lastTurn): ?NationCommand { + if(!$this->nation['capital']){ + return null; + } if (in_array($this->dipState, [self::d평화, self::d선포])) { return null; } @@ -652,6 +667,9 @@ class GeneralAI protected function do유저장전방발령(LastTurn $lastTurn): ?NationCommand { + if(!$this->nation['capital']){ + return null; + } if(!$this->frontCities){ return null; } @@ -706,7 +724,10 @@ class GeneralAI protected function do유저장내정발령(LastTurn $lastTurn): ?NationCommand { - if(count($this->supplyCitiesID) === 1){ + if(!$this->nation['capital']){ + return null; + } + if(count($this->supplyCities) === 1){ return null; } @@ -775,6 +796,9 @@ class GeneralAI protected function doNPC후방발령(LastTurn $lastTurn): ?NationCommand { + if(!$this->nation['capital']){ + return null; + } if(!$this->frontCities){ return null; } @@ -848,6 +872,9 @@ class GeneralAI protected function doNPC구출발령(LastTurn $lastTurn): ?NationCommand { + if(!$this->nation['capital']){ + return null; + } //고립 도시 장수 발령 $args = []; foreach ($this->lostGenerals as $lostGeneral) { @@ -873,6 +900,9 @@ class GeneralAI protected function doNPC전방발령(LastTurn $lastTurn): ?NationCommand { + if(!$this->nation['capital']){ + return null; + } if(!$this->frontCities){ return null; } @@ -927,7 +957,10 @@ class GeneralAI protected function doNPC내정발령(LastTurn $lastTurn): ?NationCommand { - if(count($this->supplyCitiesID) === 1){ + if(!$this->nation['capital']){ + return null; + } + if(count($this->supplyCities) === 1){ return null; } @@ -1035,6 +1068,9 @@ class GeneralAI } //국고와 '충분한 금액'의 기하평균 $payAmount = sqrt(($enoughMoney - $targetUserGeneral->getVar($resName)) * $resVal); + if($payAmount < $this->nationPolicy->minimumResourceActionAmount){ + continue; + } if ($resVal < $payAmount / 2) { continue; @@ -1127,6 +1163,9 @@ class GeneralAI } //국고와 '충분한 금액'의 기하평균 $payAmount = sqrt(($enoughMoney - $targetUserGeneral->getVar($resName)) * $resVal); + if($payAmount < $this->nationPolicy->minimumResourceActionAmount){ + continue; + } if ($resVal < $payAmount / 2) { continue; @@ -1203,6 +1242,10 @@ class GeneralAI //국고와 '충분한 금액'의 기하평균 $payAmount = sqrt(($enoughMoney - $targetNPCGeneral->getVar($resName)) * $resVal); + if($payAmount < $this->nationPolicy->minimumResourceActionAmount){ + continue; + } + if ($resVal < $payAmount / 2) { continue; } @@ -1308,6 +1351,10 @@ class GeneralAI $payAmount = $enoughMoney - $targetNPCGeneral->getVar($resName); $payAmount = Util::valueFit($payAmount, 100, GameConst::$maxResourceActionAmount); + if($payAmount < $this->nationPolicy->minimumResourceActionAmount){ + continue; + } + $candidateArgs[] = [[ 'destGeneralID' => $targetNPCGeneral->getID(), 'isGold' => $resName == 'gold', @@ -1374,6 +1421,9 @@ class GeneralAI $takeAmount = $targetNPCGeneral->getVar($resName) - $reqNPCMinDevelRes; $takeAmount = Util::valueFit($takeAmount, 100, GameConst::$maxResourceActionAmount); + if($takeAmount < $this->nationPolicy->minimumResourceActionAmount){ + break; + } $candidateArgs[] = [[ 'destGeneralID' => $targetNPCGeneral->getID(), @@ -1430,6 +1480,10 @@ class GeneralAI break; } + if($takeAmount < $this->nationPolicy->minimumResourceActionAmount){ + break; + } + $takeAmount = Util::valueFit($takeAmount, 100, GameConst::$maxResourceActionAmount); $candidateArgs[] = [[ 'destGeneralID' => $targetNPCGeneral->getID(), diff --git a/hwe/sammo/TextDecoration/DyingMessage.php b/hwe/sammo/TextDecoration/DyingMessage.php index cb464c7b..4443e524 100644 --- a/hwe/sammo/TextDecoration/DyingMessage.php +++ b/hwe/sammo/TextDecoration/DyingMessage.php @@ -127,6 +127,6 @@ class DyingMessage{ } - return JosaUtil::batch($text, $name); + return JosaUtil::batch($text); } } \ No newline at end of file diff --git a/hwe/scenario/unit/ludo_rathowm.php b/hwe/scenario/unit/ludo_rathowm.php index 825059e3..229ab1f4 100644 --- a/hwe/scenario/unit/ludo_rathowm.php +++ b/hwe/scenario/unit/ludo_rathowm.php @@ -3,7 +3,7 @@ namespace sammo; class GameUnitConst extends GameUnitConstBase { - const DEFAULT_CREWTYPE = 217001; + const DEFAULT_CREWTYPE = 217100; protected static $typeData = [ self::T_FOOTMAN => '보병', diff --git a/hwe/scenario/unit/siegetank.php b/hwe/scenario/unit/siegetank.php index 805a1543..7a2bc5fd 100644 --- a/hwe/scenario/unit/siegetank.php +++ b/hwe/scenario/unit/siegetank.php @@ -3,7 +3,7 @@ namespace sammo; class GameUnitConst extends GameUnitConstBase { - const DEFAULT_CREWTYPE = 40; + const DEFAULT_CREWTYPE = 1500; protected static $_buildData = [ [
; bgcolor=' colspan=6> - 【 {$nation['name']} 】 + ; background-color:' colspan=6> +