refac: 장수 생성페이지 GetConst 활용
This commit is contained in:
+242
-198
@@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<TopBackBar title="장수 생성" />
|
<TopBackBar title="장수 생성" />
|
||||||
|
|
||||||
<div id="container" class="bg0">
|
<div v-if="gameConstStore && args" id="container" class="bg0">
|
||||||
<div class="nation-list">
|
<div class="nation-list">
|
||||||
<div class="nation-header nation-row bg1 center">
|
<div class="nation-header nation-row bg1 center">
|
||||||
<div>국가명</div>
|
<div>국가명</div>
|
||||||
@@ -176,8 +176,8 @@
|
|||||||
<div class="col col-6 align-self-center">
|
<div class="col col-6 align-self-center">
|
||||||
<select v-model="args.inheritCity" class="form-select form-inline" style="max-width: 20ch">
|
<select v-model="args.inheritCity" class="form-select form-inline" style="max-width: 20ch">
|
||||||
<option :value="undefined">사용안함</option>
|
<option :value="undefined">사용안함</option>
|
||||||
<option v-for="city in availableInheritCity" :key="city[0]" :value="city[0]">
|
<option v-for="city in availableInheritCity" :key="city.id" :value="city.id">
|
||||||
{{ `[${city[1]}] ${city[2]}` }}
|
{{ `[${city.region}] ${city.name}` }}
|
||||||
</option>
|
</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
@@ -216,13 +216,13 @@
|
|||||||
<div class="a-center">추가 능력치 고정</div>
|
<div class="a-center">추가 능력치 고정</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<NumberInputWithInfo v-model="(args.inheritBonusStat ?? [0, 0, 0])[0]" title="통솔" />
|
<NumberInputWithInfo v-model="(args.inheritBonusStat ?? [0, 0, 0])[0]" :max="stats.bonusMax" title="통솔" />
|
||||||
</div>
|
</div>
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<NumberInputWithInfo v-model="(args.inheritBonusStat ?? [0, 0, 0])[1]" title="무력" />
|
<NumberInputWithInfo v-model="(args.inheritBonusStat ?? [0, 0, 0])[1]" :max="stats.bonusMax" title="무력" />
|
||||||
</div>
|
</div>
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<NumberInputWithInfo v-model="(args.inheritBonusStat ?? [0, 0, 0])[2]" title="지력" />
|
<NumberInputWithInfo v-model="(args.inheritBonusStat ?? [0, 0, 0])[2]" :max="stats.bonusMax" title="지력" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -238,220 +238,264 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
declare const staticValues: {
|
||||||
|
nationList: {
|
||||||
|
nation: number;
|
||||||
|
name: string;
|
||||||
|
color: string;
|
||||||
|
scout: number;
|
||||||
|
scoutmsg?: string;
|
||||||
|
}[];
|
||||||
|
turnterm: number;
|
||||||
|
|
||||||
|
member: {
|
||||||
|
name: string;
|
||||||
|
grade: number;
|
||||||
|
picture: string;
|
||||||
|
imgsvr: 0 | 1;
|
||||||
|
};
|
||||||
|
|
||||||
|
serverID: string;
|
||||||
|
inheritTotalPoint: number;
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
<script lang="ts" setup>
|
||||||
import "@scss/common/bootstrap5.scss";
|
import "@scss/common/bootstrap5.scss";
|
||||||
import "@scss/game_bg.scss";
|
import "@scss/game_bg.scss";
|
||||||
|
|
||||||
import { defineComponent } from "vue";
|
|
||||||
import TopBackBar from "@/components/TopBackBar.vue";
|
import TopBackBar from "@/components/TopBackBar.vue";
|
||||||
import { getIconPath } from "@util/getIconPath";
|
import { getIconPath } from "@util/getIconPath";
|
||||||
import { isBrightColor } from "@util/isBrightColor";
|
import { isBrightColor } from "@util/isBrightColor";
|
||||||
import { abilityLeadint, abilityLeadpow, abilityPowint, abilityRand } from "@util/generalStats";
|
import { abilityLeadint, abilityLeadpow, abilityPowint, abilityRand } from "@util/generalStats";
|
||||||
import { clone, shuffle, sum } from "lodash";
|
import { shuffle, sum } from "lodash";
|
||||||
import NumberInputWithInfo from "@/components/NumberInputWithInfo.vue";
|
import NumberInputWithInfo from "@/components/NumberInputWithInfo.vue";
|
||||||
import { SammoAPI } from "./SammoAPI";
|
import { SammoAPI } from "./SammoAPI";
|
||||||
import type { JoinArgs } from "./defs/API/General";
|
import type { JoinArgs } from "./defs/API/General";
|
||||||
|
import { GameConstStore, getGameConstStore } from "@/GameConstStore";
|
||||||
|
import { computed, onMounted, ref, watch } from "vue";
|
||||||
|
import type { CityID, GameIActionInfo } from "./defs/GameObj";
|
||||||
|
import { unwrap } from "@/util/unwrap";
|
||||||
|
|
||||||
declare const nationList: {
|
const gameConstStore = ref<GameConstStore>();
|
||||||
nation: number;
|
|
||||||
name: string;
|
|
||||||
color: string;
|
|
||||||
scout: number;
|
|
||||||
scoutmsg?: string;
|
|
||||||
}[];
|
|
||||||
declare const availablePersonality: {
|
|
||||||
[key: string]: {
|
|
||||||
name: string;
|
|
||||||
info: string;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
declare const availableInheritSpecial: {
|
const { serverID, member, turnterm } = staticValues;
|
||||||
[key: string]: {
|
|
||||||
name: string;
|
|
||||||
info: string;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
declare const availableInheritCity: [number, string, string][];
|
const nationList = ref(shuffle(staticValues.nationList));
|
||||||
|
const args = ref<JoinArgs>();
|
||||||
|
|
||||||
declare const turnterm: number;
|
const stats = ref({
|
||||||
|
min: 50,
|
||||||
|
max: 50,
|
||||||
|
total: 50,
|
||||||
|
bonusMin: 1,
|
||||||
|
bonusMax: 5,
|
||||||
|
});
|
||||||
|
|
||||||
declare const member: {
|
const inheritTotalPoint = ref(staticValues.inheritTotalPoint);
|
||||||
name: string;
|
const availableInheritCity = ref<{ id: CityID; name: string; region: string }[]>([]);
|
||||||
grade: number;
|
const availableInheritSpecial = ref<Record<string, GameIActionInfo>>({});
|
||||||
picture: string;
|
const availablePersonality = ref<Record<string, GameIActionInfo>>({});
|
||||||
imgsvr: 0 | 1;
|
|
||||||
};
|
|
||||||
|
|
||||||
declare const stats: {
|
watch(gameConstStore, (gameConst) => {
|
||||||
min: number;
|
if (gameConst === undefined) {
|
||||||
max: number;
|
console.error();
|
||||||
total: number;
|
return;
|
||||||
bonusMin: number;
|
|
||||||
bonusMax: number;
|
|
||||||
};
|
|
||||||
|
|
||||||
declare const inheritPoints: {
|
|
||||||
special: number;
|
|
||||||
turnTime: number;
|
|
||||||
city: number;
|
|
||||||
stat: number;
|
|
||||||
};
|
|
||||||
|
|
||||||
declare const serverID: string;
|
|
||||||
declare const inheritTotalPoint: number;
|
|
||||||
|
|
||||||
declare module "@vue/runtime-core" {
|
|
||||||
interface ComponentCustomProperties {
|
|
||||||
member: typeof member;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
availableInheritCity.value = (() => {
|
||||||
|
const cityList: { id: CityID; name: string; region: string }[] = [];
|
||||||
|
for (const city of Object.values(gameConst.cityConst)) {
|
||||||
|
cityList.push({
|
||||||
|
id: city.id,
|
||||||
|
name: city.name,
|
||||||
|
region: gameConst.cityConstMap.region[city.region] as string,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
cityList.sort((lhs, rhs) => {
|
||||||
|
const rC = lhs.region.localeCompare(rhs.region);
|
||||||
|
if (rC != 0) return rC;
|
||||||
|
return lhs.name.localeCompare(rhs.name);
|
||||||
|
});
|
||||||
|
return cityList;
|
||||||
|
})();
|
||||||
|
|
||||||
|
availableInheritSpecial.value = (() => {
|
||||||
|
const specialList: typeof availableInheritSpecial.value = {};
|
||||||
|
for (const specialWarID of Object.values(gameConst.gameConst.availableSpecialWar)) {
|
||||||
|
specialList[specialWarID] = unwrap(gameConst.iActionInfo.specialWar[specialWarID]);
|
||||||
|
}
|
||||||
|
return specialList;
|
||||||
|
})();
|
||||||
|
|
||||||
|
availablePersonality.value = (() => {
|
||||||
|
const personalityList: typeof availablePersonality.value = {};
|
||||||
|
for (const personalityID of Object.values(gameConst.gameConst.availablePersonality)) {
|
||||||
|
personalityList[personalityID] = unwrap(gameConst.iActionInfo.personality[personalityID]);
|
||||||
|
}
|
||||||
|
personalityList["Random"] = {
|
||||||
|
value: "Random",
|
||||||
|
name: "???",
|
||||||
|
info: "무작위 성격을 선택합니다.",
|
||||||
|
};
|
||||||
|
return personalityList;
|
||||||
|
})();
|
||||||
|
|
||||||
|
stats.value = {
|
||||||
|
min: gameConst.gameConst.defaultStatMin,
|
||||||
|
max: gameConst.gameConst.defaultStatMax,
|
||||||
|
total: gameConst.gameConst.defaultStatTotal,
|
||||||
|
bonusMin: gameConst.gameConst.defaultStatMin,
|
||||||
|
bonusMax: gameConst.gameConst.defaultStatMax,
|
||||||
|
}
|
||||||
|
|
||||||
|
args.value = {
|
||||||
|
name: member.name,
|
||||||
|
leadership: stats.value.total - 2 * Math.floor(stats.value.total / 3),
|
||||||
|
strength: Math.floor(stats.value.total / 3),
|
||||||
|
intel: Math.floor(stats.value.total / 3),
|
||||||
|
pic: true,
|
||||||
|
character: "Random",
|
||||||
|
|
||||||
|
inheritCity: undefined,
|
||||||
|
inheritBonusStat: [0, 0, 0],
|
||||||
|
inheritSpecial: undefined,
|
||||||
|
inheritTurntime: undefined,
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
onMounted(async () => {
|
||||||
|
gameConstStore.value = await getGameConstStore();
|
||||||
|
});
|
||||||
|
|
||||||
|
function randStatRandom() {
|
||||||
|
if (args.value === undefined) throw "nyc";
|
||||||
|
[args.value.leadership, args.value.strength, args.value.intel] = abilityRand(stats.value);
|
||||||
|
}
|
||||||
|
function randStatLeadPow() {
|
||||||
|
if (args.value === undefined) throw "nyc";
|
||||||
|
[args.value.leadership, args.value.strength, args.value.intel] = abilityLeadpow(stats.value);
|
||||||
|
}
|
||||||
|
function randStatLeadInt() {
|
||||||
|
if (args.value === undefined) throw "nyc";
|
||||||
|
[args.value.leadership, args.value.strength, args.value.intel] = abilityLeadint(stats.value);
|
||||||
|
}
|
||||||
|
function randStatPowInt() {
|
||||||
|
if (args.value === undefined) throw "nyc";
|
||||||
|
[args.value.leadership, args.value.strength, args.value.intel] = abilityPowint(stats.value);
|
||||||
|
}
|
||||||
|
function resetArgs() {
|
||||||
|
if (!args.value) throw "nyc";
|
||||||
|
const defaultStatTotal = stats.value.total;
|
||||||
|
args.value.name = member.name;
|
||||||
|
args.value.pic = true;
|
||||||
|
args.value.character = "Random";
|
||||||
|
args.value.leadership = defaultStatTotal - 2 * Math.floor(defaultStatTotal / 3);
|
||||||
|
args.value.strength = Math.floor(defaultStatTotal / 3);
|
||||||
|
args.value.intel = Math.floor(defaultStatTotal / 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default defineComponent({
|
async function submitForm() {
|
||||||
name: "PageJoin",
|
if (!args.value) throw "nyc";
|
||||||
components: {
|
//검증은 언제 되어야 하는가?
|
||||||
TopBackBar,
|
const subbmitArgs = args.value;
|
||||||
NumberInputWithInfo,
|
const totalStat = subbmitArgs.leadership + subbmitArgs.strength + subbmitArgs.intel;
|
||||||
},
|
const defaultStatTotal = stats.value.total;
|
||||||
data() {
|
|
||||||
const displayTable = JSON.parse(localStorage.getItem(`conf.${serverID}.join.displayTable`) ?? "true");
|
|
||||||
const displayInherit = JSON.parse(localStorage.getItem(`conf.${serverID}.join.displayInherit`) ?? "true");
|
|
||||||
const nationListShuffled = shuffle(nationList);
|
|
||||||
const args: JoinArgs = {
|
|
||||||
name: member.name,
|
|
||||||
leadership: stats.total - 2 * Math.floor(stats.total / 3),
|
|
||||||
strength: Math.floor(stats.total / 3),
|
|
||||||
intel: Math.floor(stats.total / 3),
|
|
||||||
pic: true,
|
|
||||||
character: "Random",
|
|
||||||
|
|
||||||
inheritCity: undefined,
|
if (totalStat < defaultStatTotal) {
|
||||||
inheritBonusStat: [0, 0, 0],
|
if (
|
||||||
inheritSpecial: undefined,
|
!confirm(
|
||||||
inheritTurntime: undefined,
|
`설정한 능력치가 ${totalStat}으로, 실제 최대치인 ${defaultStatTotal}보다 적습니다.\r\n그래도 진행할까요?`
|
||||||
};
|
)
|
||||||
availableInheritCity.sort((lhs, rhs) => {
|
) {
|
||||||
const rC = lhs[1].localeCompare(rhs[1]);
|
return false;
|
||||||
if (rC != 0) return rC;
|
}
|
||||||
return lhs[2].localeCompare(rhs[2]);
|
}
|
||||||
});
|
try {
|
||||||
return {
|
await SammoAPI.General.Join(subbmitArgs);
|
||||||
displayTable,
|
} catch (e) {
|
||||||
displayInherit,
|
console.error(e);
|
||||||
availablePersonality,
|
alert(`실패했습니다: ${e}`);
|
||||||
availableInheritSpecial,
|
return;
|
||||||
availableInheritCity,
|
}
|
||||||
member: member,
|
|
||||||
stats,
|
|
||||||
args,
|
|
||||||
nationList: nationListShuffled,
|
|
||||||
isBrightColor,
|
|
||||||
inheritTotalPoint,
|
|
||||||
inheritTurnTimeSet: false,
|
|
||||||
inheritTurnTimeMinute: 0,
|
|
||||||
inheritTurnTimeSecond: 0,
|
|
||||||
turnterm,
|
|
||||||
toggleZoom: true,
|
|
||||||
};
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
iconPath() {
|
|
||||||
if (this.args.pic) {
|
|
||||||
return getIconPath(this.member.imgsvr, this.member.picture);
|
|
||||||
}
|
|
||||||
return getIconPath(0, "default.jpg");
|
|
||||||
},
|
|
||||||
inheritRequiredPoint() {
|
|
||||||
let inheritRequiredPoint = 0;
|
|
||||||
if (this.args.inheritCity !== undefined) {
|
|
||||||
inheritRequiredPoint += inheritPoints.city;
|
|
||||||
}
|
|
||||||
if (this.args.inheritSpecial !== undefined) {
|
|
||||||
inheritRequiredPoint += inheritPoints.special;
|
|
||||||
}
|
|
||||||
if (this.args.inheritTurntime !== undefined) {
|
|
||||||
inheritRequiredPoint += inheritPoints.turnTime;
|
|
||||||
}
|
|
||||||
if (this.args.inheritBonusStat !== undefined && sum(this.args.inheritBonusStat) != 0) {
|
|
||||||
inheritRequiredPoint += inheritPoints.stat;
|
|
||||||
}
|
|
||||||
return inheritRequiredPoint;
|
|
||||||
},
|
|
||||||
},
|
|
||||||
watch: {
|
|
||||||
displayTable(newValue: boolean) {
|
|
||||||
localStorage.setItem(`conf.${serverID}.join.displayTable`, JSON.stringify(newValue));
|
|
||||||
},
|
|
||||||
displayInherit(newValue: boolean) {
|
|
||||||
localStorage.setItem(`conf.${serverID}.join.displayInherit`, JSON.stringify(newValue));
|
|
||||||
},
|
|
||||||
inheritTurnTimeMinute(newValue: number) {
|
|
||||||
if (!this.inheritTurnTimeSet) {
|
|
||||||
this.args.inheritTurntime = undefined;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.args.inheritTurntime = newValue * 60 + this.inheritTurnTimeSecond;
|
|
||||||
},
|
|
||||||
inheritTurnTimeSecond(newValue: number) {
|
|
||||||
if (!this.inheritTurnTimeSet) {
|
|
||||||
this.args.inheritTurntime = undefined;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.args.inheritTurntime = this.inheritTurnTimeMinute * 60 + newValue;
|
|
||||||
},
|
|
||||||
inheritTurnTimeSet(newValue: boolean) {
|
|
||||||
if (!newValue) {
|
|
||||||
this.args.inheritTurntime = undefined;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.args.inheritTurntime = this.inheritTurnTimeMinute * 60 + this.inheritTurnTimeSecond;
|
|
||||||
},
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
randStatRandom() {
|
|
||||||
[this.args.leadership, this.args.strength, this.args.intel] = abilityRand();
|
|
||||||
},
|
|
||||||
randStatLeadPow() {
|
|
||||||
[this.args.leadership, this.args.strength, this.args.intel] = abilityLeadpow();
|
|
||||||
},
|
|
||||||
randStatLeadInt() {
|
|
||||||
[this.args.leadership, this.args.strength, this.args.intel] = abilityLeadint();
|
|
||||||
},
|
|
||||||
randStatPowInt() {
|
|
||||||
[this.args.leadership, this.args.strength, this.args.intel] = abilityPowint();
|
|
||||||
},
|
|
||||||
resetArgs() {
|
|
||||||
this.args.name = member.name;
|
|
||||||
this.args.pic = true;
|
|
||||||
this.args.character = "Random";
|
|
||||||
this.args.leadership = stats.total - 2 * Math.floor(stats.total / 3);
|
|
||||||
this.args.strength = Math.floor(stats.total / 3);
|
|
||||||
this.args.intel = Math.floor(stats.total / 3);
|
|
||||||
},
|
|
||||||
async submitForm() {
|
|
||||||
//검증은 언제 되어야 하는가?
|
|
||||||
const args = clone(this.args);
|
|
||||||
const totalStat = args.leadership + args.strength + args.intel;
|
|
||||||
|
|
||||||
if (totalStat < stats.total) {
|
alert("정상적으로 생성되었습니다. \n위키와 팁/강좌 게시판을 꼭 읽어보세요!");
|
||||||
if (
|
location.href = "./";
|
||||||
!confirm(`설정한 능력치가 ${totalStat}으로, 실제 최대치인 ${stats.total}보다 적습니다.\r\n그래도 진행할까요?`)
|
}
|
||||||
) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
await SammoAPI.General.Join(args);
|
|
||||||
} catch (e) {
|
|
||||||
console.error(e);
|
|
||||||
alert(`실패했습니다: ${e}`);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
alert("정상적으로 생성되었습니다. \n위키와 팁/강좌 게시판을 꼭 읽어보세요!");
|
const iconPath = computed(() => {
|
||||||
location.href = "./";
|
if (!args.value) throw "nyc";
|
||||||
},
|
|
||||||
},
|
if (args.value.pic) {
|
||||||
|
return getIconPath(member.imgsvr, member.picture);
|
||||||
|
}
|
||||||
|
return getIconPath(0, "default.jpg");
|
||||||
|
});
|
||||||
|
|
||||||
|
const inheritRequiredPoint = computed(() => {
|
||||||
|
if (!args.value || !gameConstStore.value) throw "nyc";
|
||||||
|
|
||||||
|
let inheritRequiredPoint = 0;
|
||||||
|
const gameConst = gameConstStore.value.gameConst;
|
||||||
|
|
||||||
|
if (args.value.inheritCity !== undefined) {
|
||||||
|
inheritRequiredPoint += gameConst.inheritBornCityPoint;
|
||||||
|
}
|
||||||
|
if (args.value.inheritSpecial !== undefined) {
|
||||||
|
inheritRequiredPoint += gameConst.inheritBornSpecialPoint;
|
||||||
|
}
|
||||||
|
if (args.value.inheritTurntime !== undefined) {
|
||||||
|
inheritRequiredPoint += gameConst.inheritBornTurntimePoint;
|
||||||
|
}
|
||||||
|
if (args.value.inheritBonusStat !== undefined && sum(args.value.inheritBonusStat) != 0) {
|
||||||
|
inheritRequiredPoint += gameConst.inheritBornStatPoint;
|
||||||
|
}
|
||||||
|
return inheritRequiredPoint;
|
||||||
|
});
|
||||||
|
|
||||||
|
const toggleZoom = ref(true);
|
||||||
|
|
||||||
|
const displayTable = ref(JSON.parse(localStorage.getItem(`conf.${serverID}.join.displayTable`) ?? "true"));
|
||||||
|
watch(displayTable, (newValue: boolean) => {
|
||||||
|
localStorage.setItem(`conf.${serverID}.join.displayTable`, JSON.stringify(newValue));
|
||||||
|
});
|
||||||
|
|
||||||
|
const displayInherit = ref(JSON.parse(localStorage.getItem(`conf.${serverID}.join.displayInherit`) ?? "true"));
|
||||||
|
watch(displayInherit, (newValue: boolean) => {
|
||||||
|
localStorage.setItem(`conf.${serverID}.join.displayInherit`, JSON.stringify(newValue));
|
||||||
|
});
|
||||||
|
|
||||||
|
const inheritTurnTimeSet = ref(false);
|
||||||
|
watch(inheritTurnTimeSet, (newValue: boolean) => {
|
||||||
|
if (!args.value) throw "nyc";
|
||||||
|
|
||||||
|
if (!newValue) {
|
||||||
|
args.value.inheritTurntime = undefined;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
args.value.inheritTurntime = inheritTurnTimeMinute.value * 60 + inheritTurnTimeSecond.value;
|
||||||
|
});
|
||||||
|
|
||||||
|
const inheritTurnTimeMinute = ref(0);
|
||||||
|
watch(inheritTurnTimeMinute, (newValue: number) => {
|
||||||
|
if (!args.value) throw "nyc";
|
||||||
|
if (!inheritTurnTimeSet.value) {
|
||||||
|
args.value.inheritTurntime = undefined;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
args.value.inheritTurntime = newValue * 60 + inheritTurnTimeSecond.value;
|
||||||
|
});
|
||||||
|
|
||||||
|
const inheritTurnTimeSecond = ref(0);
|
||||||
|
watch(inheritTurnTimeSecond, (newValue: number) => {
|
||||||
|
if (!args.value) throw "nyc";
|
||||||
|
|
||||||
|
if (!inheritTurnTimeSet.value) {
|
||||||
|
args.value.inheritTurntime = undefined;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
args.value.inheritTurntime = inheritTurnTimeMinute.value * 60 + newValue;
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
|
|||||||
@@ -1,12 +1,6 @@
|
|||||||
declare const stats: {
|
interface Stats { min: number, max: number, total: number };
|
||||||
min: number;
|
|
||||||
max: number;
|
|
||||||
total: number;
|
|
||||||
bonusMin: number;
|
|
||||||
bonusMax: number;
|
|
||||||
};
|
|
||||||
|
|
||||||
export function abilityRand(): [number, number, number] {
|
export function abilityRand(stats: Stats): [number, number, number] {
|
||||||
let leadership = Math.random() * 65 + 10;
|
let leadership = Math.random() * 65 + 10;
|
||||||
let strength = Math.random() * 65 + 10;
|
let strength = Math.random() * 65 + 10;
|
||||||
let intel = Math.random() * 65 + 10;
|
let intel = Math.random() * 65 + 10;
|
||||||
@@ -28,13 +22,13 @@ export function abilityRand(): [number, number, number] {
|
|||||||
strength < stats.min ||
|
strength < stats.min ||
|
||||||
intel < stats.min
|
intel < stats.min
|
||||||
) {
|
) {
|
||||||
return abilityRand();
|
return abilityRand(stats);
|
||||||
}
|
}
|
||||||
|
|
||||||
return [leadership, strength, intel];
|
return [leadership, strength, intel];
|
||||||
}
|
}
|
||||||
|
|
||||||
export function abilityLeadpow(): [number, number, number] {
|
export function abilityLeadpow(stats: Stats): [number, number, number] {
|
||||||
let leadership = Math.random() * 6;
|
let leadership = Math.random() * 6;
|
||||||
let strength = Math.random() * 6;
|
let strength = Math.random() * 6;
|
||||||
let intel = Math.random() * 1;
|
let intel = Math.random() * 1;
|
||||||
@@ -71,7 +65,7 @@ export function abilityLeadpow(): [number, number, number] {
|
|||||||
return [leadership, strength, intel];
|
return [leadership, strength, intel];
|
||||||
}
|
}
|
||||||
|
|
||||||
export function abilityLeadint(): [number, number, number] {
|
export function abilityLeadint(stats: Stats): [number, number, number] {
|
||||||
let leadership = Math.random() * 6;
|
let leadership = Math.random() * 6;
|
||||||
let strength = Math.random() * 1;
|
let strength = Math.random() * 1;
|
||||||
let intel = Math.random() * 6;
|
let intel = Math.random() * 6;
|
||||||
@@ -108,7 +102,7 @@ export function abilityLeadint(): [number, number, number] {
|
|||||||
return [leadership, strength, intel];
|
return [leadership, strength, intel];
|
||||||
}
|
}
|
||||||
|
|
||||||
export function abilityPowint(): [number, number, number] {
|
export function abilityPowint(stats: Stats): [number, number, number] {
|
||||||
let leadership = Math.random() * 1;
|
let leadership = Math.random() * 1;
|
||||||
let strength = Math.random() * 6;
|
let strength = Math.random() * 6;
|
||||||
let intel = Math.random() * 6;
|
let intel = Math.random() * 6;
|
||||||
|
|||||||
+15
-56
@@ -47,31 +47,6 @@ $scoutMsgs = KVStorage::getValuesFromInterNamespace($db, 'nation_env', 'scout_ms
|
|||||||
foreach ($scoutMsgs as $destNationID => $scoutMsg) {
|
foreach ($scoutMsgs as $destNationID => $scoutMsg) {
|
||||||
$nationList[$destNationID]['scoutmsg'] = $scoutMsg;
|
$nationList[$destNationID]['scoutmsg'] = $scoutMsg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$availablePersonality = [];
|
|
||||||
foreach (GameConst::$availablePersonality as $personalityID) {
|
|
||||||
$personalityObj = buildPersonalityClass($personalityID);
|
|
||||||
$availablePersonality[$personalityID] = [
|
|
||||||
'name' => $personalityObj->getName(),
|
|
||||||
'info' => $personalityObj->getInfo(),
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
$availableInheritSpecial = [];
|
|
||||||
foreach (GameConst::$availableSpecialWar as $specialID){
|
|
||||||
$specialObj = buildGeneralSpecialWarClass($specialID);
|
|
||||||
$availableInheritSpecial[$specialID] = [
|
|
||||||
'name' => $specialObj->getName(),
|
|
||||||
'info' => $specialObj->getInfo(),
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
$availableInheritCity = [];
|
|
||||||
foreach(CityConst::all() as $city){
|
|
||||||
$availableInheritCity[] = [$city->id, CityConst::$regionMap[$city->region], $city->name];
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
@@ -85,37 +60,21 @@ foreach(CityConst::all() as $city){
|
|||||||
<?= WebUtil::printDist('vue', 'v_join', true) ?>
|
<?= WebUtil::printDist('vue', 'v_join', true) ?>
|
||||||
|
|
||||||
<?= WebUtil::printStaticValues([
|
<?= WebUtil::printStaticValues([
|
||||||
'serverID' => UniqueConst::$serverID,
|
'staticValues'=>[
|
||||||
'nationList' => array_values($nationList),
|
'serverID' => UniqueConst::$serverID,
|
||||||
'config' => [
|
'nationList' => array_values($nationList),
|
||||||
'show_img_level' => $admin['show_img_level']
|
'config' => [
|
||||||
],
|
'show_img_level' => $admin['show_img_level']
|
||||||
'member' => [
|
],
|
||||||
'name' => $member['name'],
|
'member' => [
|
||||||
'grade' => $member['grade'],
|
'name' => $member['name'],
|
||||||
'picture' => $member['picture'],
|
'grade' => $member['grade'],
|
||||||
'imgsvr' => $member['imgsvr'],
|
'picture' => $member['picture'],
|
||||||
],
|
'imgsvr' => $member['imgsvr'],
|
||||||
'availablePersonality' => array_merge([
|
],
|
||||||
'Random' => ['name' => '???', 'info' => '무작위 성격을 선택합니다.']
|
'inheritTotalPoint'=>$inheritTotalPoint,
|
||||||
], $availablePersonality),
|
'turnterm'=>$gameStor->turnterm,
|
||||||
'stats' => [
|
]
|
||||||
'min' => GameConst::$defaultStatMin,
|
|
||||||
'max' => GameConst::$defaultStatMax,
|
|
||||||
'total' => GameConst::$defaultStatTotal,
|
|
||||||
'bonusMin' => GameConst::$bornMinStatBonus,
|
|
||||||
'bonusMax' => GameConst::$bornMaxStatBonus,
|
|
||||||
],
|
|
||||||
'inheritTotalPoint'=>$inheritTotalPoint,
|
|
||||||
'inheritPoints'=>[
|
|
||||||
'special'=>GameConst::$inheritBornSpecialPoint,
|
|
||||||
'turnTime'=>GameConst::$inheritBornTurntimePoint,
|
|
||||||
'city'=>GameConst::$inheritBornCityPoint,
|
|
||||||
'stat'=>GameConst::$inheritBornStatPoint
|
|
||||||
],
|
|
||||||
'availableInheritSpecial' => $availableInheritSpecial,
|
|
||||||
'availableInheritCity'=> $availableInheritCity,
|
|
||||||
'turnterm'=>$gameStor->turnterm,
|
|
||||||
]) ?>
|
]) ?>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user