diff --git a/logic/service/fight/effect/effect_107.go b/logic/service/fight/effect/effect_107.go new file mode 100644 index 00000000..f578f886 --- /dev/null +++ b/logic/service/fight/effect/effect_107.go @@ -0,0 +1,37 @@ +package effect + +import ( + "blazing/logic/service/fight/info" + "blazing/logic/service/fight/input" + "blazing/logic/service/fight/node" + + "github.com/shopspring/decimal" +) + +//若本次攻击造成的伤害小于n 则自身xx等级提升1个等级 + +func init() { + input.InitEffect(input.EffectType.Skill, 107, &Effect107{ + EffectNode: node.EffectNode{}, + }) + +} + +type Effect107 struct { + node.EffectNode +} + +// 我方使用效果 +func (e *Effect107) Skill_Useed() bool { + if !e.Hit() { + return true + } + + d := e.Ctx().Our.DamageZone.Damage.Cmp(decimal.NewFromInt(int64(e.SideEffectArgs[0]))) + //说明伤害小于N + if d == -1 { + + e.Ctx().Our.SetProp(e.Ctx().Our, int8(e.Args()[1]), 1, info.AbilityOpType.ADD) + } + return true +} diff --git a/logic/service/fight/effect/effect_115.go b/logic/service/fight/effect/effect_115.go new file mode 100644 index 00000000..3978bdcc --- /dev/null +++ b/logic/service/fight/effect/effect_115.go @@ -0,0 +1,42 @@ +package effect + +import ( + "blazing/logic/service/fight/info" + "blazing/logic/service/fight/input" + "blazing/logic/service/fight/node" + + "github.com/shopspring/decimal" +) + +/** + * n%几率附加速度的1/m伤害 + */ + +func init() { + input.InitEffect(input.EffectType.Skill, 115, &Effect115{ + EffectNode: node.EffectNode{}, + }) + +} + +type Effect115 struct { + node.EffectNode +} + +func (e *Effect115) OnSkill() bool { + if !e.Hit() { + return true + } + // 概率判定 + ok, _, _ := e.Input.Player.Roll(e.Args()[0], 100) + if !ok { + return true + } + rr := decimal.NewFromInt(1).Div(decimal.NewFromInt(int64(e.SideEffectArgs[1]))) + + e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{ + Type: info.DamageType.Fixed, + Damage: rr.Mul(decimal.NewFromInt(int64(e.Ctx().Our.GetProp(4, true)))), + }) + return true +} diff --git a/logic/service/fight/effect/effect_116.go b/logic/service/fight/effect/effect_116.go new file mode 100644 index 00000000..927343fb --- /dev/null +++ b/logic/service/fight/effect/effect_116.go @@ -0,0 +1,45 @@ +package effect + +import ( + "blazing/logic/service/fight/action" + "blazing/logic/service/fight/input" + "blazing/logic/service/fight/node" + + "github.com/shopspring/decimal" +) + +/** + * n回合,若自己先手,则伤害的1/5回复体力 + */ + +func init() { + t := &Effect116{ + EffectNode: node.EffectNode{}, + } + // t.Duration(-1) //设置成无限回合,到回合数就停止 + input.InitEffect(input.EffectType.Skill, 116, t) + +} + +type Effect116 struct { + node.EffectNode +} + +// 默认添加回合 +func (e *Effect116) SetArgs(t *input.Input, a ...int) { + + e.EffectNode.SetArgs(t, a...) + e.EffectNode.Duration(e.EffectNode.SideEffectArgs[0]) + +} +func (e *Effect116) Skill_Useed() bool { + if !e.Hit() { + return true + } + + if e.Input.FightC.IsFirst(e.Input.Player) { + e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, e.Ctx().Our.DamageZone.Damage.Mul(decimal.NewFromInt(5))) + } + + return true +} diff --git a/logic/service/fight/effect/effect_134.go b/logic/service/fight/effect/effect_134.go new file mode 100644 index 00000000..0b274f80 --- /dev/null +++ b/logic/service/fight/effect/effect_134.go @@ -0,0 +1,41 @@ +package effect + +import ( + "blazing/logic/service/fight/info" + "blazing/logic/service/fight/input" + "blazing/logic/service/fight/node" + + "github.com/shopspring/decimal" +) + +/** + * 若造成的伤害低于n,则所有技能的PP值提高m点 + */ + +func init() { + input.InitEffect(input.EffectType.Skill, 134, &Effect134{}) + +} + +type Effect134 struct { + node.EffectNode +} + +func (e *Effect134) Damage_Floor(t *info.DamageZone) bool { + if !e.Hit() { + return true + } + // fmt.Println("Effect134_old", t.Damage.IntPart()) + if t.Type == info.DamageType.Red { + + is := t.Damage.Cmp(decimal.NewFromInt(int64(e.Args()[0]))) + if is == -1 { + + e.Ctx().Our.HealPP(e.Args()[1]) + + } + + } + //fmt.Println("Effect134_new", t.Damage.IntPart()) + return true +} diff --git a/logic/service/fight/effect/effect_135.go b/logic/service/fight/effect/effect_135.go new file mode 100644 index 00000000..70b91ac6 --- /dev/null +++ b/logic/service/fight/effect/effect_135.go @@ -0,0 +1,36 @@ +package effect + +import ( + "blazing/logic/service/fight/info" + "blazing/logic/service/fight/input" + "blazing/logic/service/fight/node" + + "github.com/shopspring/decimal" +) + +/** + * 造成的伤害不会低于n + */ + +func init() { + input.InitEffect(input.EffectType.Skill, 135, &Effect135{}) + +} + +type Effect135 struct { + node.EffectNode +} + +func (e *Effect135) Damage_Floor(t *info.DamageZone) bool { + if !e.Hit() { + return true + } + // fmt.Println("Effect135_old", t.Damage.IntPart()) + if t.Type == info.DamageType.Red { + + t.Damage = decimal.Max(t.Damage, decimal.NewFromInt(int64(e.Args()[0]))) + + } + //fmt.Println("Effect135_new", t.Damage.IntPart()) + return true +} diff --git a/logic/service/fight/effect/effect_136.go b/logic/service/fight/effect/effect_136.go new file mode 100644 index 00000000..5ce24010 --- /dev/null +++ b/logic/service/fight/effect/effect_136.go @@ -0,0 +1,33 @@ +package effect + +import ( + "blazing/logic/service/fight/action" + "blazing/logic/service/fight/input" + "blazing/logic/service/fight/node" + + "github.com/shopspring/decimal" +) + +/** + * 若Miss则自己恢复1/n体力 + */ +type Effect136 struct { + node.EffectNode +} + +func init() { + ret := &Effect136{} + + input.InitEffect(input.EffectType.Skill, 136, ret) + +} + +// 命中之后 +func (e *Effect136) OnSkill() bool { + if !e.Hit() { + heal := e.Ctx().Our.CurrentPet.GetMaxHP().Div(decimal.NewFromInt(int64(e.Args()[0]))) + e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, heal) + } + + return true +} diff --git a/logic/service/fight/effect/effect_59.go b/logic/service/fight/effect/effect_59.go index 99b8cbda..07ec0b95 100644 --- a/logic/service/fight/effect/effect_59.go +++ b/logic/service/fight/effect/effect_59.go @@ -46,7 +46,7 @@ func (e *Effect59) Switch(in *input.Input, at info.AttackValue, oldpet *info.Bat if !e.can { return true } - // 2. 过滤我方切精灵的情况(只处理对方切精灵) + // if in != e.Ctx().Our { return true } diff --git a/logic/service/fight/effect/effect_68.go b/logic/service/fight/effect/effect_68.go new file mode 100644 index 00000000..eb9cd450 --- /dev/null +++ b/logic/service/fight/effect/effect_68.go @@ -0,0 +1,46 @@ +package effect + +import ( + "blazing/logic/service/fight/info" + "blazing/logic/service/fight/input" + "blazing/logic/service/fight/node" +) + +// 1回合内,受到致死攻击时则余下1点体力 +// ---- Effect68 ---- +type Effect68 struct { + node.EffectNode + StatusID int +} + +func (e *Effect68) Skill_Use_ex() bool { + if !e.Hit() { + return true + } + if e.Ctx().SkillEntity == nil { + return true + } + if e.Ctx().SkillEntity.Category() == info.Category.STATUS { + return true + } + + //fmt.Println("Effect68_o", t.Damage) + //伤害溢出 + if e.Ctx().Opp.DamageZone.Damage.Cmp(e.Ctx().Our.CurrentPet.GetHP()) == 1 { + e.Ctx().Our.CurrentPet.Info.Hp = 1 + + } + //fmt.Println("Effect68_n", t.Damage) + return true +} +func (e *Effect68) SetArgs(t *input.Input, a ...int) { + + e.EffectNode.SetArgs(t, a...) + e.EffectNode.Duration(e.EffectNode.SideEffectArgs[1]) + +} + +// ---- 注册所有效果 ---- +func init() { + input.InitEffect(input.EffectType.Skill, 68, &Effect68{}) +} diff --git a/logic/service/fight/effect/effect_71.go b/logic/service/fight/effect/effect_71.go new file mode 100644 index 00000000..3eab6b98 --- /dev/null +++ b/logic/service/fight/effect/effect_71.go @@ -0,0 +1,62 @@ +package effect + +import ( + "blazing/logic/service/fight/info" + "blazing/logic/service/fight/input" + "blazing/logic/service/fight/node" + + "github.com/shopspring/decimal" +) + +/** + * 自己牺牲(体力降到0), 使下一只出战精灵在前两回合内必定致命一击 + */ +type Effect71 struct { + node.EffectNode + can bool +} + +func init() { + + input.InitEffect(input.EffectType.Skill, 59, &Effect71{}) + +} +func (e *Effect71) SetArgs(t *input.Input, a ...int) { + + //e.MaxStack(-1)//后续的不会顶掉这个效果 + e.EffectNode.SetArgs(t, a...) + e.Duration(-1) //次数类,无限回合 + +} + +// 命中之后 +func (e *Effect71) OnSkill() bool { + if !e.Hit() { + return true + } + e.can = true + e.Ctx().Our.Damage(e.Ctx().Our, &info.DamageZone{ + Type: info.DamageType.Fixed, + Damage: decimal.NewFromInt(int64(e.Ctx().Our.CurrentPet.Info.MaxHp)), + }) + return true +} +func (e *Effect71) Switch(in *input.Input, at info.AttackValue, oldpet *info.BattlePetEntity) bool { + // 1. 检查效果是否生效(当次攻击有效) + if !e.can { + return true + } + + if in != e.Ctx().Our { + return true + } + + t := input.Geteffect(input.EffectType.Skill, 58) + if t != nil { + e.SetArgs(e.Ctx().Our, 2) + e.Ctx().Our.AddEffect(e.Ctx().Our, e) + + } + e.Alive(false) + return true +} diff --git a/logic/service/fight/effect/effect_72.go b/logic/service/fight/effect/effect_72.go new file mode 100644 index 00000000..88d7f871 --- /dev/null +++ b/logic/service/fight/effect/effect_72.go @@ -0,0 +1,35 @@ +package effect + +import ( + "blazing/logic/service/fight/info" + "blazing/logic/service/fight/input" + "blazing/logic/service/fight/node" + + "github.com/shopspring/decimal" +) + +/** + * 如果此回合miss,则立即死亡 + */ +type Effect72 struct { + node.EffectNode +} + +func init() { + ret := &Effect72{} + + input.InitEffect(input.EffectType.Skill, 72, ret) + +} + +// 命中之后 +func (e *Effect72) OnSkill() bool { + if !e.Hit() { + e.Ctx().Our.Damage(e.Ctx().Our, &info.DamageZone{ + Type: info.DamageType.True, + Damage: decimal.NewFromInt(int64(e.Ctx().Our.CurrentPet.Info.Hp)), + }) + } + + return true +} diff --git a/logic/service/fight/effect/effect_76.go b/logic/service/fight/effect/effect_76.go new file mode 100644 index 00000000..cb7feccc --- /dev/null +++ b/logic/service/fight/effect/effect_76.go @@ -0,0 +1,46 @@ +package effect + +import ( + "blazing/logic/service/fight/info" + "blazing/logic/service/fight/input" + "blazing/logic/service/fight/node" + + "github.com/shopspring/decimal" +) + +/** + * 有m%的几率在n回合内,每回合造成k点固定伤害 + */ + +func init() { + input.InitEffect(input.EffectType.Skill, 76, &Effect76{ + EffectNode: node.EffectNode{}, + }) + +} + +type Effect76 struct { + node.EffectNode +} + +func (e *Effect76) OnSkill() bool { + if !e.Hit() { + return true + } + // 概率判定 + ok, _, _ := e.Input.Player.Roll(e.Args()[0], 100) + if !ok { + return true + } + e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{ + Type: info.DamageType.Fixed, + Damage: decimal.NewFromInt(int64(e.SideEffectArgs[2])), + }) + return true +} +func (e *Effect76) SetArgs(t *input.Input, a ...int) { + + e.EffectNode.SetArgs(t, a...) + e.EffectNode.Duration(e.EffectNode.SideEffectArgs[1]) + +} diff --git a/logic/service/fight/effect/effect_83.go b/logic/service/fight/effect/effect_83.go new file mode 100644 index 00000000..e823cc97 --- /dev/null +++ b/logic/service/fight/effect/effect_83.go @@ -0,0 +1,86 @@ +package effect + +import ( + "blazing/logic/service/fight/action" + "blazing/logic/service/fight/info" + "blazing/logic/service/fight/input" + "blazing/logic/service/fight/node" +) + +/** + * 自身雄性,下两回合必定先手;自身雌性,下两回合必定致命一击 + */ + +func init() { + input.InitEffect(input.EffectType.Skill, 83, &Effect83{}) + +} + +type Effect83 struct { + node.EffectNode + can bool +} + +func (e *Effect83) OnSkill() bool { + if !e.Hit() { + return true + } + e.can = true + + return true +} + +func (e *Effect83) Compare_Pre(fattack *action.SelectSkillAction, sattack *action.SelectSkillAction) bool { + if !e.Hit() { + return true + } + if !e.can { + return true + } + + if e.Ctx().Our.CurrentPet.Gender != 2 { + return true + } + + if fattack == nil { + return true + } + //先手是自己 + if fattack.PlayerID == e.Ctx().Our.UserID { + return true + } + //对调 + *fattack, *sattack = *sattack, *fattack + return true +} + +// /自身雄性,下两回合必定先手;自身雌性,下两回合必定致命一击 +func (e *Effect83) Skill_Hit_Pre(a, b *action.SelectSkillAction) bool { + if !e.Hit() { + return true + } + 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 + } + if e.Ctx().Our.CurrentPet.Gender != 1 { + return true + } + + e.Ctx().SkillEntity.CritRate = 16 + + return true +} +func (e *Effect83) SetArgs(t *input.Input, a ...int) { + + e.EffectNode.SetArgs(t, a...) + + e.EffectNode.Duration(2) + +} diff --git a/logic/service/fight/effect/effect_88.go b/logic/service/fight/effect/effect_88.go new file mode 100644 index 00000000..688368ac --- /dev/null +++ b/logic/service/fight/effect/effect_88.go @@ -0,0 +1,42 @@ +package effect + +import ( + "blazing/logic/service/fight/info" + "blazing/logic/service/fight/input" + "blazing/logic/service/fight/node" + + "github.com/shopspring/decimal" +) + +/** + * n%几率伤害为m倍 + */ + +func init() { + input.InitEffect(input.EffectType.Skill, 88, &Effect88{ + EffectNode: node.EffectNode{}, + }) + +} + +type Effect88 struct { + node.EffectNode +} + +func (e *Effect88) Damage_Mul(t *info.DamageZone) bool { + if !e.Hit() { + return true + } + // 概率判定 + ok, _, _ := e.Input.Player.Roll(e.Args()[0], 100) + if !ok { + return true + } + if t.Type == info.DamageType.Red { + + e.Ctx().Our.DamageZone.Damage = e.Ctx().Our.DamageZone.Damage.Mul(decimal.NewFromInt(int64(e.SideEffectArgs[1]))) + + } + + return true +} diff --git a/logic/service/fight/effect/effect_90.go b/logic/service/fight/effect/effect_90.go new file mode 100644 index 00000000..3cb6d27c --- /dev/null +++ b/logic/service/fight/effect/effect_90.go @@ -0,0 +1,44 @@ +package effect + +import ( + "blazing/logic/service/fight/info" + "blazing/logic/service/fight/input" + "blazing/logic/service/fight/node" + + "github.com/shopspring/decimal" +) + +/** + * n回合内,自身造成的伤害为m倍 + */ + +func init() { + input.InitEffect(input.EffectType.Skill, 90, &Effect90{ + EffectNode: node.EffectNode{}, + }) + +} + +type Effect90 struct { + node.EffectNode +} + +func (e *Effect90) Damage_Mul(t *info.DamageZone) bool { + if !e.Hit() { + return true + } + + if t.Type == info.DamageType.Red { + + e.Ctx().Our.DamageZone.Damage = e.Ctx().Our.DamageZone.Damage.Mul(decimal.NewFromInt(int64(e.SideEffectArgs[1]))) + + } + + return true +} +func (e *Effect90) SetArgs(t *input.Input, a ...int) { + + e.EffectNode.SetArgs(t, a...) + e.EffectNode.Duration(e.EffectNode.SideEffectArgs[0]) + +} diff --git a/logic/service/fight/effect/effect_98.go b/logic/service/fight/effect/effect_98.go new file mode 100644 index 00000000..c383814d --- /dev/null +++ b/logic/service/fight/effect/effect_98.go @@ -0,0 +1,48 @@ +package effect + +import ( + "blazing/logic/service/fight/info" + "blazing/logic/service/fight/input" + "blazing/logic/service/fight/node" + + "github.com/shopspring/decimal" +) + +/** + *n回合内,对雄性精灵的伤害为m倍 + */ + +func init() { + input.InitEffect(input.EffectType.Skill, 98, &Effect98{ + EffectNode: node.EffectNode{}, + }) + +} + +type Effect98 struct { + node.EffectNode +} + +func (e *Effect98) Damage_Mul(t *info.DamageZone) bool { + if !e.Hit() { + return true + } + + if e.Ctx().Opp.CurrentPet.Gender != 1 { + return true + } + + if t.Type == info.DamageType.Red { + + e.Ctx().Our.DamageZone.Damage = e.Ctx().Our.DamageZone.Damage.Mul(decimal.NewFromInt(int64(e.SideEffectArgs[1]))) + + } + + return true +} +func (e *Effect98) SetArgs(t *input.Input, a ...int) { + + e.EffectNode.SetArgs(t, a...) + e.EffectNode.Duration(e.EffectNode.SideEffectArgs[0]) + +} diff --git a/logic/service/fight/fightc.go b/logic/service/fight/fightc.go index 11365b43..79c9f6c0 100644 --- a/logic/service/fight/fightc.go +++ b/logic/service/fight/fightc.go @@ -27,13 +27,13 @@ func (f *FightC) processSkillAttack(attacker, defender *input.Input, a *info.Ski }) attacker.AttackValue.AttackTime = a.AttackTime //是否命中赋值 - attacker.Exec(func(t input.Effect) bool { //计算命中 miss改命中 - //计算视为效果 - t.Ctx().SkillEntity = a - t.Calculate_Pre() //相当于先调整基础命中,不光调整命中,这里还能调整技能属性,暴击率 + // attacker.Exec(func(t input.Effect) bool { //计算命中 miss改命中 + // //计算视为效果 + // t.Ctx().SkillEntity = a + // t.Calculate_Pre() //相当于先调整基础命中,不光调整命中,这里还能调整技能属性,暴击率 - return true - }) + // return true + // }) attacker.Exec(func(t input.Effect) bool { //计算变威力 t.Ctx().SkillEntity = a @@ -45,9 +45,9 @@ func (f *FightC) processSkillAttack(attacker, defender *input.Input, a *info.Ski //技能miss+效果生效 这里属于强制改命中效果,但是正常来说,技能miss掉后效果也应该失效 //技能失效+效果失效 // 记录技能信息 - attacker.SkillID = uint32(a.ID) //获取技能ID - if attacker.AttackTime > 0 { //如果命中 + if attacker.AttackTime > 0 { //如果命中 + attacker.SkillID = uint32(a.ID) //获取技能ID attacker.CalculateCrit(defender, a) //暴击计算 attacker.IsCritical = a.Crit diff --git a/logic/service/fight/input/interface.go b/logic/service/fight/input/interface.go index af2c9f6a..d5cd2220 100644 --- a/logic/service/fight/input/interface.go +++ b/logic/service/fight/input/interface.go @@ -16,8 +16,8 @@ type Effect interface { Skill_Hit() bool //这是是命中后的对技能的修改,比如变威力 Skill_Hit_ex() bool // 技能命中前触发//预处理受击技能 被攻击方效果,比如受击时无效技能这样 - Calculate_Pre() bool //视为 无视效果,相当于这里对敌方的修改 - OnSkill() bool // 触发on miss onhit + //Calculate_Pre() bool //视为 无视效果,相当于这里对敌方的修改 + OnSkill() bool // 触发on miss onhit //Skill_Can() bool //使用技能 可以取消用技能节点 技能无效节点锁定伤害加上 Damage_ADD(*info.DamageZone) bool // 攻击前触发 ,这时候就是+区间 diff --git a/logic/service/fight/node/skill.go b/logic/service/fight/node/skill.go index ea09463f..3eff4ad6 100644 --- a/logic/service/fight/node/skill.go +++ b/logic/service/fight/node/skill.go @@ -8,9 +8,10 @@ import ( func (e *EffectNode) Skill_Pre() bool { return true } -func (e *EffectNode) Calculate_Pre() bool { - return true -} + +// func (e *EffectNode) Calculate_Pre() bool { +// return true +// } func (e *EffectNode) Skill_Hit() bool { return true