ConstraintHelper 추가
This commit is contained in:
@@ -8,6 +8,7 @@ use \sammo\{
|
||||
};
|
||||
|
||||
use \sammo\Constraint\Constraint;
|
||||
use \sammo\Constraint\ConstraintHelper;
|
||||
|
||||
abstract class BaseCommand{
|
||||
/**
|
||||
|
||||
@@ -11,6 +11,7 @@ use \sammo\{
|
||||
};
|
||||
|
||||
use \sammo\Constraint\Constraint;
|
||||
use \sammo\Constraint\ConstraintHelper;
|
||||
|
||||
|
||||
class che_NPC능동 extends Command\GeneralCommand{
|
||||
@@ -43,7 +44,7 @@ class che_NPC능동 extends Command\GeneralCommand{
|
||||
$general = $this->generalObj;
|
||||
|
||||
$this->runnableConstraints=[
|
||||
['MustBeNPC']
|
||||
ConstraintHelper::MustBeNPC()
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ use function \sammo\{
|
||||
};
|
||||
|
||||
use \sammo\Constraint\Constraint;
|
||||
use \sammo\Constraint\ConstraintHelper;
|
||||
use sammo\CityConst;
|
||||
|
||||
|
||||
@@ -47,10 +48,10 @@ class che_강행 extends Command\GeneralCommand{
|
||||
[$reqGold, $reqRice] = $this->getCost();
|
||||
|
||||
$this->runnableConstraints=[
|
||||
['NotSameDestCity'],
|
||||
['NearCity', 3],
|
||||
['ReqGeneralGold', $reqGold],
|
||||
['ReqGeneralRice', $reqRice],
|
||||
ConstraintHelper::NotSameDestCity(),
|
||||
ConstraintHelper::NearCity(3),
|
||||
ConstraintHelper::ReqGeneralGold($reqGold),
|
||||
ConstraintHelper::ReqGeneralRice($reqRice),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ use \sammo\{
|
||||
|
||||
|
||||
use \sammo\Constraint\Constraint;
|
||||
use \sammo\Constraint\ConstraintHelper;
|
||||
use sammo\CityConst;
|
||||
use function sammo\getNationTypeClass;
|
||||
use function sammo\refreshNationStaticInfo;
|
||||
@@ -44,9 +45,9 @@ class che_거병 extends Command\GeneralCommand{
|
||||
$relYear = $env['year'] - $env['startyear'];
|
||||
|
||||
$this->runnableConstraints=[
|
||||
['BeNeutral'],
|
||||
['BeOpeningPart', $relYear],
|
||||
['AllowJoinAction'],
|
||||
ConstraintHelper::BeNeutral(),
|
||||
ConstraintHelper::BeOpeningPart($relYear),
|
||||
ConstraintHelper::AllowJoinAction(),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ use function \sammo\{
|
||||
};
|
||||
|
||||
use \sammo\Constraint\Constraint;
|
||||
use \sammo\Constraint\ConstraintHelper;
|
||||
use sammo\CityConst;
|
||||
use function sammo\getNationTypeClass;
|
||||
use function sammo\refreshNationStaticInfo;
|
||||
@@ -78,13 +79,13 @@ class che_건국 extends Command\GeneralCommand{
|
||||
$relYear = $env['year'] - $env['startyear'];
|
||||
|
||||
$this->runnableConstraints=[
|
||||
['ReqNationValue', 'gennum', '수하 장수', '>=', 2],
|
||||
['BeOpeningPart', $relYear],
|
||||
['WanderingNation'],
|
||||
['CheckNationNameDuplicate', $nationName],
|
||||
['BeLord'],
|
||||
['AllowJoinAction'],
|
||||
['ConstructableCity']
|
||||
ConstraintHelper::ReqNationValue('gennum', '수하 장수', '>=', 2),
|
||||
ConstraintHelper::BeOpeningPart($relYear),
|
||||
ConstraintHelper::WanderingNation(),
|
||||
ConstraintHelper::CheckNationNameDuplicate($nationName),
|
||||
ConstraintHelper::BeLord(),
|
||||
ConstraintHelper::AllowJoinAction(),
|
||||
ConstraintHelper::ConstructableCity(),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ use function \sammo\{
|
||||
};
|
||||
|
||||
use \sammo\Constraint\Constraint;
|
||||
use \sammo\Constraint\ConstraintHelper;
|
||||
use \sammo\TextDecoration\SightseeingMessage;
|
||||
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ use function \sammo\{
|
||||
};
|
||||
|
||||
use \sammo\Constraint\Constraint;
|
||||
use \sammo\Constraint\ConstraintHelper;
|
||||
use sammo\MustNotBeReachedException;
|
||||
|
||||
class che_군량매매 extends Command\GeneralCommand{
|
||||
@@ -59,16 +60,16 @@ class che_군량매매 extends Command\GeneralCommand{
|
||||
$this->setNation();
|
||||
|
||||
$this->runnableConstraints=[
|
||||
['ReqCityTrader', $general->getVar('npc')],
|
||||
['OccupiedCity', true],
|
||||
['SuppliedCity'],
|
||||
ConstraintHelper::ReqCityTrader($general->getVar('npc')),
|
||||
ConstraintHelper::OccupiedCity(true),
|
||||
ConstraintHelper::SuppliedCity(),
|
||||
];
|
||||
|
||||
if($this->arg['buyRice']){
|
||||
$this->runnableConstraints[] = ['ReqGeneralGold', 1];
|
||||
$this->runnableConstraints[] = ConstraintHelper::ReqGeneralGold(1);
|
||||
}
|
||||
else{
|
||||
$this->runnableConstraints[] = ['ReqGeneralRice', 1];
|
||||
$this->runnableConstraints[] = ConstraintHelper::ReqGeneralRice(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ use function \sammo\{
|
||||
};
|
||||
|
||||
use \sammo\Constraint\Constraint;
|
||||
use \sammo\Constraint\ConstraintHelper;
|
||||
use sammo\CityConst;
|
||||
|
||||
|
||||
@@ -38,9 +39,9 @@ class che_귀환 extends Command\GeneralCommand{
|
||||
[$reqGold, $reqRice] = $this->getCost();
|
||||
|
||||
$this->runnableConstraints=[
|
||||
['NotBeNeutral'],
|
||||
['NotWanderingNation'],
|
||||
['NotCapital', 1],
|
||||
ConstraintHelper::NotBeNeutral(),
|
||||
ConstraintHelper::NotWanderingNation(),
|
||||
ConstraintHelper::NotCapital(true),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ use function sammo\{
|
||||
};
|
||||
|
||||
use \sammo\Constraint\Constraint;
|
||||
use \sammo\Constraint\ConstraintHelper;
|
||||
|
||||
|
||||
class che_기술연구 extends che_상업투자{
|
||||
@@ -40,12 +41,12 @@ class che_기술연구 extends che_상업투자{
|
||||
[$reqGold, $reqRice] = $this->getCost();
|
||||
|
||||
$this->runnableConstraints=[
|
||||
['NotBeNeutral'],
|
||||
['NotWanderingNation'],
|
||||
['OccupiedCity'],
|
||||
['SuppliedCity'],
|
||||
['ReqGeneralGold', $reqGold],
|
||||
['ReqGeneralRice', $reqRice]
|
||||
ConstraintHelper::NotBeNeutral(),
|
||||
ConstraintHelper::NotWanderingNation(),
|
||||
ConstraintHelper::OccupiedCity(),
|
||||
ConstraintHelper::SuppliedCity(),
|
||||
ConstraintHelper::ReqGeneralGold($reqGold),
|
||||
ConstraintHelper::ReqGeneralRice($reqRice)
|
||||
];
|
||||
|
||||
$this->reqGold = $reqGold;
|
||||
|
||||
@@ -16,6 +16,7 @@ use function \sammo\{
|
||||
};
|
||||
|
||||
use \sammo\Constraint\Constraint;
|
||||
use \sammo\Constraint\ConstraintHelper;
|
||||
|
||||
|
||||
|
||||
@@ -37,12 +38,12 @@ class che_단련 extends Command\GeneralCommand{
|
||||
[$reqGold, $reqRice] = $this->getCost();
|
||||
|
||||
$this->runnableConstraints=[
|
||||
['NotBeNeutral'],
|
||||
['ReqGeneralCrew'],
|
||||
['ReqGeneralValue', 'train', '훈련', GameConst::$defaultTrainHigh],
|
||||
['ReqGeneralValue', 'atmos', '사기', GameConst::$defaultAtmosHigh],
|
||||
['ReqGeneralGold', $reqGold],
|
||||
['ReqGeneralRice', $reqRice],
|
||||
ConstraintHelper::NotBeNeutral(),
|
||||
ConstraintHelper::ReqGeneralCrew(),
|
||||
ConstraintHelper::ReqGeneralValue('train', '훈련', '<', GameConst::$defaultTrainHigh),
|
||||
ConstraintHelper::ReqGeneralValue('atmos', '사기', '<', GameConst::$defaultAtmosHigh),
|
||||
ConstraintHelper::ReqGeneralGold($reqGold),
|
||||
ConstraintHelper::ReqGeneralRice($reqRice),
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ use function \sammo\{
|
||||
};
|
||||
|
||||
use \sammo\Constraint\Constraint;
|
||||
use \sammo\Constraint\ConstraintHelper;
|
||||
|
||||
|
||||
class che_등용 extends Command\GeneralCommand{
|
||||
@@ -57,17 +58,18 @@ class che_등용 extends Command\GeneralCommand{
|
||||
$this->setDestGeneral($destGeneral);
|
||||
|
||||
[$reqGold, $reqRice] = $this->getCost();
|
||||
$relYear = $this->env['year'] - $this->env['startyear'];
|
||||
|
||||
$this->runnableConstraints=[
|
||||
['ReqEnvValue', 'join_mode', '==', 'onlyRandom', '랜덤 임관만 가능합니다'],
|
||||
['NotBeNeutral'],
|
||||
['NotOpeningPart'],
|
||||
['OccupiedCity'],
|
||||
['SuppliedCity'],
|
||||
['ExistsDestGeneral'],
|
||||
['DifferentNationDestGeneral'],
|
||||
['ReqGeneralGold', $reqGold],
|
||||
['ReqGeneralRice', $reqRice],
|
||||
ConstraintHelper::ReqEnvValue('join_mode', '==', 'onlyRandom', '랜덤 임관만 가능합니다'),
|
||||
ConstraintHelper::NotBeNeutral(),
|
||||
ConstraintHelper::NotOpeningPart($relYear),
|
||||
ConstraintHelper::OccupiedCity(),
|
||||
ConstraintHelper::SuppliedCity(),
|
||||
ConstraintHelper::ExistsDestGeneral(),
|
||||
ConstraintHelper::DifferentNationDestGeneral(),
|
||||
ConstraintHelper::ReqGeneralGold($reqGold),
|
||||
ConstraintHelper::ReqGeneralRice($reqRice),
|
||||
];
|
||||
|
||||
if($this->destGeneralObj->getVar('level') == 12){
|
||||
|
||||
@@ -16,6 +16,7 @@ use function \sammo\{
|
||||
};
|
||||
|
||||
use \sammo\Constraint\Constraint;
|
||||
use \sammo\Constraint\ConstraintHelper;
|
||||
use sammo\CityConst;
|
||||
use sammo\MustNotBeReachedException;
|
||||
|
||||
@@ -61,10 +62,10 @@ class che_랜덤임관 extends Command\GeneralCommand{
|
||||
$relYear = $env['year'] - $env['startyear'];
|
||||
|
||||
$this->runnableConstraints=[
|
||||
['BeNeutral'],
|
||||
['ExistsDestNation'],
|
||||
['AllowJoinAction'],
|
||||
['ExistsAllowJoinNation', $relYear, [$this->arg['destNationIDList']]],
|
||||
ConstraintHelper::BeNeutral(),
|
||||
ConstraintHelper::ExistsDestNation(),
|
||||
ConstraintHelper::AllowJoinAction(),
|
||||
ConstraintHelper::ExistsAllowJoinNation($relYear, $this->arg['destNationIDList']),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,119 @@
|
||||
<?php
|
||||
namespace sammo\GeneralCommand;
|
||||
|
||||
use \sammo\{
|
||||
DB, Util, JosaUtil,
|
||||
General, DummyGeneral,
|
||||
ActionLogger,
|
||||
GameConst,
|
||||
LastTurn,
|
||||
GameUnitConst,
|
||||
Command
|
||||
};
|
||||
|
||||
use function \sammo\{
|
||||
getDomesticExpLevelBonus,
|
||||
CriticalRatioDomestic,
|
||||
CriticalScoreEx,
|
||||
tryUniqueItemLottery
|
||||
};
|
||||
|
||||
use \sammo\Constraint\Constraint;
|
||||
use \sammo\Constraint\ConstraintHelper;
|
||||
|
||||
class che_모반 extends Command\GeneralCommand{
|
||||
static protected $actionName = '모반';
|
||||
|
||||
protected function argTest():bool{
|
||||
$this->arg = null;
|
||||
return true;
|
||||
}
|
||||
|
||||
protected function init(){
|
||||
|
||||
$general = $this->generalObj;
|
||||
|
||||
$this->setNation();
|
||||
|
||||
$destGeneral = General::createGeneralObjFromDB($this->arg['destGeneralID'], ['gold', 'nation'], 1);
|
||||
$this->setDestGeneral($destGeneral);
|
||||
|
||||
$this->runnableConstraints=[
|
||||
ConstraintHelper::NotBeNeutral(),
|
||||
ConstraintHelper::BeChief(),
|
||||
ConstraintHelper::OccupiedCity(),
|
||||
ConstraintHelper::SuppliedCity(),
|
||||
ConstraintHelper::NotLord(),
|
||||
ConstraintHelper::AllowRebellion(),
|
||||
];
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
$destGeneral = $this->destGeneralObj;
|
||||
|
||||
$generalName = $general->getName();
|
||||
$destGeneralName = $destGeneral->getName();
|
||||
|
||||
$nationName = $this->nation['name'];
|
||||
|
||||
$logger = $general->getLogger();
|
||||
$destLogger = $destGeneral->getLogger();
|
||||
|
||||
$destGeneral->setVar('level', 12);
|
||||
$general->setVar('level', 1);
|
||||
$general->multiplyVar('experience', 0.7);
|
||||
|
||||
$db->update('city', [
|
||||
'gen1'=>0
|
||||
], 'gen1=%i', $destGeneral->getID());
|
||||
$db->update('city', [
|
||||
'gen2'=>0
|
||||
], 'gen2=%i', $destGeneral->getID());
|
||||
$db->update('city', [
|
||||
'gen3'=>0
|
||||
], 'gen3=%i', $destGeneral->getID());
|
||||
|
||||
$destGeneral->increaseVarWithLimit($resKey, $amount);
|
||||
$general->increaseVarWithLimit($resKey, -$amount, 0);
|
||||
|
||||
$josaYi = JosaUtil::pick($generalName, '이');
|
||||
$logger->pushGlobalHistoryLog("<Y><b>【선양】</b></><Y>{$generalName}</>{$josaYi} <D><b>{$nationName}</b></>의 군주 자리를 <Y>{$destGeneralName}</>에게 선양했습니다.");
|
||||
$logger->pushNationalHistoryLog("<Y>{$generalName}</>{$josaYi} <Y>{$destGeneralName}</>에게 선양");
|
||||
|
||||
$logger->pushGeneralActionLog("<Y>{$destGeneralName}</>에게 군주의 자리를 물려줍니다. <1>$date</>");
|
||||
$destLogger->pushGeneralActionLog("<Y>{$generalName}</>에게서 군주의 자리를 물려받습니다.");
|
||||
|
||||
$logger->pushGeneralHistoryLog("<D><b>{$nationName}</b></>의 군주자리를 <Y>{$destGeneralName}</>에게 선양");
|
||||
$destLogger->pushGeneralHistoryLog("<D><b>{$nationName}</b></>의 군주자리를 물려 받음");
|
||||
|
||||
$general->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||
$general->checkStatChange();
|
||||
$general->applyDB($db);
|
||||
$destGeneral->applyDB($db);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -19,6 +19,7 @@ use function \sammo\{
|
||||
};
|
||||
|
||||
use \sammo\Constraint\Constraint;
|
||||
use \sammo\Constraint\ConstraintHelper;
|
||||
|
||||
|
||||
class che_물자조달 extends Command\GeneralCommand{
|
||||
@@ -37,10 +38,10 @@ class che_물자조달 extends Command\GeneralCommand{
|
||||
$this->setNation();
|
||||
|
||||
$this->runnableConstraints=[
|
||||
['NotBeNeutral'],
|
||||
['NotWanderingNation'],
|
||||
['OccupiedCity'],
|
||||
['SuppliedCity']
|
||||
ConstraintHelper::NotBeNeutral(),
|
||||
ConstraintHelper::NotWanderingNation(),
|
||||
ConstraintHelper::OccupiedCity(),
|
||||
ConstraintHelper::SuppliedCity()
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ use function \sammo\{
|
||||
};
|
||||
|
||||
use \sammo\Constraint\Constraint;
|
||||
use \sammo\Constraint\ConstraintHelper;
|
||||
|
||||
|
||||
class che_사기진작 extends Command\GeneralCommand{
|
||||
@@ -36,13 +37,13 @@ class che_사기진작 extends Command\GeneralCommand{
|
||||
[$reqGold, $reqRice] = $this->getCost();
|
||||
|
||||
$this->runnableConstraints=[
|
||||
['NotBeNeutral'],
|
||||
['NotWanderingNation'],
|
||||
['OccupiedCity'],
|
||||
['ReqGeneralCrew'],
|
||||
['ReqGeneralGold', $reqGold],
|
||||
['ReqGeneralRice', $reqRice],
|
||||
['ReqGeneralAtmosMargin', GameConst::$maxAtmosByCommand],
|
||||
ConstraintHelper::NotBeNeutral(),
|
||||
ConstraintHelper::NotWanderingNation(),
|
||||
ConstraintHelper::OccupiedCity(),
|
||||
ConstraintHelper::ReqGeneralCrew(),
|
||||
ConstraintHelper::ReqGeneralGold($reqGold),
|
||||
ConstraintHelper::ReqGeneralRice($reqRice),
|
||||
ConstraintHelper::ReqGeneralAtmosMargin(GameConst::$maxAtmosByCommand),
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ use function \sammo\{
|
||||
};
|
||||
|
||||
use \sammo\Constraint\Constraint;
|
||||
use \sammo\Constraint\ConstraintHelper;
|
||||
|
||||
|
||||
class che_상업투자 extends Command\GeneralCommand{
|
||||
@@ -43,13 +44,13 @@ class che_상업투자 extends Command\GeneralCommand{
|
||||
[$reqGold, $reqRice] = $this->getCost();
|
||||
|
||||
$this->runnableConstraints=[
|
||||
['NotBeNeutral'],
|
||||
['NotWanderingNation'],
|
||||
['OccupiedCity'],
|
||||
['SuppliedCity'],
|
||||
['ReqGeneralGold', $reqGold],
|
||||
['ReqGeneralRice', $reqRice],
|
||||
['RemainCityCapacity', [static::$cityKey, static::$actionName]]
|
||||
ConstraintHelper::NotBeNeutral(),
|
||||
ConstraintHelper::NotWanderingNation(),
|
||||
ConstraintHelper::OccupiedCity(),
|
||||
ConstraintHelper::SuppliedCity(),
|
||||
ConstraintHelper::ReqGeneralGold($reqGold),
|
||||
ConstraintHelper::ReqGeneralRice($reqRice),
|
||||
ConstraintHelper::RemainCityCapacity(static::$cityKey, static::$actionName)
|
||||
];
|
||||
|
||||
$this->reqGold = $reqGold;
|
||||
|
||||
@@ -19,6 +19,7 @@ use function \sammo\{
|
||||
};
|
||||
|
||||
use \sammo\Constraint\Constraint;
|
||||
use \sammo\Constraint\ConstraintHelper;
|
||||
|
||||
|
||||
class che_선양 extends Command\GeneralCommand{
|
||||
@@ -55,10 +56,10 @@ class che_선양 extends Command\GeneralCommand{
|
||||
$this->setDestGeneral($destGeneral);
|
||||
|
||||
$this->runnableConstraints=[
|
||||
['BeLord'],
|
||||
['ExistsDestGeneral'],
|
||||
['FriendlyDestGeneral'],
|
||||
['DisallowDiplomacyStatus', [4], '현재 통합 진행중입니다.']
|
||||
ConstraintHelper::BeLord(),
|
||||
ConstraintHelper::ExistsDestGeneral(),
|
||||
ConstraintHelper::FriendlyDestGeneral(),
|
||||
ConstraintHelper::DisallowDiplomacyStatus([4], '현재 통합 진행중입니다.')
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ use function \sammo\{
|
||||
};
|
||||
|
||||
use \sammo\Constraint\Constraint;
|
||||
use \sammo\Constraint\ConstraintHelper;
|
||||
|
||||
class che_소집해제 extends Command\GeneralCommand{
|
||||
static protected $actionName = '소집해제';
|
||||
@@ -33,7 +34,7 @@ class che_소집해제 extends Command\GeneralCommand{
|
||||
$this->setNation();
|
||||
|
||||
$this->runnableConstraints=[
|
||||
['ReqGeneralCrew'],
|
||||
ConstraintHelper::ReqGeneralCrew(),
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ use function \sammo\{
|
||||
};
|
||||
|
||||
use \sammo\Constraint\Constraint;
|
||||
use \sammo\Constraint\ConstraintHelper;
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ use function \sammo\{
|
||||
};
|
||||
|
||||
use \sammo\Constraint\Constraint;
|
||||
use \sammo\Constraint\ConstraintHelper;
|
||||
use sammo\CityConst;
|
||||
|
||||
|
||||
@@ -47,10 +48,10 @@ class che_이동 extends Command\GeneralCommand{
|
||||
[$reqGold, $reqRice] = $this->getCost();
|
||||
|
||||
$this->runnableConstraints=[
|
||||
['NotSameDestCity'],
|
||||
['NearCity', 1],
|
||||
['ReqGeneralGold', $reqGold],
|
||||
['ReqGeneralRice', $reqRice],
|
||||
ConstraintHelper::NotSameDestCity(),
|
||||
ConstraintHelper::NearCity(1),
|
||||
ConstraintHelper::ReqGeneralGold($reqGold),
|
||||
ConstraintHelper::ReqGeneralRice($reqRice),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ use function \sammo\{
|
||||
};
|
||||
|
||||
use \sammo\Constraint\Constraint;
|
||||
use \sammo\Constraint\ConstraintHelper;
|
||||
|
||||
|
||||
class che_인재탐색 extends Command\GeneralCommand{
|
||||
@@ -39,17 +40,17 @@ class che_인재탐색 extends Command\GeneralCommand{
|
||||
[$reqGold, $reqRice] = $this->getCost();
|
||||
|
||||
$this->runnableConstraints=[
|
||||
['NotBeNeutral'],
|
||||
['NotWanderingNation'],
|
||||
['ReqGeneralGold', $reqGold],
|
||||
['ReqGeneralRice', $reqRice],
|
||||
ConstraintHelper::NotBeNeutral(),
|
||||
ConstraintHelper::NotWanderingNation(),
|
||||
ConstraintHelper::ReqGeneralGold($reqGold),
|
||||
ConstraintHelper::ReqGeneralRice($reqRice),
|
||||
];
|
||||
|
||||
$relYear = $env['year'] - $env['startyear'];
|
||||
if($relYear < 3 && $this->nation['gennum'] >= GameConst::$initialNationGenLimit){
|
||||
$nationName = $this->nation['name'];
|
||||
$josaUn = JosaUtil::pick($nationName, '은');
|
||||
$this->runnableConstraints[] = ['AlwaysFail', "현재 <D>{$nationName}</>{$josaUn} 탐색이 제한되고 있습니다."];
|
||||
$this->runnableConstraints[] = ConstraintHelper::AlwaysFail("현재 <D>{$nationName}</>{$josaUn} 탐색이 제한되고 있습니다.");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ use function \sammo\{
|
||||
};
|
||||
|
||||
use \sammo\Constraint\Constraint;
|
||||
use \sammo\Constraint\ConstraintHelper;
|
||||
use sammo\CityConst;
|
||||
|
||||
|
||||
@@ -84,11 +85,11 @@ class che_임관 extends Command\GeneralCommand{
|
||||
$relYear = $env['year'] - $env['startyear'];
|
||||
|
||||
$this->runnableConstraints=[
|
||||
['ReqEnvValue', 'join_mode', '==', 'onlyRandom', '랜덤 임관만 가능합니다'],
|
||||
['BeNeutral'],
|
||||
['ExistsDestNation'],
|
||||
['AllowJoinDestNation', $relYear],
|
||||
['AllowJoinAction']
|
||||
ConstraintHelper::ReqEnvValue('join_mode', '==', 'onlyRandom', '랜덤 임관만 가능합니다'),
|
||||
ConstraintHelper::BeNeutral(),
|
||||
ConstraintHelper::ExistsDestNation(),
|
||||
ConstraintHelper::AllowJoinDestNation($relYear),
|
||||
ConstraintHelper::AllowJoinAction()
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ use function \sammo\{
|
||||
};
|
||||
|
||||
use \sammo\Constraint\Constraint;
|
||||
use \sammo\Constraint\ConstraintHelper;
|
||||
|
||||
class che_장비매매 extends Command\GeneralCommand{
|
||||
static protected $actionName = '장비매매';
|
||||
@@ -65,20 +66,20 @@ class che_장비매매 extends Command\GeneralCommand{
|
||||
[$reqGold, $reqRice] = $this->getCost();
|
||||
|
||||
$this->runnableConstraints=[
|
||||
['ReqCityTrader', $general->getVar('npc')],
|
||||
['ReqCityCapacity', 'secu', '치안 수치', $itemCode * 1000],
|
||||
['ReqGeneralGold', $reqGold],
|
||||
['ReqGeneralRice', $reqRice],
|
||||
ConstraintHelper::ReqCityTrader($general->getVar('npc')),
|
||||
ConstraintHelper::ReqCityCapacity('secu', '치안 수치', $itemCode * 1000),
|
||||
ConstraintHelper::ReqGeneralGold($reqGold),
|
||||
ConstraintHelper::ReqGeneralRice($reqRice),
|
||||
];
|
||||
|
||||
if($itemCode == 0){
|
||||
$this->runnableConstraints[] = ['ReqGeneralValue', $itemType, $itemTypeName, 1];
|
||||
$this->runnableConstraints[] = ConstraintHelper::ReqGeneralValue($itemType, $itemTypeName, '>=', 1);
|
||||
}
|
||||
else if($itemCode == $general->getVar($itemType)){
|
||||
$this->runnableConstraints[] = ['AlwaysFail', '이미 가지고 있습니다.'];
|
||||
$this->runnableConstraints[] = ConstraintHelper::AlwaysFail('이미 가지고 있습니다.');
|
||||
}
|
||||
else if($itemType != 'item' && $general->getVar($itemType) > 6){
|
||||
$this->runnableConstraints[] = ['AlwaysFail', '이미 진귀한 것을 가지고 있습니다.'];
|
||||
$this->runnableConstraints[] = ConstraintHelper::AlwaysFail('이미 진귀한 것을 가지고 있습니다.');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ use function \sammo\{
|
||||
};
|
||||
|
||||
use \sammo\Constraint\Constraint;
|
||||
use \sammo\Constraint\ConstraintHelper;
|
||||
|
||||
|
||||
class che_전투태세 extends Command\GeneralCommand{
|
||||
@@ -37,14 +38,14 @@ class che_전투태세 extends Command\GeneralCommand{
|
||||
[$reqGold, $reqRice] = $this->getCost();
|
||||
|
||||
$this->runnableConstraints=[
|
||||
['NotBeNeutral'],
|
||||
['NotWanderingNation'],
|
||||
['OccupiedCity'],
|
||||
['ReqGeneralCrew'],
|
||||
['ReqGeneralGold', $reqGold],
|
||||
['ReqGeneralRice', $reqRice],
|
||||
['ReqGeneralTrainMargin', GameConst::$maxTrainByCommand - 10],
|
||||
['ReqGeneralAtmosMargin', GameConst::$maxAtmosByCommand - 10],
|
||||
ConstraintHelper::NotBeNeutral(),
|
||||
ConstraintHelper::NotWanderingNation(),
|
||||
ConstraintHelper::OccupiedCity(),
|
||||
ConstraintHelper::ReqGeneralCrew(),
|
||||
ConstraintHelper::ReqGeneralGold($reqGold),
|
||||
ConstraintHelper::ReqGeneralRice($reqRice),
|
||||
ConstraintHelper::ReqGeneralTrainMargin(GameConst::$maxTrainByCommand - 10),
|
||||
ConstraintHelper::ReqGeneralAtmosMargin(GameConst::$maxAtmosByCommand - 10),
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ use function \sammo\{
|
||||
};
|
||||
|
||||
use \sammo\Constraint\Constraint;
|
||||
use \sammo\Constraint\ConstraintHelper;
|
||||
use function sammo\getGeneralLeadership;
|
||||
|
||||
|
||||
@@ -43,13 +44,13 @@ class che_정착장려 extends Command\GeneralCommand{
|
||||
[$reqGold, $reqRice] = $this->getCost();
|
||||
|
||||
$this->runnableConstraints=[
|
||||
['NotBeNeutral'],
|
||||
['NotWanderingNation'],
|
||||
['OccupiedCity'],
|
||||
['SuppliedCity'],
|
||||
['ReqGeneralGold', $reqGold],
|
||||
['ReqGeneralRice', $reqRice],
|
||||
['RemainCityCapacity', [static::$cityKey, static::$actionName]]
|
||||
ConstraintHelper::NotBeNeutral(),
|
||||
ConstraintHelper::NotWanderingNation(),
|
||||
ConstraintHelper::OccupiedCity(),
|
||||
ConstraintHelper::SuppliedCity(),
|
||||
ConstraintHelper::ReqGeneralGold($reqGold),
|
||||
ConstraintHelper::ReqGeneralRice($reqRice),
|
||||
ConstraintHelper::RemainCityCapacity(static::$cityKey, static::$actionName)
|
||||
];
|
||||
|
||||
$this->reqRice = $reqRice;
|
||||
|
||||
@@ -19,6 +19,7 @@ use function \sammo\{
|
||||
};
|
||||
|
||||
use \sammo\Constraint\Constraint;
|
||||
use \sammo\Constraint\ConstraintHelper;
|
||||
|
||||
|
||||
class che_주민선정 extends Command\GeneralCommand{
|
||||
@@ -42,13 +43,13 @@ class che_주민선정 extends Command\GeneralCommand{
|
||||
[$reqGold, $reqRice] = $this->getCost();
|
||||
|
||||
$this->runnableConstraints=[
|
||||
['NotBeNeutral'],
|
||||
['NotWanderingNation'],
|
||||
['OccupiedCity'],
|
||||
['SuppliedCity'],
|
||||
['ReqGeneralGold', $reqGold],
|
||||
['ReqGeneralRice', $reqRice],
|
||||
['RemainCityTrust', static::$actionName]
|
||||
ConstraintHelper::NotBeNeutral(),
|
||||
ConstraintHelper::NotWanderingNation(),
|
||||
ConstraintHelper::OccupiedCity(),
|
||||
ConstraintHelper::SuppliedCity(),
|
||||
ConstraintHelper::ReqGeneralGold($reqGold),
|
||||
ConstraintHelper::ReqGeneralRice($reqRice),
|
||||
ConstraintHelper::RemainCityTrust(static::$actionName)
|
||||
];
|
||||
|
||||
$this->reqRice = $reqRice;
|
||||
|
||||
@@ -19,6 +19,7 @@ use function \sammo\{
|
||||
};
|
||||
|
||||
use \sammo\Constraint\Constraint;
|
||||
use \sammo\Constraint\ConstraintHelper;
|
||||
|
||||
|
||||
class che_증여 extends Command\GeneralCommand{
|
||||
@@ -73,17 +74,17 @@ class che_증여 extends Command\GeneralCommand{
|
||||
$this->setDestGeneral($destGeneral);
|
||||
|
||||
$this->runnableConstraints=[
|
||||
['NotBeNeutral'],
|
||||
['OccupiedCity'],
|
||||
['SuppliedCity'],
|
||||
['ExistsDestGeneral'],
|
||||
['FriendlyDestGeneral']
|
||||
ConstraintHelper::NotBeNeutral(),
|
||||
ConstraintHelper::OccupiedCity(),
|
||||
ConstraintHelper::SuppliedCity(),
|
||||
ConstraintHelper::ExistsDestGeneral(),
|
||||
ConstraintHelper::FriendlyDestGeneral()
|
||||
];
|
||||
if($this->arg['isGold']){
|
||||
$this->runnableConstraints[] = ['ReqGeneralGold', 1];
|
||||
$this->runnableConstraints[] = ConstraintHelper::ReqGeneralGold(1);
|
||||
}
|
||||
else{
|
||||
$this->runnableConstraints[] = ['ReqGeneralRice', 1];
|
||||
$this->runnableConstraints[] = ConstraintHelper::ReqGeneralRice(1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ use function \sammo\{
|
||||
};
|
||||
|
||||
use \sammo\Constraint\Constraint;
|
||||
use \sammo\Constraint\ConstraintHelper;
|
||||
use sammo\CityConst;
|
||||
|
||||
|
||||
@@ -39,11 +40,11 @@ class che_집합 extends Command\GeneralCommand{
|
||||
[$reqGold, $reqRice] = $this->getCost();
|
||||
|
||||
$this->runnableConstraints=[
|
||||
['NotBeNeutral'],
|
||||
['OccupiedCity'],
|
||||
['SuppliedCity'],
|
||||
['MustBeTroopLeader'],
|
||||
['ReqTroopMembers'],
|
||||
ConstraintHelper::NotBeNeutral(),
|
||||
ConstraintHelper::OccupiedCity(),
|
||||
ConstraintHelper::SuppliedCity(),
|
||||
ConstraintHelper::MustBeTroopLeader(),
|
||||
ConstraintHelper::ReqTroopMembers(),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ use function \sammo\{
|
||||
};
|
||||
|
||||
use \sammo\Constraint\Constraint;
|
||||
use \sammo\Constraint\ConstraintHelper;
|
||||
|
||||
|
||||
|
||||
@@ -92,14 +93,14 @@ class che_징병 extends Command\GeneralCommand{
|
||||
[$reqGold, $reqRice] = $this->getCost();
|
||||
|
||||
$this->runnableConstraints=[
|
||||
['NotBeNeutral'],
|
||||
['OccupiedCity'],
|
||||
['ReqCityCapacity', 'pop', '주민', 30000 + $reqCrew],
|
||||
['ReqCityTrust', 20],
|
||||
['ReqGeneralGold', $reqGold],
|
||||
['ReqGeneralRice', $reqRice],
|
||||
['ReqGeneralCrewMargin', $reqCrewType->id],
|
||||
['AvailableRecruitCrewType', $reqCrewType->id]
|
||||
ConstraintHelper::NotBeNeutral(),
|
||||
ConstraintHelper::OccupiedCity(),
|
||||
ConstraintHelper::ReqCityCapacity('pop', '주민', 30000 + $reqCrew),
|
||||
ConstraintHelper::ReqCityTrust(20),
|
||||
ConstraintHelper::ReqGeneralGold($reqGold),
|
||||
ConstraintHelper::ReqGeneralRice($reqRice),
|
||||
ConstraintHelper::ReqGeneralCrewMargin($reqCrewType->id),
|
||||
ConstraintHelper::AvailableRecruitCrewType($reqCrewType->id)
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ use function \sammo\{
|
||||
};
|
||||
|
||||
use \sammo\Constraint\Constraint;
|
||||
use \sammo\Constraint\ConstraintHelper;
|
||||
use sammo\CityConst;
|
||||
|
||||
|
||||
@@ -49,9 +50,9 @@ class che_첩보 extends Command\GeneralCommand{
|
||||
[$reqGold, $reqRice] = $this->getCost();
|
||||
|
||||
$this->runnableConstraints=[
|
||||
['NotOccupiedDestCity'],
|
||||
['ReqGeneralGold', $reqGold],
|
||||
['ReqGeneralRice', $reqRice],
|
||||
ConstraintHelper::NotOccupiedDestCity(),
|
||||
ConstraintHelper::ReqGeneralGold($reqGold),
|
||||
ConstraintHelper::ReqGeneralRice($reqRice),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ use function \sammo\{
|
||||
};
|
||||
|
||||
use \sammo\Constraint\Constraint;
|
||||
use \sammo\Constraint\ConstraintHelper;
|
||||
use sammo\CityConst;
|
||||
|
||||
|
||||
@@ -47,16 +48,17 @@ class che_출병 extends Command\GeneralCommand{
|
||||
$this->setDestNation(['nation' ,'level','name','capital','gennum','tech','type','gold','rice']);
|
||||
|
||||
[$reqGold, $reqRice] = $this->getCost();
|
||||
$relYear = $this->env['year'] - $this->env['startyear'];
|
||||
|
||||
$this->runnableConstraints=[
|
||||
['NotOpeningPart'],
|
||||
['NearCity', 1],
|
||||
['NotBeNeutral'],
|
||||
['OccupiedCity'],
|
||||
['ReqGeneralCrew'],
|
||||
['ReqGeneralRice', $reqRice],
|
||||
['AllowWar'],
|
||||
['BattleGroundCity', 1],
|
||||
ConstraintHelper::NotOpeningPart($relYear),
|
||||
ConstraintHelper::NearCity(1),
|
||||
ConstraintHelper::NotBeNeutral(),
|
||||
ConstraintHelper::OccupiedCity(),
|
||||
ConstraintHelper::ReqGeneralCrew(),
|
||||
ConstraintHelper::ReqGeneralRice($reqRice),
|
||||
ConstraintHelper::AllowWar(),
|
||||
ConstraintHelper::BattleGroundCity(true),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ use function \sammo\{
|
||||
};
|
||||
|
||||
use \sammo\Constraint\Constraint;
|
||||
use \sammo\Constraint\ConstraintHelper;
|
||||
use sammo\CityConst;
|
||||
|
||||
|
||||
@@ -38,9 +39,9 @@ class che_하야 extends Command\GeneralCommand{
|
||||
$relYear = $env['year'] - $env['startyear'];
|
||||
|
||||
$this->runnableConstraints=[
|
||||
['NotBeNeutral'],
|
||||
['NotOpeningPart', $relYear],
|
||||
['NotLord'],
|
||||
ConstraintHelper::NotBeNeutral(),
|
||||
ConstraintHelper::NotOpeningPart($relYear),
|
||||
ConstraintHelper::NotLord(),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ use \sammo\{
|
||||
|
||||
|
||||
use \sammo\Constraint\Constraint;
|
||||
use \sammo\Constraint\ConstraintHelper;
|
||||
use sammo\CityConst;
|
||||
use function sammo\getNationTypeClass;
|
||||
use function sammo\refreshNationStaticInfo;
|
||||
@@ -46,8 +47,8 @@ class che_해산 extends Command\GeneralCommand{
|
||||
$relYear = $env['year'] - $env['startyear'];
|
||||
|
||||
$this->runnableConstraints=[
|
||||
['BeLord'],
|
||||
['WanderingNation'],
|
||||
ConstraintHelper::BeLord(),
|
||||
ConstraintHelper::WanderingNation(),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ use function \sammo\{
|
||||
};
|
||||
|
||||
use \sammo\Constraint\Constraint;
|
||||
use \sammo\Constraint\ConstraintHelper;
|
||||
|
||||
|
||||
class che_헌납 extends Command\GeneralCommand{
|
||||
@@ -55,15 +56,15 @@ class che_헌납 extends Command\GeneralCommand{
|
||||
$this->setNation();
|
||||
|
||||
$this->runnableConstraints=[
|
||||
['NotBeNeutral'],
|
||||
['OccupiedCity'],
|
||||
['SuppliedCity'],
|
||||
ConstraintHelper::NotBeNeutral(),
|
||||
ConstraintHelper::OccupiedCity(),
|
||||
ConstraintHelper::SuppliedCity(),
|
||||
];
|
||||
if($this->arg['isGold']){
|
||||
$this->runnableConstraints[] = ['ReqGeneralGold', 1];
|
||||
$this->runnableConstraints[] = ConstraintHelper::ReqGeneralGold(1);
|
||||
}
|
||||
else{
|
||||
$this->runnableConstraints[] = ['ReqGeneralRice', 1];
|
||||
$this->runnableConstraints[] = ConstraintHelper::ReqGeneralRice(1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ use function \sammo\{
|
||||
};
|
||||
|
||||
use \sammo\Constraint\Constraint;
|
||||
use \sammo\Constraint\ConstraintHelper;
|
||||
|
||||
|
||||
|
||||
@@ -35,11 +36,11 @@ class che_훈련 extends Command\GeneralCommand{
|
||||
$this->setNation();
|
||||
|
||||
$this->runnableConstraints=[
|
||||
['NotBeNeutral'],
|
||||
['NotWanderingNation'],
|
||||
['OccupiedCity'],
|
||||
['ReqGeneralCrew'],
|
||||
['ReqGeneralTrainMargin', GameConst::$maxTrainByCommand],
|
||||
ConstraintHelper::NotBeNeutral(),
|
||||
ConstraintHelper::NotWanderingNation(),
|
||||
ConstraintHelper::OccupiedCity(),
|
||||
ConstraintHelper::ReqGeneralCrew(),
|
||||
ConstraintHelper::ReqGeneralTrainMargin(GameConst::$maxTrainByCommand),
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user