Add equipment growth system

This commit is contained in:
2026-06-22 02:27:03 +09:00
parent f99884ea29
commit b0c6c0ebea
4 changed files with 424 additions and 18 deletions

View File

@@ -0,0 +1,203 @@
export type EquipmentSlot = 'weapon' | 'armor' | 'accessory';
export type EquipmentRank = 'common' | 'treasure';
export type EquipmentState = {
itemId: string;
level: number;
exp: number;
};
export type EquipmentSet = Record<EquipmentSlot, EquipmentState>;
export type ItemDefinition = {
id: string;
name: string;
slot: EquipmentSlot;
rank: EquipmentRank;
description: string;
attackBonus?: number;
defenseBonus?: number;
strategyBonus?: number;
effects: string[];
};
export const equipmentSlotLabels: Record<EquipmentSlot, string> = {
weapon: '무기',
armor: '방어구',
accessory: '보조구'
};
export const equipmentSlots: EquipmentSlot[] = ['weapon', 'armor', 'accessory'];
export const itemCatalog: Record<string, ItemDefinition> = {
'training-sword': {
id: 'training-sword',
name: '연습검',
slot: 'weapon',
rank: 'common',
description: '의용군이 가장 쉽게 다룰 수 있는 기본 검.',
attackBonus: 1,
effects: ['공격 경험치를 안정적으로 쌓는다']
},
'twin-oath-blades': {
id: 'twin-oath-blades',
name: '쌍의검',
slot: 'weapon',
rank: 'treasure',
description: '도원에서 맹세한 뜻을 담아 벼린 쌍검.',
attackBonus: 3,
effects: ['공명 관계가 70 이상이면 공격 경험치 +2']
},
'green-dragon-glaive': {
id: 'green-dragon-glaive',
name: '청룡월도',
slot: 'weapon',
rank: 'treasure',
description: '묵직한 월도로 전열을 갈라내는 관우의 보물 무기.',
attackBonus: 5,
effects: ['적보다 무력이 높으면 피해 보너스']
},
'serpent-spear': {
id: 'serpent-spear',
name: '장팔장창',
slot: 'weapon',
rank: 'treasure',
description: '한 번 내지르면 기세까지 꿰뚫는 장비의 긴 창.',
attackBonus: 5,
effects: ['연속 공격 판정 보정']
},
'yellow-turban-saber': {
id: 'yellow-turban-saber',
name: '황건도',
slot: 'weapon',
rank: 'common',
description: '황건 무리가 들고 다니는 거친 도검.',
attackBonus: 1,
effects: ['평지 전투에 무난하다']
},
'short-bow': {
id: 'short-bow',
name: '단궁',
slot: 'weapon',
rank: 'common',
description: '가볍게 쏘기 좋은 짧은 활.',
attackBonus: 2,
effects: ['궁병 기본 사거리 장비']
},
'leader-axe': {
id: 'leader-axe',
name: '두령부',
slot: 'weapon',
rank: 'common',
description: '두령이 위압을 보이기 위해 쓰는 큼직한 도끼.',
attackBonus: 3,
effects: ['HP가 낮은 적을 압박한다']
},
'cloth-armor': {
id: 'cloth-armor',
name: '포의',
slot: 'armor',
rank: 'common',
description: '가벼운 천옷. 민첩함은 해치지 않지만 방어는 낮다.',
defenseBonus: 1,
effects: ['방어 경험치를 빠르게 시작한다']
},
'lamellar-armor': {
id: 'lamellar-armor',
name: '찰갑',
slot: 'armor',
rank: 'common',
description: '작은 철편을 엮어 만든 실전용 갑옷.',
defenseBonus: 3,
effects: ['근접 견제에 강하다']
},
'oath-robe': {
id: 'oath-robe',
name: '도원포',
slot: 'armor',
rank: 'treasure',
description: '맹세의 문양을 수놓은 전투복.',
defenseBonus: 2,
strategyBonus: 1,
effects: ['공명 경험치 획득 시 방어 경험치 +1']
},
'reinforced-lamellar': {
id: 'reinforced-lamellar',
name: '철린갑',
slot: 'armor',
rank: 'treasure',
description: '비늘처럼 맞물린 철편으로 급소를 덮은 보물 갑옷.',
defenseBonus: 5,
effects: ['방어 시 받는 피해 감소']
},
'rebel-vest': {
id: 'rebel-vest',
name: '황건 조끼',
slot: 'armor',
rank: 'common',
description: '두꺼운 천과 가죽을 덧댄 조끼.',
defenseBonus: 1,
effects: ['숲 지형에서 버티기 좋다']
},
'peach-charm': {
id: 'peach-charm',
name: '복숭아 부적',
slot: 'accessory',
rank: 'treasure',
description: '도원결의의 상징을 새긴 작은 부적.',
strategyBonus: 2,
effects: ['턴 시작 시 낮은 병력을 조금 회복할 예정']
},
'war-manual': {
id: 'war-manual',
name: '병법서',
slot: 'accessory',
rank: 'treasure',
description: '진형과 공격 타이밍을 적은 병법서.',
strategyBonus: 2,
effects: ['공명 연계 판정 보정']
},
'bravery-token': {
id: 'bravery-token',
name: '호담패',
slot: 'accessory',
rank: 'treasure',
description: '물러서지 않는 기개를 새긴 패.',
attackBonus: 1,
effects: ['HP가 낮을수록 공격 의지가 오른다']
},
'grain-pouch': {
id: 'grain-pouch',
name: '군량 주머니',
slot: 'accessory',
rank: 'common',
description: '전투 중 병사들의 허기를 달래는 보조 도구.',
effects: ['장기전 회복 아이템과 연동 예정']
},
'yellow-scarf-charm': {
id: 'yellow-scarf-charm',
name: '황건 부적',
slot: 'accessory',
rank: 'common',
description: '황건 무리가 신념의 증표로 지닌 부적.',
effects: ['사기 유지에 도움을 준다']
},
'wind-quiver': {
id: 'wind-quiver',
name: '바람 화살통',
slot: 'accessory',
rank: 'treasure',
description: '가벼운 화살깃과 균형추가 달린 보물 화살통.',
attackBonus: 1,
effects: ['궁병의 명중 보정']
}
};
export function getItem(itemId: string) {
return itemCatalog[itemId] ?? itemCatalog['training-sword'];
}
export function equipmentExpToNext(level: number) {
return 50 + Math.min(level, 9) * 20;
}

View File

@@ -1,4 +1,5 @@
import type { TerrainType, UnitClassKey } from './battleRules';
import type { EquipmentSet } from './battleItems';
export type PortraitKey = 'liuBei' | 'guanYu' | 'zhangFei';
@@ -23,6 +24,7 @@ export type UnitData = {
attack: number;
move: number;
stats: UnitStats;
equipment: EquipmentSet;
x: number;
y: number;
};
@@ -168,6 +170,11 @@ export const firstBattleUnits: UnitData[] = [
attack: 9,
move: 4,
stats: { might: 76, intelligence: 78, leadership: 84, agility: 70, luck: 88 },
equipment: {
weapon: { itemId: 'twin-oath-blades', level: 1, exp: 18 },
armor: { itemId: 'oath-robe', level: 1, exp: 12 },
accessory: { itemId: 'peach-charm', level: 1, exp: 0 }
},
x: 1,
y: 9
},
@@ -182,6 +189,11 @@ export const firstBattleUnits: UnitData[] = [
attack: 10,
move: 3,
stats: { might: 96, intelligence: 74, leadership: 91, agility: 72, luck: 68 },
equipment: {
weapon: { itemId: 'green-dragon-glaive', level: 1, exp: 26 },
armor: { itemId: 'reinforced-lamellar', level: 1, exp: 10 },
accessory: { itemId: 'war-manual', level: 1, exp: 0 }
},
x: 2,
y: 10
},
@@ -196,6 +208,11 @@ export const firstBattleUnits: UnitData[] = [
attack: 10,
move: 3,
stats: { might: 95, intelligence: 42, leadership: 83, agility: 67, luck: 61 },
equipment: {
weapon: { itemId: 'serpent-spear', level: 1, exp: 20 },
armor: { itemId: 'lamellar-armor', level: 1, exp: 8 },
accessory: { itemId: 'bravery-token', level: 1, exp: 0 }
},
x: 1,
y: 10
},
@@ -210,6 +227,11 @@ export const firstBattleUnits: UnitData[] = [
attack: 6,
move: 3,
stats: { might: 49, intelligence: 34, leadership: 38, agility: 45, luck: 40 },
equipment: {
weapon: { itemId: 'yellow-turban-saber', level: 1, exp: 6 },
armor: { itemId: 'rebel-vest', level: 1, exp: 4 },
accessory: { itemId: 'yellow-scarf-charm', level: 1, exp: 0 }
},
x: 8,
y: 2
},
@@ -224,6 +246,11 @@ export const firstBattleUnits: UnitData[] = [
attack: 6,
move: 3,
stats: { might: 47, intelligence: 32, leadership: 36, agility: 48, luck: 38 },
equipment: {
weapon: { itemId: 'yellow-turban-saber', level: 1, exp: 4 },
armor: { itemId: 'rebel-vest', level: 1, exp: 5 },
accessory: { itemId: 'yellow-scarf-charm', level: 1, exp: 0 }
},
x: 9,
y: 3
},
@@ -238,6 +265,11 @@ export const firstBattleUnits: UnitData[] = [
attack: 7,
move: 3,
stats: { might: 52, intelligence: 40, leadership: 43, agility: 56, luck: 42 },
equipment: {
weapon: { itemId: 'short-bow', level: 1, exp: 10 },
armor: { itemId: 'cloth-armor', level: 1, exp: 6 },
accessory: { itemId: 'wind-quiver', level: 1, exp: 0 }
},
x: 10,
y: 2
},
@@ -252,6 +284,11 @@ export const firstBattleUnits: UnitData[] = [
attack: 9,
move: 3,
stats: { might: 64, intelligence: 46, leadership: 61, agility: 52, luck: 50 },
equipment: {
weapon: { itemId: 'leader-axe', level: 1, exp: 18 },
armor: { itemId: 'lamellar-armor', level: 1, exp: 12 },
accessory: { itemId: 'grain-pouch', level: 1, exp: 0 }
},
x: 10,
y: 4
}