From 1b24aa2421966e2e00636b24274bf4d69e7b4936 Mon Sep 17 00:00:00 2001 From: Hide_D Date: Tue, 26 Apr 2022 03:23:13 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EA=B8=B0=EB=B3=B8=20=EB=82=B4=EC=A0=95?= =?UTF-8?q?=EB=B3=B4=20=EC=B9=B4=EB=93=9C=20-=20=EC=95=84=EC=A7=81=20bar?= =?UTF-8?q?=EA=B0=80=20=EC=97=86=EC=9D=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/ts/components/GeneralBasicCard.vue | 248 +++++++++++++++++++++++ hwe/ts/utilGame/formatGeneralTypeCall.ts | 32 +++ hwe/ts/utilGame/formatInjury.ts | 15 ++ hwe/ts/utilGame/nextExpLevelRemain.ts | 9 + 4 files changed, 304 insertions(+) create mode 100644 hwe/ts/components/GeneralBasicCard.vue create mode 100644 hwe/ts/utilGame/formatGeneralTypeCall.ts create mode 100644 hwe/ts/utilGame/formatInjury.ts create mode 100644 hwe/ts/utilGame/nextExpLevelRemain.ts diff --git a/hwe/ts/components/GeneralBasicCard.vue b/hwe/ts/components/GeneralBasicCard.vue new file mode 100644 index 00000000..68ba3922 --- /dev/null +++ b/hwe/ts/components/GeneralBasicCard.vue @@ -0,0 +1,248 @@ + + + + + diff --git a/hwe/ts/utilGame/formatGeneralTypeCall.ts b/hwe/ts/utilGame/formatGeneralTypeCall.ts new file mode 100644 index 00000000..ec5b4487 --- /dev/null +++ b/hwe/ts/utilGame/formatGeneralTypeCall.ts @@ -0,0 +1,32 @@ +import type { GameConstType } from "@/defs/GameObj"; + +export function formatGeneralTypeCall(leadership: number, strength: number, intel: number, gameConst: GameConstType): string { + if (leadership < 40) { + if (strength + intel < 40) { + return '아둔'; + } + if (intel >= gameConst.chiefStatMin && strength < intel * 0.8) { + return '학자'; + } + if (strength >= gameConst.chiefStatMin && intel < strength * 0.8) { + return '장사'; + } + return '명사'; + } + + const maxStat = Math.max(leadership, strength, intel); + const sum2Stat = Math.min(leadership + strength, strength + intel, intel + leadership); + if (maxStat >= gameConst.chiefStatMin + gameConst.statGradeLevel && sum2Stat >= maxStat * 1.7) { + return '만능'; + } + if (strength >= gameConst.chiefStatMin - gameConst.statGradeLevel && intel < strength * 0.8) { + return '용장'; + } + if (intel >= gameConst.chiefStatMin - gameConst.statGradeLevel && strength < intel * 0.8) { + return '명장'; + } + if (leadership >= gameConst.chiefStatMin - gameConst.statGradeLevel && strength + intel < leadership) { + return '차장'; + } + return '평범'; +} \ No newline at end of file diff --git a/hwe/ts/utilGame/formatInjury.ts b/hwe/ts/utilGame/formatInjury.ts new file mode 100644 index 00000000..793b6c84 --- /dev/null +++ b/hwe/ts/utilGame/formatInjury.ts @@ -0,0 +1,15 @@ +export function formatInjury(injury: number): [string, string]{ + if(injury <= 0){ + return ['건강', 'white']; + } + if(injury <= 20){ + return ['경상', 'yellow']; + } + if(injury <= 40){ + return ['중상', 'orange']; + } + if(injury <= 60){ + return ['심각', 'magenta']; + } + return ['위독', 'red']; +} \ No newline at end of file diff --git a/hwe/ts/utilGame/nextExpLevelRemain.ts b/hwe/ts/utilGame/nextExpLevelRemain.ts new file mode 100644 index 00000000..bc7c8ff9 --- /dev/null +++ b/hwe/ts/utilGame/nextExpLevelRemain.ts @@ -0,0 +1,9 @@ +export function nextExpLevelRemain(exp: number, expLevel: number): [number, number] { + if (exp < 1000) { + return [exp - expLevel * 100, 100] + } + + const expBase = 10 * expLevel ** 2; + const expNext = 10 * (expLevel + 1) ** 2; + return [exp - expBase, expNext - expBase]; +} \ No newline at end of file