From bd44e243988cfb0d1ab5d81406cb71c8b2c79744 Mon Sep 17 00:00:00 2001 From: hide_d Date: Sat, 15 Sep 2018 00:40:24 +0900 Subject: [PATCH] =?UTF-8?q?=EB=86=8D=EC=83=81=EC=B9=98=EC=84=B1=EC=88=98?= =?UTF-8?q?=20=EB=82=B4=EC=A0=95=20=EC=BD=94=EB=93=9C=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/func_process.php | 9 -------- hwe/sammo/Command/che_농지개간.php | 1 + hwe/sammo/Command/che_상업투자.php | 34 ++++++++++++++++++++++++------ hwe/sammo/Command/che_성벽보수.php | 12 +++++++++++ hwe/sammo/Command/che_수비강화.php | 12 +++++++++++ hwe/sammo/Command/che_치안강화.php | 12 +++++++++++ 6 files changed, 64 insertions(+), 16 deletions(-) create mode 100644 hwe/sammo/Command/che_성벽보수.php create mode 100644 hwe/sammo/Command/che_수비강화.php create mode 100644 hwe/sammo/Command/che_치안강화.php diff --git a/hwe/func_process.php b/hwe/func_process.php index 9d71d0eb..d5b04366 100644 --- a/hwe/func_process.php +++ b/hwe/func_process.php @@ -199,15 +199,6 @@ function process_1(array $rawGeneral, int $type){ $date = substr($general['turntime'],11,5); - if($type == 1){ - $cityKey = 'agri'; - $actionName = '농지 개간'; - } - else{ - $cityKey = 'comm'; - $actionName = '상업 투자'; - } - $env = $gameStor->getValues(['startyear', 'year', 'month', 'develcost']); $general = new General($rawGeneral, null, $env['year'], $env['month']); diff --git a/hwe/sammo/Command/che_농지개간.php b/hwe/sammo/Command/che_농지개간.php index df02639b..40623bad 100644 --- a/hwe/sammo/Command/che_농지개간.php +++ b/hwe/sammo/Command/che_농지개간.php @@ -6,6 +6,7 @@ use \sammo\JosaUtil; class che_농지개간 extends che_상업투자{ static $cityKey = 'agri'; + static $statKey = 'intel'; static $actionKey = '농업'; static $actionName = '농지 개간'; } \ No newline at end of file diff --git a/hwe/sammo/Command/che_상업투자.php b/hwe/sammo/Command/che_상업투자.php index 35f8834e..e13e677d 100644 --- a/hwe/sammo/Command/che_상업투자.php +++ b/hwe/sammo/Command/che_상업투자.php @@ -5,7 +5,7 @@ use \sammo\{ DB, Util, JosaUtil, General, ActionLogger, - getGeneralIntel, + getGeneralLeadership,getGeneralPower,getGeneralIntel, getDomesticExpLevelBonus, CriticalRatioDomestic, CriticalScore, checkAbilityEx @@ -14,10 +14,12 @@ use \sammo\{ use \sammo\Constraint\Constraint; use function sammo\CriticalScore; use function sammo\uniqueItemEx; +use function sammo\getGeneralLeadership; class che_상업투자 extends BaseCommand{ static $cityKey = 'comm'; + static $statKey = 'intel'; static $actionKey = '상업'; static $actionName = '상업 투자'; @@ -43,6 +45,28 @@ class che_상업투자 extends BaseCommand{ $this->reqGold = $reqGold; } + protected function calcBaseScore():float{ + if(static::$statKey == 'intel'){ + $score = getGeneralIntel($general->getRaw(), true, true, true, false); + } + else if(static::$statKey == 'power'){ + $score = getGeneralPower($general->getRaw(), true, true, true, false); + } + else if(static::$statKey == 'leader'){ + $score = getGeneralLeadership($general->getRaw(), true, true, true, false); + } + else{ + throw new \sammo\MustNotBeReachedException(); + } + + $score *= $trust / 100; + $score *= getDomesticExpLevelBonus($general['explevel']); + $score *= Util::randRange(0.8, 1.2); + $score = $general->onCalcDomestic(static::$actionKey, 'score', $score); + + return $score; + } + public function run():bool{ if(!$this->isAvailable()){ throw new \RuntimeException('불가능한 커맨드를 강제로 실행 시도'); @@ -54,11 +78,7 @@ class che_상업투자 extends BaseCommand{ $trust = Util::valueFit($this->city['trust'], 50); - $score = getGeneralIntel($general->getRaw(), true, true, true, false); - $score *= $trust / 100; - $score *= getDomesticExpLevelBonus($general['explevel']); - $score *= Util::randRange(0.8, 1.2); - $score = $general->onCalcDomestic(static::$actionKey, 'score', $score); + $score = $this->calcBaseScore(); ['succ'=>$successRatio, 'fail'=>$failRatio] = CriticalRatioDomestic($general->getRaw(), 2); $successRatio = $naionTypeObj->onCalcDomestic(static::$cityKey, 'succ', $successRatio); @@ -109,7 +129,7 @@ class che_상업투자 extends BaseCommand{ $general->increaseVarWithLimit('gold', -$this->reqGold, 0); $general->increaseVar('experience', $exp); $general->increaseVar('dedication', $ded); - $general->increaseVar('intel2', 1); + $general->increaseVar(static::$statKey.'2', 1); $general->updateVar('resturn', 'SUCCESS'); $general->applyDB($db); diff --git a/hwe/sammo/Command/che_성벽보수.php b/hwe/sammo/Command/che_성벽보수.php new file mode 100644 index 00000000..f98311e9 --- /dev/null +++ b/hwe/sammo/Command/che_성벽보수.php @@ -0,0 +1,12 @@ +