소집해제 추가. 커맨드 버그 수정
This commit is contained in:
@@ -128,9 +128,9 @@ class che_기술연구 extends che_상업투자{
|
|||||||
$general->increaseVar(static::$statKey.'2', 1);
|
$general->increaseVar(static::$statKey.'2', 1);
|
||||||
|
|
||||||
$general->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
$general->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||||
|
$general->checkStatChange();
|
||||||
$general->applyDB($db);
|
$general->applyDB($db);
|
||||||
|
|
||||||
$this->checkStatChange();
|
|
||||||
uniqueItemEx($general->getVar('no'), $logger);
|
uniqueItemEx($general->getVar('no'), $logger);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -120,9 +120,8 @@ class che_물자조달 extends Command\GeneralCommand{
|
|||||||
], 'nation=%i',$general->getNationID());
|
], 'nation=%i',$general->getNationID());
|
||||||
|
|
||||||
$general->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
$general->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||||
|
$general->checkStatChange();
|
||||||
$general->applyDB($db);
|
$general->applyDB($db);
|
||||||
|
|
||||||
$this->checkStatChange();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -93,9 +93,9 @@ class che_사기진작 extends Command\GeneralCommand{
|
|||||||
$general->increaseVar('dedication', $ded);
|
$general->increaseVar('dedication', $ded);
|
||||||
$general->increaseVar('leader2', 1);
|
$general->increaseVar('leader2', 1);
|
||||||
$general->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
$general->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||||
|
$general->checkStatChange();
|
||||||
$general->applyDB($db);
|
$general->applyDB($db);
|
||||||
|
|
||||||
$this->checkStatChange();
|
|
||||||
uniqueItemEx($general->getVar('no'), $logger);
|
uniqueItemEx($general->getVar('no'), $logger);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -171,9 +171,9 @@ class che_상업투자 extends Command\GeneralCommand{
|
|||||||
$general->increaseVar('dedication', $ded);
|
$general->increaseVar('dedication', $ded);
|
||||||
$general->increaseVar(static::$statKey.'2', 1);
|
$general->increaseVar(static::$statKey.'2', 1);
|
||||||
$general->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
$general->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||||
|
$general->checkStatChange();
|
||||||
$general->applyDB($db);
|
$general->applyDB($db);
|
||||||
|
|
||||||
$this->checkStatChange();
|
|
||||||
uniqueItemEx($general->getVar('no'), $logger);
|
uniqueItemEx($general->getVar('no'), $logger);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,92 @@
|
|||||||
|
<?php
|
||||||
|
namespace sammo\GeneralCommand;
|
||||||
|
|
||||||
|
use \sammo\{
|
||||||
|
DB, Util, JosaUtil,
|
||||||
|
General,
|
||||||
|
ActionLogger,
|
||||||
|
GameConst, GameUnitConst,
|
||||||
|
LastTurn,
|
||||||
|
Command
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
use function \sammo\{
|
||||||
|
uniqueItemEx
|
||||||
|
};
|
||||||
|
|
||||||
|
use \sammo\Constraint\Constraint;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class che_소집해제 extends Command\GeneralCommand{
|
||||||
|
static protected $actionName = '소집해제';
|
||||||
|
|
||||||
|
protected function init(){
|
||||||
|
|
||||||
|
$general = $this->generalObj;
|
||||||
|
|
||||||
|
$this->setCity();
|
||||||
|
$this->setNation();
|
||||||
|
|
||||||
|
$this->runnableConstraints=[
|
||||||
|
['ReqGeneralCrew'],
|
||||||
|
];
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function argTest():bool{
|
||||||
|
$this->arg = null;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getCost():array{
|
||||||
|
return [0, 0];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPreReqTurn():int{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPostReqTurn():int{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function run():bool{
|
||||||
|
if(!$this->isRunnable()){
|
||||||
|
throw new \RuntimeException('불가능한 커맨드를 강제로 실행 시도');
|
||||||
|
}
|
||||||
|
|
||||||
|
$db = DB::db();
|
||||||
|
|
||||||
|
$general = $this->generalObj;
|
||||||
|
$date = substr($general->getVar('turntime'),11,5);
|
||||||
|
|
||||||
|
$crew = $general->getVar('crew');
|
||||||
|
|
||||||
|
$logger = $general->getLogger();
|
||||||
|
|
||||||
|
$logger->pushGeneralActionLog("병사들을 <R>소집해제</>하였습니다. <1>$date</>");
|
||||||
|
|
||||||
|
$exp = 70;
|
||||||
|
$ded = 100;
|
||||||
|
|
||||||
|
$exp = $general->onPreGeneralStatUpdate($general, 'experience', $exp);
|
||||||
|
$ded = $general->onPreGeneralStatUpdate($general, 'dedication', $ded);
|
||||||
|
|
||||||
|
$db->update('city', [
|
||||||
|
'pop'=>$db->sqleval('pop + %i', $crew)
|
||||||
|
], 'city=%i', $general->getCityID());
|
||||||
|
|
||||||
|
$general->setVar('crew', 0);
|
||||||
|
$general->increaseVar('experience', $exp);
|
||||||
|
$general->increaseVar('dedication', $ded);
|
||||||
|
$general->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||||
|
$general->checkStatChange();
|
||||||
|
$general->applyDB($db);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -158,9 +158,9 @@ class che_정착장려 extends Command\GeneralCommand{
|
|||||||
$general->increaseVar('dedication', $ded);
|
$general->increaseVar('dedication', $ded);
|
||||||
$general->increaseVar(static::$statKey.'2', 1);
|
$general->increaseVar(static::$statKey.'2', 1);
|
||||||
$general->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
$general->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||||
|
$general->checkStatChange();
|
||||||
$general->applyDB($db);
|
$general->applyDB($db);
|
||||||
|
|
||||||
$this->checkStatChange();
|
|
||||||
uniqueItemEx($general->getVar('no'), $logger);
|
uniqueItemEx($general->getVar('no'), $logger);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -155,9 +155,9 @@ class che_주민선정 extends Command\GeneralCommand{
|
|||||||
$general->increaseVar('dedication', $ded);
|
$general->increaseVar('dedication', $ded);
|
||||||
$general->increaseVar(static::$statKey.'2', 1);
|
$general->increaseVar(static::$statKey.'2', 1);
|
||||||
$general->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
$general->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||||
|
$general->checkStatChange();
|
||||||
$general->applyDB($db);
|
$general->applyDB($db);
|
||||||
|
|
||||||
$this->checkStatChange();
|
|
||||||
uniqueItemEx($general->getVar('no'), $logger);
|
uniqueItemEx($general->getVar('no'), $logger);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -90,9 +90,9 @@ class che_훈련 extends Command\GeneralCommand{
|
|||||||
$general->increaseVar('dedication', $ded);
|
$general->increaseVar('dedication', $ded);
|
||||||
$general->increaseVar('leader2', 1);
|
$general->increaseVar('leader2', 1);
|
||||||
$general->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
$general->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||||
|
$general->checkStatChange();
|
||||||
$general->applyDB($db);
|
$general->applyDB($db);
|
||||||
|
|
||||||
$this->checkStatChange();
|
|
||||||
uniqueItemEx($general->getVar('no'), $logger);
|
uniqueItemEx($general->getVar('no'), $logger);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -336,7 +336,7 @@ class General implements iAction{
|
|||||||
$result = true;
|
$result = true;
|
||||||
}
|
}
|
||||||
else if($this->getVar($statExpName) >= $limit){
|
else if($this->getVar($statExpName) >= $limit){
|
||||||
$logger->pushGeneralActionLog("<R>{$statNickName}</>이 <C>1</> 올랐습니다!", ActionLogger::PLAIN);
|
$logger->pushGeneralActionLog("<S>{$statNickName}</>이 <C>1</> 올랐습니다!", ActionLogger::PLAIN);
|
||||||
$this->increaseVar($statExpName, -$limit);
|
$this->increaseVar($statExpName, -$limit);
|
||||||
$this->increaseVar($statName, 1);
|
$this->increaseVar($statName, 1);
|
||||||
$result = true;
|
$result = true;
|
||||||
|
|||||||
@@ -967,7 +967,7 @@ class WarUnitGeneral extends WarUnit{
|
|||||||
$result = true;
|
$result = true;
|
||||||
}
|
}
|
||||||
else if($this->getVar($statExpName) >= $limit){
|
else if($this->getVar($statExpName) >= $limit){
|
||||||
$logger->pushGeneralActionLog("<R>{$statNickName}</>이 <C>1</> 올랐습니다!", ActionLogger::PLAIN);
|
$logger->pushGeneralActionLog("<S>{$statNickName}</>이 <C>1</> 올랐습니다!", ActionLogger::PLAIN);
|
||||||
$this->increaseVar($statExpName, -$limit);
|
$this->increaseVar($statExpName, -$limit);
|
||||||
$this->increaseVar($statName, 1);
|
$this->increaseVar($statName, 1);
|
||||||
$result = true;
|
$result = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user