Files
bl/logic/service/fight/effect/effect_71.go
昔念 004ce51c5e feat(fight): 调整效果叠加逻辑与精灵属性处理
- 将 `MaxStack` 方法重命名为 `CanStack`,并修改其逻辑为布尔值控制是否可叠加
- 更新多个效果文件中的注释和调用方式以适配新的叠加控制方法
- 修复精灵属性类型获取逻辑,增加缓存字段 `PType`
- 修改战斗回合处理流程,优化技能解析顺序和状态比较时机
- 调整状态效果初始化逻辑,确保状态类效果默认允许无限叠加
- 更正伤害类型缺失问题,在固定伤害
2025-11-14 06:14:49 +08:00

63 lines
1.2 KiB
Go

package effect
import (
"blazing/logic/service/fight/info"
"blazing/logic/service/fight/input"
"blazing/logic/service/fight/node"
"github.com/shopspring/decimal"
)
/**
* 自己牺牲(体力降到0), 使下一只出战精灵在前两回合内必定致命一击
*/
type Effect71 struct {
node.EffectNode
can bool
}
func init() {
input.InitEffect(input.EffectType.Skill, 59, &Effect71{})
}
func (e *Effect71) SetArgs(t *input.Input, a ...int) {
//e.CanStack(-1)//后续的不会顶掉这个效果
e.EffectNode.SetArgs(t, a...)
e.Duration(-1) //次数类,无限回合
}
// 命中之后
func (e *Effect71) OnSkill() bool {
if !e.Hit() {
return true
}
e.can = true
e.Ctx().Our.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Fixed,
Damage: decimal.NewFromInt(int64(e.Ctx().Our.CurrentPet.Info.MaxHp)),
})
return true
}
func (e *Effect71) Switch(in *input.Input, at info.AttackValue, oldpet *info.BattlePetEntity) bool {
// 1. 检查效果是否生效(当次攻击有效)
if !e.can {
return true
}
if in != e.Ctx().Our {
return true
}
t := input.Geteffect(input.EffectType.Skill, 58)
if t != nil {
e.SetArgs(e.Ctx().Our, 2)
e.Ctx().Our.AddEffect(e.Ctx().Our, e)
}
e.Alive(false)
return true
}