forked from devsam/core
game: 선양시에도 거병/수뇌/외교권자 페널티 검사
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user