From 94bc7547d63a1baf44fd5817c21f8d6bd48fae1a Mon Sep 17 00:00:00 2001 From: hide_d Date: Fri, 19 Nov 2021 23:10:32 +0900 Subject: [PATCH] =?UTF-8?q?game:=20=EC=B6=9C=EB=B3=91=EC=9D=80=20=EC=9D=BC?= =?UTF-8?q?=EB=B0=98=EB=82=B4=EC=A0=95=EB=B3=B4=EB=8B=A4=20=EB=A8=BC?= =?UTF-8?q?=EC=A0=80=EC=97=AC=EC=95=BC=ED=95=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/j_set_npc_control.php | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/hwe/j_set_npc_control.php b/hwe/j_set_npc_control.php index b991ed67..7094ea2a 100644 --- a/hwe/j_set_npc_control.php +++ b/hwe/j_set_npc_control.php @@ -167,7 +167,12 @@ function applyGeneralPriority($priority, $nationID, $generalName): ?string $generalPolicyRoot = $nationStor->npc_general_policy; $defaultPriority = AutorunGeneralPolicy::$default_priority; - $mustHaveActions = ['출병' => 1]; + $actionOrder = [ + ['출병', '일반내정'] + ]; + $mustHaveActions = ['출병' => 1, '일반내정' => 1]; + + $orderMap = []; foreach ($priority as $item) { if (key_exists($item, $mustHaveActions)) { $mustHaveActions[$item] = 0; @@ -175,6 +180,19 @@ function applyGeneralPriority($priority, $nationID, $generalName): ?string if (!in_array($item, $defaultPriority)) { return "{$item}은 올바른 명령이 아닙니다."; } + $orderMap[$item] = count($orderMap); + } + + foreach($actionOrder as [$preItem, $postItem]){ + if(!key_exists($preItem, $orderMap)){ + continue; + } + if(!key_exists($postItem, $orderMap)){ + continue; + } + if($orderMap[$preItem] > $orderMap[$postItem]){ + return "{$preItem} 명령은 {$postItem} 명령보다 먼저여야 합니다."; + } } foreach ($mustHaveActions as $actionKey => $unset) {