From 937ddd0a97afe05da2c40c10a8a632cbf447dadb Mon Sep 17 00:00:00 2001 From: xinian Date: Tue, 17 Mar 2026 13:34:50 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=AE=A0=E7=89=A9?= =?UTF-8?q?=E5=AD=98=E6=B4=BB=E7=8A=B6=E6=80=81=E5=88=A4=E5=AE=9A=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 移除 `NotAlive` 字段,改用 `Alive()` 方法通过 HP 判断存活状态,修正相关效果触发逻辑。 --- logic/service/fight/effect/197.go | 13 ++++--- logic/service/fight/effect/199.go | 13 ++++--- logic/service/fight/effect/495.go | 2 +- logic/service/fight/effect/547.go | 27 +++++++++++++ logic/service/fight/effect/559.go | 43 +++++++++++++++++++++ logic/service/fight/effect/effect_72.go | 2 +- logic/service/fight/effect/selfkill.go | 4 +- logic/service/fight/fightc.go | 2 +- logic/service/fight/info/BattlePetEntity.go | 7 +++- logic/service/fight/input.go | 2 +- logic/service/fight/input/input.go | 2 +- 11 files changed, 99 insertions(+), 18 deletions(-) create mode 100644 logic/service/fight/effect/547.go create mode 100644 logic/service/fight/effect/559.go diff --git a/logic/service/fight/effect/197.go b/logic/service/fight/effect/197.go index 2490bb5c..2ebf6d2c 100644 --- a/logic/service/fight/effect/197.go +++ b/logic/service/fight/effect/197.go @@ -15,13 +15,16 @@ func (e *Effect197) SetArgs(t *input.Input, a ...int) { e.EffectNode.Duration(a[0]) // 持续n回合 } func (e *Effect197) SwitchOut(in *input.Input) bool { - if e.Ctx().Our.CurrentPet.NotAlive { // 被击败 - for i, v := range e.Ctx().Opp.Prop[:] { - if v > 0 { - e.Ctx().Opp.SetProp(e.Ctx().Opp, int8(i), 0) - } + if e.Input == in { + if !e.Ctx().Our.CurrentPet.Alive() { // 被击败 + for i, v := range e.Ctx().Opp.Prop[:] { + if v > 0 { + e.Ctx().Opp.SetProp(e.Ctx().Opp, int8(i), 0) + } + } } + e.Alive(false) } return true diff --git a/logic/service/fight/effect/199.go b/logic/service/fight/effect/199.go index 18645d62..ea394d73 100644 --- a/logic/service/fight/effect/199.go +++ b/logic/service/fight/effect/199.go @@ -15,11 +15,14 @@ func (e *Effect199) SetArgs(t *input.Input, a ...int) { e.EffectNode.Duration(-1) // 持续n回合 } func (e *Effect199) SwitchOut(in *input.Input) bool { - if e.Ctx().Our.CurrentPet.NotAlive { // 被击败 - // 设置下一个出场精灵的增益效果 - effectType := int8(e.Args()[0].IntPart()) // xx类型 - effectValue := int8(e.Args()[1].IntPart()) // 等级+k - e.Ctx().Our.SetProp(e.Ctx().Our, effectType, effectValue) + if e.Input == in { + if !e.Ctx().Our.CurrentPet.Alive() { // 被击败 + // 设置下一个出场精灵的增益效果 + effectType := int8(e.Args()[0].IntPart()) // xx类型 + effectValue := int8(e.Args()[1].IntPart()) // 等级+k + e.Ctx().Our.SetProp(e.Ctx().Our, effectType, effectValue) + } + e.Alive(false) } return true diff --git a/logic/service/fight/effect/495.go b/logic/service/fight/effect/495.go index d197e2f6..e3cc23ee 100644 --- a/logic/service/fight/effect/495.go +++ b/logic/service/fight/effect/495.go @@ -18,7 +18,7 @@ func (e *Effect495) OnSkill() bool { if success { // 秒杀对手 e.Ctx().Opp.CurrentPet.Info.Hp = 0 - e.Ctx().Opp.CurrentPet.NotAlive = true + } } diff --git a/logic/service/fight/effect/547.go b/logic/service/fight/effect/547.go new file mode 100644 index 00000000..112d4bb3 --- /dev/null +++ b/logic/service/fight/effect/547.go @@ -0,0 +1,27 @@ +package effect + +import ( + "blazing/logic/service/fight/input" + "blazing/logic/service/fight/node" +) + +type Effect547 struct { + node.EffectNode +} + +func (e *Effect547) Skill_Use() bool { + fearEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(e.SideEffectArgs[0])) + if fearEffect != nil { + e.Ctx().Opp.AddEffect(e.Ctx().Our, fearEffect) + e.Ctx().Our.AddEffect(e.Ctx().Our, fearEffect) + } + return true +} +func (e *Effect547) SetArgs(t *input.Input, a ...int) { + e.EffectNode.SetArgs(t, a...) + e.EffectNode.Duration(a[1]) // 持续n回合 +} +func init() { + input.InitEffect(input.EffectType.Skill, 547, &Effect547{}) + +} diff --git a/logic/service/fight/effect/559.go b/logic/service/fight/effect/559.go new file mode 100644 index 00000000..8a170a9b --- /dev/null +++ b/logic/service/fight/effect/559.go @@ -0,0 +1,43 @@ +package effect + +import ( + "blazing/logic/service/fight/info" + "blazing/logic/service/fight/input" + "blazing/logic/service/fight/node" + + "github.com/gogf/gf/v2/util/grand" +) + +// "id": 559, +// "argsNum": 1, +// "info": "{0}回合内若对手使用攻击技能则随机进入烧伤、冻伤、中毒、麻痹、害怕、睡眠中的一种异常状态" +// }, +type Effect559 struct { + node.EffectNode +} + +func (e *Effect559) Skill_Use_ex() bool { + if e.Ctx().SkillEntity == nil { + return true + } + + status := []info.EnumPetStatus{ + info.PetStatus.Burned, + info.PetStatus.Frozen, + info.PetStatus.Poisoned, + info.PetStatus.Paralysis, + info.PetStatus.Fear, + info.PetStatus.Sleep, + } + + fearEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(status[grand.Intn(len(status))])) + if fearEffect != nil { + e.Ctx().Opp.AddEffect(e.Ctx().Our, fearEffect) + } + return true +} + +func init() { + input.InitEffect(input.EffectType.Skill, 559, &Effect559{}) + +} diff --git a/logic/service/fight/effect/effect_72.go b/logic/service/fight/effect/effect_72.go index 68107a73..6df15ae9 100644 --- a/logic/service/fight/effect/effect_72.go +++ b/logic/service/fight/effect/effect_72.go @@ -37,7 +37,7 @@ func (e *Effect72) SkillHit() bool { Type: info.DamageType.True, Damage: alpacadecimal.NewFromInt(int64(e.Ctx().Our.CurrentPet.Info.Hp)), }) - e.Ctx().Our.CurrentPet.NotAlive = true + return true } diff --git a/logic/service/fight/effect/selfkill.go b/logic/service/fight/effect/selfkill.go index 0e6e6e24..ad79ff15 100644 --- a/logic/service/fight/effect/selfkill.go +++ b/logic/service/fight/effect/selfkill.go @@ -31,7 +31,7 @@ func (e *SelfKill) OnSkill() bool { Damage: alpacadecimal.NewFromInt(int64(e.Ctx().Our.CurrentPet.Info.MaxHp)), }) e.can = true - e.Ctx().Our.CurrentPet.NotAlive = true + return true } @@ -210,6 +210,6 @@ func (e *Effect112) Skill_Use() bool { Type: info.DamageType.Fixed, Damage: alpacadecimal.Min(alpacadecimal.NewFromInt(n), e.Ctx().Opp.CurrentPet.GetHP().Sub(alpacadecimal.NewFromInt(1))), }) - e.Ctx().Our.CurrentPet.NotAlive = true + return true } diff --git a/logic/service/fight/fightc.go b/logic/service/fight/fightc.go index 816a0d56..4c2242e5 100644 --- a/logic/service/fight/fightc.go +++ b/logic/service/fight/fightc.go @@ -355,7 +355,7 @@ func (f *FightC) enterturn(firstAttack, secondAttack *action.SelectSkillAction) } func (f *FightC) TURNOVER(cur *input.Input) { - cur.CurrentPet.NotAlive = true + f.Broadcast(func(ff *input.Input) { ff.Exec(func(t input.Effect) bool { diff --git a/logic/service/fight/info/BattlePetEntity.go b/logic/service/fight/info/BattlePetEntity.go index 16893f6c..96a7d50d 100644 --- a/logic/service/fight/info/BattlePetEntity.go +++ b/logic/service/fight/info/BattlePetEntity.go @@ -23,10 +23,15 @@ type BattlePetEntity struct { //Status StatusDict //精灵的状态 //能力提升属性 //Prop PropDict - NotAlive bool `struc:"skip"` + //NotAlive bool `struc:"skip"` //DamageZone map[EnumCategory]map[EnumsZoneType]map[EnumsZoneType][]float64 // 三维map 伤害类型-》增还是减-》加还是乘-》值 } +func (t *BattlePetEntity) Alive() bool { + return t.Info.Hp > 0 + +} + // 创建精灵实例 func CreateBattlePetEntity(info model.PetInfo, rand *rand.Rand) *BattlePetEntity { ret := &BattlePetEntity{} diff --git a/logic/service/fight/input.go b/logic/service/fight/input.go index f5250619..4147a49a 100644 --- a/logic/service/fight/input.go +++ b/logic/service/fight/input.go @@ -235,7 +235,7 @@ func initfightready(in *input.Input) (model.FightUserInfo, []model.ReadyFightPet func (f *FightC) IsWin(c *input.Input) bool { for _, v := range f.GetInputByPlayer(c.Player, true).AllPet { - if !v.NotAlive { //如果存活 + if !v.Alive() { //如果存活 return false } } diff --git a/logic/service/fight/input/input.go b/logic/service/fight/input/input.go index c909d397..9bea1c47 100644 --- a/logic/service/fight/input/input.go +++ b/logic/service/fight/input/input.go @@ -89,7 +89,7 @@ func (our *Input) SortPet() { } nonZeroHP = append(nonZeroHP, s) } else { - s.NotAlive = true + zeroHP = append(zeroHP, s) } }