From fe2a076558d92fe15f9ff4f894035500253238c8 Mon Sep 17 00:00:00 2001 From: hide_d Date: Sun, 28 Apr 2019 02:54:01 +0900 Subject: [PATCH] =?UTF-8?q?=EB=B2=84=EA=B7=B8=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/func_gamerule.php | 8 +++----- hwe/sammo/Command/General/che_사기진작.php | 2 +- hwe/sammo/Command/General/che_출병.php | 7 +++---- hwe/sammo/GeneralAI.php | 14 +++++++------- hwe/sammo/TurnExecutionHelper.php | 4 ++-- hwe/sammo/WarUnit.php | 4 ++-- 6 files changed, 18 insertions(+), 21 deletions(-) diff --git a/hwe/func_gamerule.php b/hwe/func_gamerule.php index 41dd5487..4b28301d 100644 --- a/hwe/func_gamerule.php +++ b/hwe/func_gamerule.php @@ -101,8 +101,7 @@ function SetNationFront($nationNo) { $db = DB::db(); foreach($db->queryFirstColumn( - 'SELECT city from city where nation IN - (SELECT you from diplomacy where me = %i and state=0)' + 'SELECT city FROM city JOIN diplomacy ON diplomacy.you = city.nation WHERE diplomacy.state = 0 AND me = %i' , $nationNo ) as $city){ foreach(CityConst::byID($city)->path as $adjKey=>$adjVal){ @@ -110,8 +109,7 @@ function SetNationFront($nationNo) { } }; foreach($db->queryFirstColumn( - 'SELECT city from city where nation IN - (SELECT you from diplomacy where me = %i and state=1 and term<=5)' + 'SELECT city FROM city JOIN diplomacy ON diplomacy.you = city.nation WHERE diplomacy.state = 1 AND diplomacy.term <= 5 AND me = %i' , $nationNo ) as $city){ foreach(CityConst::byID($city)->path as $adjKey=>$adjVal){ @@ -123,7 +121,7 @@ function SetNationFront($nationNo) { //NOTE: if, else일 경우 NPC는 전쟁시에는 공백지로 출병하지 않는다는 뜻이 된다. foreach ($db->queryFirstColumn('SELECT city from city where nation=0') as $city) { foreach(CityConst::byID($city)->path as $adjKey=>$adjVal){ - $adj[$adjKey] = $adjVal; + $adj2[$adjKey] = $adjVal; } } } diff --git a/hwe/sammo/Command/General/che_사기진작.php b/hwe/sammo/Command/General/che_사기진작.php index f999fd31..a7955857 100644 --- a/hwe/sammo/Command/General/che_사기진작.php +++ b/hwe/sammo/Command/General/che_사기진작.php @@ -86,7 +86,7 @@ class che_사기진작 extends Command\GeneralCommand{ $exp = $general->onPreGeneralStatUpdate($general, 'experience', $exp); $ded = $general->onPreGeneralStatUpdate($general, 'dedication', $ded); - $general->increaseVarWithLimit('atmos', $score, 0, GameConst::$maAtmosByCommand); + $general->increaseVarWithLimit('atmos', $score, 0, GameConst::$maxAtmosByCommand); $general->setVar('train', $sideEffect); $general->addDex($general->getCrewTypeObj(), $score, false); diff --git a/hwe/sammo/Command/General/che_출병.php b/hwe/sammo/Command/General/che_출병.php index 9a2bc7ba..610f47ba 100644 --- a/hwe/sammo/Command/General/che_출병.php +++ b/hwe/sammo/Command/General/che_출병.php @@ -48,8 +48,7 @@ class che_출병 extends Command\GeneralCommand{ $this->setCity(); $this->setNation(['war', 'gennum', 'tech', 'gold', 'rice']); - $this->setDestCity($this->arg['destCityID'], []); - $this->setDestNation($this->arg['destNationID'], ['nation' ,'level','name','capital','gennum','tech','type','gold','rice']); + $this->setDestCity($this->arg['destCityID'], ['city', 'name', 'nation']); [$reqGold, $reqRice] = $this->getCost(); $relYear = $this->env['year'] - $this->env['startyear']; @@ -67,7 +66,7 @@ class che_출병 extends Command\GeneralCommand{ } public function getCost():array{ - return [0, Util::round($this->general->getVar('crew')/100)]; + return [0, Util::round($this->generalObj->getVar('crew')/100)]; } public function getPreReqTurn():int{ @@ -104,7 +103,7 @@ class che_출병 extends Command\GeneralCommand{ $defenderCityName = $this->destCity['name']; $defenderCityID = $this->destCity['city']; - $josaRo = JosaUtil::pick($destCityName, '로'); + $josaRo = JosaUtil::pick($defenderCityName, '로'); $logger = $general->getLogger(); diff --git a/hwe/sammo/GeneralAI.php b/hwe/sammo/GeneralAI.php index 43009ecd..09c7abc5 100644 --- a/hwe/sammo/GeneralAI.php +++ b/hwe/sammo/GeneralAI.php @@ -904,10 +904,10 @@ class GeneralAI{ $targetCityID = Util::choiceRandom($frontCitiesID); } - $command = [['che_발령', [ + $command = ['che_발령', [ 'destGeneralID'=>$nationGeneral->no, 'destCityID'=>$targetCityID - ]], 5]; + ]]; if($nationGeneral->npc<2 && ($workRemain&2)){ $workRemain ^= 2; @@ -965,10 +965,10 @@ class GeneralAI{ } - $command = [['che_발령', [ + $command = ['che_발령', [ 'destGeneralID'=>$nationGeneral->no, 'destCityID'=>$targetCity['city'] - ]], 5]; + ]]; if($nationGeneral->npc<2 && ($workRemain&2)){ $workRemain ^= 2; @@ -1482,7 +1482,7 @@ class GeneralAI{ } } - if($general->getVar('rice') < 90){ + if($general->getVar('atmos') < 90 ){ $turnObj = buildGeneralCommandClass('che_사기진작', $general, $env, null); [$reqGold, $reqRice] = $turnObj->getCost(); if($general->getVar('gold') >= $reqGold && $general->getVar('rice') >= $reqRice){ @@ -1839,7 +1839,7 @@ class GeneralAI{ $nationID = $nation['nation']; - $incomeList = getGoldIncome($nation['nation'], $nation['rate'], $env['gold_rate'], $env['type']); + $incomeList = getGoldIncome($nation['nation'], $nation['rate'], $env['gold_rate'], $nation['type']); $income = $nation['gold'] + $incomeList[0] + $incomeList[1]; $outcome = getGoldOutcome($nation['nation'], 100); // 100%의 지급량 $bill = intval($income / $outcome * 80); // 수입의 80% 만 지급 @@ -1861,7 +1861,7 @@ class GeneralAI{ $nationID = $nation['nation']; - $incomeList = getRiceIncome($nation['nation'], $nation['rate'], $env['gold_rate'], $env['type']); + $incomeList = getRiceIncome($nation['nation'], $nation['rate'], $env['gold_rate'], $nation['type']); $income = $nation['rice'] + $incomeList[0] + $incomeList[1]; $outcome = getRiceOutcome($nation['nation'], 100); // 100%의 지급량 $bill = intval($income / $outcome * 80); // 수입의 80% 만 지급 diff --git a/hwe/sammo/TurnExecutionHelper.php b/hwe/sammo/TurnExecutionHelper.php index deb8ae02..c6b0d239 100644 --- a/hwe/sammo/TurnExecutionHelper.php +++ b/hwe/sammo/TurnExecutionHelper.php @@ -232,11 +232,11 @@ WHERE turntime < %s ORDER BY turntime ASC, `no` ASC', $lastNationTurnKey = "turn_last_{$general->getVar('nation')}_{$general->getVar('level')}"; $lastNationTurn = $nationStor->getValue($lastNationTurnKey); //수뇌 몇 없는데 매번 left join 하는건 낭비인것 같다. - $rawNationTurn = Json::decode($db->queryFirstRow( + $rawNationTurn = $db->queryFirstRow( 'SELECT action, arg FROM nation_turn WHERE nation_id = %i AND level = %i AND turn_idx =0', $general->getVar('nation'), $general->getVar('level') - ))??[]; + )??[]; $hasNationTurn = true; $nationCommand = $rawNationTurn['action']; $nationArg = Json::decode($rawNationTurn['arg']??null); diff --git a/hwe/sammo/WarUnit.php b/hwe/sammo/WarUnit.php index 1b94fbaf..89309e10 100644 --- a/hwe/sammo/WarUnit.php +++ b/hwe/sammo/WarUnit.php @@ -4,7 +4,7 @@ namespace sammo; class WarUnit{ use LazyVarUpdater; - protected $raw; + protected $raw = []; protected $rawNation; protected $logger; @@ -114,7 +114,7 @@ class WarUnit{ return GameConst::$defaultSpecialDomestic; } - function getSpecialWar():int{ + function getSpecialWar():string{ return 0; }