1 import {Profession} from "./profession";
2 import {SkillID} from "./skills";
4 export type InventoryType = 'ARMOUR' | 'WEAPON' | 'SPELL';
6 export type ArmourEquipmentSlot = 'HEAD' | 'LEGS' | 'ARMS' | 'CHEST';
7 export type WeaponEquipmentSlot = 'LEFT_HAND' | 'RIGHT_HAND' | 'TWO_HANDED' | 'ANY_HAND';
9 export type EquipmentSlot = ArmourEquipmentSlot | WeaponEquipmentSlot;
12 export type InventoryItem = {
17 profession: Profession;
18 equipment_slot: EquipmentSlot;
35 damage_mitigation: number;
40 affectedSkills: SkillID[];
43 // shop items have a numeric id since they're tracked in a separate spreadsheet
44 // and they are also tied to a specific location
45 export type ShopEquipment = Omit<InventoryItem, 'id' | 'player_id'> & {
50 export function repairCost(item: InventoryItem): number {
51 const totalCost = item.cost * 0.7;
53 const damageRatio = 1 - (item.currentAp / item.maxAp);
55 return Math.floor(totalCost * damageRatio);