2026-01-23 16:20:10 +08:00
|
|
|
/**
|
|
|
|
|
* 敌人配置
|
|
|
|
|
* Phase 4 数值调整 - 战斗数值平衡
|
|
|
|
|
*/
|
|
|
|
|
|
2026-01-21 17:13:51 +08:00
|
|
|
// 敌人配置
|
|
|
|
|
export const ENEMY_CONFIG = {
|
2026-01-23 16:20:10 +08:00
|
|
|
// ===== Lv.1 敌人 =====
|
2026-01-21 17:13:51 +08:00
|
|
|
wild_dog: {
|
|
|
|
|
id: 'wild_dog',
|
|
|
|
|
name: '野狗',
|
|
|
|
|
level: 1,
|
|
|
|
|
baseStats: {
|
2026-01-23 16:20:10 +08:00
|
|
|
health: 35,
|
2026-01-21 17:13:51 +08:00
|
|
|
attack: 8,
|
|
|
|
|
defense: 2,
|
2026-01-23 16:20:10 +08:00
|
|
|
speed: 1.2
|
|
|
|
|
},
|
|
|
|
|
derivedStats: {
|
|
|
|
|
ap: 8,
|
|
|
|
|
ep: 10
|
|
|
|
|
},
|
|
|
|
|
expReward: 20,
|
|
|
|
|
skillExpReward: 12,
|
|
|
|
|
drops: [
|
|
|
|
|
{ itemId: 'dog_skin', chance: 0.7, count: { min: 1, max: 1 } },
|
|
|
|
|
{ itemId: 'healing_herb', chance: 0.15, count: { min: 1, max: 2 } }
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
rat: {
|
|
|
|
|
id: 'rat',
|
|
|
|
|
name: '老鼠',
|
|
|
|
|
level: 1,
|
|
|
|
|
baseStats: {
|
|
|
|
|
health: 20,
|
|
|
|
|
attack: 5,
|
|
|
|
|
defense: 1,
|
|
|
|
|
speed: 1.5
|
|
|
|
|
},
|
|
|
|
|
derivedStats: {
|
|
|
|
|
ap: 6,
|
|
|
|
|
ep: 12
|
|
|
|
|
},
|
|
|
|
|
expReward: 10,
|
|
|
|
|
skillExpReward: 6,
|
|
|
|
|
drops: [
|
|
|
|
|
{ itemId: 'healing_herb', chance: 0.2, count: { min: 1, max: 1 } }
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
// ===== Lv.3 敌人 =====
|
|
|
|
|
wolf: {
|
|
|
|
|
id: 'wolf',
|
|
|
|
|
name: '灰狼',
|
|
|
|
|
level: 3,
|
|
|
|
|
baseStats: {
|
|
|
|
|
health: 50,
|
|
|
|
|
attack: 15,
|
|
|
|
|
defense: 5,
|
|
|
|
|
speed: 1.3
|
|
|
|
|
},
|
|
|
|
|
derivedStats: {
|
|
|
|
|
ap: 14,
|
|
|
|
|
ep: 13
|
|
|
|
|
},
|
|
|
|
|
expReward: 40,
|
|
|
|
|
skillExpReward: 20,
|
|
|
|
|
drops: [
|
|
|
|
|
{ itemId: 'wolf_fang', chance: 0.6, count: { min: 1, max: 2 } },
|
|
|
|
|
{ itemId: 'dog_skin', chance: 0.3, count: { min: 1, max: 1 } }
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
bandit: {
|
|
|
|
|
id: 'bandit',
|
|
|
|
|
name: '流浪者',
|
|
|
|
|
level: 3,
|
|
|
|
|
baseStats: {
|
|
|
|
|
health: 60,
|
|
|
|
|
attack: 18,
|
|
|
|
|
defense: 8,
|
2026-01-21 17:13:51 +08:00
|
|
|
speed: 1.0
|
|
|
|
|
},
|
|
|
|
|
derivedStats: {
|
2026-01-23 16:20:10 +08:00
|
|
|
ap: 16,
|
|
|
|
|
ep: 10
|
2026-01-21 17:13:51 +08:00
|
|
|
},
|
2026-01-23 16:20:10 +08:00
|
|
|
expReward: 50,
|
|
|
|
|
skillExpReward: 25,
|
2026-01-21 17:13:51 +08:00
|
|
|
drops: [
|
2026-01-23 16:20:10 +08:00
|
|
|
{ itemId: 'copper_coin', chance: 0.8, count: { min: 3, max: 8 } },
|
|
|
|
|
{ itemId: 'bread', chance: 0.3, count: { min: 1, max: 2 } }
|
2026-01-21 17:13:51 +08:00
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
|
2026-01-23 16:20:10 +08:00
|
|
|
// ===== Lv.5 Boss =====
|
2026-01-21 17:13:51 +08:00
|
|
|
test_boss: {
|
|
|
|
|
id: 'test_boss',
|
2026-01-23 16:20:10 +08:00
|
|
|
name: '流浪狗王',
|
2026-01-21 17:13:51 +08:00
|
|
|
level: 5,
|
|
|
|
|
baseStats: {
|
2026-01-23 16:20:10 +08:00
|
|
|
health: 250,
|
|
|
|
|
attack: 30,
|
|
|
|
|
defense: 15,
|
|
|
|
|
speed: 1.1
|
|
|
|
|
},
|
|
|
|
|
derivedStats: {
|
|
|
|
|
ap: 30,
|
|
|
|
|
ep: 18
|
|
|
|
|
},
|
|
|
|
|
expReward: 200,
|
|
|
|
|
skillExpReward: 80,
|
|
|
|
|
drops: [
|
|
|
|
|
{ itemId: 'basement_key', chance: 1.0, count: { min: 1, max: 1 } },
|
|
|
|
|
{ itemId: 'dog_skin', chance: 0.5, count: { min: 2, max: 4 } }
|
|
|
|
|
],
|
|
|
|
|
isBoss: true
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
// ===== Lv.7 敌人 =====
|
|
|
|
|
cave_bat: {
|
|
|
|
|
id: 'cave_bat',
|
|
|
|
|
name: '洞穴蝙蝠',
|
|
|
|
|
level: 7,
|
|
|
|
|
baseStats: {
|
|
|
|
|
health: 40,
|
2026-01-21 17:13:51 +08:00
|
|
|
attack: 25,
|
2026-01-23 16:20:10 +08:00
|
|
|
defense: 3,
|
|
|
|
|
speed: 1.8
|
2026-01-21 17:13:51 +08:00
|
|
|
},
|
|
|
|
|
derivedStats: {
|
2026-01-23 16:20:10 +08:00
|
|
|
ap: 22,
|
|
|
|
|
ep: 24
|
2026-01-21 17:13:51 +08:00
|
|
|
},
|
2026-01-23 16:20:10 +08:00
|
|
|
expReward: 70,
|
|
|
|
|
skillExpReward: 35,
|
2026-01-21 17:13:51 +08:00
|
|
|
drops: [
|
2026-01-23 16:20:10 +08:00
|
|
|
{ itemId: 'bat_wing', chance: 0.5, count: { min: 1, max: 2 } }
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
// ===== Lv.10 Boss =====
|
|
|
|
|
cave_boss: {
|
|
|
|
|
id: 'cave_boss',
|
|
|
|
|
name: '洞穴领主',
|
|
|
|
|
level: 10,
|
|
|
|
|
baseStats: {
|
|
|
|
|
health: 500,
|
|
|
|
|
attack: 50,
|
|
|
|
|
defense: 25,
|
|
|
|
|
speed: 0.9
|
|
|
|
|
},
|
|
|
|
|
derivedStats: {
|
|
|
|
|
ap: 50,
|
|
|
|
|
ep: 25
|
|
|
|
|
},
|
|
|
|
|
expReward: 500,
|
|
|
|
|
skillExpReward: 200,
|
|
|
|
|
drops: [
|
|
|
|
|
{ itemId: 'rare_gem', chance: 0.8, count: { min: 1, max: 1 } },
|
|
|
|
|
{ itemId: 'iron_sword', chance: 0.3, count: { min: 1, max: 1 } }
|
2026-01-21 17:13:51 +08:00
|
|
|
],
|
|
|
|
|
isBoss: true
|
|
|
|
|
}
|
|
|
|
|
}
|
2026-01-23 16:20:10 +08:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 根据区域获取可用的敌人列表
|
|
|
|
|
* @param {String} locationId - 位置ID
|
|
|
|
|
* @returns {Array} 敌人ID列表
|
|
|
|
|
*/
|
|
|
|
|
export function getEnemiesForLocation(locationId) {
|
|
|
|
|
const locationEnemies = {
|
|
|
|
|
'wild1': ['wild_dog', 'rat'],
|
|
|
|
|
'wild2': ['wolf', 'bandit'],
|
|
|
|
|
'wild3': ['cave_bat', 'wolf'],
|
|
|
|
|
'boss_lair': ['test_boss'],
|
|
|
|
|
'cave_depth': ['cave_bat', 'cave_boss']
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return locationEnemies[locationId] || []
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取位置的敌人完整配置
|
|
|
|
|
* @param {String} locationId - 位置ID
|
|
|
|
|
* @returns {Array} 敌人配置对象列表
|
|
|
|
|
*/
|
|
|
|
|
export function getEnemyConfigsForLocation(locationId) {
|
|
|
|
|
const enemyIds = getEnemiesForLocation(locationId)
|
|
|
|
|
return enemyIds.map(id => ENEMY_CONFIG[id]).filter(Boolean)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 根据等级获取推荐的敌人
|
|
|
|
|
* @param {Number} playerLevel - 玩家等级
|
|
|
|
|
* @returns {Array} 敌人ID列表
|
|
|
|
|
*/
|
|
|
|
|
export function getRecommendedEnemies(playerLevel) {
|
|
|
|
|
const enemies = []
|
|
|
|
|
|
|
|
|
|
for (const [id, enemy] of Object.entries(ENEMY_CONFIG)) {
|
|
|
|
|
const levelDiff = Math.abs(enemy.level - playerLevel)
|
|
|
|
|
// 推荐等级差在3以内的敌人
|
|
|
|
|
if (levelDiff <= 3 && !enemy.isBoss) {
|
|
|
|
|
enemies.push({ id, levelDiff, enemy })
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 按等级差排序
|
|
|
|
|
enemies.sort((a, b) => a.levelDiff - b.levelDiff)
|
|
|
|
|
return enemies.map(e => e.id)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 随机获取位置的一个敌人
|
|
|
|
|
* @param {String} locationId - 位置ID
|
|
|
|
|
* @returns {Object|null} 敌人配置
|
|
|
|
|
*/
|
|
|
|
|
export function getRandomEnemyForLocation(locationId) {
|
|
|
|
|
const enemyIds = getEnemiesForLocation(locationId)
|
|
|
|
|
if (enemyIds.length === 0) return null
|
|
|
|
|
|
|
|
|
|
const randomIndex = Math.floor(Math.random() * enemyIds.length)
|
|
|
|
|
const enemyId = enemyIds[randomIndex]
|
|
|
|
|
return ENEMY_CONFIG[enemyId] || null
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取所有敌人列表
|
|
|
|
|
* @returns {Array} 所有敌人ID
|
|
|
|
|
*/
|
|
|
|
|
export function getAllEnemyIds() {
|
|
|
|
|
return Object.keys(ENEMY_CONFIG)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取Boss列表
|
|
|
|
|
* @returns {Array} Boss敌人ID
|
|
|
|
|
*/
|
|
|
|
|
export function getBossIds() {
|
|
|
|
|
return Object.entries(ENEMY_CONFIG)
|
|
|
|
|
.filter(([_, config]) => config.isBoss)
|
|
|
|
|
.map(([id, _]) => id)
|
|
|
|
|
}
|