feat: 접경귀환, 다 전략 조건 추가
This commit is contained in:
@@ -3,6 +3,7 @@ namespace sammo\Command\UserAction;
|
||||
|
||||
use sammo\ActionBuff\g65_징병비용무시;
|
||||
use \sammo\Command;
|
||||
use sammo\Constraint\ConstraintHelper;
|
||||
|
||||
class g65_병장기지원 extends Command\UserActionCommand{
|
||||
static protected $actionName = '병장기지원';
|
||||
@@ -23,9 +24,10 @@ class g65_병장기지원 extends Command\UserActionCommand{
|
||||
}
|
||||
|
||||
protected function init(){
|
||||
//아무것도 하지 않음
|
||||
$this->fullConditionConstraints=[];
|
||||
|
||||
$this->fullConditionConstraints = [
|
||||
ConstraintHelper::NotBeNeutral(),
|
||||
ConstraintHelper::OccupiedCity()
|
||||
];
|
||||
}
|
||||
|
||||
public function getPreReqTurn():int{
|
||||
@@ -41,6 +43,10 @@ class g65_병장기지원 extends Command\UserActionCommand{
|
||||
}
|
||||
|
||||
public function run(\Sammo\RandUtil $rng):bool{
|
||||
if (!$this->hasFullConditionMet()) {
|
||||
throw new \RuntimeException('불가능한 커맨드를 강제로 실행 시도');
|
||||
}
|
||||
|
||||
$general = $this->generalObj;
|
||||
$general->addInstantBuff(new g65_징병비용무시(), 1);
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ namespace sammo\Command\UserAction;
|
||||
|
||||
use sammo\ActionBuff\g65_징병인구무시;
|
||||
use \sammo\Command;
|
||||
use sammo\Constraint\ConstraintHelper;
|
||||
|
||||
class g65_입대독려 extends Command\UserActionCommand{
|
||||
static protected $actionName = '입대독려';
|
||||
@@ -23,9 +24,10 @@ class g65_입대독려 extends Command\UserActionCommand{
|
||||
}
|
||||
|
||||
protected function init(){
|
||||
//아무것도 하지 않음
|
||||
$this->fullConditionConstraints=[];
|
||||
|
||||
$this->fullConditionConstraints = [
|
||||
ConstraintHelper::NotBeNeutral(),
|
||||
ConstraintHelper::OccupiedCity()
|
||||
];
|
||||
}
|
||||
|
||||
public function getPreReqTurn():int{
|
||||
@@ -41,6 +43,10 @@ class g65_입대독려 extends Command\UserActionCommand{
|
||||
}
|
||||
|
||||
public function run(\Sammo\RandUtil $rng):bool{
|
||||
if (!$this->hasFullConditionMet()) {
|
||||
throw new \RuntimeException('불가능한 커맨드를 강제로 실행 시도');
|
||||
}
|
||||
|
||||
$general = $this->generalObj;
|
||||
$general->addInstantBuff(new g65_징병인구무시(), 1);
|
||||
|
||||
|
||||
@@ -0,0 +1,104 @@
|
||||
<?php
|
||||
|
||||
namespace sammo\Command\UserAction;
|
||||
|
||||
use sammo\CityConst;
|
||||
use \sammo\Command;
|
||||
use sammo\Constraint\ConstraintHelper;
|
||||
use sammo\DB;
|
||||
use sammo\JosaUtil;
|
||||
|
||||
use function sammo\searchDistance;
|
||||
|
||||
class g65_접경귀환 extends Command\UserActionCommand
|
||||
{
|
||||
static protected $actionName = '접경귀환';
|
||||
|
||||
protected function argTest(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getBrief(): string
|
||||
{
|
||||
return '접경 귀환';
|
||||
}
|
||||
|
||||
public function getCommandDetailTitle(): string
|
||||
{
|
||||
$postReqTurn = $this->getPostReqTurn();
|
||||
return "적군 도시 소재 시 접경으로 귀환(재사용 대기 {$postReqTurn})";
|
||||
}
|
||||
|
||||
protected function init()
|
||||
{
|
||||
$this->fullConditionConstraints = [
|
||||
ConstraintHelper::NotBeNeutral(),
|
||||
ConstraintHelper::NotWanderingNation(),
|
||||
ConstraintHelper::NotOccupiedCity()
|
||||
];
|
||||
}
|
||||
|
||||
public function getPreReqTurn(): int
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
public function getPostReqTurn(): int
|
||||
{
|
||||
return 60;
|
||||
}
|
||||
|
||||
public function getCost(): array
|
||||
{
|
||||
return [0, 0];
|
||||
}
|
||||
|
||||
public function run(\Sammo\RandUtil $rng): bool
|
||||
{
|
||||
if (!$this->hasFullConditionMet()) {
|
||||
throw new \RuntimeException('불가능한 커맨드를 강제로 실행 시도');
|
||||
}
|
||||
|
||||
$db = DB::db();
|
||||
|
||||
$general = $this->generalObj;
|
||||
$cityID = $general->getCityID();
|
||||
$logger = $general->getLogger();
|
||||
|
||||
$distanceList = searchDistance($cityID, 3, true);
|
||||
|
||||
$occupiedCityList = new \Ds\Set($db->queryFirstColumn(
|
||||
'SELECT city FROM city WHERE nation = %i AND city IN %li AND supply = 1',
|
||||
$general->getNationID(),
|
||||
array_merge(...$distanceList)
|
||||
));
|
||||
|
||||
$nearestCityList = [];
|
||||
foreach ($distanceList as $cityList) {
|
||||
foreach ($cityList as $cityID) {
|
||||
if ($occupiedCityList->contains($cityID)) {
|
||||
$nearestCityList[] = $cityID;
|
||||
}
|
||||
}
|
||||
if ($nearestCityList) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$nearestCityList) {
|
||||
$logger->pushGeneralActionLog("3칸 이내에 아국 도시가 없습니다.");
|
||||
return false;
|
||||
}
|
||||
|
||||
$destCityID = $rng->choice($nearestCityList);
|
||||
$destCityName = CityConst::byID($destCityID)->name;
|
||||
|
||||
$josaRo = JosaUtil::pick($destCityName, '로');
|
||||
$logger->pushGeneralActionLog("<G><b>{$destCityName}</b></>{$josaRo} 접경귀환했습니다.");
|
||||
$general->setVar('city', $destCityID);
|
||||
|
||||
$general->applyDB($db);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@ namespace sammo\Command\UserAction;
|
||||
|
||||
use sammo\ActionBuff\g65_내정성공;
|
||||
use \sammo\Command;
|
||||
use sammo\Constraint\ConstraintHelper;
|
||||
|
||||
class g65_철야내정 extends Command\UserActionCommand{
|
||||
static protected $actionName = '철야내정';
|
||||
@@ -23,9 +24,10 @@ class g65_철야내정 extends Command\UserActionCommand{
|
||||
}
|
||||
|
||||
protected function init(){
|
||||
//아무것도 하지 않음
|
||||
$this->fullConditionConstraints=[];
|
||||
|
||||
$this->fullConditionConstraints = [
|
||||
ConstraintHelper::NotBeNeutral(),
|
||||
ConstraintHelper::OccupiedCity()
|
||||
];
|
||||
}
|
||||
|
||||
public function getPreReqTurn():int{
|
||||
@@ -41,6 +43,10 @@ class g65_철야내정 extends Command\UserActionCommand{
|
||||
}
|
||||
|
||||
public function run(\Sammo\RandUtil $rng):bool{
|
||||
if (!$this->hasFullConditionMet()) {
|
||||
throw new \RuntimeException('불가능한 커맨드를 강제로 실행 시도');
|
||||
}
|
||||
|
||||
$general = $this->generalObj;
|
||||
$general->addInstantBuff(new g65_내정성공(), 2);
|
||||
|
||||
|
||||
@@ -400,10 +400,12 @@ class GameConstBase
|
||||
public static $availableUserActionCommand = [
|
||||
'개인 전략' => [
|
||||
'휴식',
|
||||
'g65_병사연회',
|
||||
'g65_철야내정',
|
||||
'g65_의원소환',
|
||||
'g65_철야내정',
|
||||
'g65_접경귀환',
|
||||
'g65_병장기지원',
|
||||
'g65_입대독려',
|
||||
'g65_병사연회',
|
||||
]
|
||||
];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user