diff --git a/common/go.mod b/common/go.mod index 14d676718..09d3f6e53 100644 --- a/common/go.mod +++ b/common/go.mod @@ -1,6 +1,6 @@ module blazing/common -go 1.23.0 +go 1.23 require ( github.com/panjf2000/gnet v1.6.7 diff --git a/docs/effect-unimplemented-tasks/task-041-effects-815-819.md b/docs/effect-unimplemented-tasks/task-041-effects-815-819.md deleted file mode 100644 index b1f35dd5e..000000000 --- a/docs/effect-unimplemented-tasks/task-041-effects-815-819.md +++ /dev/null @@ -1,36 +0,0 @@ -# Task 041: Effects 815-819 - -## 目标 - -- 补齐以下 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 815 -- `argsNum`: `1` -- `info`: `后出手时附加自身当前体力{0}%的百分比伤害` - -### Effect 816 -- `argsNum`: `0` -- `info`: `免疫对手下次攻击技能造成的伤害并直接扣除对手等量体力` - -### Effect 817 -- `argsNum`: `1` -- `info`: `{0}回合内受到攻击则对手下回合受到的伤害翻倍` - -### Effect 818 -- `argsNum`: `0` -- `info`: `出手时本回合若受到伤害,则将伤害反馈给对手` - -### Effect 819 -- `argsNum`: `2` -- `info`: `出手时本回合若未受到攻击伤害,则附加自身{0}值{1}%的百分比伤害,并恢复等量体力` -- `param`: `2,0,0` - -## 备注 - -- 该清单按当前仓库静态注册结果生成;如果某个 effect 实际通过其他模块或运行时路径实现,需要先复核后再落代码。 -- 对 `201`、`445` 这类占位 effect,优先补核心逻辑或补充明确的不可实现说明。 diff --git a/docs/effect-unimplemented-tasks/task-042-effects-820-824.md b/docs/effect-unimplemented-tasks/task-042-effects-820-824.md deleted file mode 100644 index 4a7481c19..000000000 --- a/docs/effect-unimplemented-tasks/task-042-effects-820-824.md +++ /dev/null @@ -1,36 +0,0 @@ -# Task 042: Effects 820-824 - -## 目标 - -- 补齐以下 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 820 -- `argsNum`: `2` -- `info`: `未击败对手下{0}回合自身攻击先制+{1}` - -### Effect 821 -- `argsNum`: `1` -- `info`: `{0}回合内自身的回合类效果无法被消除,后出手时回合数+1` - -### Effect 822 -- `argsNum`: `0` -- `info`: `吸收对手的能力提升同时反转对手的能力提升` - -### Effect 823 -- `argsNum`: `1` -- `info`: `当回合未击败对手,则下{0}回合必定先出手` - -### Effect 824 -- `argsNum`: `2` -- `info`: `若对手不处于{0}状态则吸取对手1/{1}最大体力` -- `param`: `1,0,0` - -## 备注 - -- 该清单按当前仓库静态注册结果生成;如果某个 effect 实际通过其他模块或运行时路径实现,需要先复核后再落代码。 -- 对 `201`、`445` 这类占位 effect,优先补核心逻辑或补充明确的不可实现说明。 diff --git a/docs/effect-unimplemented-tasks/task-043-effects-825-829.md b/docs/effect-unimplemented-tasks/task-043-effects-825-829.md deleted file mode 100644 index 37d0a9db6..000000000 --- a/docs/effect-unimplemented-tasks/task-043-effects-825-829.md +++ /dev/null @@ -1,35 +0,0 @@ -# Task 043: Effects 825-829 - -## 目标 - -- 补齐以下 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 825 -- `argsNum`: `1` -- `info`: `若对手处于能力提升状态则附加对手最大体力1/{0}的百分比伤害` - -### Effect 826 -- `argsNum`: `1` -- `info`: `当回合击败对手则对手下只出场精灵随机进入{0}种异常状态` - -### Effect 827 -- `argsNum`: `2` -- `info`: `消除对手能力提升状态,消除成功则令自身下{0}回合必定先出手且下{1}回合造成的攻击伤害翻倍` - -### Effect 828 -- `argsNum`: `0` -- `info`: `若自身处于能力提升状态则先制+1` - -### Effect 829 -- `argsNum`: `2` -- `info`: `下{0}回合对手每回合受到相当于本次伤害的1/{1}的百分比伤害(可以叠加)` - -## 备注 - -- 该清单按当前仓库静态注册结果生成;如果某个 effect 实际通过其他模块或运行时路径实现,需要先复核后再落代码。 -- 对 `201`、`445` 这类占位 effect,优先补核心逻辑或补充明确的不可实现说明。 diff --git a/docs/effect-unimplemented-tasks/task-044-effects-830-835.md b/docs/effect-unimplemented-tasks/task-044-effects-830-835.md deleted file mode 100644 index 3946418f6..000000000 --- a/docs/effect-unimplemented-tasks/task-044-effects-830-835.md +++ /dev/null @@ -1,35 +0,0 @@ -# Task 044: Effects 830-835 - -## 目标 - -- 补齐以下 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 830 -- `argsNum`: `0` -- `info`: `若后出手,则免疫本回合受到的伤害` - -### Effect 831 -- `argsNum`: `1` -- `info`: `附加自身最大体力{0}%的百分比伤害` - -### Effect 833 -- `argsNum`: `1` -- `info`: `当回合若未击败对手则吸取对手最大体力的1/{0}` - -### Effect 834 -- `argsNum`: `2` -- `info`: `{0}回合内自身能力提升状态被消除或吸取时,{1}回合内对手属性技能无效` - -### Effect 835 -- `argsNum`: `0` -- `info`: `反转自身能力下降状态,反转成功则恢复自身全部体力` - -## 备注 - -- 该清单按当前仓库静态注册结果生成;如果某个 effect 实际通过其他模块或运行时路径实现,需要先复核后再落代码。 -- 对 `201`、`445` 这类占位 effect,优先补核心逻辑或补充明确的不可实现说明。 diff --git a/docs/effect-unimplemented-tasks/task-045-effects-836-840.md b/docs/effect-unimplemented-tasks/task-045-effects-836-840.md deleted file mode 100644 index efec3808c..000000000 --- a/docs/effect-unimplemented-tasks/task-045-effects-836-840.md +++ /dev/null @@ -1,35 +0,0 @@ -# Task 045: Effects 836-840 - -## 目标 - -- 补齐以下 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 836 -- `argsNum`: `1` -- `info`: `自身体力高于对手时先制+{0}` - -### Effect 837 -- `argsNum`: `3` -- `info`: `吸取对手{0}点固定体力,每次使用额外附加{1}点,最高{2}点` - -### Effect 838 -- `argsNum`: `1` -- `info`: `若当回合未击败对手,则下回合附加{0}点固定伤害` - -### Effect 839 -- `argsNum`: `1` -- `info`: `附加自身最大体力{0}%的百分比伤害并恢复等量体力` - -### Effect 840 -- `argsNum`: `1` -- `info`: `击败对手则对方下只精灵出战时己方在场精灵吸取其最大体力的1/{0}` - -## 备注 - -- 该清单按当前仓库静态注册结果生成;如果某个 effect 实际通过其他模块或运行时路径实现,需要先复核后再落代码。 -- 对 `201`、`445` 这类占位 effect,优先补核心逻辑或补充明确的不可实现说明。 diff --git a/docs/effect-unimplemented-tasks/task-052-effects-871-875.md b/docs/effect-unimplemented-tasks/task-052-effects-871-875.md deleted file mode 100644 index bc8a27550..000000000 --- a/docs/effect-unimplemented-tasks/task-052-effects-871-875.md +++ /dev/null @@ -1,35 +0,0 @@ -# Task 052: Effects 871-875 - -## 目标 - -- 补齐以下 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 871 -- `argsNum`: `2` -- `info`: `下{0}回合,每回合攻击技能造成的伤害不少于{1}` - -### Effect 872 -- `argsNum`: `1` -- `info`: `吸取对手能力提升状态,吸取成功则{0}回合内令对手使用的属性技能无效` - -### Effect 873 -- `argsNum`: `0` -- `info`: `消耗自身全部体力,消除对手能力提升状态和回合类效果,使己方下只出场精灵下次攻击必定先手、必定命中且造成的伤害翻倍` - -### Effect 874 -- `argsNum`: `2` -- `info`: `{0}回合内若对手造成的伤害低于{1}则免疫该伤害` - -### Effect 875 -- `argsNum`: `0` -- `info`: `消耗自身全部体力,对手所有技能PP值归零,全属性-1` - -## 备注 - -- 该清单按当前仓库静态注册结果生成;如果某个 effect 实际通过其他模块或运行时路径实现,需要先复核后再落代码。 -- 对 `201`、`445` 这类占位 effect,优先补核心逻辑或补充明确的不可实现说明。 diff --git a/go.work b/go.work index 3dbcfd1dc..cd4b2a92c 100644 --- a/go.work +++ b/go.work @@ -1,4 +1,4 @@ -go 1.25.0 +go 1.25 use ( ./common diff --git a/logic/go.mod b/logic/go.mod index 6b647c219..90a982b05 100644 --- a/logic/go.mod +++ b/logic/go.mod @@ -1,6 +1,6 @@ module blazing/logic -go 1.24.0 +go 1.24 require ( github.com/antlabs/timer v0.1.4 diff --git a/logic/service/fight/effect/820_824.go b/logic/service/fight/effect/820_824.go new file mode 100644 index 000000000..d0fcc8a9a --- /dev/null +++ b/logic/service/fight/effect/820_824.go @@ -0,0 +1,186 @@ +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 820: 未击败对手下{0}回合自身攻击先制+{1} +type Effect820 struct{ node.EffectNode } + +func (e *Effect820) Skill_Use() bool { + if len(e.Args()) < 2 || e.Ctx().Opp.CurrentPet == nil || e.Ctx().Opp.CurrentPet.Info.Hp <= 0 { + return true + } + + sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 820, int(e.Args()[0].IntPart()), int(e.Args()[1].IntPart())) + if sub != nil { + e.Ctx().Our.AddEffect(e.Ctx().Our, sub) + } + return true +} + +type Effect820Sub struct{ RoundEffectArg0Base } + +func (e *Effect820Sub) ComparePre(fattack, sattack *action.SelectSkillAction) bool { + current := actionByPlayer(fattack, sattack, e.Ctx().Our.UserID) + if current == nil || current.SkillEntity == nil || current.SkillEntity.Category() == info.Category.STATUS || len(e.Args()) < 2 { + return true + } + + current.SkillEntity.XML.Priority += int(e.Args()[1].IntPart()) + return true +} + +// Effect 821: {0}回合内自身的回合类效果无法被消除,后出手时回合数+1 +type Effect821 struct{ node.EffectNode } + +func (e *Effect821) Skill_Use() bool { + if len(e.Args()) == 0 { + return true + } + + rounds := int(e.Args()[0].IntPart()) + if !e.IsFirst() { + rounds++ + } + sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 821, rounds) + if sub != nil { + e.Ctx().Our.AddEffect(e.Ctx().Our, sub) + } + return true +} + +type Effect821Sub struct { + node.EffectNode + remaining int +} + +func (e *Effect821Sub) SetArgs(t *input.Input, a ...int) { + e.EffectNode.SetArgs(t, a...) + e.Duration(-1) + if len(a) > 0 { + e.remaining = a[0] + } +} + +func (e *Effect821Sub) Skill_Use_ex() bool { + for _, eff := range e.Ctx().Our.Effects { + if eff == nil || eff == e || eff.Alive() { + continue + } + if eff.ID().GetEffectType() == input.EffectType.Status || eff.Duration() <= 0 { + continue + } + eff.Alive(true) + } + return true +} + +func (e *Effect821Sub) TurnEnd() { + e.remaining-- + if e.remaining <= 0 { + e.Alive(false) + } +} + +// Effect 822: 吸收对手的能力提升同时反转对手的能力提升 +type Effect822 struct{ node.EffectNode } + +func (e *Effect822) OnSkill() bool { + for i, v := range e.Ctx().Opp.Prop[:] { + if v <= 0 { + continue + } + if e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), -2*v) { + e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), v) + } + } + return true +} + +// Effect 823: 当回合未击败对手,则下{0}回合必定先出手 +type Effect823 struct{ node.EffectNode } + +func (e *Effect823) Skill_Use() bool { + if len(e.Args()) == 0 || e.Ctx().Opp.CurrentPet == nil || e.Ctx().Opp.CurrentPet.Info.Hp <= 0 { + return true + } + + sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 823, int(e.Args()[0].IntPart())) + if sub != nil { + e.Ctx().Our.AddEffect(e.Ctx().Our, sub) + } + return true +} + +type Effect823Sub struct { + node.EffectNode + remaining int +} + +func (e *Effect823Sub) SetArgs(t *input.Input, a ...int) { + e.EffectNode.SetArgs(t, a...) + e.Duration(-1) + if len(a) > 0 { + e.remaining = a[0] + } +} + +func (e *Effect823Sub) ComparePre(fattack, sattack *action.SelectSkillAction) bool { + if e.remaining <= 0 { + e.Alive(false) + return true + } + + current := actionByPlayer(fattack, sattack, e.Ctx().Our.UserID) + if current == nil || current.SkillEntity == nil { + return true + } + + current.SkillEntity.XML.Priority += 7 + e.remaining-- + if e.remaining <= 0 { + e.Alive(false) + } + return true +} + +// Effect 824: 若对手不处于{0}状态则吸取对手1/{1}最大体力 +type Effect824 struct{ node.EffectNode } + +func (e *Effect824) Skill_Use() bool { + if len(e.Args()) < 2 || e.Args()[1].Cmp(alpacadecimal.Zero) <= 0 { + return true + } + if e.Ctx().Opp.StatEffect_Exist(info.EnumPetStatus(e.Args()[0].IntPart())) { + return true + } + + drain := e.Ctx().Opp.CurrentPet.GetMaxHP().Div(e.Args()[1]) + if drain.Cmp(alpacadecimal.Zero) <= 0 { + return true + } + + e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{ + Type: info.DamageType.Percent, + Damage: drain, + }) + e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, drain) + return true +} + +func init() { + input.InitEffect(input.EffectType.Skill, 820, &Effect820{}) + input.InitEffect(input.EffectType.Sub, 820, &Effect820Sub{}) + input.InitEffect(input.EffectType.Skill, 821, &Effect821{}) + input.InitEffect(input.EffectType.Sub, 821, &Effect821Sub{}) + input.InitEffect(input.EffectType.Skill, 822, &Effect822{}) + input.InitEffect(input.EffectType.Skill, 823, &Effect823{}) + input.InitEffect(input.EffectType.Sub, 823, &Effect823Sub{}) + input.InitEffect(input.EffectType.Skill, 824, &Effect824{}) +} diff --git a/logic/service/fight/effect/825_829.go b/logic/service/fight/effect/825_829.go new file mode 100644 index 000000000..d4186ef52 --- /dev/null +++ b/logic/service/fight/effect/825_829.go @@ -0,0 +1,198 @@ +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 825: 若对手处于能力提升状态则附加对手最大体力1/{0}的百分比伤害 +type Effect825 struct{ node.EffectNode } + +func (e *Effect825) OnSkill() bool { + if len(e.Args()) == 0 || e.Args()[0].Cmp(alpacadecimal.Zero) <= 0 || !e.Ctx().Opp.HasPropADD() { + return true + } + + damage := e.Ctx().Opp.CurrentPet.GetMaxHP().Div(e.Args()[0]) + if damage.Cmp(alpacadecimal.Zero) <= 0 { + return true + } + + e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{ + Type: info.DamageType.Percent, + Damage: damage, + }) + return true +} + +// Effect 826: 当回合击败对手则对手下只出场精灵随机进入{0}种异常状态 +type Effect826 struct{ node.EffectNode } + +func (e *Effect826) Skill_Use() bool { + if len(e.Args()) == 0 || e.Ctx().Opp.CurrentPet == nil || e.Ctx().Opp.CurrentPet.Info.Hp > 0 { + return true + } + + sub := e.Ctx().Opp.InitEffect(input.EffectType.Sub, 826, int(e.Args()[0].IntPart())) + if sub != nil { + e.Ctx().Opp.AddEffect(e.Ctx().Our, sub) + } + return true +} + +type Effect826Sub struct{ node.EffectNode } + +func (e *Effect826Sub) SetArgs(t *input.Input, a ...int) { + e.EffectNode.SetArgs(t, a...) + e.CanStack(false) + e.Duration(1) +} + +func (e *Effect826Sub) SwitchIn(in *input.Input) bool { + if in != e.Ctx().Our || len(e.Args()) == 0 { + return true + } + + applyRandomStatuses1507(e.Ctx().Opp, e.Ctx().Our, int(e.Args()[0].IntPart())) + e.Alive(false) + return true +} + +// Effect 827: 消除对手能力提升状态,消除成功则令自身下{0}回合必定先出手且下{1}回合造成的攻击伤害翻倍 +type Effect827 struct{ node.EffectNode } + +func (e *Effect827) Skill_Use() bool { + if len(e.Args()) < 2 { + return true + } + + cleared := false + for i, v := range e.Ctx().Opp.Prop[:] { + if v <= 0 { + continue + } + if e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), 0) { + cleared = true + } + } + if !cleared { + return true + } + + prioritySub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 827, int(e.Args()[0].IntPart())) + if prioritySub != nil { + e.Ctx().Our.AddEffect(e.Ctx().Our, prioritySub) + } + damageSub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 8271, int(e.Args()[1].IntPart())) + if damageSub != nil { + e.Ctx().Our.AddEffect(e.Ctx().Our, damageSub) + } + return true +} + +type Effect827PrioritySub struct{ RoundEffectArg0Base } + +func (e *Effect827PrioritySub) ComparePre(fattack, sattack *action.SelectSkillAction) bool { + current := actionByPlayer(fattack, sattack, e.Ctx().Our.UserID) + if current == nil || current.SkillEntity == nil { + return true + } + + current.SkillEntity.XML.Priority += 7 + return true +} + +type Effect827DamageSub struct{ RoundEffectArg0Base } + +func (e *Effect827DamageSub) Damage_Mul(zone *info.DamageZone) bool { + if zone == nil || zone.Type != info.DamageType.Red { + return true + } + + zone.Damage = zone.Damage.Mul(alpacadecimal.NewFromInt(2)) + return true +} + +// Effect 828: 若自身处于能力提升状态则先制+1 +type Effect828 struct{ node.EffectNode } + +func (e *Effect828) ComparePre(fattack, sattack *action.SelectSkillAction) bool { + if !e.Ctx().Our.HasPropADD() { + return true + } + + current := actionByPlayer(fattack, sattack, e.Ctx().Our.UserID) + if current != nil && current.SkillEntity != nil { + current.SkillEntity.XML.Priority += 1 + } + return true +} + +// Effect 829: 下{0}回合对手每回合受到相当于本次伤害的1/{1}的百分比伤害(可以叠加) +type Effect829 struct{ node.EffectNode } + +func (e *Effect829) Skill_Use() bool { + if len(e.Args()) < 2 || e.Args()[1].Cmp(alpacadecimal.Zero) <= 0 || e.Ctx().Our.SumDamage.Cmp(alpacadecimal.Zero) <= 0 { + return true + } + + damage := e.Ctx().Our.SumDamage.Div(e.Args()[1]) + if damage.Cmp(alpacadecimal.Zero) <= 0 { + return true + } + + sub := e.Ctx().Opp.InitEffect(input.EffectType.Sub, 829, int(e.Args()[0].IntPart()), int(damage.IntPart())) + if effect, ok := sub.(*Effect829Sub); ok { + effect.damage = damage + } + if sub != nil { + e.Ctx().Opp.AddEffect(e.Ctx().Our, sub) + } + return true +} + +type Effect829Sub struct { + node.EffectNode + damage alpacadecimal.Decimal +} + +func (e *Effect829Sub) SetArgs(t *input.Input, a ...int) { + e.EffectNode.SetArgs(t, a...) + e.CanStack(true) + if len(a) > 0 { + e.Duration(a[0]) + } + if len(a) > 1 { + e.damage = alpacadecimal.NewFromInt(int64(a[1])) + } +} + +func (e *Effect829Sub) TurnEnd() { + if e.damage.Cmp(alpacadecimal.Zero) > 0 && e.Ctx().Our.CurrentPet != nil && e.Ctx().Our.CurrentPet.Info.Hp > 0 { + damage := e.damage + if e.Stack() > 1 { + damage = damage.Mul(alpacadecimal.NewFromInt(int64(e.Stack()))) + } + e.Ctx().Our.Damage(e.Ctx().Opp, &info.DamageZone{ + Type: info.DamageType.Percent, + Damage: damage, + }) + } + e.EffectNode.TurnEnd() +} + +func init() { + input.InitEffect(input.EffectType.Skill, 825, &Effect825{}) + input.InitEffect(input.EffectType.Skill, 826, &Effect826{}) + input.InitEffect(input.EffectType.Sub, 826, &Effect826Sub{}) + input.InitEffect(input.EffectType.Skill, 827, &Effect827{}) + input.InitEffect(input.EffectType.Sub, 827, &Effect827PrioritySub{}) + input.InitEffect(input.EffectType.Sub, 8271, &Effect827DamageSub{}) + input.InitEffect(input.EffectType.Skill, 828, &Effect828{}) + input.InitEffect(input.EffectType.Skill, 829, &Effect829{}) + input.InitEffect(input.EffectType.Sub, 829, &Effect829Sub{}) +} diff --git a/logic/service/fight/effect/830_835.go b/logic/service/fight/effect/830_835.go new file mode 100644 index 000000000..92339787d --- /dev/null +++ b/logic/service/fight/effect/830_835.go @@ -0,0 +1,151 @@ +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 830: 若后出手,则免疫本回合受到的伤害 +type Effect830 struct{ node.EffectNode } + +func (e *Effect830) DamageLockEx(zone *info.DamageZone) bool { + if e.IsFirst() || zone == nil { + return true + } + + zone.Damage = alpacadecimal.Zero + return true +} + +func (e *Effect830) DamageDivEx(zone *info.DamageZone) bool { + if e.IsFirst() || zone == nil { + return true + } + + zone.Damage = alpacadecimal.Zero + return true +} + +// Effect 831: 附加自身最大体力{0}%的百分比伤害 +type Effect831 struct{ node.EffectNode } + +func (e *Effect831) OnSkill() bool { + if len(e.Args()) == 0 { + return true + } + + damage := e.Ctx().Our.CurrentPet.GetMaxHP().Mul(e.Args()[0]).Div(hundred) + if damage.Cmp(alpacadecimal.Zero) <= 0 { + return true + } + + e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{ + Type: info.DamageType.Percent, + Damage: damage, + }) + return true +} + +// Effect 833: 当回合若未击败对手则吸取对手最大体力的1/{0} +type Effect833 struct{ node.EffectNode } + +func (e *Effect833) Skill_Use() bool { + if len(e.Args()) == 0 || e.Args()[0].Cmp(alpacadecimal.Zero) <= 0 || e.Ctx().Opp.CurrentPet == nil || e.Ctx().Opp.CurrentPet.Info.Hp <= 0 { + return true + } + + drain := e.Ctx().Opp.CurrentPet.GetMaxHP().Div(e.Args()[0]) + if drain.Cmp(alpacadecimal.Zero) <= 0 { + return true + } + + e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{ + Type: info.DamageType.Percent, + Damage: drain, + }) + e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, drain) + return true +} + +// Effect 834: {0}回合内自身能力提升状态被消除或吸取时,{1}回合内对手属性技能无效 +type Effect834 struct{ node.EffectNode } + +func (e *Effect834) Skill_Use() bool { + if len(e.Args()) < 2 { + return true + } + + sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 834, int(e.Args()[0].IntPart()), int(e.Args()[1].IntPart())) + if sub != nil { + e.Ctx().Our.AddEffect(e.Ctx().Our, sub) + } + return true +} + +type Effect834Sub struct{ RoundEffectArg0Base } + +func (e *Effect834Sub) PropBefer(in *input.Input, prop, level int8) bool { + if in != e.Ctx().Opp || level != 0 || len(e.Args()) < 2 { + return true + } + if e.Ctx().Our.Prop[prop] <= 0 { + return true + } + + sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 8341, int(e.Args()[1].IntPart())) + if sub != nil { + e.Ctx().Opp.AddEffect(e.Ctx().Our, sub) + } + e.Alive(false) + return true +} + +type Effect834SealSub struct{ RoundEffectArg0Base } + +func (e *Effect834SealSub) ActionStart(a, b *action.SelectSkillAction) bool { + if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() != info.Category.STATUS { + return true + } + + e.Ctx().SkillEntity.SetNoSide() + e.Ctx().SkillEntity.AttackTime = 0 + return true +} + +// Effect 835: 反转自身能力下降状态,反转成功则恢复自身全部体力 +type Effect835 struct{ node.EffectNode } + +func (e *Effect835) Skill_Use() 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 { + return true + } + + heal := e.Ctx().Our.CurrentPet.GetMaxHP().Sub(e.Ctx().Our.CurrentPet.GetHP()) + if heal.Cmp(alpacadecimal.Zero) > 0 { + e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, heal) + } + return true +} + +func init() { + input.InitEffect(input.EffectType.Skill, 830, &Effect830{}) + input.InitEffect(input.EffectType.Skill, 831, &Effect831{}) + input.InitEffect(input.EffectType.Skill, 833, &Effect833{}) + input.InitEffect(input.EffectType.Skill, 834, &Effect834{}) + input.InitEffect(input.EffectType.Sub, 834, &Effect834Sub{}) + input.InitEffect(input.EffectType.Sub, 8341, &Effect834SealSub{}) + input.InitEffect(input.EffectType.Skill, 835, &Effect835{}) +} diff --git a/logic/service/fight/effect/836_840.go b/logic/service/fight/effect/836_840.go new file mode 100644 index 000000000..afccc3e78 --- /dev/null +++ b/logic/service/fight/effect/836_840.go @@ -0,0 +1,158 @@ +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 836: 自身体力高于对手时先制+{0} +type Effect836 struct{ node.EffectNode } + +func (e *Effect836) ComparePre(fattack, sattack *action.SelectSkillAction) bool { + if len(e.Args()) == 0 || e.Ctx().Our.CurrentPet.GetHP().Cmp(e.Ctx().Opp.CurrentPet.GetHP()) <= 0 { + return true + } + + current := actionByPlayer(fattack, sattack, e.Ctx().Our.UserID) + if current != nil && current.SkillEntity != nil { + current.SkillEntity.XML.Priority += int(e.Args()[0].IntPart()) + } + return true +} + +// Effect 837: 吸取对手{0}点固定体力,每次使用额外附加{1}点,最高{2}点 +type Effect837 struct{ AddLvelEffect } + +func (e *Effect837) Skill_Use() bool { + if len(e.Args()) < 3 { + return true + } + + damage := e.Args()[0] + if e.UseSkillCount > 1 { + damage = damage.Add(e.Args()[1].Mul(alpacadecimal.NewFromInt(e.UseSkillCount - 1))) + } + if damage.Cmp(e.Args()[2]) > 0 { + damage = e.Args()[2] + } + if damage.Cmp(alpacadecimal.Zero) <= 0 { + return true + } + + e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{ + Type: info.DamageType.Fixed, + Damage: damage, + }) + e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, damage) + return true +} + +// Effect 838: 若当回合未击败对手,则下回合附加{0}点固定伤害 +type Effect838 struct{ node.EffectNode } + +func (e *Effect838) Skill_Use() bool { + if len(e.Args()) == 0 || e.Ctx().Opp.CurrentPet == nil || e.Ctx().Opp.CurrentPet.Info.Hp <= 0 { + return true + } + + sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 838, int(e.Args()[0].IntPart())) + if sub != nil { + e.Ctx().Our.AddEffect(e.Ctx().Our, sub) + } + return true +} + +type Effect838Sub struct{ node.EffectNode } + +func (e *Effect838Sub) SetArgs(t *input.Input, a ...int) { + e.EffectNode.SetArgs(t, a...) + e.Duration(1) +} + +func (e *Effect838Sub) Skill_Use() bool { + if len(e.Args()) == 0 || e.Args()[0].Cmp(alpacadecimal.Zero) <= 0 { + return true + } + + e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{ + Type: info.DamageType.Fixed, + Damage: e.Args()[0], + }) + e.Alive(false) + return true +} + +// Effect 839: 附加自身最大体力{0}%的百分比伤害并恢复等量体力 +type Effect839 struct{ node.EffectNode } + +func (e *Effect839) Skill_Use() bool { + if len(e.Args()) == 0 { + return true + } + + amount := e.Ctx().Our.CurrentPet.GetMaxHP().Mul(e.Args()[0]).Div(hundred) + if amount.Cmp(alpacadecimal.Zero) <= 0 { + return true + } + + e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{ + Type: info.DamageType.Percent, + Damage: amount, + }) + e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, amount) + return true +} + +// Effect 840: 击败对手则对方下只精灵出战时己方在场精灵吸取其最大体力的1/{0} +type Effect840 struct{ node.EffectNode } + +func (e *Effect840) Skill_Use() bool { + if len(e.Args()) == 0 || e.Args()[0].Cmp(alpacadecimal.Zero) <= 0 || e.Ctx().Opp.CurrentPet == nil || e.Ctx().Opp.CurrentPet.Info.Hp > 0 { + return true + } + + sub := e.Ctx().Opp.InitEffect(input.EffectType.Sub, 840, int(e.Args()[0].IntPart())) + if sub != nil { + e.Ctx().Opp.AddEffect(e.Ctx().Our, sub) + } + return true +} + +type Effect840Sub struct{ node.EffectNode } + +func (e *Effect840Sub) SetArgs(t *input.Input, a ...int) { + e.EffectNode.SetArgs(t, a...) + e.CanStack(false) + e.Duration(1) +} + +func (e *Effect840Sub) SwitchIn(in *input.Input) bool { + if in != e.Ctx().Our || len(e.Args()) == 0 || e.Args()[0].Cmp(alpacadecimal.Zero) <= 0 { + return true + } + + drain := e.Ctx().Our.CurrentPet.GetMaxHP().Div(e.Args()[0]) + if drain.Cmp(alpacadecimal.Zero) > 0 { + e.Ctx().Our.Damage(e.Ctx().Opp, &info.DamageZone{ + Type: info.DamageType.Percent, + Damage: drain, + }) + e.Ctx().Opp.Heal(e.Ctx().Opp, &action.SelectSkillAction{}, drain) + } + e.Alive(false) + return true +} + +func init() { + input.InitEffect(input.EffectType.Skill, 836, &Effect836{}) + input.InitEffect(input.EffectType.Skill, 837, &Effect837{}) + input.InitEffect(input.EffectType.Skill, 838, &Effect838{}) + input.InitEffect(input.EffectType.Sub, 838, &Effect838Sub{}) + input.InitEffect(input.EffectType.Skill, 839, &Effect839{}) + input.InitEffect(input.EffectType.Skill, 840, &Effect840{}) + input.InitEffect(input.EffectType.Sub, 840, &Effect840Sub{}) +} diff --git a/logic/service/fight/effect/871_875.go b/logic/service/fight/effect/871_875.go new file mode 100644 index 000000000..2d070ebd8 --- /dev/null +++ b/logic/service/fight/effect/871_875.go @@ -0,0 +1,200 @@ +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 871: 下{0}回合,每回合攻击技能造成的伤害不少于{1} +type Effect871 struct{ node.EffectNode } + +func (e *Effect871) Skill_Use() bool { + if len(e.Args()) < 2 { + return true + } + + sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 871, int(e.Args()[0].IntPart()), int(e.Args()[1].IntPart())) + if sub != nil { + e.Ctx().Our.AddEffect(e.Ctx().Our, sub) + } + return true +} + +type Effect871Sub struct{ RoundEffectArg0Base } + +func (e *Effect871Sub) DamageFloor(zone *info.DamageZone) bool { + if zone == nil || zone.Type != info.DamageType.Red || len(e.Args()) < 2 || e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS || e.Ctx().SkillEntity.AttackTime == 0 { + return true + } + if zone.Damage.Cmp(e.Args()[1]) < 0 { + zone.Damage = e.Args()[1] + } + return true +} + +// Effect 872: 吸取对手能力提升状态,吸取成功则{0}回合内令对手使用的属性技能无效 +type Effect872 struct{ node.EffectNode } + +func (e *Effect872) OnSkill() bool { + if len(e.Args()) == 0 { + return true + } + + cleared := false + for i, v := range e.Ctx().Opp.Prop[:] { + if v <= 0 { + continue + } + if e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), 0) { + e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), v) + cleared = true + } + } + if !cleared { + return true + } + + sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 872, int(e.Args()[0].IntPart())) + if sub != nil { + e.Ctx().Opp.AddEffect(e.Ctx().Our, sub) + } + return true +} + +type Effect872Sub struct{ RoundEffectArg0Base } + +func (e *Effect872Sub) ActionStart(a, b *action.SelectSkillAction) bool { + if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() != info.Category.STATUS { + return true + } + + e.Ctx().SkillEntity.SetNoSide() + e.Ctx().SkillEntity.AttackTime = 0 + return true +} + +// Effect 873: 消耗自身全部体力,消除对手能力提升状态和回合类效果,使己方下只出场精灵下次攻击必定先手、必定命中且造成的伤害翻倍 +type Effect873 struct{ node.EffectNode } + +func (e *Effect873) Skill_Use() bool { + for i, v := range e.Ctx().Opp.Prop[:] { + if v > 0 { + e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), 0) + } + } + e.Ctx().Opp.CancelTurn(e.Ctx().Our) + + e.Ctx().Our.Damage(e.Ctx().Our, &info.DamageZone{ + Type: info.DamageType.Fixed, + Damage: e.Ctx().Our.CurrentPet.GetHP(), + }) + + sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 873) + if sub != nil { + e.Ctx().Our.AddEffect(e.Ctx().Our, sub) + } + return true +} + +type Effect873Sub struct{ node.EffectNode } + +func (e *Effect873Sub) SetArgs(t *input.Input, a ...int) { + e.EffectNode.SetArgs(t, a...) + e.CanStack(false) + e.Duration(-1) +} + +func (e *Effect873Sub) ComparePre(fattack, sattack *action.SelectSkillAction) bool { + 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 += 7 + return true +} + +func (e *Effect873Sub) ActionStart(a, b *action.SelectSkillAction) bool { + if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS { + return true + } + + e.Ctx().SkillEntity.XML.MustHit = 1 + return true +} + +func (e *Effect873Sub) Damage_Mul(zone *info.DamageZone) bool { + if zone == nil || zone.Type != info.DamageType.Red || e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS { + return true + } + + zone.Damage = zone.Damage.Mul(alpacadecimal.NewFromInt(2)) + e.Alive(false) + return true +} + +// Effect 874: {0}回合内若对手造成的伤害低于{1}则免疫该伤害 +type Effect874 struct{ node.EffectNode } + +func (e *Effect874) Skill_Use() bool { + if len(e.Args()) < 2 { + return true + } + + sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 874, int(e.Args()[0].IntPart()), int(e.Args()[1].IntPart())) + if sub != nil { + e.Ctx().Our.AddEffect(e.Ctx().Our, sub) + } + return true +} + +type Effect874Sub struct{ RoundEffectArg0Base } + +func (e *Effect874Sub) DamageLockEx(zone *info.DamageZone) bool { + if zone == nil || len(e.Args()) < 2 { + return true + } + if zone.Damage.Cmp(e.Args()[1]) < 0 { + zone.Damage = alpacadecimal.Zero + } + return true +} + +func (e *Effect874Sub) DamageDivEx(zone *info.DamageZone) bool { + if zone == nil || len(e.Args()) < 2 { + return true + } + if zone.Damage.Cmp(e.Args()[1]) < 0 { + zone.Damage = alpacadecimal.Zero + } + return true +} + +// Effect 875: 消耗自身全部体力,对手所有技能PP值归零,全属性-1 +type Effect875 struct{ node.EffectNode } + +func (e *Effect875) Skill_Use() bool { + zeroAllSkillPP(e.Ctx().Opp) + applyAllPropDown(e.Ctx().Our, e.Ctx().Opp, 1) + e.Ctx().Our.Damage(e.Ctx().Our, &info.DamageZone{ + Type: info.DamageType.Fixed, + Damage: e.Ctx().Our.CurrentPet.GetHP(), + }) + return true +} + +func init() { + input.InitEffect(input.EffectType.Skill, 871, &Effect871{}) + input.InitEffect(input.EffectType.Sub, 871, &Effect871Sub{}) + input.InitEffect(input.EffectType.Skill, 872, &Effect872{}) + input.InitEffect(input.EffectType.Sub, 872, &Effect872Sub{}) + input.InitEffect(input.EffectType.Skill, 873, &Effect873{}) + input.InitEffect(input.EffectType.Sub, 873, &Effect873Sub{}) + input.InitEffect(input.EffectType.Skill, 874, &Effect874{}) + input.InitEffect(input.EffectType.Sub, 874, &Effect874Sub{}) + input.InitEffect(input.EffectType.Skill, 875, &Effect875{}) +} diff --git a/login/go.mod b/login/go.mod index 92ee41adf..20f308efe 100644 --- a/login/go.mod +++ b/login/go.mod @@ -1,6 +1,6 @@ module blazing/login -go 1.25.0 +go 1.25 require ( github.com/gogf/gf/contrib/nosql/redis/v2 v2.8.0 diff --git a/modules/base/go.mod b/modules/base/go.mod index 5e4dcaf99..c74e63952 100644 --- a/modules/base/go.mod +++ b/modules/base/go.mod @@ -1,6 +1,6 @@ module blazing/modules/base -go 1.24.0 +go 1.24 require ( github.com/gogf/gf/v2 v2.8.0 diff --git a/modules/config/go.mod b/modules/config/go.mod index 04063afc5..cbd695c5a 100644 --- a/modules/config/go.mod +++ b/modules/config/go.mod @@ -1,5 +1,5 @@ module blazing/modules/config -go 1.25.0 +go 1.25 require github.com/aidarkhanov/nanoid/v2 v2.0.0-20210915221554-84fce99176fc // indirect