Files
core/hwe/sammo/Command/General/che_요양.php
T
2018-10-19 02:47:07 +09:00

88 lines
1.8 KiB
PHP

<?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=[
];
}
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("건강 회복을 위해 요양합니다. <1>$date</>");
$exp = 10;
$ded = 7;
$exp = $general->onPreGeneralStatUpdate($general, 'experience', $exp);
$ded = $general->onPreGeneralStatUpdate($general, 'dedication', $ded);
$general->setVar('injury', 0);
$general->increaseVar('experience', $exp);
$general->increaseVar('dedication', $ded);
$general->setResultTurn(new LastTurn(static::getName(), $this->arg));
$general->checkStatChange();
$general->applyDB($db);
return true;
}
}