diff --git a/hwe/sammo/Command/General/che_전투특기초기화.php b/hwe/sammo/Command/General/che_전투특기초기화.php index 7cff8ae1..3d3d5fab 100644 --- a/hwe/sammo/Command/General/che_전투특기초기화.php +++ b/hwe/sammo/Command/General/che_전투특기초기화.php @@ -1,130 +1,130 @@ -arg = null; - return true; - } - - protected function init(){ - - $general = $this->generalObj; - $env = $this->env; - $yearMonth = Util::joinYearMonth($env['year'], $env['month']); - $auxYearMonth = $general->getAuxVar('used_'.$this->getName())??-999; - - if($yearMonth < $auxYearMonth + 60){ - $this->minConditionConstraints=[ - ConstraintHelper::AlwaysFail('초기화한 지 5년이 지나야합니다') - ]; - - $this->fullConditionConstraints=[ - ConstraintHelper::AlwaysFail('초기화한 지 5년이 지나야합니다') - ]; - return; - } - - - $this->minConditionConstraints=[ - ConstraintHelper::ReqGeneralValue(static::$specialType, static::$specialText, '!=', 'None', '특기가 없습니다.'), - ]; - - $this->fullConditionConstraints=[ - ConstraintHelper::ReqGeneralValue(static::$specialType, static::$specialText, '!=', 'None', '특기가 없습니다.') - ]; - - } - - public function getCommandDetailTitle():string{ - $name = $this->getName(); - if($this->getPreReqTurn()){ - $reqTurn = ($this->getPreReqTurn()+1).'턴, '; - } - else{ - $reqTurn = 0; - } - - $title = "{$name}({$reqTurn}5년마다 1회)"; - return $title; - } - - public function getCost():array{ - return [0, 0]; - } - - public function getPreReqTurn():int{ - return 1; - } - - public function getPostReqTurn():int{ - return 0; - } - - public function getTermString():string{ - $term = $this->getResultTurn()->getTerm(); - $termMax = $this->getPreReqTurn() + 1; - return "새로운 적성을 찾는 중... ({$term}/{$termMax})"; - } - - public function run():bool{ - if(!$this->hasFullConditionMet()){ - throw new \RuntimeException('불가능한 커맨드를 강제로 실행 시도'); - } - - $db = DB::db(); - - $general = $this->generalObj; - $date = $general->getTurnTime($general::TURNTIME_HM); - - $oldTypeKey = 'prev_types_'.static::$specialType; - $specialName = static::$specialText; - - $env = $this->env; - - $yearMonth = Util::joinYearMonth($env['year'], $env['month']); - $oldSpecialList = $general->getAuxVar($oldTypeKey)??[]; - $oldSpecialList[] = $general->getVar(static::$specialType); - $general->setAuxVar($oldTypeKey, $oldSpecialList); - - $general->setVar(static::$specialType, 'None'); - $general->setVar(static::$speicalAge, $general->getVar('age') + 1); - $general->setAuxVar('used_'.$this->getName(), $yearMonth); - - $logger = $general->getLogger(); - - $logger->pushGeneralActionLog("새로운 {$specialName}를 가질 준비가 되었습니다. <1>$date"); - - $this->setResultTurn(new LastTurn(static::getName(), $this->arg)); - tryUniqueItemLottery($general); - $general->applyDB($db); - - return true; - } - - +arg = null; + return true; + } + + protected function init(){ + + $general = $this->generalObj; + $env = $this->env; + $yearMonth = Util::joinYearMonth($env['year'], $env['month']); + $auxYearMonth = $general->getAuxVar('used_'.$this->getName())??-999; + + if($yearMonth < $auxYearMonth + 60 - $this->getPreReqTurn()){ + $this->minConditionConstraints=[ + ConstraintHelper::AlwaysFail('초기화한 지 5년이 지나야합니다') + ]; + + $this->fullConditionConstraints=[ + ConstraintHelper::AlwaysFail('초기화한 지 5년이 지나야합니다') + ]; + return; + } + + + $this->minConditionConstraints=[ + ConstraintHelper::ReqGeneralValue(static::$specialType, static::$specialText, '!=', 'None', '특기가 없습니다.'), + ]; + + $this->fullConditionConstraints=[ + ConstraintHelper::ReqGeneralValue(static::$specialType, static::$specialText, '!=', 'None', '특기가 없습니다.') + ]; + + } + + public function getCommandDetailTitle():string{ + $name = $this->getName(); + if($this->getPreReqTurn()){ + $reqTurn = ($this->getPreReqTurn()+1).'턴, '; + } + else{ + $reqTurn = 0; + } + + $title = "{$name}({$reqTurn}5년마다 1회)"; + return $title; + } + + public function getCost():array{ + return [0, 0]; + } + + public function getPreReqTurn():int{ + return 1; + } + + public function getPostReqTurn():int{ + return 0; + } + + public function getTermString():string{ + $term = $this->getResultTurn()->getTerm(); + $termMax = $this->getPreReqTurn() + 1; + return "새로운 적성을 찾는 중... ({$term}/{$termMax})"; + } + + public function run():bool{ + if(!$this->hasFullConditionMet()){ + throw new \RuntimeException('불가능한 커맨드를 강제로 실행 시도'); + } + + $db = DB::db(); + + $general = $this->generalObj; + $date = $general->getTurnTime($general::TURNTIME_HM); + + $oldTypeKey = 'prev_types_'.static::$specialType; + $specialName = static::$specialText; + + $env = $this->env; + + $yearMonth = Util::joinYearMonth($env['year'], $env['month']); + $oldSpecialList = $general->getAuxVar($oldTypeKey)??[]; + $oldSpecialList[] = $general->getVar(static::$specialType); + $general->setAuxVar($oldTypeKey, $oldSpecialList); + + $general->setVar(static::$specialType, 'None'); + $general->setVar(static::$speicalAge, $general->getVar('age') + 1); + $general->setAuxVar('used_'.$this->getName(), $yearMonth); + + $logger = $general->getLogger(); + + $logger->pushGeneralActionLog("새로운 {$specialName}를 가질 준비가 되었습니다. <1>$date"); + + $this->setResultTurn(new LastTurn(static::getName(), $this->arg)); + tryUniqueItemLottery($general); + $general->applyDB($db); + + return true; + } + + } \ No newline at end of file