game: 선양시에도 거병/수뇌/외교권자 페널티 검사

This commit is contained in:
2024-12-21 08:56:24 +00:00
parent 83b550adbe
commit 688de08feb
2 changed files with 13 additions and 3 deletions
+10
View File
@@ -21,6 +21,8 @@ use \sammo\Constraint\Constraint;
use \sammo\Constraint\ConstraintHelper; use \sammo\Constraint\ConstraintHelper;
use sammo\Enums\GeneralQueryMode; use sammo\Enums\GeneralQueryMode;
use sammo\Enums\InheritanceKey; use sammo\Enums\InheritanceKey;
use sammo\Enums\PenaltyKey;
use sammo\Json;
use sammo\StaticEventHandler; use sammo\StaticEventHandler;
class che_선양 extends Command\GeneralCommand class che_선양 extends Command\GeneralCommand
@@ -111,6 +113,14 @@ class che_선양 extends Command\GeneralCommand
$date = $general->getTurnTime($general::TURNTIME_HM); $date = $general->getTurnTime($general::TURNTIME_HM);
$destGeneral = $this->destGeneralObj; $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(); $generalName = $general->getName();
$destGeneralName = $destGeneral->getName(); $destGeneralName = $destGeneral->getName();
+3 -3
View File
@@ -33,12 +33,12 @@ class NoPenalty extends Constraint{
/** @var PenaltyKey */ /** @var PenaltyKey */
$checkKey = $this->arg; $checkKey = $this->arg;
$peneltyList = JSON::decode($this->general['penalty']); $penaltyList = JSON::decode($this->general['penalty']);
if(!key_exists($checkKey->value, $peneltyList)){ if(!key_exists($checkKey->value, $penaltyList)){
return true; return true;
} }
$this->reason = "징계 사유: {$peneltyList[$checkKey->value]}"; $this->reason = "징계 사유: {$penaltyList[$checkKey->value]}";
return false; return false;
} }
} }