feat: 선전포고 구현

This commit is contained in:
2021-12-21 03:45:33 +09:00
parent dd6d59cf97
commit c757687eba
4 changed files with 60 additions and 12 deletions
+2 -1
View File
@@ -228,7 +228,8 @@ class che_급습 extends Command\NationCommand
return [ return [
'mapTheme' => \sammo\getMapTheme(), 'mapTheme' => \sammo\getMapTheme(),
'procRes' => [ 'procRes' => [
'nations' => $nationList 'nations' => $nationList,
'startYear' => $this->env['startyear'],
], ],
]; ];
} }
@@ -192,6 +192,45 @@ class che_선전포고 extends Command\NationCommand
return true; return true;
} }
public function exportJSVars(): array
{
$generalObj = $this->generalObj;
$nationID = $generalObj->getNationID();
$nationList = [];
$testTurn = new LastTurn($this->getName(), null, $this->getPreReqTurn());
foreach (getAllNationStaticInfo() as $destNation) {
/*if ($destNation['nation'] == $nationID) {
continue;
}*/
$testTurn->setArg(['destNationID' => $destNation['nation']]);
$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;
}
return [
'mapTheme' => \sammo\getMapTheme(),
'procRes' => [
'nations' => $nationList,
'startYear' => $this->env['startyear'],
],
];
}
public function getJSPlugins(): array public function getJSPlugins(): array
{ {
return [ return [
@@ -10,12 +10,21 @@
v-model="selectedCityObj" v-model="selectedCityObj"
/> />
<div> <div v-if="(commandName == '선전포고')">
타국에게 선전 포고합니다.<br />
선전 포고할 국가를 목록에서 선택하세요.<br />
고립되지 않은 아국 도시에서 인접한 국가에 선포 가능합니다.<br />
초반제한 해제 2년전부터 선포가 가능합니다. ({{ startYear + 1 }}
1월부터 가능)<br />
현재 선포가 불가능한 국가는 배경색이 <span style="color: red">붉은색</span>으로
표시됩니다.<br />
</div>
<div v-if="(commandName == '급습')">
선택된 국가에 급습을 발동합니다.<br /> 선택된 국가에 급습을 발동합니다.<br />
선포, 전쟁중인 상대국에만 가능합니다.<br /> 선포, 전쟁중인 상대국에만 가능합니다.<br />
상대 국가를 목록에서 선택하세요.<br /> 상대 국가를 목록에서 선택하세요.<br />
배경색은 현재 급습 불가능 국가는 <span style="color:red;">붉은색</span>으로 배경색은 현재 급습 불가능 국가는
표시됩니다.<br /> <span style="color: red">붉은색</span>으로 표시됩니다.<br />
</div> </div>
<div class="row"> <div class="row">
<div class="col-6 col-md-3"> <div class="col-6 col-md-3">
@@ -40,16 +49,14 @@ import { unwrap } from "@/util/unwrap";
import { Args } from "@/processing/args"; import { Args } from "@/processing/args";
import TopBackBar from "@/components/TopBackBar.vue"; import TopBackBar from "@/components/TopBackBar.vue";
import BottomBar from "@/components/BottomBar.vue"; import BottomBar from "@/components/BottomBar.vue";
import { import { procNationItem, procNationList } from "../processingRes";
procNationItem,
procNationList
} from "../processingRes";
declare const mapTheme: string; declare const mapTheme: string;
declare const currentNation: number; declare const currentNation: number;
declare const commandName: string; declare const commandName: string;
declare const procRes: { declare const procRes: {
nations: procNationList, nations: procNationList;
startYear: number,
}; };
export default defineComponent({ export default defineComponent({
@@ -61,7 +68,7 @@ export default defineComponent({
}, },
watch: { watch: {
selectedCityObj(city: MapCityParsed) { selectedCityObj(city: MapCityParsed) {
if(!city.nationID){ if (!city.nationID) {
return; return;
} }
this.selectedNationID = city.nationID; this.selectedNationID = city.nationID;
@@ -73,7 +80,7 @@ export default defineComponent({
nations.set(nationItem.id, nationItem); nations.set(nationItem.id, nationItem);
} }
const selectedNationID = ref(currentNation); const selectedNationID = ref(procRes.nations[0].id);
function selectedNation(nationID: number) { function selectedNation(nationID: number) {
selectedNationID.value = nationID; selectedNationID.value = nationID;
+2 -1
View File
@@ -1,6 +1,6 @@
import { default as che_국기변경 } from "./che_국기변경.vue"; import { default as che_국기변경 } from "./che_국기변경.vue";
import { default as che_국호변경 } from "./che_국호변경.vue"; import { default as che_국호변경 } from "./che_국호변경.vue";
import { default as NationProcess } from "./che_급습.vue"; import { default as NationProcess } from "./che_선전포고.vue";
import { default as GeneralAmountProcess } from "./che_몰수.vue"; import { default as GeneralAmountProcess } from "./che_몰수.vue";
import { default as GeneralCityProcess } from "./che_발령.vue"; import { default as GeneralCityProcess } from "./che_발령.vue";
@@ -9,6 +9,7 @@ export const commandMap: Record<string, typeof NationProcess> = {
che_국호변경, che_국호변경,
che_급습: NationProcess, che_급습: NationProcess,
che_몰수: GeneralAmountProcess, che_몰수: GeneralAmountProcess,
che_선전포고: NationProcess,
che_포상: GeneralAmountProcess, che_포상: GeneralAmountProcess,
che_발령: GeneralCityProcess, che_발령: GeneralCityProcess,
} }