From 642ad6f6f45ccf108db9406ec1eaeb8ee348f716 Mon Sep 17 00:00:00 2001 From: hide_d Date: Tue, 16 Oct 2018 01:01:50 +0900 Subject: [PATCH] =?UTF-8?q?=EC=86=8C=EC=A7=91=ED=95=B4=EC=A0=9C=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80.=20=EC=BB=A4=EB=A7=A8=EB=93=9C=20=EB=B2=84?= =?UTF-8?q?=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/sammo/Command/General/che_기술연구.php | 2 +- hwe/sammo/Command/General/che_물자조달.php | 3 +- hwe/sammo/Command/General/che_사기진작.php | 4 +- hwe/sammo/Command/General/che_상업투자.php | 4 +- hwe/sammo/Command/General/che_소집해제.php | 92 ++++++++++++++++++++++ hwe/sammo/Command/General/che_정착장려.php | 4 +- hwe/sammo/Command/General/che_주민선정.php | 4 +- hwe/sammo/Command/General/che_훈련.php | 4 +- hwe/sammo/General.php | 2 +- hwe/sammo/WarUnitGeneral.php | 2 +- 10 files changed, 106 insertions(+), 15 deletions(-) create mode 100644 hwe/sammo/Command/General/che_소집해제.php diff --git a/hwe/sammo/Command/General/che_기술연구.php b/hwe/sammo/Command/General/che_기술연구.php index cfad970d..2113618a 100644 --- a/hwe/sammo/Command/General/che_기술연구.php +++ b/hwe/sammo/Command/General/che_기술연구.php @@ -128,9 +128,9 @@ class che_기술연구 extends che_상업투자{ $general->increaseVar(static::$statKey.'2', 1); $general->setResultTurn(new LastTurn(static::getName(), $this->arg)); + $general->checkStatChange(); $general->applyDB($db); - $this->checkStatChange(); uniqueItemEx($general->getVar('no'), $logger); } diff --git a/hwe/sammo/Command/General/che_물자조달.php b/hwe/sammo/Command/General/che_물자조달.php index a0797de4..44aa4a97 100644 --- a/hwe/sammo/Command/General/che_물자조달.php +++ b/hwe/sammo/Command/General/che_물자조달.php @@ -120,9 +120,8 @@ class che_물자조달 extends Command\GeneralCommand{ ], 'nation=%i',$general->getNationID()); $general->setResultTurn(new LastTurn(static::getName(), $this->arg)); + $general->checkStatChange(); $general->applyDB($db); - - $this->checkStatChange(); } diff --git a/hwe/sammo/Command/General/che_사기진작.php b/hwe/sammo/Command/General/che_사기진작.php index 9005d305..63236398 100644 --- a/hwe/sammo/Command/General/che_사기진작.php +++ b/hwe/sammo/Command/General/che_사기진작.php @@ -93,9 +93,9 @@ class che_사기진작 extends Command\GeneralCommand{ $general->increaseVar('dedication', $ded); $general->increaseVar('leader2', 1); $general->setResultTurn(new LastTurn(static::getName(), $this->arg)); + $general->checkStatChange(); $general->applyDB($db); - - $this->checkStatChange(); + uniqueItemEx($general->getVar('no'), $logger); } diff --git a/hwe/sammo/Command/General/che_상업투자.php b/hwe/sammo/Command/General/che_상업투자.php index b749dd60..702424d6 100644 --- a/hwe/sammo/Command/General/che_상업투자.php +++ b/hwe/sammo/Command/General/che_상업투자.php @@ -171,9 +171,9 @@ class che_상업투자 extends Command\GeneralCommand{ $general->increaseVar('dedication', $ded); $general->increaseVar(static::$statKey.'2', 1); $general->setResultTurn(new LastTurn(static::getName(), $this->arg)); + $general->checkStatChange(); $general->applyDB($db); - - $this->checkStatChange(); + uniqueItemEx($general->getVar('no'), $logger); } diff --git a/hwe/sammo/Command/General/che_소집해제.php b/hwe/sammo/Command/General/che_소집해제.php new file mode 100644 index 00000000..0bdb2a75 --- /dev/null +++ b/hwe/sammo/Command/General/che_소집해제.php @@ -0,0 +1,92 @@ +generalObj; + + $this->setCity(); + $this->setNation(); + + $this->runnableConstraints=[ + ['ReqGeneralCrew'], + ]; + + } + + protected function argTest():bool{ + $this->arg = null; + return true; + } + + public function getCost():array{ + return [0, 0]; + } + + public function getPreReqTurn():int{ + return 0; + } + + public function getPostReqTurn():int{ + return 0; + } + + public function run():bool{ + if(!$this->isRunnable()){ + throw new \RuntimeException('불가능한 커맨드를 강제로 실행 시도'); + } + + $db = DB::db(); + + $general = $this->generalObj; + $date = substr($general->getVar('turntime'),11,5); + + $crew = $general->getVar('crew'); + + $logger = $general->getLogger(); + + $logger->pushGeneralActionLog("병사들을 소집해제하였습니다. <1>$date"); + + $exp = 70; + $ded = 100; + + $exp = $general->onPreGeneralStatUpdate($general, 'experience', $exp); + $ded = $general->onPreGeneralStatUpdate($general, 'dedication', $ded); + + $db->update('city', [ + 'pop'=>$db->sqleval('pop + %i', $crew) + ], 'city=%i', $general->getCityID()); + + $general->setVar('crew', 0); + $general->increaseVar('experience', $exp); + $general->increaseVar('dedication', $ded); + $general->setResultTurn(new LastTurn(static::getName(), $this->arg)); + $general->checkStatChange(); + $general->applyDB($db); + + + } + + +} \ No newline at end of file diff --git a/hwe/sammo/Command/General/che_정착장려.php b/hwe/sammo/Command/General/che_정착장려.php index 5b324ed4..7df42c3b 100644 --- a/hwe/sammo/Command/General/che_정착장려.php +++ b/hwe/sammo/Command/General/che_정착장려.php @@ -158,9 +158,9 @@ class che_정착장려 extends Command\GeneralCommand{ $general->increaseVar('dedication', $ded); $general->increaseVar(static::$statKey.'2', 1); $general->setResultTurn(new LastTurn(static::getName(), $this->arg)); + $general->checkStatChange(); $general->applyDB($db); - - $this->checkStatChange(); + uniqueItemEx($general->getVar('no'), $logger); } diff --git a/hwe/sammo/Command/General/che_주민선정.php b/hwe/sammo/Command/General/che_주민선정.php index f2fd60f6..760e63ab 100644 --- a/hwe/sammo/Command/General/che_주민선정.php +++ b/hwe/sammo/Command/General/che_주민선정.php @@ -155,9 +155,9 @@ class che_주민선정 extends Command\GeneralCommand{ $general->increaseVar('dedication', $ded); $general->increaseVar(static::$statKey.'2', 1); $general->setResultTurn(new LastTurn(static::getName(), $this->arg)); + $general->checkStatChange(); $general->applyDB($db); - - $this->checkStatChange(); + uniqueItemEx($general->getVar('no'), $logger); } diff --git a/hwe/sammo/Command/General/che_훈련.php b/hwe/sammo/Command/General/che_훈련.php index f68a5138..f3416dc6 100644 --- a/hwe/sammo/Command/General/che_훈련.php +++ b/hwe/sammo/Command/General/che_훈련.php @@ -90,9 +90,9 @@ class che_훈련 extends Command\GeneralCommand{ $general->increaseVar('dedication', $ded); $general->increaseVar('leader2', 1); $general->setResultTurn(new LastTurn(static::getName(), $this->arg)); + $general->checkStatChange(); $general->applyDB($db); - - $this->checkStatChange(); + uniqueItemEx($general->getVar('no'), $logger); } diff --git a/hwe/sammo/General.php b/hwe/sammo/General.php index 038acbb6..7c8662ca 100644 --- a/hwe/sammo/General.php +++ b/hwe/sammo/General.php @@ -336,7 +336,7 @@ class General implements iAction{ $result = true; } else if($this->getVar($statExpName) >= $limit){ - $logger->pushGeneralActionLog("{$statNickName}이 1 올랐습니다!", ActionLogger::PLAIN); + $logger->pushGeneralActionLog("{$statNickName}이 1 올랐습니다!", ActionLogger::PLAIN); $this->increaseVar($statExpName, -$limit); $this->increaseVar($statName, 1); $result = true; diff --git a/hwe/sammo/WarUnitGeneral.php b/hwe/sammo/WarUnitGeneral.php index 0656d6b6..f406ebe9 100644 --- a/hwe/sammo/WarUnitGeneral.php +++ b/hwe/sammo/WarUnitGeneral.php @@ -967,7 +967,7 @@ class WarUnitGeneral extends WarUnit{ $result = true; } else if($this->getVar($statExpName) >= $limit){ - $logger->pushGeneralActionLog("{$statNickName}이 1 올랐습니다!", ActionLogger::PLAIN); + $logger->pushGeneralActionLog("{$statNickName}이 1 올랐습니다!", ActionLogger::PLAIN); $this->increaseVar($statExpName, -$limit); $this->increaseVar($statName, 1); $result = true;