From d86b75408b978d0e926d1d9421e1c76eae19c162 Mon Sep 17 00:00:00 2001 From: xinian Date: Thu, 2 Apr 2026 23:32:21 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=E6=8A=80=E8=83=BD?= =?UTF-8?q?=E6=95=88=E6=9E=9C1378-1382?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../task-153-effects-1378-1382.md | 36 ----- logic/service/fight/effect/1378.go | 66 +++++++++ logic/service/fight/effect/1379.go | 29 ++++ logic/service/fight/effect/1380.go | 45 ++++++ logic/service/fight/effect/1381.go | 46 +++++++ logic/service/fight/effect/1382.go | 129 ++++++++++++++++++ logic/service/fight/effect/effect_info_map.go | 5 + 7 files changed, 320 insertions(+), 36 deletions(-) delete mode 100644 docs/effect-unimplemented-tasks/task-153-effects-1378-1382.md create mode 100644 logic/service/fight/effect/1378.go create mode 100644 logic/service/fight/effect/1379.go create mode 100644 logic/service/fight/effect/1380.go create mode 100644 logic/service/fight/effect/1381.go create mode 100644 logic/service/fight/effect/1382.go diff --git a/docs/effect-unimplemented-tasks/task-153-effects-1378-1382.md b/docs/effect-unimplemented-tasks/task-153-effects-1378-1382.md deleted file mode 100644 index 363753c62..000000000 --- a/docs/effect-unimplemented-tasks/task-153-effects-1378-1382.md +++ /dev/null @@ -1,36 +0,0 @@ -# Task 153: Effects 1378-1382 - -## 目标 - -- 补齐以下 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 1378 -- `argsNum`: `9` -- `info`: `全属性+{0},{1}%概率强化效果翻倍,未触发则{2}回合内每回合{3}` -- `param`: `0,3,3` - -### Effect 1379 -- `argsNum`: `0` -- `info`: `自身不处于能力提升状态时50%的概率打出致命一击` - -### Effect 1380 -- `argsNum`: `3` -- `info`: `牺牲自身全部体力,使对手全属性-{0}且{1}回合内先制-{2}` - -### Effect 1381 -- `argsNum`: `1` -- `info`: `消除对手回合类效果,消除成功则自身{0}回合内免疫并反弹异常状态` - -### Effect 1382 -- `argsNum`: `3` -- `info`: `命中后获得{0}层自然祝福,若造成的伤害高于{1}则额外获得{2}层自然祝福` - -## 备注 - -- 该清单按当前仓库静态注册结果生成;如果某个 effect 实际通过其他模块或运行时路径实现,需要先复核后再落代码。 -- 对 `201`、`445` 这类占位 effect,优先补核心逻辑或补充明确的不可实现说明。 diff --git a/logic/service/fight/effect/1378.go b/logic/service/fight/effect/1378.go new file mode 100644 index 000000000..4b25c23c5 --- /dev/null +++ b/logic/service/fight/effect/1378.go @@ -0,0 +1,66 @@ +package effect + +import ( + "blazing/logic/service/fight/input" + "blazing/logic/service/fight/node" +) + +// Effect 1378: 全属性+{0},{1}%概率强化效果翻倍,未触发则{2}回合内每回合{3} +type Effect1378 struct{ node.EffectNode } + +func (e *Effect1378) OnSkill() bool { + if len(e.Args()) < 9 { + return true + } + + boost := int8(e.Args()[0].IntPart()) + ok, _, _ := e.Input.Player.Roll(int(e.Args()[1].IntPart()), 100) + if ok { + boost *= 2 + } + + for i := 0; i < 6; i++ { + e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), boost) + } + if ok || e.Args()[2].IntPart() <= 0 { + return true + } + + sub := e.Ctx().Our.InitEffect( + input.EffectType.Sub, + 1378, + int(e.Args()[2].IntPart()), + int(e.Args()[3].IntPart()), + int(e.Args()[4].IntPart()), + int(e.Args()[5].IntPart()), + int(e.Args()[6].IntPart()), + int(e.Args()[7].IntPart()), + int(e.Args()[8].IntPart()), + ) + if sub != nil { + e.Ctx().Our.AddEffect(e.Ctx().Our, sub) + } + return true +} + +type Effect1378Sub struct{ RoundEffectArg0Base } + +func (e *Effect1378Sub) TurnEnd() { + if len(e.Args()) >= 7 && e.Ctx().Our.CurrentPet.Info.Hp > 0 { + changes := []int{ + int(e.Args()[1].IntPart()), + int(e.Args()[2].IntPart()), + int(e.Args()[3].IntPart()), + int(e.Args()[4].IntPart()), + int(e.Args()[5].IntPart()), + int(e.Args()[6].IntPart()), + } + applyEffectPropChanges(e.Ctx().Our, e.Ctx().Our, changes, false) + } + e.EffectNode.TurnEnd() +} + +func init() { + input.InitEffect(input.EffectType.Skill, 1378, &Effect1378{}) + input.InitEffect(input.EffectType.Sub, 1378, &Effect1378Sub{}) +} diff --git a/logic/service/fight/effect/1379.go b/logic/service/fight/effect/1379.go new file mode 100644 index 000000000..aa493236d --- /dev/null +++ b/logic/service/fight/effect/1379.go @@ -0,0 +1,29 @@ +package effect + +import ( + "blazing/logic/service/fight/info" + "blazing/logic/service/fight/input" + "blazing/logic/service/fight/node" +) + +// Effect 1379: 自身不处于能力提升状态时50%的概率打出致命一击 +type Effect1379 struct{ node.EffectNode } + +func (e *Effect1379) SkillHit() bool { + if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS { + return true + } + if e.Ctx().Our.HasPropADD() { + return true + } + + ok, _, _ := e.Input.Player.Roll(50, 100) + if ok { + e.Ctx().SkillEntity.XML.CritRate = 16 + } + return true +} + +func init() { + input.InitEffect(input.EffectType.Skill, 1379, &Effect1379{}) +} diff --git a/logic/service/fight/effect/1380.go b/logic/service/fight/effect/1380.go new file mode 100644 index 000000000..10eeff262 --- /dev/null +++ b/logic/service/fight/effect/1380.go @@ -0,0 +1,45 @@ +package effect + +import ( + "blazing/logic/service/fight/action" + "blazing/logic/service/fight/info" + "blazing/logic/service/fight/input" + "blazing/logic/service/fight/node" +) + +// Effect 1380: 牺牲自身全部体力,使对手全属性-{0}且{1}回合内先制-{2} +type Effect1380 struct{ node.EffectNode } + +func (e *Effect1380) Skill_Use() bool { + if len(e.Args()) < 3 { + return true + } + + applyAllPropDown(e.Ctx().Our, e.Ctx().Opp, int8(e.Args()[0].IntPart())) + sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1380, int(e.Args()[1].IntPart()), int(e.Args()[2].IntPart())) + if sub != nil { + e.Ctx().Opp.AddEffect(e.Ctx().Our, sub) + } + e.Ctx().Our.Damage(e.Ctx().Our, &info.DamageZone{ + Type: info.DamageType.Fixed, + Damage: e.Ctx().Our.CurrentPet.GetHP(), + }) + return true +} + +type Effect1380Sub struct{ RoundEffectArg0Base } + +func (e *Effect1380Sub) ComparePre(fattack, sattack *action.SelectSkillAction) bool { + current := actionByPlayer(fattack, sattack, e.Ctx().Our.UserID) + if current == nil || current.SkillEntity == nil || len(e.Args()) < 2 { + return true + } + + current.SkillEntity.XML.Priority -= int(e.Args()[1].IntPart()) + return true +} + +func init() { + input.InitEffect(input.EffectType.Skill, 1380, &Effect1380{}) + input.InitEffect(input.EffectType.Sub, 1380, &Effect1380Sub{}) +} diff --git a/logic/service/fight/effect/1381.go b/logic/service/fight/effect/1381.go new file mode 100644 index 000000000..2f65be6e2 --- /dev/null +++ b/logic/service/fight/effect/1381.go @@ -0,0 +1,46 @@ +package effect + +import ( + "blazing/logic/service/fight/input" + "blazing/logic/service/fight/node" +) + +// Effect 1381: 消除对手回合类效果,消除成功则自身{0}回合内免疫并反弹异常状态 +type Effect1381 struct{ node.EffectNode } + +func (e *Effect1381) Skill_Use() bool { + if len(e.Args()) == 0 { + return true + } + + before := activeTurnEffectCount(e.Ctx().Opp) + e.Ctx().Opp.CancelTurn(e.Ctx().Our) + if before <= 0 { + return true + } + + sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1381, int(e.Args()[0].IntPart())) + if sub != nil { + e.Ctx().Our.AddEffect(e.Ctx().Our, sub) + } + return true +} + +type Effect1381Sub struct{ RoundEffectArg0Base } + +func (e *Effect1381Sub) EFFect_Befer(in *input.Input, effEffect input.Effect) bool { + if in != e.Ctx().Opp || !input.IS_Stat(effEffect) { + return true + } + + statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(effEffect.ID().Suffix())) + if statusEffect != nil { + e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect) + } + return false +} + +func init() { + input.InitEffect(input.EffectType.Skill, 1381, &Effect1381{}) + input.InitEffect(input.EffectType.Sub, 1381, &Effect1381Sub{}) +} diff --git a/logic/service/fight/effect/1382.go b/logic/service/fight/effect/1382.go new file mode 100644 index 000000000..e1a0bc783 --- /dev/null +++ b/logic/service/fight/effect/1382.go @@ -0,0 +1,129 @@ +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" +) + +// Effect 1382: 命中后获得{0}层自然祝福,若造成的伤害高于{1}则额外获得{2}层自然祝福 +type Effect1382 struct{ node.EffectNode } + +func (e *Effect1382) Skill_Use() bool { + if len(e.Args()) < 3 || e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.AttackTime == 0 { + return true + } + + layers := int(e.Args()[0].IntPart()) + if e.Ctx().Our.SumDamage.Cmp(e.Args()[1]) > 0 { + layers += int(e.Args()[2].IntPart()) + } + if layers <= 0 { + return true + } + + grantNaturalBlessing(e.Ctx().Our, e.Ctx().Our, layers) + return true +} + +type Effect1382Sub struct { + node.EffectNode + layers int +} + +func (e *Effect1382Sub) SetArgs(t *input.Input, a ...int) { + e.EffectNode.SetArgs(t, a...) + e.Duration(-1) + e.CanStack(false) + if len(a) > 0 { + e.layers = a[0] + } +} + +func (e *Effect1382Sub) ComparePre(fattack, sattack *action.SelectSkillAction) bool { + if e.layers <= 0 { + return true + } + + current := actionByPlayer(fattack, sattack, e.Ctx().Our.UserID) + if current == nil || current.SkillEntity == nil || current.SkillEntity.Category() == info.Category.STATUS { + return true + } + + current.SkillEntity.XML.Priority += e.layers + return true +} + +func (e *Effect1382Sub) DamageLockEx(zone *info.DamageZone) bool { + if zone == nil || e.layers <= 0 || zone.Damage.Cmp(alpacadecimal.Zero) <= 0 { + return true + } + + rate := hundred.Sub(alpacadecimal.NewFromInt(int64(e.layers * 8))) + if rate.Cmp(alpacadecimal.Zero) < 0 { + rate = alpacadecimal.Zero + } + zone.Damage = zone.Damage.Mul(rate).Div(hundred) + return true +} + +func (e *Effect1382Sub) EFFect_Befer(in *input.Input, effEffect input.Effect) bool { + if e.layers <= 0 || in != e.Ctx().Opp || !input.IS_Stat(effEffect) { + return true + } + + ok, _, _ := e.Input.Player.Roll(25, 100) + if ok { + return false + } + return true +} + +func naturalBlessingEffect(target *input.Input) *Effect1382Sub { + if target == nil { + return nil + } + + for _, effect := range target.Effects { + if sub, ok := effect.(*Effect1382Sub); ok && sub.Alive() { + return sub + } + } + return nil +} + +func grantNaturalBlessing(owner, target *input.Input, layers int) { + if owner == nil || target == nil || layers <= 0 { + return + } + + if sub := naturalBlessingEffect(target); sub != nil { + sub.layers += layers + return + } + + effect := owner.InitEffect(input.EffectType.Sub, 1382, layers) + if effect != nil { + target.AddEffect(owner, effect) + } +} + +func consumeNaturalBlessing(target *input.Input) int { + sub := naturalBlessingEffect(target) + if sub == nil { + return 0 + } + + layers := sub.layers + sub.Alive(false) + sub.layers = 0 + return layers +} + +func init() { + input.InitEffect(input.EffectType.Skill, 1382, &Effect1382{}) + input.InitEffect(input.EffectType.Sub, 1382, &Effect1382Sub{}) +} diff --git a/logic/service/fight/effect/effect_info_map.go b/logic/service/fight/effect/effect_info_map.go index 7a8130a2a..d479309b7 100644 --- a/logic/service/fight/effect/effect_info_map.go +++ b/logic/service/fight/effect/effect_info_map.go @@ -927,6 +927,11 @@ var effectInfoByID = map[int]string{ 1375: "自身下{0}回合获得了冰之祝福", 1376: "{0}回合内自身使用攻击技能则{1}%令对手{2},未触发则吸取对手最大体力的1/{3}", 1377: "使用后在战斗结束时可以获得500泰坦之灵,每日上限5000", + 1378: "全属性+{0},{1}%概率强化效果翻倍,未触发则{2}回合内每回合{3}", + 1379: "自身不处于能力提升状态时50%的概率打出致命一击", + 1380: "牺牲自身全部体力,使对手全属性-{0}且{1}回合内先制-{2}", + 1381: "消除对手回合类效果,消除成功则自身{0}回合内免疫并反弹异常状态", + 1382: "命中后获得{0}层自然祝福,若造成的伤害高于{1}则额外获得{2}层自然祝福", 1393: "{0}回合内每回合使用技能则造成伤害前令对手防御-{1}、速度-{2},未触发则附加对手最大体力1/{3}的百分比伤害", 1394: "{0}回合内对手使用属性技能则随机进入{1}种异常状态", 1395: "若先出手则必定打出致命一击",