diff --git a/logic/service/fight/effect/197.go b/logic/service/fight/effect/197.go new file mode 100644 index 000000000..6cf9296f7 --- /dev/null +++ b/logic/service/fight/effect/197.go @@ -0,0 +1,31 @@ +package effect + +import ( + "blazing/logic/service/fight/input" + "blazing/logic/service/fight/node" +) + +// 197 - n回合内若被对方击败,则对手所有能力加强状态消失 +type Effect197 struct { + node.EffectNode +} + +func (e *Effect197) SetArgs(t *input.Input, a ...int) { + e.EffectNode.SetArgs(t, a...) + 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) + } + + } + } + + return true +} +func init() { + input.InitEffect(input.EffectType.NewSel, 197, &Effect197{}) +} diff --git a/logic/service/fight/effect/199.go b/logic/service/fight/effect/199.go new file mode 100644 index 000000000..ec39c6bc0 --- /dev/null +++ b/logic/service/fight/effect/199.go @@ -0,0 +1,29 @@ +package effect + +import ( + "blazing/logic/service/fight/input" + "blazing/logic/service/fight/node" +) + +// 199 - 下次被击败后,下一个出场的精灵xx等级+k +type Effect199 struct { + node.EffectNode +} + +func (e *Effect199) SetArgs(t *input.Input, a ...int) { + e.EffectNode.SetArgs(t, a...) + 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) + } + + return true +} +func init() { + input.InitEffect(input.EffectType.NewSel, 199, &Effect199{}) +} diff --git a/logic/service/fight/effect/435.go b/logic/service/fight/effect/435.go deleted file mode 100644 index fad4294f7..000000000 --- a/logic/service/fight/effect/435.go +++ /dev/null @@ -1,82 +0,0 @@ -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" -) - -// 435 - 牺牲自己,使下回合出场的精灵首次攻击必定命中,必定先手 -type Effect435 struct { - node.EffectNode - can bool - can2 bool -} - -func (e *Effect435) SetArgs(t *input.Input, a ...int) { - - //e.CanStack(-1)//后续的不会顶掉这个效果 - e.EffectNode.SetArgs(t, a...) - e.Duration(-1) //次数类,无限回合 - -} - -// 命中之后 -func (e *Effect435) OnSkill() bool { - - e.can = true - e.Ctx().Our.Damage(e.Ctx().Our, &info.DamageZone{ - Type: info.DamageType.Fixed, - Damage: alpacadecimal.NewFromInt(int64(e.Ctx().Our.CurrentPet.Info.MaxHp)), - }) - e.Ctx().Our.CurrentPet.NotAlive = true - return true -} -func (e *Effect435) SwitchOut(in *input.Input) bool { - return true -} -func (e *Effect435) SwitchIn(in *input.Input) bool { - // 1. 检查效果是否生效(当次攻击有效) - if !e.can { - return true - } - // - if in != e.Ctx().Our { - return true - } - - e.can2 = true - return true -} -func (e *Effect435) ComparePre(fattack *action.SelectSkillAction, sattack *action.SelectSkillAction) bool { - if !e.can2 { - return true - } - if fattack == nil { - return true - } - //先手是自己 - if fattack.PlayerID == e.Ctx().Our.UserID { - return true - } - if sattack == nil { - return true - } - if sattack == nil { - return true - } - if sattack.SkillEntity == nil { - return true - } - //对调 - sattack.SkillEntity.XML.Priority += 7 - e.Alive(false) - return true -} -func init() { - input.InitEffect(input.EffectType.Skill, 435, &Effect435{}) - -} diff --git a/logic/service/fight/effect/497.go b/logic/service/fight/effect/497.go index 1a24910af..5690faf38 100644 --- a/logic/service/fight/effect/497.go +++ b/logic/service/fight/effect/497.go @@ -2,13 +2,18 @@ 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/barkimedes/go-deepcopy" ) // 457 - 复制对手释放的技能(组队对战时无效) type Effect457 struct { node.EffectNode + org *info.SkillEntity + reid int } func (e *Effect457) ComparePre(fattack *action.SelectSkillAction, sattack *action.SelectSkillAction) bool { @@ -19,18 +24,41 @@ func (e *Effect457) ComparePre(fattack *action.SelectSkillAction, sattack *actio //先手是自己 if fattack.PlayerID == e.Ctx().Our.UserID { if sattack != nil { - fattack.Accuracy = sattack.SkillEntity.Accuracy + originalSkill, _ := deepcopy.Anything(sattack.SkillEntity) //备份技能 + originalSkill.(*info.SkillEntity).Accuracy = sattack.SkillEntity.Accuracy + e.reid = sattack.SkillEntity.XML.ID + fattack.SkillEntity = originalSkill.(*info.SkillEntity) } else { fattack = nil } } else { - + if fattack != nil { + e.org = sattack.SkillEntity + originalSkill, _ := deepcopy.Anything(fattack.SkillEntity) //备份技能 + originalSkill.(*info.SkillEntity).Accuracy = fattack.SkillEntity.Accuracy + e.reid = fattack.SkillEntity.XML.ID + sattack.SkillEntity = originalSkill.(*info.SkillEntity) + } else { + sattack = nil + } } return true } + +func (e *Effect457) TurnEnd() { + + for _, v := range e.Ctx().Our.CurrentPet.Skills { + if v.XML.ID == e.reid { + v = e.org + + } + + } + +} func init() { input.InitEffect(input.EffectType.Skill, 457, &Effect457{}) diff --git a/logic/service/fight/effect/523.go b/logic/service/fight/effect/523.go new file mode 100644 index 000000000..150620a79 --- /dev/null +++ b/logic/service/fight/effect/523.go @@ -0,0 +1,29 @@ +package effect + +import ( + "blazing/logic/service/fight/input" + "blazing/logic/service/fight/node" +) + +// 523 - 若当回合未击败对手,则自身1 1 1 1 1 1能力+1 +type Effect523 struct { + node.EffectNode +} + +func (e *Effect523) Action_end() bool { + // 检查对手是否还活着 + if e.Ctx().Opp.CurrentPet.Info.Hp > 0 { + // 提升自身的全部能力等级 + for i := 0; i < 6; i++ { + e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), int8(e.SideEffectArgs[i])) + + } + + } + + return true +} +func init() { + input.InitEffect(input.EffectType.Skill, 523, &Effect523{}) + +} diff --git a/logic/service/fight/effect/back.go1 b/logic/service/fight/effect/back.go1 deleted file mode 100644 index 1913a9166..000000000 --- a/logic/service/fight/effect/back.go1 +++ /dev/null @@ -1,77 +0,0 @@ -package effect - -import ( - "blazing/logic/service/fight/info" - "blazing/logic/service/fight/input" - "blazing/logic/service/fight/node" -) - -// 523 - 若当回合未击败对手,则自身1 1 1 1 1 1能力+1 -type Effect523 struct { - node.EffectNode -} - -func (e *Effect523) Action_end_ex() bool { - // 检查对手是否还活着 - if e.Ctx().Opp.CurrentPet.Info.Hp > 0 { - // 提升自身的全部能力等级 - stats := []int{ - int(info.PetStatus.AtkUp), - int(info.PetStatus.DefUp), - int(info.PetStatus.SpAtkUp), - int(info.PetStatus.SpDefUp), - int(info.PetStatus.SpeedUp), - int(info.PetStatus.AccuracyUp), - } - - for _, stat := range stats { - statEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, stat) - if statEffect != nil { - statEffect.SetArgs(e.Ctx().Our, 1) // 提升1级 - e.Ctx().Our.AddEffect(e.Ctx().Our, statEffect) - } - } - } - - return true -} - -// 197 - n回合内若被对方击败,则对手所有能力加强状态消失 -type Effect197 struct { - node.EffectNode -} - -func (e *Effect197) Skill_Use() bool { - if e.Ctx().Our.CurrentPet.Info.Hp <= 0 { // 被击败 - // 清除对手的所有能力加强状态 - e.Ctx().Opp.RemoveAllPositiveBuffs() - } - - return true -} - -func (e *Effect197) SetArgs(t *input.Input, a ...int) { - e.EffectNode.SetArgs(t, a...) - e.EffectNode.Duration(a[0]) // 持续n回合 -} - -// 199 - 下次被击败后,下一个出场的精灵xx等级+k -type Effect199 struct { - node.EffectNode -} - -func (e *Effect199) Skill_Use() bool { - if e.Ctx().Our.CurrentPet.Info.Hp <= 0 { // 被击败 - // 设置下一个出场精灵的增益效果 - effectType := int(e.Args()[0].IntPart()) // xx类型 - effectValue := int(e.Args()[1].IntPart()) // 等级+k - - buffEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, effectType) - if buffEffect != nil { - buffEffect.SetArgs(e.Ctx().Our, effectValue) - e.Ctx().Our.SetNextPetBuff(buffEffect) - } - } - - return true -} diff --git a/logic/service/fight/effect/effect_46.go b/logic/service/fight/effect/effect_46.go index b51ede82d..ead5dc115 100644 --- a/logic/service/fight/effect/effect_46.go +++ b/logic/service/fight/effect/effect_46.go @@ -16,7 +16,7 @@ type Effect46 struct { conut int64 } -func (e *Effect46) DamageDivEx(t *info.DamageZone) bool { +func (e *Effect46) Damage_Shield(t *info.DamageZone) bool { if e.Ctx().SkillEntity == nil { return true diff --git a/logic/service/fight/effect/selfkill.go b/logic/service/fight/effect/selfkill.go index 5faae2abb..4bc63c97a 100644 --- a/logic/service/fight/effect/selfkill.go +++ b/logic/service/fight/effect/selfkill.go @@ -134,6 +134,56 @@ func (e *Effect144) EFFect_Befer(in *input.Input, effEffect input.Effect) bool { return true } +// 435 - 牺牲自己,使下回合出场的精灵首次攻击必定命中,必定先手 +type Effect435 struct { + SelfKill +} + +func (e *Effect435) ComparePre(fattack *action.SelectSkillAction, sattack *action.SelectSkillAction) bool { + if !e.can { + return true + } + if fattack == nil { + return true + } + //先手是自己 + if fattack.PlayerID == e.Ctx().Our.UserID { + return true + } + if sattack == nil { + return true + } + if sattack == nil { + return true + } + if sattack.SkillEntity == nil { + return true + } + //对调 + sattack.SkillEntity.XML.Priority += 7 + e.Alive(false) + return true +} +func (e *Effect435) ActionStart(a, b *action.SelectSkillAction) bool { + + if !e.can { + return true + } + //fmt.Println(e.Ctx().SkillEntity) + if e.Ctx().SkillEntity == nil { + return true + } + if e.Ctx().SkillEntity.Category() == info.Category.STATUS { + return true + } + e.Ctx().SkillEntity.XML.MustHit = 1 + return true +} +func init() { + input.InitEffect(input.EffectType.Skill, 435, &Effect435{}) + +} + /** * 牺牲全部体力造成对手250~300点伤害,造成致命伤害时,对手剩下1点体力 */ diff --git a/logic/service/fight/fightc.go b/logic/service/fight/fightc.go index cf7cf479e..816a0d562 100644 --- a/logic/service/fight/fightc.go +++ b/logic/service/fight/fightc.go @@ -271,19 +271,19 @@ func (f *FightC) enterturn(firstAttack, secondAttack *action.SelectSkillAction) return true }) } - - //技能使用后 - attacker.Exec(func(effect input.Effect) bool { //技能使用后的我方效果 - effect.Ctx().SkillEntity = currentSkill - effect.Action_end() - return true - }) //技能使用后 defender.Exec(func(effect input.Effect) bool { //技能使用后的我方效果 effect.Ctx().SkillEntity = currentSkill effect.Action_end_ex() return true }) + //技能使用后 + attacker.Exec(func(effect input.Effect) bool { //技能使用后的我方效果 + effect.Ctx().SkillEntity = currentSkill + effect.Action_end() + return true + }) + if defender.CurrentPet.Info.Hp <= 0 && attacker.CurrentPet.Info.Hp <= 0 { //先手方死亡,触发反同归于尽 attacker.CurrentPet.Info.Hp = 1 } diff --git a/logic/service/fight/input/fight.go b/logic/service/fight/input/fight.go index 533d6148b..aaaf6db72 100644 --- a/logic/service/fight/input/fight.go +++ b/logic/service/fight/input/fight.go @@ -134,16 +134,6 @@ func (our *Input) Damage(in *Input, sub *info.DamageZone) { return true }) } - - // sub.BeforeLock = sub.Damage - if ok && in != our { - ok = our.Opp.Exec(func(t Effect) bool { - - t.DamageLock(sub) - - return true - }) - } //sub.BeforeLocked = sub.Damage if ok { our.Exec(func(t Effect) bool { @@ -153,10 +143,31 @@ func (our *Input) Damage(in *Input, sub *info.DamageZone) { return true }) } + // sub.BeforeLock = sub.Damage + if ok && in != our { + ok = our.Opp.Exec(func(t Effect) bool { + + t.DamageLock(sub) + + return true + }) + } if sub.Type == info.DamageType.Red { //红才会产生造成伤害 our.Opp.SumDamage = sub.Damage.Add(our.Opp.SumDamage) // 叠加总伤害 这里相当于记录红伤 + } + if ok { + our.Exec(func(t Effect) bool { + + t.Damage_Shield(sub) + + return true + }) + } + if sub.Type == info.DamageType.Red { //红才会产生造成伤害 + our.AttackValue.LostHp += uint32(sub.Damage.IntPart()) //红伤落实 + } if uint32(sub.Damage.IntPart()) > our.CurrentPet.Info.Hp { diff --git a/logic/service/fight/input/input.go b/logic/service/fight/input/input.go index db27f63de..c909d3975 100644 --- a/logic/service/fight/input/input.go +++ b/logic/service/fight/input/input.go @@ -165,7 +165,7 @@ func (our *Input) GenInfo() { our.RemainHp = int32(our.CurrentPet.Info.Hp) our.SkillList = our.CurrentPet.Info.SkillList - our.AttackValue.LostHp = uint32(our.SumDamage.IntPart()) //红伤落实 + // f.Second.SkillList = f.Second.CurrentPet.Info.SkillList // f.Second.RemainHp = int32(f.Second.CurrentPet.Info.Hp) // ret.FAttack = *f.First.AttackValue