From 688de08feb5768df23b2d63e94049e4214c3da7e Mon Sep 17 00:00:00 2001 From: Hide_D Date: Sat, 21 Dec 2024 08:56:24 +0000 Subject: [PATCH] =?UTF-8?q?game:=20=EC=84=A0=EC=96=91=EC=8B=9C=EC=97=90?= =?UTF-8?q?=EB=8F=84=20=EA=B1=B0=EB=B3=91/=EC=88=98=EB=87=8C/=EC=99=B8?= =?UTF-8?q?=EA=B5=90=EA=B6=8C=EC=9E=90=20=ED=8E=98=EB=84=90=ED=8B=B0=20?= =?UTF-8?q?=EA=B2=80=EC=82=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/sammo/Command/General/che_선양.php | 10 ++++++++++ hwe/sammo/Constraint/NoPenalty.php | 6 +++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/hwe/sammo/Command/General/che_선양.php b/hwe/sammo/Command/General/che_선양.php index ac0166bb..2e170bca 100644 --- a/hwe/sammo/Command/General/che_선양.php +++ b/hwe/sammo/Command/General/che_선양.php @@ -21,6 +21,8 @@ use \sammo\Constraint\Constraint; use \sammo\Constraint\ConstraintHelper; use sammo\Enums\GeneralQueryMode; use sammo\Enums\InheritanceKey; +use sammo\Enums\PenaltyKey; +use sammo\Json; use sammo\StaticEventHandler; class che_선양 extends Command\GeneralCommand @@ -111,6 +113,14 @@ class che_선양 extends Command\GeneralCommand $date = $general->getTurnTime($general::TURNTIME_HM); $destGeneral = $this->destGeneralObj; + $destGeneralPenaltyList = JSON::decode($destGeneral->getVar('penalty')); + $penaltyKeyList = [PenaltyKey::NoChief, PenaltyKey::NoFoundNation, PenaltyKey::NoAmbassador]; + foreach ($penaltyKeyList as $penaltyKey) { + if (key_exists($penaltyKey->value, $destGeneralPenaltyList)) { + $general->getLogger()->pushGeneralActionLog("선양할 수 없는 장수입니다."); + return false; + } + } $generalName = $general->getName(); $destGeneralName = $destGeneral->getName(); diff --git a/hwe/sammo/Constraint/NoPenalty.php b/hwe/sammo/Constraint/NoPenalty.php index 764c4ae9..4b76ac0c 100644 --- a/hwe/sammo/Constraint/NoPenalty.php +++ b/hwe/sammo/Constraint/NoPenalty.php @@ -33,12 +33,12 @@ class NoPenalty extends Constraint{ /** @var PenaltyKey */ $checkKey = $this->arg; - $peneltyList = JSON::decode($this->general['penalty']); - if(!key_exists($checkKey->value, $peneltyList)){ + $penaltyList = JSON::decode($this->general['penalty']); + if(!key_exists($checkKey->value, $penaltyList)){ return true; } - $this->reason = "징계 사유: {$peneltyList[$checkKey->value]}"; + $this->reason = "징계 사유: {$penaltyList[$checkKey->value]}"; return false; } } \ No newline at end of file