From e3716bda566f241701b0f644088a7ec03ac178b8 Mon Sep 17 00:00:00 2001 From: Hide_D Date: Wed, 18 May 2022 01:41:37 +0900 Subject: [PATCH] =?UTF-8?q?game:=20=EC=9E=85=EA=B4=80=ED=96=88=EB=8D=98=20?= =?UTF-8?q?=EA=B5=AD=EA=B0=80=20=EC=9E=AC=EC=9E=84=EA=B4=80=20=EA=B0=80?= =?UTF-8?q?=EB=8A=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/sammo/Command/General/che_등용수락.php | 7 ------- hwe/sammo/Command/General/che_랜덤임관.php | 9 +-------- hwe/sammo/Command/General/che_임관.php | 7 ------- hwe/sammo/Command/General/che_장수대상임관.php | 7 ------- hwe/sammo/Constraint/AllowJoinDestNation.php | 6 ------ hwe/sammo/Constraint/ExistsAllowJoinNation.php | 11 +++-------- hwe/sammo/GeneralAI.php | 7 +++---- 7 files changed, 7 insertions(+), 47 deletions(-) diff --git a/hwe/sammo/Command/General/che_등용수락.php b/hwe/sammo/Command/General/che_등용수락.php index 223eab6f..ef798761 100644 --- a/hwe/sammo/Command/General/che_등용수락.php +++ b/hwe/sammo/Command/General/che_등용수락.php @@ -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); diff --git a/hwe/sammo/Command/General/che_랜덤임관.php b/hwe/sammo/Command/General/che_랜덤임관.php index ad9a6624..4dea3dd5 100644 --- a/hwe/sammo/Command/General/che_랜덤임관.php +++ b/hwe/sammo/Command/General/che_랜덤임관.php @@ -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)); diff --git a/hwe/sammo/Command/General/che_임관.php b/hwe/sammo/Command/General/che_임관.php index 2a7e4e20..06c7f229 100644 --- a/hwe/sammo/Command/General/che_임관.php +++ b/hwe/sammo/Command/General/che_임관.php @@ -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)); diff --git a/hwe/sammo/Command/General/che_장수대상임관.php b/hwe/sammo/Command/General/che_장수대상임관.php index 480be561..5182b55d 100644 --- a/hwe/sammo/Command/General/che_장수대상임관.php +++ b/hwe/sammo/Command/General/che_장수대상임관.php @@ -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)); diff --git a/hwe/sammo/Constraint/AllowJoinDestNation.php b/hwe/sammo/Constraint/AllowJoinDestNation.php index 6d8b457b..36e9c7b2 100644 --- a/hwe/sammo/Constraint/AllowJoinDestNation.php +++ b/hwe/sammo/Constraint/AllowJoinDestNation.php @@ -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; } } \ No newline at end of file diff --git a/hwe/sammo/Constraint/ExistsAllowJoinNation.php b/hwe/sammo/Constraint/ExistsAllowJoinNation.php index 32168209..bc1e8ac5 100644 --- a/hwe/sammo/Constraint/ExistsAllowJoinNation.php +++ b/hwe/sammo/Constraint/ExistsAllowJoinNation.php @@ -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; } diff --git a/hwe/sammo/GeneralAI.php b/hwe/sammo/GeneralAI.php index 715e2f42..4300375a 100644 --- a/hwe/sammo/GeneralAI.php +++ b/hwe/sammo/GeneralAI.php @@ -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) {