Files
bl/logic/service/fight/effect/effect_147_159.go
昔念 0f524aab85 ```
fix(fight): 修复战斗命中判断逻辑并移除冗余命中检查

- 修复 NewSel32 中的命中判断,将 Side 字段改为 Hit 字段
- 移除 EffectAttackMiss 中的冗余命中判断逻辑
- 移除 EffectDefeatTrigger 中的重复命中检查
- 移除 EffectPhysicalAttackAddStatus 中的冗余命中判断
- 移除多个效果文件中的重复命中检查逻辑
- 修正 Effect136 中的命中处理逻辑,确保在技能命中时正确触发
- 移除其他多个效果中的重复命中检查代码
```
2026-01-04 21:41:10 +08:00

107 lines
2.9 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package effect
import (
"blazing/logic/service/fight/info"
"blazing/logic/service/fight/input"
"blazing/logic/service/fight/node"
)
// -----------------------------------------------------------
// 效果147后出手时{0}%概率使对方{1}
// -----------------------------------------------------------
type Effect147 struct {
node.EffectNode
can bool
}
func (e *Effect147) OnSkill() bool {
if e.Ctx().Our.FightC.IsFirst(e.Ctx().Our.Player) {
return true
}
chance := int(e.Args()[0].IntPart())
ok, _, _ := e.Input.Player.Roll(chance, 100)
if ok {
// 使对方进入指定状态Args[1]为状态类型)
statusType := int(e.Args()[1].IntPart())
statusEff := e.Ctx().Our.InitEffect(input.EffectType.Status, statusType)
if statusEff != nil {
statusEff.SetArgs(e.Ctx().Our, 2)
e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEff)
}
}
return true
}
// -----------------------------------------------------------
// 效果148后出手时{1}%改变对方{0}等级{2}
// -----------------------------------------------------------
type Effect148 struct {
node.EffectNode
can bool
}
func (e *Effect148) OnSkill() bool {
if e.Ctx().Our.FightC.IsFirst(e.Ctx().Our.Player) {
return true
}
propIndex := int(e.Args()[0].IntPart())
chance := int(e.Args()[1].IntPart())
changeAmount := int(e.Args()[2].IntPart())
ok, _, _ := e.Input.Player.Roll(chance, 100)
if ok {
opType := info.AbilityOpType.ADD
if changeAmount < 0 {
opType = info.AbilityOpType.SUB
}
e.Ctx().Opp.SetProp(e.Ctx().Our, int8(propIndex), int8(changeAmount), opType)
}
return true
}
// -----------------------------------------------------------
// 效果159自身体力小于最大值的1/{0}时,{1}%概率令对方{2}
// -----------------------------------------------------------
type Effect159 struct {
node.EffectNode
}
func (e *Effect159) OnSkill() bool {
// 检查自身体力是否小于最大值的1/{0}
maxHP := int64(e.Ctx().Our.CurrentPet.Info.MaxHp)
currentHP := int64(e.Ctx().Our.CurrentPet.Info.Hp)
// 比较 currentHP * {0} < maxHP
if currentHP*int64(e.Args()[0].IntPart()) < maxHP {
// 满足条件:{1}%概率令对方{2}
chance := int(e.Args()[1].IntPart())
ok, _, _ := e.Input.Player.Roll(chance, 100)
if ok {
statusType := int(e.Args()[2].IntPart())
statusEff := e.Ctx().Our.InitEffect(input.EffectType.Status, statusType)
if statusEff != nil {
statusEff.SetArgs(e.Ctx().Our, 2)
e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEff)
}
}
}
return true
}
// -----------------------------------------------------------
// 初始化
// -----------------------------------------------------------
func init() {
input.InitEffect(input.EffectType.Skill, 147, &Effect147{})
input.InitEffect(input.EffectType.Skill, 148, &Effect148{})
//input.InitEffect(input.EffectType.Skill, 154, &Effect154{})
input.InitEffect(input.EffectType.Skill, 159, &Effect159{})
}