국기 변경 수정, 아이템 보상 추가
This commit is contained in:
@@ -11,7 +11,8 @@ use\sammo\{
|
||||
GameConst,
|
||||
GameUnitConst,
|
||||
LastTurn,
|
||||
Command
|
||||
Command,
|
||||
Json
|
||||
};
|
||||
|
||||
|
||||
@@ -79,7 +80,7 @@ class che_건국 extends Command\GeneralCommand
|
||||
$env = $this->env;
|
||||
|
||||
$this->setCity();
|
||||
$this->setNation(['gennum']);
|
||||
$this->setNation(['gennum', 'aux']);
|
||||
|
||||
$relYear = $env['year'] - $env['startyear'];
|
||||
|
||||
@@ -173,6 +174,9 @@ class che_건국 extends Command\GeneralCommand
|
||||
$general->addExperience($exp);
|
||||
$general->addDedication($ded);
|
||||
|
||||
$aux = Json::decode($this->nation['aux'])??[];
|
||||
$aux['can_국기변경'] = 1;
|
||||
|
||||
$db->update('city', [
|
||||
'nation' => $general->getNationID(),
|
||||
'conflict' => '{}'
|
||||
@@ -183,7 +187,8 @@ class che_건국 extends Command\GeneralCommand
|
||||
'color' => $colorType,
|
||||
'level' => 1,
|
||||
'type' => $nationType,
|
||||
'capital' => $general->getCityID()
|
||||
'capital' => $general->getCityID(),
|
||||
'aux' => Json::encode($aux)
|
||||
], 'nation=%i', $general->getNationID());
|
||||
|
||||
refreshNationStaticInfo();
|
||||
|
||||
@@ -15,7 +15,8 @@ use\sammo\{
|
||||
Command,
|
||||
MessageTarget,
|
||||
Message,
|
||||
CityConst
|
||||
CityConst,
|
||||
Json,
|
||||
};
|
||||
|
||||
use function\sammo\{
|
||||
@@ -64,23 +65,27 @@ class che_국기변경 extends Command\NationCommand
|
||||
$env = $this->env;
|
||||
|
||||
$this->setCity();
|
||||
$this->setNation(['can_change_flag']);
|
||||
$this->setNation(['aux']);
|
||||
|
||||
$actionName = $this->getName();
|
||||
|
||||
$this->minConditionConstraints = [
|
||||
ConstraintHelper::OccupiedCity(),
|
||||
ConstraintHelper::BeChief(),
|
||||
ConstraintHelper::SuppliedCity(),
|
||||
ConstraintHelper::ReqNationValue('can_change_flag', '국기색', '>', 0, '더이상 변경이 불가능합니다.')
|
||||
ConstraintHelper::ReqNationAuxValue("can_{$actionName}", null, '>', 0, '더이상 변경이 불가능합니다.')
|
||||
];
|
||||
}
|
||||
|
||||
protected function initWithArg()
|
||||
{
|
||||
$actionName = $this->getName();
|
||||
|
||||
$this->fullConditionConstraints = [
|
||||
ConstraintHelper::OccupiedCity(),
|
||||
ConstraintHelper::BeChief(),
|
||||
ConstraintHelper::SuppliedCity(),
|
||||
ConstraintHelper::ReqNationValue('can_change_flag', '국기색', '>', 0, '더이상 변경이 불가능합니다.')
|
||||
ConstraintHelper::ReqNationAuxValue("can_{$actionName}", null, '>', 0, '더이상 변경이 불가능합니다.')
|
||||
];
|
||||
}
|
||||
|
||||
@@ -113,6 +118,7 @@ class che_국기변경 extends Command\NationCommand
|
||||
}
|
||||
|
||||
$db = DB::db();
|
||||
$actionName = $this->getName();
|
||||
|
||||
$general = $this->generalObj;
|
||||
$generalID = $general->getID();
|
||||
@@ -135,9 +141,12 @@ class che_국기변경 extends Command\NationCommand
|
||||
$josaYi = JosaUtil::pick($generalName, '이');
|
||||
$josaYiNation = JosaUtil::pick($nationName, '이');
|
||||
|
||||
$aux = Json::decode($this->nation['aux']);
|
||||
$aux["can_{$actionName}"] = 0;
|
||||
|
||||
$db->update('nation', [
|
||||
'color'=>$color,
|
||||
'can_change_flag' => $db->sqleval('can_change_flag - 1'),
|
||||
'aux'=>Json::encode($aux)
|
||||
], 'nation=%i', $nationID);
|
||||
|
||||
$logger->pushGeneralActionLog("<span style='color:{$color};'><b>국기</b></span>를 변경하였습니다 <1>$date</>");
|
||||
|
||||
@@ -158,6 +158,7 @@ class General implements iAction{
|
||||
return $this->itemObjs[$itemKey];
|
||||
}
|
||||
|
||||
/** @return BaseItem[] */
|
||||
function getItems():array{
|
||||
return $this->itemObjs;
|
||||
}
|
||||
@@ -512,7 +513,7 @@ class General implements iAction{
|
||||
}
|
||||
|
||||
function updateVar(string $key, $value){
|
||||
if($this->raw[$key] === $value){
|
||||
if(($this->raw[$key]??null) === $value){
|
||||
return;
|
||||
}
|
||||
if(!key_exists($key, $this->updatedVar)){
|
||||
|
||||
@@ -67,7 +67,7 @@ trait LazyVarUpdater{
|
||||
}
|
||||
|
||||
function updateVar(string $key, $value){
|
||||
if($this->raw[$key] === $value){
|
||||
if(($this->raw[$key]??null) === $value){
|
||||
return;
|
||||
}
|
||||
if(!key_exists($key, $this->updatedVar)){
|
||||
|
||||
Reference in New Issue
Block a user