feat: 优化游戏体验和系统平衡性
- 修复商店物品名称显示问题,添加堆叠物品出售数量选择 - 自动战斗状态持久化,战斗结束显示"寻找中"状态 - 战斗日志显示经验获取详情(战斗经验、武器经验) - 技能进度条显示当前/最大经验值 - 阅读自动解锁技能并持续获得阅读经验,背包可直接阅读 - 优化训练平衡:时长60秒,经验5点/秒,耐力消耗降低 - 实现自然回复系统:基于体质回复HP/耐力,休息提供3倍加成 - 战斗和训练时不进行自然回复 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -312,6 +312,9 @@ function processReadingTask(gameStore, playerStore, task, elapsedSeconds) {
|
||||
|
||||
const readingTime = bookConfig.readingTime || 60
|
||||
|
||||
// 首次阅读时解锁阅读技能
|
||||
unlockSkill(playerStore, 'reading')
|
||||
|
||||
// 检查环境惩罚
|
||||
const location = playerStore.currentLocation
|
||||
let timeMultiplier = 1.0
|
||||
@@ -322,9 +325,26 @@ function processReadingTask(gameStore, playerStore, task, elapsedSeconds) {
|
||||
timeMultiplier = 0.5 + (darkPenaltyReduce / 100) * 0.5
|
||||
}
|
||||
|
||||
// 阅读技能速度加成
|
||||
const readingSkillLevel = playerStore.skills.reading?.level || 0
|
||||
const readingSpeedBonus = playerStore.globalBonus?.readingSpeed || 1
|
||||
timeMultiplier *= readingSpeedBonus
|
||||
|
||||
// 计算有效进度
|
||||
const effectiveProgress = task.progress * timeMultiplier
|
||||
|
||||
// 给予阅读技能经验(每秒给予经验)
|
||||
const readingExpPerSecond = 1
|
||||
const readingExpGain = readingExpPerSecond * elapsedSeconds * timeMultiplier
|
||||
const readingResult = addSkillExp(playerStore, 'reading', readingExpGain)
|
||||
|
||||
// 检查技能是否升级
|
||||
if (readingResult.leveledUp) {
|
||||
if (gameStore.addLog) {
|
||||
gameStore.addLog(`阅读技能升级到了 Lv.${readingResult.newLevel}!`, 'reward')
|
||||
}
|
||||
}
|
||||
|
||||
if (effectiveProgress >= readingTime) {
|
||||
// 阅读完成
|
||||
const rewards = {}
|
||||
@@ -343,13 +363,13 @@ function processReadingTask(gameStore, playerStore, task, elapsedSeconds) {
|
||||
|
||||
// 添加日志
|
||||
if (gameStore.addLog) {
|
||||
gameStore.addLog(`读完了《${bookConfig.name}》`, 'reward')
|
||||
gameStore.addLog(`读完了《${bookConfig.name}》,阅读经验+${Math.floor(readingExpGain * task.progress / readingTime)}`, 'reward')
|
||||
}
|
||||
|
||||
return { completed: true, rewards }
|
||||
}
|
||||
|
||||
// 阅读进行中,给予少量经验
|
||||
// 阅读进行中,给予其他技能经验
|
||||
if (bookConfig.expReward) {
|
||||
for (const [skillId, expPerSecond] of Object.entries(bookConfig.expReward)) {
|
||||
const expPerTick = (expPerSecond / readingTime) * elapsedSeconds * timeMultiplier
|
||||
@@ -412,8 +432,8 @@ function processTrainingTask(gameStore, playerStore, task, elapsedSeconds) {
|
||||
return { completed: true, error: '技能不存在' }
|
||||
}
|
||||
|
||||
// 消耗耐力
|
||||
const staminaCost = 2 * elapsedSeconds
|
||||
// 消耗耐力(降低消耗)
|
||||
const staminaCost = 1 * elapsedSeconds
|
||||
if (playerStore.currentStats.stamina < staminaCost) {
|
||||
// 耐力不足,任务结束
|
||||
return { completed: true, rewards: {} }
|
||||
@@ -421,8 +441,8 @@ function processTrainingTask(gameStore, playerStore, task, elapsedSeconds) {
|
||||
|
||||
playerStore.currentStats.stamina -= staminaCost
|
||||
|
||||
// 给予技能经验
|
||||
const expPerSecond = 1
|
||||
// 给予技能经验(提升获取速度)
|
||||
const expPerSecond = 5 // 从1提升到5
|
||||
const expGain = expPerSecond * elapsedSeconds
|
||||
|
||||
if (!task.accumulatedExp) {
|
||||
@@ -433,6 +453,12 @@ function processTrainingTask(gameStore, playerStore, task, elapsedSeconds) {
|
||||
}
|
||||
task.accumulatedExp[skillId] += expGain
|
||||
|
||||
// 检查技能是否升级
|
||||
const result = addSkillExp(playerStore, skillId, expGain)
|
||||
if (result.leveledUp && gameStore.addLog) {
|
||||
gameStore.addLog(`${skillConfig.name}升级到了 Lv.${result.newLevel}!`, 'reward')
|
||||
}
|
||||
|
||||
// 检查是否完成
|
||||
if (task.data.duration && task.progress >= task.data.duration) {
|
||||
const rewards = { [skillId]: task.accumulatedExp[skillId] || 0 }
|
||||
|
||||
Reference in New Issue
Block a user