148 lines
2.4 KiB
JavaScript
148 lines
2.4 KiB
JavaScript
|
|
/**
|
||
|
|
* 敌人测试夹具
|
||
|
|
*/
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 创建模拟敌人
|
||
|
|
* @param {Object} overrides - 覆盖属性
|
||
|
|
* @returns {Object} 敌人对象
|
||
|
|
*/
|
||
|
|
export function createMockEnemy(overrides = {}) {
|
||
|
|
return {
|
||
|
|
id: 'wild_dog',
|
||
|
|
name: '野狗',
|
||
|
|
baseStats: {
|
||
|
|
health: 50,
|
||
|
|
attack: 8,
|
||
|
|
defense: 3,
|
||
|
|
strength: 8,
|
||
|
|
agility: 12,
|
||
|
|
dexterity: 6,
|
||
|
|
intuition: 4,
|
||
|
|
vitality: 6
|
||
|
|
},
|
||
|
|
expReward: 20,
|
||
|
|
drops: [],
|
||
|
|
...overrides
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 创建Boss敌人
|
||
|
|
* @param {Object} overrides - 覆盖属性
|
||
|
|
* @returns {Object} Boss对象
|
||
|
|
*/
|
||
|
|
export function createMockBoss(overrides = {}) {
|
||
|
|
return {
|
||
|
|
id: 'test_boss',
|
||
|
|
name: '测试Boss',
|
||
|
|
baseStats: {
|
||
|
|
health: 200,
|
||
|
|
attack: 15,
|
||
|
|
defense: 10,
|
||
|
|
strength: 15,
|
||
|
|
agility: 10,
|
||
|
|
dexterity: 10,
|
||
|
|
intuition: 8,
|
||
|
|
vitality: 15
|
||
|
|
},
|
||
|
|
expReward: 100,
|
||
|
|
drops: [
|
||
|
|
{
|
||
|
|
itemId: 'epic_sword',
|
||
|
|
chance: 1.0,
|
||
|
|
count: 1
|
||
|
|
}
|
||
|
|
],
|
||
|
|
...overrides
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 创建弱小敌人
|
||
|
|
* @returns {Object} 弱小敌人
|
||
|
|
*/
|
||
|
|
export function createWeakEnemy() {
|
||
|
|
return createMockEnemy({
|
||
|
|
id: 'rat',
|
||
|
|
name: '老鼠',
|
||
|
|
baseStats: {
|
||
|
|
health: 20,
|
||
|
|
attack: 3,
|
||
|
|
defense: 1,
|
||
|
|
strength: 3,
|
||
|
|
agility: 8,
|
||
|
|
dexterity: 4,
|
||
|
|
intuition: 2,
|
||
|
|
vitality: 3
|
||
|
|
},
|
||
|
|
expReward: 5
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 创建强大敌人
|
||
|
|
* @returns {Object} 强大敌人
|
||
|
|
*/
|
||
|
|
export function createStrongEnemy() {
|
||
|
|
return createMockEnemy({
|
||
|
|
id: 'orc',
|
||
|
|
name: '兽人',
|
||
|
|
baseStats: {
|
||
|
|
health: 120,
|
||
|
|
attack: 18,
|
||
|
|
defense: 12,
|
||
|
|
strength: 18,
|
||
|
|
agility: 8,
|
||
|
|
dexterity: 10,
|
||
|
|
intuition: 6,
|
||
|
|
vitality: 16
|
||
|
|
},
|
||
|
|
expReward: 60
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 创建敏捷型敌人
|
||
|
|
* @returns {Object} 敏捷型敌人
|
||
|
|
*/
|
||
|
|
export function createAgileEnemy() {
|
||
|
|
return createMockEnemy({
|
||
|
|
id: 'goblin',
|
||
|
|
name: '哥布林',
|
||
|
|
baseStats: {
|
||
|
|
health: 40,
|
||
|
|
attack: 6,
|
||
|
|
defense: 2,
|
||
|
|
strength: 6,
|
||
|
|
agility: 18,
|
||
|
|
dexterity: 14,
|
||
|
|
intuition: 6,
|
||
|
|
vitality: 6
|
||
|
|
},
|
||
|
|
expReward: 25
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 创建防御型敌人
|
||
|
|
* @returns {Object} 防御型敌人
|
||
|
|
*/
|
||
|
|
export function createTankEnemy() {
|
||
|
|
return createMockEnemy({
|
||
|
|
id: 'golem',
|
||
|
|
name: '石魔像',
|
||
|
|
baseStats: {
|
||
|
|
health: 150,
|
||
|
|
attack: 10,
|
||
|
|
defense: 20,
|
||
|
|
strength: 16,
|
||
|
|
agility: 4,
|
||
|
|
dexterity: 4,
|
||
|
|
intuition: 2,
|
||
|
|
vitality: 20
|
||
|
|
},
|
||
|
|
expReward: 50
|
||
|
|
})
|
||
|
|
}
|