267 lines
7.7 KiB
TypeScript
267 lines
7.7 KiB
TypeScript
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: ['연속 공격 판정 보정']
|
|
},
|
|
'iron-spear': {
|
|
id: 'iron-spear',
|
|
name: '철창',
|
|
slot: 'weapon',
|
|
rank: 'common',
|
|
description: '숙련된 보병과 기병이 두루 쓰는 견고한 창.',
|
|
attackBonus: 3,
|
|
effects: ['전열 유지와 반격에 무난하다']
|
|
},
|
|
'sky-piercer-halberd': {
|
|
id: 'sky-piercer-halberd',
|
|
name: '방천화극',
|
|
slot: 'weapon',
|
|
rank: 'treasure',
|
|
description: '여포의 상징으로 두려움을 산 긴 화극. 한 번 휘두르면 전열이 크게 흔들린다.',
|
|
attackBonus: 6,
|
|
effects: ['단독으로 돌파할 때 피해 보너스']
|
|
},
|
|
'western-cavalry-spear': {
|
|
id: 'western-cavalry-spear',
|
|
name: '서량장창',
|
|
slot: 'weapon',
|
|
rank: 'common',
|
|
description: '서량 기병이 말 위에서 다루기 좋게 균형을 맞춘 장창.',
|
|
attackBonus: 4,
|
|
effects: ['기병 돌격과 추격전에 잘 맞는다']
|
|
},
|
|
'white-feather-fan': {
|
|
id: 'white-feather-fan',
|
|
name: '백우선',
|
|
slot: 'weapon',
|
|
rank: 'treasure',
|
|
description: '제갈량이 책략을 펼칠 때 드는 흰 깃털 부채. 전장의 바람과 마음을 읽는다.',
|
|
strategyBonus: 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: ['공명 연계 판정 보정']
|
|
},
|
|
'mountain-guide-scroll': {
|
|
id: 'mountain-guide-scroll',
|
|
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 const itemCatalogEntries = Object.values(itemCatalog);
|
|
|
|
export function getItem(itemId: string) {
|
|
return itemCatalog[itemId] ?? itemCatalog['training-sword'];
|
|
}
|
|
|
|
export function findItemByName(name: string) {
|
|
return itemCatalogEntries.find((item) => item.name === name);
|
|
}
|
|
|
|
export function itemInventoryLabel(itemId: string) {
|
|
return getItem(itemId).name;
|
|
}
|
|
|
|
export function equipmentItemIdForInventoryLabel(label: string) {
|
|
return findItemByName(label)?.id;
|
|
}
|
|
|
|
export function isEquipmentInventoryLabel(label: string) {
|
|
return Boolean(findItemByName(label));
|
|
}
|
|
|
|
export function equipmentExpToNext(level: number) {
|
|
return 50 + Math.min(level, 9) * 20;
|
|
}
|