game: 입관했던 국가 재임관 가능
This commit is contained in:
@@ -118,13 +118,6 @@ class che_등용수락 extends Command\GeneralCommand{
|
||||
$destNationID = $this->destNation['nation'];
|
||||
$destNationName = $this->destNation['name'];
|
||||
|
||||
$relYear = $env['year'] - $env['startyear'];
|
||||
if($general->getNPCType() == 1 || $relYear >= 3){
|
||||
$joinedNations = $general->getAuxVar('joinedNations')??[];
|
||||
$joinedNations[] = $destNationID;
|
||||
$general->setAuxVar('joinedNations', $joinedNations);
|
||||
}
|
||||
|
||||
$isTroopLeader = ($generalID == $general->getVar('troop'));
|
||||
|
||||
$destGeneral->addExperience(100);
|
||||
|
||||
@@ -128,7 +128,7 @@ class che_랜덤임관 extends Command\GeneralCommand
|
||||
$relYear = $env['year'] - $env['startyear'];
|
||||
|
||||
/*
|
||||
$notIn = array_merge($general->getAuxVar('joinedNations')??[], $this->arg['destNationIDList']);
|
||||
$notIn = $this->arg['destNationIDList']);
|
||||
*/
|
||||
$notIn = null;
|
||||
|
||||
@@ -280,13 +280,6 @@ class che_랜덤임관 extends Command\GeneralCommand
|
||||
'gennum' => $db->sqleval('gennum + 1')
|
||||
], 'nation=%i', $destNationID);
|
||||
|
||||
$relYear = $env['year'] - $env['startyear'];
|
||||
if ($general->getNPCType() == 1 || $relYear >= 3) {
|
||||
$joinedNations = $general->getAuxVar('joinedNations') ?? [];
|
||||
$joinedNations[] = $destNationID;
|
||||
$general->setAuxVar('joinedNations', $joinedNations);
|
||||
}
|
||||
|
||||
$general->increaseInheritancePoint(InheritanceKey::active_action, 1);
|
||||
$general->addExperience($exp);
|
||||
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||
|
||||
@@ -168,13 +168,6 @@ class che_임관 extends Command\GeneralCommand
|
||||
], 'nation=%i', $destNationID);
|
||||
\sammo\refreshNationStaticInfo();
|
||||
|
||||
$relYear = $env['year'] - $env['startyear'];
|
||||
if ($general->getNPCType() == 1 || $relYear >= 3) {
|
||||
$joinedNations = $general->getAuxVar('joinedNations') ?? [];
|
||||
$joinedNations[] = $destNationID;
|
||||
$general->setAuxVar('joinedNations', $joinedNations);
|
||||
}
|
||||
|
||||
$general->increaseInheritancePoint(InheritanceKey::active_action, 1);
|
||||
$general->addExperience($exp);
|
||||
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||
|
||||
@@ -165,13 +165,6 @@ class che_장수대상임관 extends Command\GeneralCommand{
|
||||
], 'nation=%i', $destNationID);
|
||||
\sammo\refreshNationStaticInfo();
|
||||
|
||||
$relYear = $env['year'] - $env['startyear'];
|
||||
if($general->getNPCType() == 1 || $relYear >= 3){
|
||||
$joinedNations = $general->getAuxVar('joinedNations')??[];
|
||||
$joinedNations[] = $destNationID;
|
||||
$general->setAuxVar('joinedNations', $joinedNations);
|
||||
}
|
||||
|
||||
$general->increaseInheritancePoint(InheritanceKey::active_action, 1);
|
||||
$general->addExperience($exp);
|
||||
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||
|
||||
@@ -60,12 +60,6 @@ class AllowJoinDestNation extends Constraint{
|
||||
return false;
|
||||
}
|
||||
|
||||
$joinedNations = $this->general['auxVar']['joinedNations']??[];
|
||||
if(in_array($this->destNation['nation'], $joinedNations)){
|
||||
$this->reason = "이미 임관했었던 국가입니다.";
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -20,11 +20,6 @@ class ExistsAllowJoinNation extends Constraint{
|
||||
throw new \InvalidArgumentException("require auxVar in general");
|
||||
}
|
||||
|
||||
if(!key_exists('joinedNations', $this->general['auxVar'])){
|
||||
if(!$throwExeception){return false; }
|
||||
throw new \InvalidArgumentException("require joinedNations in general['auxVar']");
|
||||
}
|
||||
|
||||
if(!is_int($this->arg[0])){
|
||||
if(!$throwExeception){return false; }
|
||||
throw new \InvalidArgumentException("first arg must be int(relYear)");
|
||||
@@ -34,7 +29,7 @@ class ExistsAllowJoinNation extends Constraint{
|
||||
if(!$throwExeception){return false; }
|
||||
throw new \InvalidArgumentException("first arg must be array(exludeList)");
|
||||
}
|
||||
|
||||
|
||||
$this->relYear = $this->arg;
|
||||
|
||||
return true;
|
||||
@@ -47,14 +42,14 @@ class ExistsAllowJoinNation extends Constraint{
|
||||
$db = DB::db();
|
||||
|
||||
$relYear = $this->arg[0];
|
||||
$notIn = array_merge($this->general['auxVar']['joinedNations'], $this->arg[1]);
|
||||
$notIn = $this->arg[1];
|
||||
//이걸 호출하는 경우 분명 동일한 쿼리를 한번 더 부를 것. 쿼리 캐시를 기대함
|
||||
$nations = $db->queryFirstColumn(
|
||||
'SELECT nation, name, gennum, scout FROM nation WHERE scout=0 AND gennum < %i AND no NOT IN %li',
|
||||
$relYear<3?GameConst::$initialNationGenLimit:GameConst::$defaultMaxGeneral,
|
||||
$notIn
|
||||
);
|
||||
|
||||
|
||||
if($nations){
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -271,7 +271,7 @@ class GeneralAI
|
||||
if ($this->warRoute !== null) {
|
||||
return;
|
||||
}
|
||||
$target = array_keys($this->warTargetNation??[]);
|
||||
$target = array_keys($this->warTargetNation ?? []);
|
||||
$target[] = $this->nation['nation'];
|
||||
|
||||
$this->warRoute = searchAllDistanceByNationList($target, false);
|
||||
@@ -2385,7 +2385,7 @@ class GeneralAI
|
||||
}
|
||||
|
||||
$tryBuying = false;
|
||||
if ($general->getNPCType() < 2 && $relGold >= $goldCost * 3 && $relRice >= $riceCost * 3){
|
||||
if ($general->getNPCType() < 2 && $relGold >= $goldCost * 3 && $relRice >= $riceCost * 3) {
|
||||
return null;
|
||||
}
|
||||
if ($this->generalPolicy->can상인무시) {
|
||||
@@ -3296,8 +3296,7 @@ class GeneralAI
|
||||
// 오랑캐는 바로 임관
|
||||
if ($general->getNPCType() == 9) {
|
||||
$rulerNation = $db->queryFirstField(
|
||||
'SELECT nation FROM general WHERE `officer_level`=12 AND npc=9 and nation not in %li ORDER BY RAND() limit 1',
|
||||
$general->getAuxVar('joinedNations') ?? [0]
|
||||
'SELECT nation FROM general WHERE `officer_level`=12 AND npc=9 and nation ORDER BY RAND() limit 1'
|
||||
);
|
||||
|
||||
if ($rulerNation) {
|
||||
|
||||
Reference in New Issue
Block a user