diff --git a/docs/effect-unimplemented-tasks/task-021-effects-714-718.md b/docs/effect-unimplemented-tasks/task-021-effects-714-718.md deleted file mode 100644 index 0fd31f49e..000000000 --- a/docs/effect-unimplemented-tasks/task-021-effects-714-718.md +++ /dev/null @@ -1,35 +0,0 @@ -# Task 021: Effects 714-718 - -## 目标 - -- 补齐以下 5 个(或最后一组不足 5 个)当前判定未实现的 skill effect。 -- 实现位置优先放在 `logic/service/fight/effect/`。 -- 如 effect 需要展示说明,同步更新 `logic/service/fight/effect/effect_info_map.go`。 -- 完成后至少执行:`cd /workspace/logic && go test ./service/fight/effect`。 - -## Effect 列表 - -### Effect 714 -- `argsNum`: `1` -- `info`: `使用技能时若对手处于能力提升状态,则先制+{0},同时消除对手能力提升状态` - -### Effect 715 -- `argsNum`: `2` -- `info`: `若下回合受到攻击,则对手随机{0}项能力值-{1}` - -### Effect 716 -- `argsNum`: `2` -- `info`: `{0}回合内对手使用攻击技能,则使对手随机{1}个技能的PP值归零` - -### Effect 717 -- `argsNum`: `3` -- `info`: `{0}回合内每回合使用技能吸取对手最大体力的1/{1},恢复体力时若自身体力低于最大体力的1/{2}则恢复效果翻倍` - -### Effect 718 -- `argsNum`: `2` -- `info`: `{0}回合内对手使用属性技能,则自身下{1}回合必定暴击` - -## 备注 - -- 该清单按当前仓库静态注册结果生成;如果某个 effect 实际通过其他模块或运行时路径实现,需要先复核后再落代码。 -- 对 `201`、`445` 这类占位 effect,优先补核心逻辑或补充明确的不可实现说明。 diff --git a/docs/effect-unimplemented-tasks/task-022-effects-719-723.md b/docs/effect-unimplemented-tasks/task-022-effects-719-723.md deleted file mode 100644 index c078d112d..000000000 --- a/docs/effect-unimplemented-tasks/task-022-effects-719-723.md +++ /dev/null @@ -1,36 +0,0 @@ -# Task 022: Effects 719-723 - -## 目标 - -- 补齐以下 5 个(或最后一组不足 5 个)当前判定未实现的 skill effect。 -- 实现位置优先放在 `logic/service/fight/effect/`。 -- 如 effect 需要展示说明,同步更新 `logic/service/fight/effect/effect_info_map.go`。 -- 完成后至少执行:`cd /workspace/logic && go test ./service/fight/effect`。 - -## Effect 列表 - -### Effect 719 -- `argsNum`: `2` -- `info`: `未击败对手则{0}%令对手{1}` -- `param`: `1,1,1` - -### Effect 720 -- `argsNum`: `0` -- `info`: `若先出手则当回合闪避对手的攻击技能` - -### Effect 721 -- `argsNum`: `1` -- `info`: `后出手时使对手下{0}回合攻击技能MISS` - -### Effect 722 -- `argsNum`: `0` -- `info`: `将自身相应的能力提升赋予给对手相应的能力下降` - -### Effect 723 -- `argsNum`: `2` -- `info`: `后出手时令对手下{0}回合先制-{1}` - -## 备注 - -- 该清单按当前仓库静态注册结果生成;如果某个 effect 实际通过其他模块或运行时路径实现,需要先复核后再落代码。 -- 对 `201`、`445` 这类占位 effect,优先补核心逻辑或补充明确的不可实现说明。 diff --git a/docs/effect-unimplemented-tasks/task-024-effects-729-733.md b/docs/effect-unimplemented-tasks/task-024-effects-729-733.md deleted file mode 100644 index a61c21afd..000000000 --- a/docs/effect-unimplemented-tasks/task-024-effects-729-733.md +++ /dev/null @@ -1,39 +0,0 @@ -# Task 024: Effects 729-733 - -## 目标 - -- 补齐以下 5 个(或最后一组不足 5 个)当前判定未实现的 skill effect。 -- 实现位置优先放在 `logic/service/fight/effect/`。 -- 如 effect 需要展示说明,同步更新 `logic/service/fight/effect/effect_info_map.go`。 -- 完成后至少执行:`cd /workspace/logic && go test ./service/fight/effect`。 - -## Effect 列表 - -### Effect 729 -- `argsNum`: `4` -- `info`: `{0}回合内若造成伤害大于{1}则{2}%概率使对手{3}` -- `param`: `1,3,3` - -### Effect 730 -- `argsNum`: `7` -- `info`: `下回合起,{0}回合内每回合{1}` -- `param`: `0,1,0` - -### Effect 731 -- `argsNum`: `1` -- `info`: `本回合打出致命一击则下{0}回合其它攻击技能必定致命一击` - -### Effect 732 -- `argsNum`: `6` -- `info`: `本回合若没有打出致命一击则{0}` -- `param`: `0,0,0` - -### Effect 733 -- `argsNum`: `1` -- `info`: `反转自身能力下降状态,反转成功则对手{0}` -- `param`: `1,0,0` - -## 备注 - -- 该清单按当前仓库静态注册结果生成;如果某个 effect 实际通过其他模块或运行时路径实现,需要先复核后再落代码。 -- 对 `201`、`445` 这类占位 effect,优先补核心逻辑或补充明确的不可实现说明。 diff --git a/logic/service/fight/effect/714_718.go b/logic/service/fight/effect/714_718.go new file mode 100644 index 000000000..92c8a216a --- /dev/null +++ b/logic/service/fight/effect/714_718.go @@ -0,0 +1,182 @@ +package effect + +import ( + "blazing/logic/service/fight/action" + "blazing/logic/service/fight/info" + "blazing/logic/service/fight/input" + "blazing/logic/service/fight/node" + + "github.com/alpacahq/alpacadecimal" + "github.com/gogf/gf/v2/util/grand" +) + +// Effect 714: 使用技能时若对手处于能力提升状态,则先制+{0},同时消除对手能力提升状态 +type Effect714 struct { + node.EffectNode + armed bool +} + +func (e *Effect714) ComparePre(fattack, sattack *action.SelectSkillAction) bool { + if !e.Ctx().Opp.HasPropADD() { + return true + } + + current := actionByPlayer(fattack, sattack, e.Ctx().Our.UserID) + if current == nil || current.SkillEntity == nil { + return true + } + + current.SkillEntity.XML.Priority += int(e.Args()[0].IntPart()) + e.armed = true + return true +} + +func (e *Effect714) OnSkill() bool { + if !e.armed { + return true + } + for i, v := range e.Ctx().Opp.Prop[:] { + if v > 0 { + e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), 0) + } + } + return true +} + +// Effect 715: 若下回合受到攻击,则对手随机{0}项能力值-{1} +type Effect715 struct { + node.EffectNode +} + +func (e *Effect715) OnSkill() bool { + effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 715, e.SideEffectArgs...) + if effect != nil { + e.Ctx().Our.AddEffect(e.Ctx().Our, effect) + } + return true +} + +type Effect715Sub struct { + FixedDuration1Base + triggered bool +} + +func (e *Effect715Sub) Skill_Use_ex() bool { + if e.triggered { + return true + } + skill := e.Ctx().SkillEntity + if skill == nil || skill.Category() == info.Category.STATUS { + return true + } + + count := int(e.Args()[0].IntPart()) + level := int8(e.Args()[1].IntPart()) + if count <= 0 || level <= 0 { + e.Alive(false) + return true + } + + indexes := grand.Perm(len(e.Ctx().Opp.Prop)) + if count > len(indexes) { + count = len(indexes) + } + for _, idx := range indexes[:count] { + e.Ctx().Opp.SetProp(e.Ctx().Our, int8(idx), -level) + } + e.triggered = true + e.Alive(false) + return true +} + +// Effect 716: {0}回合内对手使用攻击技能,则使对手随机{1}个技能的PP值归零 +type Effect716 struct { + node.EffectNode +} + +func (e *Effect716) OnSkill() bool { + addSubEffect(e.Ctx().Our, e.Ctx().Opp, &e.EffectNode, &Effect716Sub{}, -1) + return true +} + +type Effect716Sub struct { + RoundEffectArg0Base +} + +func (e *Effect716Sub) Skill_Use() bool { + skill := e.Ctx().SkillEntity + if skill == nil || skill.Category() == info.Category.STATUS { + return true + } + + zeroRandomSkillPP(e.Ctx().Our, int(e.Args()[1].IntPart())) + return true +} + +// Effect 717: {0}回合内每回合使用技能吸取对手最大体力的1/{1},恢复体力时若自身体力低于最大体力的1/{2}则恢复效果翻倍 +type Effect717 struct { + RoundEffectArg0Base +} + +func (e *Effect717) Skill_Use() bool { + if e.Ctx().SkillEntity == nil { + return true + } + drain := e.Ctx().Opp.CurrentPet.GetMaxHP().Div(e.Args()[1]) + if drain.IntPart() <= 0 { + return true + } + + e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{ + Type: info.DamageType.Percent, + Damage: drain, + }) + + heal := drain + if e.Args()[2].IntPart() > 0 { + threshold := e.Ctx().Our.CurrentPet.GetMaxHP().Div(e.Args()[2]) + if e.Ctx().Our.CurrentPet.GetHP().Cmp(threshold) < 0 { + heal = heal.Mul(alpacadecimal.NewFromInt(2)) + } + } + e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, heal) + return true +} + +// Effect 718: {0}回合内对手使用属性技能,则自身下{1}回合必定暴击 +type Effect718 struct { + RoundEffectArg0Base +} + +func (e *Effect718) SkillHit_ex() bool { + 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) + return true +} + +type Effect718Sub struct { + RoundEffectArg1Base +} + +func (e *Effect718Sub) ActionStart(a, b *action.SelectSkillAction) bool { + if e.Ctx().SkillEntity == nil { + return true + } + if e.Ctx().SkillEntity.Category() == info.Category.STATUS { + return true + } + e.Ctx().SkillEntity.XML.CritRate = 16 + return true +} + +func init() { + input.InitEffect(input.EffectType.Skill, 714, &Effect714{}) + 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.Skill, 717, &Effect717{}) + input.InitEffect(input.EffectType.Skill, 718, &Effect718{}) +} diff --git a/logic/service/fight/effect/719_723.go b/logic/service/fight/effect/719_723.go new file mode 100644 index 000000000..af2e22fdf --- /dev/null +++ b/logic/service/fight/effect/719_723.go @@ -0,0 +1,136 @@ +package effect + +import ( + "blazing/logic/service/fight/action" + "blazing/logic/service/fight/info" + "blazing/logic/service/fight/input" + "blazing/logic/service/fight/node" +) + +// Effect 719: 未击败对手则{0}%令对手{1} +type Effect719 struct { + node.EffectNode +} + +func (e *Effect719) Skill_Use() bool { + if len(e.Args()) < 2 || e.Ctx().Opp.CurrentPet.Info.Hp <= 0 { + return true + } + + success, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100) + if !success { + return true + } + + statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(e.Args()[1].IntPart())) + if statusEffect != nil { + e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect) + } + return true +} + +// Effect 720: 若先出手则当回合闪避对手的攻击技能 +type Effect720 struct { + node.EffectNode +} + +func (e *Effect720) Skill_Use() bool { + if !e.IsFirst() { + return true + } + + addSubEffect(e.Ctx().Our, e.Ctx().Our, &e.EffectNode, &Effect720Sub{}, -1) + return true +} + +type Effect720Sub struct { + FixedDuration1Base +} + +func (e *Effect720Sub) SkillHit_ex() bool { + if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS { + return true + } + + e.Ctx().SkillEntity.SetMiss() + return true +} + +// Effect 721: 后出手时使对手下{0}回合攻击技能MISS +type Effect721 struct { + node.EffectNode +} + +func (e *Effect721) Skill_Use() bool { + if e.IsFirst() { + return true + } + + addSubEffect(e.Ctx().Our, e.Ctx().Our, &e.EffectNode, &Effect721Sub{}, -1) + return true +} + +type Effect721Sub struct { + RoundEffectArg0Base +} + +func (e *Effect721Sub) SkillHit_ex() bool { + if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS { + return true + } + + e.Ctx().SkillEntity.SetMiss() + return true +} + +// Effect 722: 将自身相应的能力提升赋予给对手相应的能力下降 +type Effect722 struct { + node.EffectNode +} + +func (e *Effect722) OnSkill() bool { + for i, v := range e.Ctx().Our.Prop[:] { + if v <= 0 { + continue + } + e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), -v) + } + return true +} + +// Effect 723: 后出手时令对手下{0}回合先制-{1} +type Effect723 struct { + node.EffectNode +} + +func (e *Effect723) Skill_Use() bool { + if e.IsFirst() { + return true + } + + addSubEffect(e.Ctx().Our, e.Ctx().Opp, &e.EffectNode, &Effect723Sub{}, -1) + return true +} + +type Effect723Sub struct { + RoundEffectArg0Base +} + +func (e *Effect723Sub) ComparePre(fattack, sattack *action.SelectSkillAction) bool { + priorityDown := int(e.Args()[1].IntPart()) + current := actionByPlayer(fattack, sattack, e.Ctx().Our.UserID) + if current == nil || current.SkillEntity == nil { + return true + } + + current.SkillEntity.XML.Priority -= priorityDown + return true +} + +func init() { + input.InitEffect(input.EffectType.Skill, 719, &Effect719{}) + input.InitEffect(input.EffectType.Skill, 720, &Effect720{}) + input.InitEffect(input.EffectType.Skill, 721, &Effect721{}) + input.InitEffect(input.EffectType.Skill, 722, &Effect722{}) + input.InitEffect(input.EffectType.Skill, 723, &Effect723{}) +} diff --git a/logic/service/fight/effect/729_733.go b/logic/service/fight/effect/729_733.go new file mode 100644 index 000000000..faa6e777c --- /dev/null +++ b/logic/service/fight/effect/729_733.go @@ -0,0 +1,162 @@ +package effect + +import ( + "blazing/logic/service/fight/action" + "blazing/logic/service/fight/info" + "blazing/logic/service/fight/input" + "blazing/logic/service/fight/node" +) + +// Effect 729: {0}回合内若造成伤害大于{1}则{2}%概率使对手{3} +type Effect729 struct { + RoundEffectArg0Base +} + +func (e *Effect729) Skill_Use() bool { + skill := e.Ctx().SkillEntity + if skill == nil || skill.Category() == info.Category.STATUS || len(e.Args()) < 4 { + return true + } + if e.Ctx().Opp.CurrentPet.Info.Hp <= 0 { + return true + } + if e.Ctx().Our.SumDamage.Cmp(e.Args()[1]) <= 0 { + return true + } + + success, _, _ := e.Input.Player.Roll(int(e.Args()[2].IntPart()), 100) + if !success { + return true + } + + statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(e.Args()[3].IntPart())) + if statusEffect != nil { + e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect) + } + return true +} + +// Effect 730: 下回合起,{0}回合内每回合{1} +type Effect730 struct { + node.EffectNode +} + +func (e *Effect730) Skill_Use() bool { + addSubEffect(e.Ctx().Our, e.Ctx().Our, &e.EffectNode, &Effect730Sub{}, -1) + return true +} + +type Effect730Sub struct { + RoundEffectArg0Base +} + +func (e *Effect730Sub) ActionStart(a, b *action.SelectSkillAction) bool { + for i := 1; i < len(e.Args()) && i <= 6; i++ { + level := int8(e.Args()[i].IntPart()) + if level == 0 { + continue + } + e.Ctx().Our.SetProp(e.Ctx().Our, int8(i-1), level) + } + return true +} + +// Effect 731: 本回合打出致命一击则下{0}回合其它攻击技能必定致命一击 +type Effect731 struct { + node.EffectNode +} + +func (e *Effect731) Skill_Use() bool { + skill := e.Ctx().SkillEntity + if skill == nil || skill.Category() == info.Category.STATUS || skill.AttackTime == 0 || skill.Crit == 0 || len(e.Args()) == 0 { + return true + } + + sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 731, int(e.Args()[0].IntPart()), skill.XML.ID) + if sub != nil { + e.Ctx().Our.AddEffect(e.Ctx().Our, sub) + } + return true +} + +type Effect731Sub struct { + RoundEffectArg0Base + triggerSkillID int +} + +func (e *Effect731Sub) SetArgs(t *input.Input, a ...int) { + setArgsWithDuration0(&e.EffectNode, t, a...) + if len(a) > 1 { + e.triggerSkillID = a[1] + } +} + +func (e *Effect731Sub) ActionStart(a, b *action.SelectSkillAction) bool { + skill := e.Ctx().SkillEntity + if skill == nil || skill.Category() == info.Category.STATUS || skill.AttackTime == 0 { + return true + } + if skill.XML.ID == e.triggerSkillID { + return true + } + + skill.XML.CritRate = 16 + return true +} + +// Effect 732: 本回合若没有打出致命一击则{0} +type Effect732 struct { + node.EffectNode +} + +func (e *Effect732) Skill_Use() bool { + skill := e.Ctx().SkillEntity + if skill == nil || skill.Category() == info.Category.STATUS || skill.AttackTime == 0 || skill.Crit != 0 { + return true + } + + for i := 0; i < len(e.Args()) && i < 6; i++ { + level := int8(e.Args()[i].IntPart()) + if level == 0 { + continue + } + e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), level) + } + return true +} + +// Effect 733: 反转自身能力下降状态,反转成功则对手{0} +type Effect733 struct { + node.EffectNode +} + +func (e *Effect733) OnSkill() bool { + reversed := false + for i, v := range e.Ctx().Our.Prop[:] { + if v >= 0 { + continue + } + if e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), -2*v) { + reversed = true + } + } + if !reversed || len(e.Args()) == 0 { + return true + } + + statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(e.Args()[0].IntPart())) + if statusEffect != nil { + e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect) + } + return true +} + +func init() { + input.InitEffect(input.EffectType.Skill, 729, &Effect729{}) + input.InitEffect(input.EffectType.Skill, 730, &Effect730{}) + input.InitEffect(input.EffectType.Sub, 730, &Effect730Sub{}) + input.InitEffect(input.EffectType.Skill, 731, &Effect731{}) + input.InitEffect(input.EffectType.Sub, 731, &Effect731Sub{}) + input.InitEffect(input.EffectType.Skill, 732, &Effect732{}) + input.InitEffect(input.EffectType.Skill, 733, &Effect733{}) +} diff --git a/logic/service/fight/effect/effect_info_map.go b/logic/service/fight/effect/effect_info_map.go index e8f3fe96c..4143ef99c 100644 --- a/logic/service/fight/effect/effect_info_map.go +++ b/logic/service/fight/effect/effect_info_map.go @@ -431,11 +431,21 @@ var effectInfoByID = map[int]string{ 711: "下{0}回合若自身能力提升状态被消除则必定致命一击", 712: "{0}回合内将对手的{1}能力降为0点", 713: "附加自身能力提升等级总和X{0}的固定伤害", + 719: "未击败对手则{0}%令对手{1}", + 720: "若先出手则当回合闪避对手的攻击技能", + 721: "后出手时使对手下{0}回合攻击技能MISS", + 722: "将自身相应的能力提升赋予给对手相应的能力下降", + 723: "后出手时令对手下{0}回合先制-{1}", 724: "{0}回合内受到攻击{1}%恢复1/{2}体力", 725: "{0}回合内每回合有{1}%的概率降低对手最大体力的1/{2}", 726: "下{0}回合若对手先出手,则令对手当回合使用的攻击技能无效", 727: "后出手时将自身能力等级返回至上一回合结束时", 728: "自身处于能力提升状态时,回合结束时直接减少对手1/{0}最大体力", + 729: "{0}回合内若造成伤害大于{1}则{2}%概率使对手{3}", + 730: "下回合起,{0}回合内每回合{1}", + 731: "本回合打出致命一击则下{0}回合其它攻击技能必定致命一击", + 732: "本回合若没有打出致命一击则{0}", + 733: "反转自身能力下降状态,反转成功则对手{0}", 841: "使对手和自身同时降低1/{0}最大体力", 842: "若自身处于能力提升状态则造成的攻击伤害额外提升{0}%", 843: "下{0}回合令自身所有技能先制+{1}",