From d36439355d73fd2a112a248bc65a04bb85888457 Mon Sep 17 00:00:00 2001 From: hide_d Date: Sat, 13 Nov 2021 16:05:03 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EC=9E=90=EC=9C=A8=ED=96=89=EB=8F=99?= =?UTF-8?q?=ED=84=B4=20=EC=8B=9C=EA=B0=84=20=EC=A0=9C=ED=95=9C=EC=9D=B4=20?= =?UTF-8?q?=EB=8F=99=EC=9E=91=ED=95=98=EC=A7=80=20=EC=95=8A=EB=8D=98=20?= =?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/TurnExecutionHelper.php | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/hwe/sammo/TurnExecutionHelper.php b/hwe/sammo/TurnExecutionHelper.php index 1ba6fd94..24f862a3 100644 --- a/hwe/sammo/TurnExecutionHelper.php +++ b/hwe/sammo/TurnExecutionHelper.php @@ -238,6 +238,7 @@ class TurnExecutionHelper $turnObj = new static($general); $env = $gameStor->getAll(true); + [$startYear, $year, $month, $turnterm] = $gameStor->getValuesAsArray(['startyear', 'year', 'month', 'turnterm']); $hasNationTurn = false; if ($general->getVar('nation') != 0 && $general->getVar('officer_level') >= 5) { @@ -263,13 +264,22 @@ class TurnExecutionHelper $turnObj->preprocessCommand($env); - if ($general->getNPCType() >= 2 || ($autorun_user['limit_minutes'] ?? false)) { + if ($general->getNPCType() >= 2){ $ai = new GeneralAI($turnObj->getGeneral()); + } else { + $limitYearMonth = $general->getAuxVar('autorun_limit')??Util::joinYearMonth($startYear-2, $month); + if(Util::joinYearMonth($year, $month) < $limitYearMonth){ + $ai = new GeneralAI($turnObj->getGeneral()); + } } + $hasReservedTurn = false; if (!$turnObj->processBlocked()) { if ($hasNationTurn) { + if (!($nationCommandObj instanceof Command\Nation\휴식)) { + $hasReservedTurn = true; + } if ($ai && ($general->getAuxVar('use_auto_nation_turn') ?? 1)) { $nationCommandObj = $ai->chooseNationTurn($nationCommandObj); $cityName = CityConst::byID($general->getCityID())->name; @@ -283,6 +293,9 @@ class TurnExecutionHelper } $generalCommandObj = $general->getReservedTurn(0, $env); + if (!($generalCommandObj instanceof Command\General\휴식)) { + $hasReservedTurn = true; + } if ($ai) { $newGeneralCommandObj = $ai->chooseGeneralTurn($generalCommandObj); // npc AI 처리 @@ -302,6 +315,13 @@ class TurnExecutionHelper $currentTurn = $general->getTurnTime(); $general->increaseVarWithLimit('myset', 3, null, 9); + if($autorun_user['limit_minutes'] && $general->getNPCType() < 2 && $hasReservedTurn){ + $autorun_limit = Util::joinYearMonth($year, $month); + $autorun_limit += intdiv($autorun_user['limit_minutes'], $turnterm); + + $general->setAuxVar('autorun_limit', $autorun_limit); + } + $turnObj->updateTurnTime(); $turnObj->applyDB(); }