feat(fight): 完善战斗效果714-718的参数验证和功能实现

- 为Effect714添加armed状态重置逻辑,并增加参数长度验证
- 修复Effect716的子效果创建逻辑,改为通过InitEffect方法创建
- 为Effect717和Effect718添加参数长度验证,防止索引越界
- 重构Effect718的技能命中处理逻辑,统一效果
This commit is contained in:
昔念
2026-03-31 10:03:07 +08:00
parent 3bf07dd5c5
commit 4d39164c86

View File

@@ -17,7 +17,8 @@ type Effect714 struct {
}
func (e *Effect714) ComparePre(fattack, sattack *action.SelectSkillAction) bool {
if !e.Ctx().Opp.HasPropADD() {
e.armed = false
if len(e.Args()) == 0 || !e.Ctx().Opp.HasPropADD() {
return true
}
@@ -35,6 +36,7 @@ func (e *Effect714) OnSkill() bool {
if !e.armed {
return true
}
e.armed = false
for i, v := range e.Ctx().Opp.Prop[:] {
if v > 0 {
e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), 0)
@@ -95,7 +97,14 @@ type Effect716 struct {
}
func (e *Effect716) OnSkill() bool {
addSubEffect(e.Ctx().Our, e.Ctx().Opp, &e.EffectNode, &Effect716Sub{}, -1)
if len(e.Args()) < 2 {
return true
}
effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 716, int(e.Args()[0].IntPart()), int(e.Args()[1].IntPart()))
if effect != nil {
e.Ctx().Opp.AddEffect(e.Ctx().Our, effect)
}
return true
}
@@ -119,7 +128,7 @@ type Effect717 struct {
}
func (e *Effect717) Skill_Use() bool {
if e.Ctx().SkillEntity == nil {
if len(e.Args()) < 3 || e.Ctx().SkillEntity == nil {
return true
}
drain := e.Ctx().Opp.CurrentPet.GetMaxHP().Div(e.Args()[1])
@@ -149,11 +158,18 @@ type Effect718 struct {
}
func (e *Effect718) SkillHit_ex() bool {
if len(e.Args()) < 2 {
return true
}
skill := e.Ctx().SkillEntity
if skill == nil || skill.Category() != info.Category.STATUS {
return true
}
addSubEffect(e.Ctx().Our, e.Ctx().Our, &e.EffectNode, &Effect718Sub{}, -1)
effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 718, int(e.Args()[0].IntPart()), int(e.Args()[1].IntPart()))
if effect != nil {
e.Ctx().Our.AddEffect(e.Ctx().Our, effect)
}
return true
}
@@ -177,6 +193,8 @@ func init() {
input.InitEffect(input.EffectType.Skill, 715, &Effect715{})
input.InitEffect(input.EffectType.Sub, 715, &Effect715Sub{})
input.InitEffect(input.EffectType.Skill, 716, &Effect716{})
input.InitEffect(input.EffectType.Sub, 716, &Effect716Sub{})
input.InitEffect(input.EffectType.Skill, 717, &Effect717{})
input.InitEffect(input.EffectType.Skill, 718, &Effect718{})
input.InitEffect(input.EffectType.Sub, 718, &Effect718Sub{})
}