From a33a7317cc4263134312d7c1406abdf2a6b1dc5d Mon Sep 17 00:00:00 2001 From: hide_d Date: Wed, 3 Oct 2018 17:45:47 +0900 Subject: [PATCH] =?UTF-8?q?=ED=84=B4=20=EC=BB=A4=EB=A7=A8=EB=93=9C?= =?UTF-8?q?=EC=97=90=20getPreReqTurn,=20getPostReqTurn=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/sammo/Command/BaseCommand.php | 5 ++++- hwe/sammo/Command/General/che_기술연구.php | 5 +++-- hwe/sammo/Command/General/che_상업투자.php | 20 ++++++++++++++++++-- hwe/sammo/Command/General/che_정착장려.php | 22 +++++++++++++++++++--- hwe/sammo/Command/General/che_주민선정.php | 20 ++++++++++++++++++-- hwe/sammo/Command/General/휴식.php | 8 ++++++++ 6 files changed, 70 insertions(+), 10 deletions(-) diff --git a/hwe/sammo/Command/BaseCommand.php b/hwe/sammo/Command/BaseCommand.php index 8c966a88..5fe3b5c3 100644 --- a/hwe/sammo/Command/BaseCommand.php +++ b/hwe/sammo/Command/BaseCommand.php @@ -37,9 +37,9 @@ abstract class BaseCommand{ protected $runnableConstraints = null; protected $reservableConstraints = null; - + protected $logger; public function __construct(General $generalObj, array $env, $arg = null){ @@ -194,6 +194,9 @@ abstract class BaseCommand{ abstract public function getCost():array; + abstract public function getPreReqTurn():int; + abstract public function getPostReqTurn():int; + abstract public function run():bool; diff --git a/hwe/sammo/Command/General/che_기술연구.php b/hwe/sammo/Command/General/che_기술연구.php index 90b78a45..99426e1f 100644 --- a/hwe/sammo/Command/General/che_기술연구.php +++ b/hwe/sammo/Command/General/che_기술연구.php @@ -30,14 +30,15 @@ class che_기술연구 extends che_상업투자{ $this->setCity(); $this->setNation(); - $develCost = $this->env['develcost']; - $reqGold = $general->onCalcDomestic(static::$actionKey, 'cost', $reqGold); + [$reqGold, $reqRice] = $this->getCost(); $this->runnableConstraints=[ ['NoNeutral'], ['NoWanderingNation'], ['OccupiedCity'], ['SuppliedCity'], + ['ReqGeneralGold', $reqGold], + ['ReqGeneralRice', $reqRice], ['ReqGeneralGold', $reqGold] ]; diff --git a/hwe/sammo/Command/General/che_상업투자.php b/hwe/sammo/Command/General/che_상업투자.php index f97cc3aa..9af0a4a2 100644 --- a/hwe/sammo/Command/General/che_상업투자.php +++ b/hwe/sammo/Command/General/che_상업투자.php @@ -32,8 +32,7 @@ class che_상업투자 extends Command\GeneralCommand{ $this->setCity(); $this->setNation(); - $develCost = $this->env['develcost']; - $reqGold = $general->onCalcDomestic(static::$actionKey, 'cost', $reqGold); + [$reqGold, $reqRice] = $this->getCost(); $this->runnableConstraints=[ ['NoNeutral'], @@ -41,6 +40,7 @@ class che_상업투자 extends Command\GeneralCommand{ ['OccupiedCity'], ['SuppliedCity'], ['ReqGeneralGold', $reqGold], + ['ReqGeneralRice', $reqRice], ['RemainCityCapacity', [static::$cityKey, static::$actionName]] ]; @@ -51,6 +51,22 @@ class che_상업투자 extends Command\GeneralCommand{ return true; } + public function getCost():array{ + $develCost = $this->env['develcost']; + $reqGold = $general->onCalcDomestic(static::$actionKey, 'cost', $develCost); + $reqRice = 0; + + return [$reqGold, $reqRice]; + } + + public function getPreReqTurn():int{ + return 0; + } + + public function getPostReqTurn():int{ + return 0; + } + protected function calcBaseScore():float{ $trust = Util::valueFit($this->city['trust'], 50); $general = $this->generalObj; diff --git a/hwe/sammo/Command/General/che_정착장려.php b/hwe/sammo/Command/General/che_정착장려.php index 81d1f7d5..8a8b4789 100644 --- a/hwe/sammo/Command/General/che_정착장려.php +++ b/hwe/sammo/Command/General/che_정착장려.php @@ -31,15 +31,15 @@ class che_정착장려 extends Command\GeneralCommand{ $this->setCity(); $this->setNation(); - $develCost = $this->env['develcost'] * 2; - $reqRice = $general->onCalcDomestic(static::$actionKey, 'cost', $reqRice); + [$reqGold, $reqRice] = $this->getCost(); $this->runnableConstraints=[ ['NoNeutral'], ['NoWanderingNation'], ['OccupiedCity'], ['SuppliedCity'], - ['ReqGeneralGold', $reqRice], + ['ReqGeneralGold', $reqGold], + ['ReqGeneralRice', $reqRice], ['RemainCityCapacity', [static::$cityKey, static::$actionName]] ]; @@ -50,6 +50,22 @@ class che_정착장려 extends Command\GeneralCommand{ return true; } + public function getCost():array{ + $develCost = $this->env['develcost'] * 2; + $reqGold = 0; + $reqRice = $general->onCalcDomestic(static::$actionKey, 'cost', $develCost); + + return [$reqGold, $reqRice]; + } + + public function getPreReqTurn():int{ + return 0; + } + + public function getPostReqTurn():int{ + return 0; + } + protected function calcBaseScore():float{ $general = $this->generalObj; diff --git a/hwe/sammo/Command/General/che_주민선정.php b/hwe/sammo/Command/General/che_주민선정.php index 0692c400..c2a7f36d 100644 --- a/hwe/sammo/Command/General/che_주민선정.php +++ b/hwe/sammo/Command/General/che_주민선정.php @@ -31,14 +31,14 @@ class che_주민선정 extends Command\GeneralCommand{ $this->setCity(); $this->setNation(); - $develCost = $this->env['develcost'] * 2; - $reqRice = $general->onCalcDomestic(static::$actionKey, 'cost', $reqGold); + [$reqGold, $reqRice] = $this->getCost(); $this->runnableConstraints=[ ['NoNeutral'], ['NoWanderingNation'], ['OccupiedCity'], ['SuppliedCity'], + ['ReqGeneralGold', $reqGold], ['ReqGeneralRice', $reqRice], ['RemainCityTrust', static::$actionName] ]; @@ -50,6 +50,22 @@ class che_주민선정 extends Command\GeneralCommand{ return true; } + public function getCost():array{ + $develCost = $this->env['develcost'] * 2; + $reqGold = 0; + $reqRice = $general->onCalcDomestic(static::$actionKey, 'cost', $develCost); + + return [$reqGold, $reqRice]; + } + + public function getPreReqTurn():int{ + return 0; + } + + public function getPostReqTurn():int{ + return 0; + } + protected function calcBaseScore():float{ $general = $this->generalObj; diff --git a/hwe/sammo/Command/General/휴식.php b/hwe/sammo/Command/General/휴식.php index bfb49e43..10b519d9 100644 --- a/hwe/sammo/Command/General/휴식.php +++ b/hwe/sammo/Command/General/휴식.php @@ -18,6 +18,14 @@ class 휴식 extends GeneralCommand{ return [0, 0]; } + public function getPreReqTurn():int{ + return 0; + } + + public function getPostReqTurn():int{ + return 0; + } + public function run():bool{ $general = $this->generalObj; $logger = $general->getLogger();