Files

285 lines
6.4 KiB
JavaScript
Raw Permalink Normal View History

/**
* 敌人配置
* Phase 4 数值调整 - 战斗数值平衡
*/
// 敌人配置
export const ENEMY_CONFIG = {
// ===== Lv.1 敌人 =====
wild_dog: {
id: 'wild_dog',
name: '野狗',
level: 1,
baseStats: {
health: 35,
attack: 8,
defense: 2,
strength: 8, // 力量,影响攻击
agility: 6, // 敏捷影响闪避降低EP提高玩家命中率
dexterity: 7, // 灵巧,影响命中
intuition: 3, // 智力影响AP/EP
vitality: 8, // 体质
speed: 1.2
},
derivedStats: {
ap: 8,
ep: 6 // 降低EP值使玩家更容易命中
},
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,
strength: 5,
agility: 10, // 高敏捷,难命中
dexterity: 6,
intuition: 2,
vitality: 5,
speed: 1.5
},
derivedStats: {
ap: 6,
ep: 11 // 高闪避,符合老鼠特性
},
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,
strength: 14,
agility: 10,
dexterity: 12,
intuition: 6,
vitality: 12,
speed: 1.3
},
derivedStats: {
ap: 14,
ep: 11
},
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,
strength: 16,
agility: 9,
dexterity: 14,
intuition: 8,
vitality: 15,
speed: 1.0
},
derivedStats: {
ap: 16,
ep: 10
},
expReward: 50,
skillExpReward: 25,
drops: [
{ itemId: 'copper_coin', chance: 0.8, count: { min: 3, max: 8 } },
{ itemId: 'bread', chance: 0.3, count: { min: 1, max: 2 } }
]
},
// ===== Lv.5 Boss =====
test_boss: {
id: 'test_boss',
name: '流浪狗王',
level: 5,
baseStats: {
health: 250,
attack: 30,
defense: 15,
strength: 25,
agility: 14,
dexterity: 20,
intuition: 12,
vitality: 25,
speed: 1.1
},
derivedStats: {
ap: 30,
ep: 16
},
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 } },
{ itemId: 'steel_arm_prosthetic', chance: 0.3, count: { min: 1, max: 1 }, fixedQuality: true } // 义体掉落
],
isBoss: true
},
// ===== Lv.7 敌人 =====
cave_bat: {
id: 'cave_bat',
name: '洞穴蝙蝠',
level: 7,
baseStats: {
health: 40,
attack: 25,
defense: 3,
strength: 20,
agility: 16, // 高闪避
dexterity: 18,
intuition: 6,
vitality: 8,
speed: 1.8
},
derivedStats: {
ap: 22,
ep: 18 // 高闪避,但不是不可能命中
},
expReward: 70,
skillExpReward: 35,
drops: [
{ 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,
strength: 45,
agility: 18,
dexterity: 35,
intuition: 20,
vitality: 50,
speed: 0.9
},
derivedStats: {
ap: 50,
ep: 22
},
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 } },
{ itemId: 'optical_eye_prosthetic', chance: 0.4, count: { min: 1, max: 1 }, fixedQuality: true },
{ itemId: 'dermal_armor_prosthetic', chance: 0.3, count: { min: 1, max: 1 }, fixedQuality: true }
],
isBoss: true
}
}
/**
* 根据区域获取可用的敌人列表
* @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)
}