Features: - Combat system with AP/EP hit calculation and three-layer defense - Auto-combat/farming mode - Item system with stacking support - Skill system with levels, milestones, and parent skill sync - Shop system with dynamic pricing - Inventory management with bulk selling - Event system - Game loop with offline earnings - Save/Load system Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
145 lines
2.9 KiB
JavaScript
145 lines
2.9 KiB
JavaScript
/**
|
|
* 物品测试夹具
|
|
*/
|
|
|
|
/**
|
|
* 创建模拟武器
|
|
* @param {Object} overrides - 覆盖属性
|
|
* @returns {Object} 武器对象
|
|
*/
|
|
export function createMockWeapon(overrides = {}) {
|
|
return {
|
|
id: 'wooden_sword',
|
|
name: '木剑',
|
|
type: 'weapon',
|
|
subtype: 'one_handed',
|
|
baseDamage: 10,
|
|
baseDefense: 0,
|
|
baseShield: 0,
|
|
baseValue: 100,
|
|
quality: 100,
|
|
attackSpeed: 1.0,
|
|
uniqueId: `wooden_sword_${Date.now()}_test`,
|
|
count: 1,
|
|
equipped: false,
|
|
obtainedAt: Date.now(),
|
|
...overrides
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 创建模拟防具
|
|
* @param {Object} overrides - 覆盖属性
|
|
* @returns {Object} 防具对象
|
|
*/
|
|
export function createMockArmor(overrides = {}) {
|
|
return {
|
|
id: 'leather_armor',
|
|
name: '皮甲',
|
|
type: 'armor',
|
|
subtype: 'light',
|
|
baseDamage: 0,
|
|
baseDefense: 15,
|
|
baseShield: 0,
|
|
baseValue: 150,
|
|
quality: 100,
|
|
uniqueId: `leather_armor_${Date.now()}_test`,
|
|
count: 1,
|
|
equipped: false,
|
|
obtainedAt: Date.now(),
|
|
...overrides
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 创建模拟盾牌
|
|
* @param {Object} overrides - 覆盖属性
|
|
* @returns {Object} 盾牌对象
|
|
*/
|
|
export function createMockShield(overrides = {}) {
|
|
return {
|
|
id: 'wooden_shield',
|
|
name: '木盾',
|
|
type: 'shield',
|
|
baseDamage: 0,
|
|
baseDefense: 0,
|
|
baseShield: 20,
|
|
baseValue: 80,
|
|
quality: 100,
|
|
uniqueId: `wooden_shield_${Date.now()}_test`,
|
|
count: 1,
|
|
equipped: false,
|
|
obtainedAt: Date.now(),
|
|
...overrides
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 创建模拟消耗品
|
|
* @param {Object} overrides - 覆盖属性
|
|
* @returns {Object} 消耗品对象
|
|
*/
|
|
export function createMockConsumable(overrides = {}) {
|
|
return {
|
|
id: 'health_potion',
|
|
name: '生命药水',
|
|
type: 'consumable',
|
|
baseValue: 50,
|
|
quality: 100,
|
|
effect: {
|
|
health: 30,
|
|
stamina: 0,
|
|
sanity: 0
|
|
},
|
|
stackable: true,
|
|
maxStack: 99,
|
|
uniqueId: `health_potion_${Date.now()}_test`,
|
|
count: 1,
|
|
obtainedAt: Date.now(),
|
|
...overrides
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 创建模拟书籍
|
|
* @param {Object} overrides - 覆盖属性
|
|
* @returns {Object} 书籍对象
|
|
*/
|
|
export function createMockBook(overrides = {}) {
|
|
return {
|
|
id: 'skill_book_basics',
|
|
name: '技能基础',
|
|
type: 'book',
|
|
baseValue: 200,
|
|
quality: 100,
|
|
readingTime: 60,
|
|
expReward: {
|
|
sword: 50
|
|
},
|
|
completionBonus: {
|
|
intuition: 1
|
|
},
|
|
uniqueId: `skill_book_${Date.now()}_test`,
|
|
count: 1,
|
|
obtainedAt: Date.now(),
|
|
...overrides
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 创建高品质物品
|
|
* @param {string} type - 物品类型
|
|
* @param {number} quality - 品质值
|
|
* @returns {Object} 高品质物品
|
|
*/
|
|
export function createHighQualityItem(type, quality = 180) {
|
|
const itemCreators = {
|
|
weapon: createMockWeapon,
|
|
armor: createMockArmor,
|
|
shield: createMockShield
|
|
}
|
|
|
|
const creator = itemCreators[type] || createMockWeapon
|
|
return creator({ quality })
|
|
}
|