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