From ced72eeb7725c61f627568c57853c8c1a040aeaa Mon Sep 17 00:00:00 2001 From: hide_d Date: Tue, 10 Aug 2021 16:48:07 +0900 Subject: [PATCH] =?UTF-8?q?=EB=B2=84=EA=B7=B8=20=EC=88=98=EC=A0=95,=20u?= =?UTF-8?q?=EC=9E=A5=EC=88=98=20=EA=B4=80=EB=A0=A8=20=ED=8A=B9=EC=84=B1=20?= =?UTF-8?q?=EC=88=98=EC=A0=95=20-=20m=EC=9E=A5=EC=9D=80=20=EA=B1=B0?= =?UTF-8?q?=EB=B3=91=ED=95=98=EC=A7=80=20=EC=95=8A=EB=8F=84=EB=A1=9D,=20-?= =?UTF-8?q?=20=ED=83=9C=EC=88=98=EA=B5=AD=20=EA=B1=B4=EA=B5=AD=20=EB=B2=84?= =?UTF-8?q?=EA=B7=B8=20=EC=88=98=EC=A0=95=20-=20Condition=20"Logic"=20?= =?UTF-8?q?=EC=9D=B4=20=ED=95=98=EC=9C=84=20Condition=EC=9D=84=20=ED=95=B4?= =?UTF-8?q?=EC=84=9D=ED=95=98=EC=A7=80=20=EB=AA=BB=ED=95=98=EB=8A=94=20?= =?UTF-8?q?=EB=B2=84=EA=B7=B8=20=EC=88=98=EC=A0=95=20-=20=EC=8B=9C?= =?UTF-8?q?=EB=82=98=EB=A6=AC=EC=98=A4=20=EA=B5=AD=EA=B0=80=20=EA=B1=B4?= =?UTF-8?q?=EA=B5=AD=EC=8B=9C=20type=EC=9C=BC=EB=A1=9C=20null(=EB=9E=9C?= =?UTF-8?q?=EB=8D=A4)=EC=9D=84=20=ED=95=B4=EC=84=9D=ED=95=98=EC=A7=80=20?= =?UTF-8?q?=EB=AA=BB=ED=95=98=EB=8A=94=20=EB=B2=84=EA=B7=B8=20=EC=88=98?= =?UTF-8?q?=EC=A0=95=20-=20=EC=8B=9C=EB=82=98=EB=A6=AC=EC=98=A4=20?= =?UTF-8?q?=EC=B4=88=EB=B0=98=20NPC=20=EB=93=B1=EC=9E=A5=EC=9D=84=2012?= =?UTF-8?q?=EC=9B=94(=EA=B3=A0=EC=A0=95)=EC=97=90=EC=84=9C=206=EC=9B=94?= =?UTF-8?q?=EB=98=90=EB=8A=94=2012=EC=9B=94=EB=A1=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/sammo/Event/Action/RaiseNPCNation.php | 14 ++++++++------ hwe/sammo/Event/Condition/Logic.php | 6 +++++- hwe/sammo/GeneralAI.php | 3 +++ hwe/sammo/Scenario/Nation.php | 5 ++++- hwe/scenario/scenario_0.json | 2 +- hwe/scenario/scenario_1.json | 2 +- hwe/scenario/scenario_2.json | 2 +- 7 files changed, 23 insertions(+), 11 deletions(-) diff --git a/hwe/sammo/Event/Action/RaiseNPCNation.php b/hwe/sammo/Event/Action/RaiseNPCNation.php index dd40e8fb..de604fa6 100644 --- a/hwe/sammo/Event/Action/RaiseNPCNation.php +++ b/hwe/sammo/Event/Action/RaiseNPCNation.php @@ -48,8 +48,9 @@ class RaiseNPCNation extends \sammo\Event\Action } $citySum += $city[$key]; } + $city['sum'] = $citySum; - $targetCities[] = [$city, $citySum]; + $targetCities[] = $city; } $cityCnt = count($targetCities); @@ -64,7 +65,7 @@ class RaiseNPCNation extends \sammo\Event\Action } usort($targetCities, function (array $lhs, array $rhs) { - return $lhs[1] <=> $rhs[1]; + return $lhs['sum'] <=> $rhs['sum']; }); @@ -152,12 +153,12 @@ class RaiseNPCNation extends \sammo\Event\Action 'trust' => 100 ]; foreach (static::CITY_KEYS as $key) { - $targetCity[$key] = min($targetCity["{$key}_max"], $avgCity[$key]); + $targetCity[$key] = min($baseCity["{$key}_max"], $avgCity[$key]); } $pickTypeList = ['무' => 1, '지' => 1]; - $cityID = $baseCity['id']; + $cityID = $baseCity['city']; $cityName = $baseCity['name']; $nationName = "ⓤ{$cityName}"; @@ -224,9 +225,8 @@ class RaiseNPCNation extends \sammo\Event\Action $avgGenCnt = $this->calcAvgNationGeneralCnt(); $serverID = UniqueConst::$serverID; - $existNations = $db->queryFirstColumn("SELECT nation FROM `nation`"); $lastNationID = max( - max($existNations), + $db->queryFirstField("SELECT max(`nation`) FROM `nation`"), $db->queryFirstField("SELECT max(`nation`) FROM `ng_old_nations` WHERE server_id = %s", $serverID), ); @@ -236,6 +236,8 @@ class RaiseNPCNation extends \sammo\Event\Action $occupiedCitiesID = array_keys($occupiedCities); $npcCitiesID = []; + refreshNationStaticInfo(); + foreach ($emptyCities as $emptyCity) { $cityID = $emptyCity['city']; diff --git a/hwe/sammo/Event/Condition/Logic.php b/hwe/sammo/Event/Condition/Logic.php index f521e6f0..9e042606 100644 --- a/hwe/sammo/Event/Condition/Logic.php +++ b/hwe/sammo/Event/Condition/Logic.php @@ -1,6 +1,8 @@ mode = $mode; - $this->conditions = $conditions; + $this->conditions = array_map(function($condition){ + return Condition::build($condition); + }, $conditions); } public function eval($env=null){ diff --git a/hwe/sammo/GeneralAI.php b/hwe/sammo/GeneralAI.php index 29b679b6..8b323f48 100644 --- a/hwe/sammo/GeneralAI.php +++ b/hwe/sammo/GeneralAI.php @@ -3067,6 +3067,9 @@ class GeneralAI if($general->getVar('makelimit')){ return null; } + if($general->getNPCType() > 2){ + return null; + } if(!$this->generalPolicy->can건국){ return null; } diff --git a/hwe/sammo/Scenario/Nation.php b/hwe/sammo/Scenario/Nation.php index b8a8ad95..4ddfc83a 100644 --- a/hwe/sammo/Scenario/Nation.php +++ b/hwe/sammo/Scenario/Nation.php @@ -76,7 +76,10 @@ class Nation{ $capital = 0; } - if(strpos($this->type, '_') === FALSE){ + if($this->type === null){ + $type = Util::choiceRandom(GameConst::$availableNationType); + } + else if(strpos($this->type, '_') === FALSE){ $type = 'che_'.$this->type; } else{ diff --git a/hwe/scenario/scenario_0.json b/hwe/scenario/scenario_0.json index 2f919edb..d44a61f1 100644 --- a/hwe/scenario/scenario_0.json +++ b/hwe/scenario/scenario_0.json @@ -8,7 +8,7 @@ }, "events":[ [ - ["Date", "==", null, 12], + ["or", ["Date", "==", null, 12], ["Date", "==", null, 6]], ["CreateManyNPC", 30], ["DeleteEvent"] ], diff --git a/hwe/scenario/scenario_1.json b/hwe/scenario/scenario_1.json index 53634559..31f45dd6 100644 --- a/hwe/scenario/scenario_1.json +++ b/hwe/scenario/scenario_1.json @@ -11,7 +11,7 @@ }, "events":[ [ - ["Date", "==", null, 12], + ["or", ["Date", "==", null, 12], ["Date", "==", null, 6]], ["CreateManyNPC", 30], ["DeleteEvent"] ], diff --git a/hwe/scenario/scenario_2.json b/hwe/scenario/scenario_2.json index c1d5c41e..e6f8f410 100644 --- a/hwe/scenario/scenario_2.json +++ b/hwe/scenario/scenario_2.json @@ -15,7 +15,7 @@ }, "events":[ [ - ["Date", "==", null, 12], + ["or", ["Date", "==", null, 12], ["Date", "==", null, 6]], ["CreateManyNPC", 30], ["DeleteEvent"] ],