Task 2: Equipment System - support 2-handed weapons, staves block offhand slot
Build and Publish Mana Loop Docker Image / build-and-publish (push) Successful in 1m40s
Build and Publish Mana Loop Docker Image / build-and-publish (push) Successful in 1m40s
This commit is contained in:
@@ -15,6 +15,7 @@ export interface EquipmentType {
|
||||
description: string;
|
||||
baseDamage?: number; // For swords
|
||||
baseCastSpeed?: number; // For swords (higher = faster)
|
||||
twoHanded?: boolean; // If true, weapon occupies both main hand and offhand slots
|
||||
}
|
||||
|
||||
// ─── Equipment Types Definition ─────────────────────────────────────────────
|
||||
@@ -28,6 +29,7 @@ export const EQUIPMENT_TYPES: Record<string, EquipmentType> = {
|
||||
slot: 'mainHand',
|
||||
baseCapacity: 50,
|
||||
description: 'A simple wooden staff, basic but reliable for channeling mana.',
|
||||
twoHanded: true,
|
||||
},
|
||||
apprenticeWand: {
|
||||
id: 'apprenticeWand',
|
||||
@@ -44,6 +46,7 @@ export const EQUIPMENT_TYPES: Record<string, EquipmentType> = {
|
||||
slot: 'mainHand',
|
||||
baseCapacity: 65,
|
||||
description: 'A sturdy oak staff with decent mana capacity.',
|
||||
twoHanded: true,
|
||||
},
|
||||
crystalWand: {
|
||||
id: 'crystalWand',
|
||||
@@ -60,6 +63,7 @@ export const EQUIPMENT_TYPES: Record<string, EquipmentType> = {
|
||||
slot: 'mainHand',
|
||||
baseCapacity: 80,
|
||||
description: 'A staff designed for advanced spellcasters. High capacity for complex enchantments.',
|
||||
twoHanded: true,
|
||||
},
|
||||
battlestaff: {
|
||||
id: 'battlestaff',
|
||||
@@ -68,6 +72,7 @@ export const EQUIPMENT_TYPES: Record<string, EquipmentType> = {
|
||||
slot: 'mainHand',
|
||||
baseCapacity: 70,
|
||||
description: 'A reinforced staff suitable for both casting and combat.',
|
||||
twoHanded: true,
|
||||
},
|
||||
|
||||
// ─── Main Hand - Catalysts ────────────────────────────────────────────────
|
||||
@@ -438,6 +443,7 @@ export function getAllEquipmentTypes(): EquipmentType[] {
|
||||
}
|
||||
|
||||
// Get valid slots for a category
|
||||
// Note: For 2-handed weapons, use getValidSlotsForEquipmentType instead
|
||||
export function getValidSlotsForCategory(category: EquipmentCategory): EquipmentSlot[] {
|
||||
switch (category) {
|
||||
case 'caster':
|
||||
@@ -461,6 +467,17 @@ export function getValidSlotsForCategory(category: EquipmentCategory): Equipment
|
||||
}
|
||||
}
|
||||
|
||||
// Get valid slots for a specific equipment type (considers 2-handed weapons)
|
||||
export function getValidSlotsForEquipmentType(equipType: EquipmentType): EquipmentSlot[] {
|
||||
// 2-handed weapons occupy both main hand and offhand
|
||||
if (equipType.twoHanded) {
|
||||
return ['mainHand', 'offHand'];
|
||||
}
|
||||
|
||||
// Otherwise use category-based slots
|
||||
return getValidSlotsForCategory(equipType.category);
|
||||
}
|
||||
|
||||
// Check if an equipment type can be equipped in a specific slot
|
||||
export function canEquipInSlot(equipmentType: EquipmentType, slot: EquipmentSlot): boolean {
|
||||
const validSlots = getValidSlotsForCategory(equipmentType.category);
|
||||
|
||||
Reference in New Issue
Block a user