From 5268ce9b71a3b156b8f6eae3a29ac134a473af44 Mon Sep 17 00:00:00 2001 From: Hide_D Date: Wed, 10 Jul 2024 17:00:35 +0000 Subject: [PATCH] =?UTF-8?q?game:=20=ED=9B=88=EB=A0=A8,=20=EC=82=AC?= =?UTF-8?q?=EA=B8=B0=EC=A7=84=EC=9E=91=20=EC=8B=9C=20=EB=B3=91=EB=A0=A5?= =?UTF-8?q?=EC=9D=B4=20=EB=82=AE=EC=9D=84=20=EB=95=8C=EB=8F=84=20=EC=88=99?= =?UTF-8?q?=EB=A0=A8=20=EC=83=81=EC=8A=B9=EB=9F=89=20=EC=A1=B0=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/sammo/Command/General/che_사기진작.php | 53 +++++++++++++-------- hwe/sammo/Command/General/che_훈련.php | 55 +++++++++++++--------- 2 files changed, 67 insertions(+), 41 deletions(-) diff --git a/hwe/sammo/Command/General/che_사기진작.php b/hwe/sammo/Command/General/che_사기진작.php index 20b15165..cd14ea2e 100644 --- a/hwe/sammo/Command/General/che_사기진작.php +++ b/hwe/sammo/Command/General/che_사기진작.php @@ -1,11 +1,15 @@ arg = null; return true; } - protected function init(){ + protected function init() + { $general = $this->generalObj; @@ -33,13 +40,13 @@ class che_사기진작 extends Command\GeneralCommand{ [$reqGold, $reqRice] = $this->getCost(); - $this->minConditionConstraints=[ + $this->minConditionConstraints = [ ConstraintHelper::NotBeNeutral(), ConstraintHelper::NotWanderingNation(), ConstraintHelper::OccupiedCity(), ]; - $this->fullConditionConstraints=[ + $this->fullConditionConstraints = [ ConstraintHelper::NotBeNeutral(), ConstraintHelper::NotWanderingNation(), ConstraintHelper::OccupiedCity(), @@ -48,31 +55,35 @@ class che_사기진작 extends Command\GeneralCommand{ ConstraintHelper::ReqGeneralRice($reqRice), ConstraintHelper::ReqGeneralAtmosMargin(GameConst::$maxAtmosByCommand), ]; - } - public function getCommandDetailTitle():string{ + public function getCommandDetailTitle(): string + { $name = $this->getName(); //[$reqGold, $reqRice] = $this->getCost(); return "{$name}(통솔경험, 자금↓)"; } - public function getCost():array{ + public function getCost(): array + { $general = $this->generalObj; - return [Util::round($general->getVar('crew')/100), 0]; + return [Util::round($general->getVar('crew') / 100), 0]; } - public function getPreReqTurn():int{ + public function getPreReqTurn(): int + { return 0; } - public function getPostReqTurn():int{ + public function getPostReqTurn(): int + { return 0; } - public function run(\Sammo\RandUtil $rng):bool{ - if(!$this->hasFullConditionMet()){ + public function run(\Sammo\RandUtil $rng): bool + { + if (!$this->hasFullConditionMet()) { throw new \RuntimeException('불가능한 커맨드를 강제로 실행 시도'); } @@ -81,7 +92,11 @@ class che_사기진작 extends Command\GeneralCommand{ $general = $this->generalObj; $date = $general->getTurnTime($general::TURNTIME_HM); - $score = Util::round($general->getLeadership() * 100 / $general->getVar('crew') * GameConst::$atmosDelta); + $score = Util::clamp( + Util::round($general->getLeadership() * 100 / $general->getVar('crew') * GameConst::$atmosDelta), + 0, + Util::clamp(GameConst::$maxAtmosByCommand - $general->getVar('atmos'), 0), + ); $scoreText = number_format($score, 0); $sideEffect = Util::valueFit(intval($general->getVar('train') * GameConst::$trainSideEffectByAtmosTurn), 0); @@ -93,7 +108,7 @@ class che_사기진작 extends Command\GeneralCommand{ $exp = 100; $ded = 70; - $general->increaseVarWithLimit('atmos', $score, 0, GameConst::$maxAtmosByCommand); + $general->increaseVar('atmos', $score); $general->setVar('train', $sideEffect); $general->addDex($general->getCrewTypeObj(), $score, false); @@ -111,6 +126,4 @@ class che_사기진작 extends Command\GeneralCommand{ return true; } - - -} \ No newline at end of file +} diff --git a/hwe/sammo/Command/General/che_훈련.php b/hwe/sammo/Command/General/che_훈련.php index fc4c0234..b26efb1a 100644 --- a/hwe/sammo/Command/General/che_훈련.php +++ b/hwe/sammo/Command/General/che_훈련.php @@ -1,11 +1,15 @@ arg = null; return true; } - protected function init(){ + protected function init() + { $general = $this->generalObj; $this->setCity(); $this->setNation(); - $this->minConditionConstraints=[ + $this->minConditionConstraints = [ ConstraintHelper::NotBeNeutral(), ConstraintHelper::NotWanderingNation(), ConstraintHelper::OccupiedCity(), ]; - $this->fullConditionConstraints=[ + $this->fullConditionConstraints = [ ConstraintHelper::NotBeNeutral(), ConstraintHelper::NotWanderingNation(), ConstraintHelper::OccupiedCity(), ConstraintHelper::ReqGeneralCrew(), ConstraintHelper::ReqGeneralTrainMargin(GameConst::$maxTrainByCommand), ]; - } - public function getCommandDetailTitle():string{ + public function getCommandDetailTitle(): string + { $name = $this->getName(); [$reqGold, $reqRice] = $this->getCost(); $title = "{$name}(통솔경험"; - if($reqGold > 0){ + if ($reqGold > 0) { $title .= ", 자금{$reqGold}"; } - if($reqRice > 0){ + if ($reqRice > 0) { $title .= ", 군량{$reqRice}"; } $title .= ')'; return $title; } - public function getCost():array{ + public function getCost(): array + { return [0, 0]; } - public function getPreReqTurn():int{ + public function getPreReqTurn(): int + { return 0; } - public function getPostReqTurn():int{ + public function getPostReqTurn(): int + { return 0; } - public function run(\Sammo\RandUtil $rng):bool{ - if(!$this->hasFullConditionMet()){ + public function run(\Sammo\RandUtil $rng): bool + { + if (!$this->hasFullConditionMet()) { throw new \RuntimeException('불가능한 커맨드를 강제로 실행 시도'); } @@ -85,7 +96,11 @@ class che_훈련 extends Command\GeneralCommand{ $general = $this->generalObj; $date = $general->getTurnTime($general::TURNTIME_HM); - $score = Util::round($general->getLeadership() * 100 / $general->getVar('crew') * GameConst::$trainDelta); + $score = Util::clamp( + Util::round($general->getLeadership() * 100 / $general->getVar('crew') * GameConst::$trainDelta), + 0, + Util::clamp(GameConst::$maxTrainByCommand - $general->getVar('train'), 0) + ); $scoreText = number_format($score, 0); $sideEffect = Util::valueFit(intval($general->getVar('atmos') * GameConst::$atmosSideEffectByTraining), 0); @@ -97,7 +112,7 @@ class che_훈련 extends Command\GeneralCommand{ $exp = 100; $ded = 70; - $general->increaseVarWithLimit('train', $score, 0, GameConst::$maxTrainByCommand); + $general->increaseVar('train', $score); $general->setVar('atmos', $sideEffect); $general->addDex($general->getCrewTypeObj(), $score, false); @@ -112,6 +127,4 @@ class che_훈련 extends Command\GeneralCommand{ return true; } - - -} \ No newline at end of file +}