From 751336e5d1cf684e3e4965e46958a2ec0bfb7de4 Mon Sep 17 00:00:00 2001 From: hide_d Date: Mon, 27 Apr 2020 14:09:23 +0900 Subject: [PATCH] =?UTF-8?q?=EB=B2=84=EA=B7=B8=20=ED=85=8C=EC=8A=A4?= =?UTF-8?q?=ED=8A=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/sammo/GeneralAI.php | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/hwe/sammo/GeneralAI.php b/hwe/sammo/GeneralAI.php index 08e22370..5ba3cc95 100644 --- a/hwe/sammo/GeneralAI.php +++ b/hwe/sammo/GeneralAI.php @@ -2123,8 +2123,16 @@ class GeneralAI $db = DB::db(); $armType =$general->getAuxVar('armType'); - if(!$armType){ + if($armType){ + if(!($genType & self::t지장) && $armType == GameUnitConst::T_WIZARD){ + $armType = null; + } + else if(!($genType & self::t무장) && in_array($armType, [GameUnitConst::T_FOOTMAN, GameUnitConst::T_ARCHER, GameUnitConst::T_CAVALRY])){ + $armType = null; + } + } + if(!$armType){ $dex = [ GameUnitConst::T_FOOTMAN => sqrt($general->getVar('dex1') + 500), GameUnitConst::T_ARCHER => sqrt($general->getVar('dex2') + 500), @@ -2169,13 +2177,16 @@ class GeneralAI if ($types) { $type = Util::choiceRandomUsingWeightPair($types); } else { - $type = GameUnitConst::DEFAULT_CREWTYPE; + throw new MustNotBeReachedException('에러:'.var_dump([$general->getName(), $general->getAuxVar('armType'), $armType, $cities, $regions, $relYear, $tech], true)); } if($this->generalPolicy->can고급병종){ - $currType = $general->getCrewTypeObj()->id; - if(key_exists($currType, $types) && $types[$currType][1] >= $types[$type][1]){ - $type = $currType; + $currCrewType = $general->getCrewTypeObj(); + if ($currCrewType->isValid($cities, $regions, $relYear, $tech)) { + $currScore = $crewtype->pickScore($tech); + if($types[$type][1] * 0.8 < $currScore){ + $type = $currCrewType->id; + } } }