From d38ddcd79e9d9b8f4ab0353a8727a1e17deb9ab5 Mon Sep 17 00:00:00 2001 From: Hide_D Date: Wed, 15 Jun 2022 22:34:32 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=ED=94=BC=EC=9E=A5=ED=8C=8C=EC=9E=A5?= =?UTF-8?q?=EC=97=90=EC=84=9C=20=EB=AA=A8=EB=93=A0=20=EA=B5=AD=EA=B0=80?= =?UTF-8?q?=EC=97=90(=EB=B6=88=EA=B0=80)=EA=B0=80=20=EB=82=98=ED=83=80?= =?UTF-8?q?=EB=82=98=EB=8A=94=20=EB=B2=84=EA=B7=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/sammo/Command/Nation/che_피장파장.php | 55 ++++++++++++++--------- hwe/ts/processing/Nation/che_피장파장.vue | 43 ++++++++++-------- 2 files changed, 59 insertions(+), 39 deletions(-) diff --git a/hwe/sammo/Command/Nation/che_피장파장.php b/hwe/sammo/Command/Nation/che_피장파장.php index 2507e2d3..8fb3a76e 100644 --- a/hwe/sammo/Command/Nation/che_피장파장.php +++ b/hwe/sammo/Command/Nation/che_피장파장.php @@ -243,30 +243,14 @@ class che_피장파장 extends Command\NationCommand { $generalObj = $this->generalObj; $nationID = $generalObj->getNationID(); - $nationList = []; - $testTurn = new LastTurn($this->getName(), null, $this->getPreReqTurn()); - foreach (getAllNationStaticInfo() as $destNation) { - $testCommand = new static($generalObj, $this->env, $testTurn, ['destNationID' => $destNation['nation']]); - - $nationTarget = [ - 'id' => $destNation['nation'], - 'name' => $destNation['name'], - 'color' => $destNation['color'], - 'power' => $destNation['power'], - ]; - if (!$testCommand->hasFullConditionMet()) { - $nationTarget['notAvailable'] = true; - } - if ($destNation['nation'] == $nationID) { - $nationTarget['notAvailable'] = true; - } - - $nationList[] = $nationTarget; - } + $testTurn = new LastTurn($this->getName(), null, null); $availableCommandTypeList = []; $currYearMonth = Util::joinYearMonth($this->env['year'], $this->env['month']); + + $oneAvailableCommandName = null; + foreach (GameConst::$availableChiefCommand['전략'] as $commandType) { $cmd = buildNationCommandClass($commandType, $generalObj, $this->env, new LastTurn()); $cmdName = $cmd->getName(); @@ -276,9 +260,40 @@ class che_피장파장 extends Command\NationCommand if ($nextAvailableTurn !== null && $currYearMonth < $nextAvailableTurn) { $remainTurn = $nextAvailableTurn - $currYearMonth; } + else{ + $oneAvailableCommandName = $cmd->getRawClassName(); + } $availableCommandTypeList[$commandType] = ['name' => $cmdName, 'remainTurn' => $remainTurn]; } + $nationList = []; + foreach (getAllNationStaticInfo() as $destNation) { + $nationTarget = [ + 'id' => $destNation['nation'], + 'name' => $destNation['name'], + 'color' => $destNation['color'], + 'power' => $destNation['power'], + ]; + + if($oneAvailableCommandName === null){ + $nationTarget['notAvailable'] = true; + } + else if ($destNation['nation'] == $nationID) { + $nationTarget['notAvailable'] = true; + } + else { + $testCommand = new static($generalObj, $this->env, $testTurn, [ + 'destNationID' => $destNation['nation'], + 'commandType' => $oneAvailableCommandName + ]); + if (!$testCommand->hasFullConditionMet()) { + $nationTarget['notAvailable'] = true; + } + } + + $nationList[] = $nationTarget; + } + return [ 'procRes' => [ 'nationList' => $nationList, diff --git a/hwe/ts/processing/Nation/che_피장파장.vue b/hwe/ts/processing/Nation/che_피장파장.vue index 939f7507..308281fe 100644 --- a/hwe/ts/processing/Nation/che_피장파장.vue +++ b/hwe/ts/processing/Nation/che_피장파장.vue @@ -23,14 +23,31 @@ 현재 피장파장이 불가능한 국가는 붉은색으로 표시됩니다.
-
-
+
+
국가 :
-
+
- +
@@ -56,7 +73,7 @@ declare const procRes: { delayCnt: number; postReqTurn: number; availableCommandTypeList: Record< - number, + string, { name: string; remainTurn: number; @@ -98,7 +115,6 @@ void Promise.all([storeP]).then(() => { asyncReady.value = true; }); - const nationList = new Map(); for (const nationItem of procRes.nationList) { nationList.set(nationItem.id, nationItem); @@ -111,19 +127,8 @@ const map = ref(); const delayCnt = procRes.delayCnt; const postReqTurn = procRes.postReqTurn; -const commandTypesOption: { html: string; value: string }[] = []; -for (const [commandTypeID, commandTypeInfo] of Object.entries(procRes.availableCommandTypeList)) { - const notAvailable = commandTypeInfo.remainTurn > 0; - const notAvailableText = notAvailable ? " (불가)" : ""; - const name = `${commandTypeInfo.name}${notAvailableText}`; - const html = notAvailable ? `${name}` : name; - commandTypesOption.push({ - html, - value: commandTypeID, - }); -} - -const selectedCommandID = ref(Object.keys(procRes.availableCommandTypeList)[0]); +const availableCommandTypeList = procRes.availableCommandTypeList; +const selectedCommandID = ref(Object.keys(availableCommandTypeList)[0]); async function submit(e: Event) { const event = new CustomEvent("customSubmit", {