feat: 实现游戏核心系统和UI组件
核心系统: - combatSystem: 战斗逻辑、伤害计算、战斗状态管理 - skillSystem: 技能系统、技能解锁、经验值、里程碑 - taskSystem: 任务系统、任务类型、任务执行和完成 - eventSystem: 事件系统、随机事件处理 - environmentSystem: 环境系统、时间流逝、区域效果 - levelingSystem: 升级系统、属性成长 - soundSystem: 音效系统 配置文件: - enemies: 敌人配置、掉落表 - events: 事件配置、事件效果 - items: 物品配置、装备属性 - locations: 地点配置、探索事件 - skills: 技能配置、技能树 UI组件: - CraftingDrawer: 制造界面 - InventoryDrawer: 背包界面 - 其他UI优化和动画 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,45 +1,246 @@
|
||||
/**
|
||||
* 敌人配置
|
||||
* Phase 4 数值调整 - 战斗数值平衡
|
||||
*/
|
||||
|
||||
// 敌人配置
|
||||
export const ENEMY_CONFIG = {
|
||||
// ===== Lv.1 敌人 =====
|
||||
wild_dog: {
|
||||
id: 'wild_dog',
|
||||
name: '野狗',
|
||||
level: 1,
|
||||
baseStats: {
|
||||
health: 30,
|
||||
health: 35,
|
||||
attack: 8,
|
||||
defense: 2,
|
||||
speed: 1.0
|
||||
speed: 1.2
|
||||
},
|
||||
derivedStats: {
|
||||
ap: 10, // 攻击点数
|
||||
ep: 8 // 闪避点数
|
||||
ap: 8,
|
||||
ep: 10
|
||||
},
|
||||
expReward: 15,
|
||||
skillExpReward: 10,
|
||||
expReward: 20,
|
||||
skillExpReward: 12,
|
||||
drops: [
|
||||
{ itemId: 'dog_skin', chance: 0.8, count: { min: 1, max: 1 } }
|
||||
{ itemId: 'dog_skin', chance: 0.7, count: { min: 1, max: 1 } },
|
||||
{ itemId: 'healing_herb', chance: 0.15, count: { min: 1, max: 2 } }
|
||||
]
|
||||
},
|
||||
|
||||
test_boss: {
|
||||
id: 'test_boss',
|
||||
name: '测试Boss',
|
||||
level: 5,
|
||||
rat: {
|
||||
id: 'rat',
|
||||
name: '老鼠',
|
||||
level: 1,
|
||||
baseStats: {
|
||||
health: 200,
|
||||
attack: 25,
|
||||
defense: 10,
|
||||
speed: 0.8
|
||||
health: 20,
|
||||
attack: 5,
|
||||
defense: 1,
|
||||
speed: 1.5
|
||||
},
|
||||
derivedStats: {
|
||||
ap: 25,
|
||||
ep: 15
|
||||
ap: 6,
|
||||
ep: 12
|
||||
},
|
||||
expReward: 150,
|
||||
skillExpReward: 50,
|
||||
expReward: 10,
|
||||
skillExpReward: 6,
|
||||
drops: [
|
||||
{ itemId: 'basement_key', chance: 1.0, count: { min: 1, max: 1 } }
|
||||
{ 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,
|
||||
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,
|
||||
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,
|
||||
attack: 25,
|
||||
defense: 3,
|
||||
speed: 1.8
|
||||
},
|
||||
derivedStats: {
|
||||
ap: 22,
|
||||
ep: 24
|
||||
},
|
||||
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,
|
||||
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 } }
|
||||
],
|
||||
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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user