From 089bb027ae26de5634615a97b3dd1b70ce37067d Mon Sep 17 00:00:00 2001 From: hide_d Date: Fri, 24 Apr 2020 01:51:15 +0900 Subject: [PATCH] =?UTF-8?q?=EB=B2=84=EA=B7=B8=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/sammo/Command/General/che_단련.php | 4 ++-- hwe/sammo/Command/General/che_화계.php | 25 +++++++++++-------------- hwe/sammo/GeneralAI.php | 1 + 3 files changed, 14 insertions(+), 16 deletions(-) diff --git a/hwe/sammo/Command/General/che_단련.php b/hwe/sammo/Command/General/che_단련.php index acf3d877..067dde9f 100644 --- a/hwe/sammo/Command/General/che_단련.php +++ b/hwe/sammo/Command/General/che_단련.php @@ -40,8 +40,8 @@ class che_단련 extends Command\GeneralCommand{ $this->runnableConstraints=[ ConstraintHelper::NotBeNeutral(), ConstraintHelper::ReqGeneralCrew(), - ConstraintHelper::ReqGeneralValue('train', '훈련', '<', GameConst::$defaultTrainHigh), - ConstraintHelper::ReqGeneralValue('atmos', '사기', '<', GameConst::$defaultAtmosHigh), + ConstraintHelper::ReqGeneralValue('train', '훈련', '>=', GameConst::$defaultTrainLow), + ConstraintHelper::ReqGeneralValue('atmos', '사기', '>=', GameConst::$defaultAtmosLow), ConstraintHelper::ReqGeneralGold($reqGold), ConstraintHelper::ReqGeneralRice($reqRice), ]; diff --git a/hwe/sammo/Command/General/che_화계.php b/hwe/sammo/Command/General/che_화계.php index 0ff9132f..7545f532 100644 --- a/hwe/sammo/Command/General/che_화계.php +++ b/hwe/sammo/Command/General/che_화계.php @@ -60,7 +60,7 @@ class che_화계 extends Command\GeneralCommand{ $genScore = $general->getIntel(); } else{ - throw new MustNotBeReachedException(); + throw new \sammo\MustNotBeReachedException(); } $prob = $genScore / GameConst::$sabotageProbCoefByStat; @@ -91,7 +91,7 @@ class che_화계 extends Command\GeneralCommand{ $genScore = $destGeneral->getIntel(); } else{ - throw new MustNotBeReachedException(); + throw new \sammo\MustNotBeReachedException(); } $maxGenScore = max($maxGenScore, $genScore); } @@ -243,20 +243,17 @@ class che_화계 extends Command\GeneralCommand{ $destCityGeneralList = []; - [$year, $month] = [$env['year'], $env['month']]; - - foreach($db->query( - 'SELECT `no`,name,city,nation,officer_level,leadership,horse,strength,weapon,intel,book,item,last_turn,injury,special,special2,injury,crew,atmos,train FROM general WHERE city = %i', - $destCityID, - $destNationID - ) as $rawDestCityGeneral){ - $destCityGeneralList[] = new General($rawDestCityGeneral, null, $destCity, $year, $month, true); - //계략에 성공할 경우 logger를 사용해야 하므로 해야하므로, 미리 초기화한다. - //실패하면 날리는거지 뭐~ - }; + $cityGeneralID = $db->queryFirstColumn('SELECT no FROM general WHERE city = %i AND nation = %i', $destCityID, $destNationID); + $destCityGeneralList = General::createGeneralObjListFromDB($cityGeneralID, ['name', 'city', 'nation', 'officer_level', 'leadership', 'horse', 'strength', 'weapon', 'intel', 'book', 'item', 'last_turn', 'injury', 'special', 'special2', 'injury', 'crew', 'atmos', 'train'], 2); + foreach($destCityGeneralList as &$destCityGeneral){ + $destCityGeneral->setRawCity($this->destCity); + unset($destCityGeneral); + } + //계략에 성공할 경우 logger를 사용해야 하므로 해야하므로, 미리 초기화한다. + //실패하면 날리는거지 뭐~ $prob = GameConst::$sabotageDefaultProb + $this->calcSabotageAttackProb() - $this->calcSabotageDefenceProb($destCityGeneralList); - $prob /= $dist[$destCityID]; + $prob /= $dist; if(!Util::randBool($prob)){ $josaYi = JosaUtil::pick($commandName, '이'); diff --git a/hwe/sammo/GeneralAI.php b/hwe/sammo/GeneralAI.php index 6d5e52cf..7417883b 100644 --- a/hwe/sammo/GeneralAI.php +++ b/hwe/sammo/GeneralAI.php @@ -3161,6 +3161,7 @@ class GeneralAI } if($npcType < 2 && $nationID === 0 && !$this->generalPolicy->can국가선택){ + $reservedCommand->reason = '재야유저'; return $reservedCommand; }