- 기존의 랜덤 코드는 deprecated 처리 - 서버 시작 시 랜덤하게 정해진 hiddenSeed를 활용 - 랜덤 생성 단위 - 월 실행 - 사령턴 실행 결과 - 커맨드 실행 결과 - 작위 보상 - 부대장 생성 - 유니크 획득 시도 - 설문 조사 - 장수 생성 - NPC국 생성, NPC 생성, NPC의 토너먼트 베팅 - 전투 - 도시 점령 - 자율 행동 선택 - 랜덤 턴 변경 - 거래장, 토너먼트 등 구 랜덤 코드를 이용하는 잔여 코드 있음
107 lines
3.1 KiB
PHP
107 lines
3.1 KiB
PHP
<?php
|
|
namespace sammo\Command\General;
|
|
|
|
use \sammo\{
|
|
DB, Util, JosaUtil,
|
|
General,
|
|
ActionLogger,
|
|
GameConst, GameUnitConst,
|
|
LastTurn,
|
|
Command
|
|
};
|
|
|
|
use function \sammo\tryUniqueItemLottery;
|
|
|
|
use \sammo\Constraint\Constraint;
|
|
use \sammo\Constraint\ConstraintHelper;
|
|
|
|
|
|
|
|
class che_전투특기초기화 extends Command\GeneralCommand{
|
|
static protected $actionName = '전투 특기 초기화';
|
|
static protected $specialType = 'special2';
|
|
static protected $speicalAge = 'specage2';
|
|
static protected $specialText = '전투 특기';
|
|
|
|
protected function argTest():bool{
|
|
$this->arg = null;
|
|
return true;
|
|
}
|
|
|
|
protected function init(){
|
|
$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 60;
|
|
}
|
|
|
|
public function getTermString():string{
|
|
$term = $this->getResultTurn()->getTerm();
|
|
$termMax = $this->getPreReqTurn() + 1;
|
|
return "새로운 적성을 찾는 중... ({$term}/{$termMax})";
|
|
}
|
|
|
|
public function run(\Sammo\RandUtil $rng):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);
|
|
|
|
$logger = $general->getLogger();
|
|
|
|
$logger->pushGeneralActionLog("새로운 {$specialName}를 가질 준비가 되었습니다. <1>$date</>");
|
|
|
|
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
|
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general), $general);
|
|
$general->applyDB($db);
|
|
|
|
return true;
|
|
}
|
|
|
|
|
|
} |