- 修正 `Effect7` 中敌我双方血量判断逻辑,确保技能命中率和伤害值正确计算 - 调整 `FightC` 中技能攻击流程,统一使用 `Exec` 替代 `ExecCace` 执行效果 - 移除重复的 `AddEffects` 方法,简化效果添加逻辑 - 注释暂未使用的逻辑,避免无效调用影响战斗流程 - 增加战斗超时保护机制,防止协程泄漏 - 优化玩家离线保存逻辑
46 lines
982 B
Go
46 lines
982 B
Go
package effect
|
|
|
|
import (
|
|
"blazing/logic/service/fight/info"
|
|
"blazing/logic/service/fight/input"
|
|
"blazing/logic/service/fight/node"
|
|
"fmt"
|
|
|
|
"github.com/shopspring/decimal"
|
|
)
|
|
|
|
/**
|
|
* 对方体力高于自己时才能命中,将对方体力减到和自己相同
|
|
*/
|
|
|
|
func init() {
|
|
input.InitEffect(input.EffectType.Skill, 7, &Effect7{
|
|
EffectNode: node.EffectNode{},
|
|
})
|
|
|
|
}
|
|
|
|
type Effect7 struct {
|
|
node.EffectNode
|
|
}
|
|
|
|
func (e *Effect7) Skill_Hit_Pre() bool {
|
|
if e.Ctx().Opp.CurrentPet.Info.Hp <= e.Ctx().Our.CurrentPet.Info.Hp {
|
|
e.Ctx().SkillEntity.Accuracy = 0
|
|
}
|
|
|
|
return true
|
|
}
|
|
func (e *Effect7) Damage_Floor() bool {
|
|
if !e.Hit() {
|
|
return true
|
|
}
|
|
fmt.Println("Effect7_old", e.Ctx().DamageZone.Damage.IntPart())
|
|
if e.Ctx().DamageZone.Type == info.DamageType.Red {
|
|
e.Ctx().DamageZone.Damage = decimal.NewFromInt(int64(e.Ctx().Opp.CurrentPet.Info.Hp - e.Ctx().Our.CurrentPet.Info.Hp))
|
|
|
|
}
|
|
fmt.Println("Effect7_new", e.Ctx().DamageZone.Damage.IntPart())
|
|
return true
|
|
}
|