diff --git a/logic/service/fight/effect/197.go b/logic/service/fight/effect/197.go index 2490bb5c8..2ebf6d2c6 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 18645d628..ea394d73d 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 d197e2f6e..e3cc23eef 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 000000000..112d4bb36 --- /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 000000000..8a170a9b2 --- /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 68107a73e..6df15ae91 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 0e6e6e248..ad79ff151 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 816a0d562..4c2242e52 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 16893f6c8..96a7d50da 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 f52506190..4147a49a0 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 c909d3975..9bea1c476 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) } }