fix(fight): 修复技能命中和伤害计算逻辑错误

- 修正 `Effect7` 中敌我双方血量判断逻辑,确保技能命中率和伤害值正确计算
- 调整 `FightC` 中技能攻击流程,统一使用 `Exec` 替代 `ExecCace` 执行效果
- 移除重复的 `AddEffects` 方法,简化效果添加逻辑
- 注释暂未使用的逻辑,避免无效调用影响战斗流程
- 增加战斗超时保护机制,防止协程泄漏
- 优化玩家离线保存逻辑
This commit is contained in:
2025-11-12 21:44:56 +08:00
parent 0b5cfac0b2
commit 0d61134dd8
6 changed files with 31 additions and 41 deletions

View File

@@ -124,16 +124,7 @@ func equalInts(a, b []int) bool {
}
return true
}
func (our *Input) AddEffects(e ...Effect) {
for _, v := range e {
// v.Alive()
our.AddEffect(v)
}
}
func (our *Input) AddEffect(e Effect) {
e.Alive(true) //添加后默认激活
//todo 免疫
@@ -198,22 +189,6 @@ func (our *Input) Exec(fn func(Effect) bool) bool {
return result
}
func (our *Input) ExecCace(fn func(Effect) bool) bool {
result := true
for _, value := range our.EffectCache {
if value.Alive() {
value.Ctx().Our = our
value.Ctx().Opp = our.Opp
value.Ctx().DamageZone = &info.DamageZone{}
if !fn(value) { //存在false,但是仍然要向下执行
result = false //如果是false,说明存在阻止向下执行的effect比如免疫能力提升效果
}
}
}
return result
}
// 消除回合类效果 efftype 输入是消对方的还是自己的,false是自己,true是对方
func (our *Input) CancelTurn() {

View File

@@ -180,10 +180,10 @@ func (our *Input) Parseskill(defender *Input, skill *action.SelectSkillAction) {
// defender.AddEffect(t)
// } else {
//t.SetArgs(i, temparg[:args]...) //设置入参
//i.AddEffect(t)
our.AddEffect(t)
// }
//这里是临时缓存buff,后面确认命中后修改HIT状态
t.Alive() //先让效果保持存活
// t.Alive() //先让效果保持存活
our.EffectCache = append(our.EffectCache, t)
// i.NewEffects = append(i.NewEffects, t)
}