diff --git a/logic/service/fight/effect/146.go b/logic/service/fight/effect/146.go new file mode 100644 index 00000000..f6238d3a --- /dev/null +++ b/logic/service/fight/effect/146.go @@ -0,0 +1,36 @@ +package effect + +import ( + "blazing/logic/service/fight/info" + "blazing/logic/service/fight/input" + "blazing/logic/service/fight/node" +) + +// 146 - n回合内,受到物理攻击时有m%几率使对方中毒 +type Effect146 struct { + node.EffectNode +} + +func (e *Effect146) Skill_Use_ex() bool { + if e.Ctx().SkillEntity != nil && e.Ctx().SkillEntity.Category() == info.Category.PHYSICAL { + chance := e.Args()[1].IntPart() // m% + success, _, _ := e.Input.Player.Roll(int(chance), 100) + if success { + poisonEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.Poisoned)) + if poisonEffect != nil { + e.Ctx().Opp.AddEffect(e.Ctx().Our, poisonEffect) + } + } + } + + return true +} + +func (e *Effect146) SetArgs(t *input.Input, a ...int) { + e.EffectNode.SetArgs(t, a...) + e.EffectNode.Duration(a[0]) // 持续n回合 +} +func init() { + input.InitEffect(input.EffectType.Skill, 146, &Effect146{}) + +} diff --git a/logic/service/fight/effect/149.go b/logic/service/fight/effect/149.go new file mode 100644 index 00000000..314531ee --- /dev/null +++ b/logic/service/fight/effect/149.go @@ -0,0 +1,44 @@ +package effect + +import ( + "blazing/logic/service/fight/input" + "blazing/logic/service/fight/node" +) + +// 149 - 命中后,n%令对方xx,m%令对方XX +type Effect149 struct { + node.EffectNode +} + +func (e *Effect149) OnSkill() bool { + + // n%令对方xx + firstChance := e.Args()[0].IntPart() + success1, _, _ := e.Input.Player.Roll(int(firstChance), 100) + if success1 { + effectType1 := int(e.Args()[2].IntPart()) // 第一个异常状态类型 + + statusEffect1 := e.Ctx().Our.InitEffect(input.EffectType.Status, effectType1) + if statusEffect1 != nil { + e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect1) + } + } + + // m%令对方XX + secondChance := e.Args()[1].IntPart() + success2, _, _ := e.Input.Player.Roll(int(secondChance), 100) + if success2 { + effectType2 := int(e.Args()[3].IntPart()) // 第二个异常状态类型 + + statusEffect2 := e.Ctx().Our.InitEffect(input.EffectType.Status, effectType2) + if statusEffect2 != nil { + e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect2) + } + } + + return true +} +func init() { + input.InitEffect(input.EffectType.Skill, 149, &Effect149{}) + +} diff --git a/logic/service/fight/effect/176.go b/logic/service/fight/effect/176.go new file mode 100644 index 00000000..9964e094 --- /dev/null +++ b/logic/service/fight/effect/176.go @@ -0,0 +1,42 @@ +package effect + +import ( + "blazing/logic/service/fight/info" + "blazing/logic/service/fight/input" + "blazing/logic/service/fight/node" +) + +// 176 - n%几率令对手随机进入烧伤、冻伤、中毒、麻痹、害怕、睡眠中的一种异常状态 +type Effect176 struct { + node.EffectNode +} + +func (e *Effect176) OnSkill() bool { + chance := e.Args()[0].IntPart() + success, _, _ := e.Input.Player.Roll(int(chance), 100) + + if success { + statusTypes := []int{ + int(info.PetStatus.Burned), + int(info.PetStatus.Frozen), + int(info.PetStatus.Poisoned), + int(info.PetStatus.Paralysis), + int(info.PetStatus.Fear), + int(info.PetStatus.Sleep), + } + + randomIndex := int(e.Input.FightC.GetRand().Int31n(int32(len(statusTypes)))) + selectedStatus := statusTypes[randomIndex] + + statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, selectedStatus) + if statusEffect != nil { + e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect) + } + } + + return true +} +func init() { + input.InitEffect(input.EffectType.Skill, 176, &Effect176{}) + +} diff --git a/logic/service/fight/effect/179.go b/logic/service/fight/effect/179.go new file mode 100644 index 00000000..78cf2799 --- /dev/null +++ b/logic/service/fight/effect/179.go @@ -0,0 +1,28 @@ +package effect + +import ( + "blazing/logic/service/fight/input" + "blazing/logic/service/fight/node" +) + +// 179 - 若属性相同则技能威力提升n +type Effect179 struct { + node.EffectNode +} + +func (e *Effect179) SkillHit() bool { + if e.Ctx().SkillEntity == nil { + return true + } + + if e.Ctx().Our.CurrentPet.Type == e.Ctx().Opp.CurrentPet.Type { + // 属性相同,技能威力提升n + e.Ctx().SkillEntity.Power += int(e.Args()[0].IntPart()) + } + + return true +} +func init() { + input.InitEffect(input.EffectType.Skill, 179, &Effect179{}) + +} diff --git a/logic/service/fight/effect/190.go b/logic/service/fight/effect/190.go new file mode 100644 index 00000000..7811f8c3 --- /dev/null +++ b/logic/service/fight/effect/190.go @@ -0,0 +1,34 @@ +package effect + +import ( + "blazing/logic/service/fight/info" + "blazing/logic/service/fight/input" + "blazing/logic/service/fight/node" +) + +// 190 - n回合内,若受到攻击,消除对手所有能力强化状态 +type Effect190 struct { + node.EffectNode +} + +func (e *Effect190) Skill_Use_ex() bool { + if e.Ctx().SkillEntity == nil { + return true + } + + // 消除对手所有能力强化状态 + for i, _ := range e.Ctx().Opp.Prop[:] { + e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), 1, info.AbilityOpType.RESET) + } + + return true +} + +func (e *Effect190) SetArgs(t *input.Input, a ...int) { + e.EffectNode.SetArgs(t, a...) + e.EffectNode.Duration(a[0]) // 持续n回合 +} +func init() { + input.InitEffect(input.EffectType.Skill, 190, &Effect190{}) + +} diff --git a/logic/service/fight/effect/194.go b/logic/service/fight/effect/194.go new file mode 100644 index 00000000..6d48dbc2 --- /dev/null +++ b/logic/service/fight/effect/194.go @@ -0,0 +1,34 @@ +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" +) + +// 194 - 造成伤害的1/n回复自身体力,若对手XX,则造成伤害的1/m回复自身体力 +type Effect194 struct { + node.EffectNode +} + +func (e *Effect194) SkillUseed() bool { + damageDone := e.Ctx().Our.SumDamage + + var healAmount alpacadecimal.Decimal + if e.Ctx().Opp.StatEffect_Exist(info.EnumPetStatus(e.Args()[1].IntPart())) { // 假设有检查异常状态的方法 + healAmount = damageDone.Div(e.Args()[2]) // 1/m + } else { + healAmount = damageDone.Div(e.Args()[0]) // 1/n + } + + e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, healAmount) + + return true +} +func init() { + input.InitEffect(input.EffectType.Skill, 194, &Effect194{}) + +} diff --git a/logic/service/fight/effect/200.go b/logic/service/fight/effect/200.go new file mode 100644 index 00000000..71e1259c --- /dev/null +++ b/logic/service/fight/effect/200.go @@ -0,0 +1,36 @@ +package effect + +import ( + "blazing/logic/service/fight/input" + "blazing/logic/service/fight/node" +) + +// 200 - 若对手处于能力提升状态,n%几率令对手XX +type Effect200 struct { + node.EffectNode +} + +func (e *Effect200) OnSkill() bool { + + for _, v := range e.Ctx().Opp.Prop[:] { + if v > 0 { + chance := e.Args()[0].IntPart() + success, _, _ := e.Input.Player.Roll(int(chance), 100) + if success { + effectType := int(e.Args()[1].IntPart()) // XX类型 + + statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, effectType) + if statusEffect != nil { + e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect) + } + } + } + + } + + return true +} +func init() { + input.InitEffect(input.EffectType.Skill, 200, &Effect200{}) + +} diff --git a/logic/service/fight/effect/201.go b/logic/service/fight/effect/201.go new file mode 100644 index 00000000..1174f71e --- /dev/null +++ b/logic/service/fight/effect/201.go @@ -0,0 +1,29 @@ +package effect + +import ( + "blazing/logic/service/fight/node" +) + +// 201 - 组队时恢复己方1/n的体力 +type Effect201 struct { + node.EffectNode +} + +// func (e *Effect201) OnSkill() bool { +// // 检查是否在组队战斗中 +// if e.Ctx().IsTeamBattle { +// // 计算恢复量 +// team := e.Ctx().Our.TeamPets // 假设有队伍宠物列表 +// for _, pet := range team { +// if pet.Info.Hp > 0 { // 只恢复还活着的宠物 +// maxHp := pet.GetMaxHP() +// healAmount := maxHp.Div(e.Args()[0]) // 1/n + +// // 恢复体力 +// pet.Heal(pet, &action.SelectSkillAction{}, healAmount) +// } +// } +// } + +// return true +// } diff --git a/logic/service/fight/effect/410.go b/logic/service/fight/effect/410.go new file mode 100644 index 00000000..cdfc1bb5 --- /dev/null +++ b/logic/service/fight/effect/410.go @@ -0,0 +1,30 @@ +package effect + +import ( + "blazing/logic/service/fight/action" + "blazing/logic/service/fight/input" + "blazing/logic/service/fight/node" +) + +// 410 - n%回复自身1/m体力值 +type Effect410 struct { + node.EffectNode +} + +func (e *Effect410) OnSkill() bool { + chance := e.Args()[0].IntPart() + success, _, _ := e.Input.Player.Roll(int(chance), 100) + + if success { + maxHp := e.Ctx().Our.CurrentPet.GetMaxHP() + healAmount := maxHp.Div(e.Args()[1]) // 1/m + + e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, healAmount) + } + + return true +} +func init() { + input.InitEffect(input.EffectType.Skill, 410, &Effect410{}) + +} diff --git a/logic/service/fight/effect/417.go b/logic/service/fight/effect/417.go new file mode 100644 index 00000000..664ce708 --- /dev/null +++ b/logic/service/fight/effect/417.go @@ -0,0 +1,37 @@ +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" +) + +// 417 - n回合内自身攻击技能造成伤害的m%会恢复自身体力 +type Effect417 struct { + node.EffectNode +} + +func (e *Effect417) SkillHit_ex() bool { + if e.Ctx().SkillEntity != nil && e.Ctx().SkillEntity.Category() != info.Category.STATUS { + // 是攻击技能 + damageDone := e.Ctx().Our.SumDamage + healPercent := e.Args()[0].Div(alpacadecimal.NewFromInt(100)) // m% + healAmount := damageDone.Mul(healPercent) + + e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, healAmount) + } + + return true +} + +func (e *Effect417) SetArgs(t *input.Input, a ...int) { + e.EffectNode.SetArgs(t, a...) + e.EffectNode.Duration(a[0]) // 持续n回合 +} +func init() { + input.InitEffect(input.EffectType.Skill, 417, &Effect417{}) + +} diff --git a/logic/service/fight/effect/422.go b/logic/service/fight/effect/422.go new file mode 100644 index 00000000..00061205 --- /dev/null +++ b/logic/service/fight/effect/422.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/alpacahq/alpacadecimal" +) + +// 422 - 附加所造成伤害值X%的固定伤害 +type Effect422 struct { + node.EffectNode +} + +func (e *Effect422) SkillUseed() bool { + damageDone := e.Ctx().Our.SumDamage + percent := e.Args()[0].Div(alpacadecimal.NewFromInt(100)) // X% + + additionalDamage := damageDone.Mul(percent) + + if additionalDamage.Cmp(alpacadecimal.NewFromInt(0)) > 0 { + damageZone := &info.DamageZone{ + Type: info.DamageType.Fixed, + Damage: additionalDamage, + } + e.Ctx().Opp.Damage(e.Ctx().Our, damageZone) + } + + return true +} + +func init() { + input.InitEffect(input.EffectType.Skill, 422, &Effect422{}) + +} diff --git a/logic/service/fight/effect/432.go b/logic/service/fight/effect/432.go new file mode 100644 index 00000000..12b1525f --- /dev/null +++ b/logic/service/fight/effect/432.go @@ -0,0 +1,37 @@ +package effect + +import ( + "blazing/logic/service/fight/input" + "blazing/logic/service/fight/node" +) + +func init() { + t := &Effect432{ + EffectNode: node.EffectNode{}, + } + + input.InitEffect(input.EffectType.Skill, 432, t) + +} + +// 432 - n回合内对手所有攻击必定MISS,必中技能有效 +type Effect432 struct { + node.EffectNode +} + +func (e *Effect432) SkillHit_ex() bool { + + //fmt.Println(e.Ctx().SkillEntity) + if e.Ctx().SkillEntity == nil { + return true + } + + e.Ctx().SkillEntity.SetMiss() + + return true +} + +func (e *Effect432) SetArgs(t *input.Input, a ...int) { + e.EffectNode.SetArgs(t, a...) + e.EffectNode.Duration(a[0]) // 持续n回合 +} diff --git a/logic/service/fight/effect/442.go b/logic/service/fight/effect/442.go new file mode 100644 index 00000000..41e0b199 --- /dev/null +++ b/logic/service/fight/effect/442.go @@ -0,0 +1,31 @@ +package effect + +import ( + "blazing/logic/service/fight/input" + "blazing/logic/service/fight/node" +) + +// 442 - m%令对手XX,每次造成的伤害值都将恢复自身体力 +type Effect442 struct { + node.EffectNode +} + +func (e *Effect442) OnSkill() bool { + + chance := e.Args()[0].IntPart() + success, _, _ := e.Input.Player.Roll(int(chance), 100) + if success { + statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(e.Args()[1].IntPart())) // 以麻痹为例 + if statusEffect != nil { + statusEffect.SetArgs(e.Ctx().Our, 1) + e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect) + } + } + + return true +} + +func init() { + input.InitEffect(input.EffectType.Skill, 442, &Effect442{}) + +} diff --git a/logic/service/fight/effect/449.go b/logic/service/fight/effect/449.go new file mode 100644 index 00000000..55468d18 --- /dev/null +++ b/logic/service/fight/effect/449.go @@ -0,0 +1,37 @@ +package effect + +import ( + "blazing/logic/service/fight/input" + "blazing/logic/service/fight/node" +) + +// 449 - 若对手处于能力下降状态则N%几率XX +type Effect449 struct { + node.EffectNode +} + +func (e *Effect449) OnSkill() bool { + + for _, v := range e.Ctx().Opp.Prop[:] { + if v < 0 { + chance := e.Args()[0].IntPart() // N% + success, _, _ := e.Input.Player.Roll(int(chance), 100) + if success { + effectType := int(e.Args()[1].IntPart()) // XX类型 + + statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, effectType) + if statusEffect != nil { + e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect) + } + } + return true + } + + } + + return true +} +func init() { + input.InitEffect(input.EffectType.Skill, 449, &Effect449{}) + +} diff --git a/logic/service/fight/effect/456.go b/logic/service/fight/effect/456.go new file mode 100644 index 00000000..b614ae53 --- /dev/null +++ b/logic/service/fight/effect/456.go @@ -0,0 +1,26 @@ +package effect + +import ( + "blazing/logic/service/fight/info" + "blazing/logic/service/fight/input" + "blazing/logic/service/fight/node" +) + +// 456 - 若对手体力不足n则直接秒杀 +type Effect456 struct { + node.EffectNode +} + +func (e *Effect456) OnSkill() bool { + e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{ + + Type: info.DamageType.Fixed, + Damage: e.Args()[0], + }) + + return true +} +func init() { + input.InitEffect(input.EffectType.Skill, 456, &Effect456{}) + +} diff --git a/logic/service/fight/effect/458.go b/logic/service/fight/effect/458.go new file mode 100644 index 00000000..37d6ac83 --- /dev/null +++ b/logic/service/fight/effect/458.go @@ -0,0 +1,30 @@ +package effect + +import ( + "blazing/logic/service/fight/action" + "blazing/logic/service/fight/input" + "blazing/logic/service/fight/node" + + "github.com/alpacahq/alpacadecimal" +) + +// 458 - 若先出手则造成攻击伤害的n%恢复自身体力 +type Effect458 struct { + node.EffectNode +} + +func (e *Effect458) SkillHit_ex() bool { + if e.Input.FightC.IsFirst(e.Input.Player) { // 先出手 + damageDone := e.Ctx().Our.SumDamage + healPercent := e.Args()[0].Div(alpacadecimal.NewFromInt(100)) // n% + healAmount := damageDone.Mul(healPercent) + + e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, healAmount) + } + + return true +} +func init() { + input.InitEffect(input.EffectType.Skill, 458, &Effect458{}) + +} diff --git a/logic/service/fight/effect/460.go b/logic/service/fight/effect/460.go new file mode 100644 index 00000000..e9d7de15 --- /dev/null +++ b/logic/service/fight/effect/460.go @@ -0,0 +1,45 @@ +package effect + +import ( + "blazing/logic/service/fight/info" + "blazing/logic/service/fight/input" + "blazing/logic/service/fight/node" +) + +// 460 - m%几率令对手害怕,若对手处于能力强化状态则额外附加n%几率 +type Effect460 struct { + node.EffectNode +} + +func (e *Effect460) OnSkill() bool { + baseChance := e.Args()[0].IntPart() // m% + + // 检查对手是否处于能力强化状态 + extraChance := false + + for _, v := range e.Ctx().Opp.Prop[:] { + if v > 0 { + extraChance = true + } + + } + + totalChance := baseChance + if extraChance { + totalChance += e.Args()[1].IntPart() + } + success, _, _ := e.Input.Player.Roll(int(totalChance), 100) + + if success { + fearEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.Fear)) + if fearEffect != nil { + e.Ctx().Opp.AddEffect(e.Ctx().Our, fearEffect) + } + } + + return true +} +func init() { + input.InitEffect(input.EffectType.Skill, 460, &Effect460{}) + +} diff --git a/logic/service/fight/effect/476.go b/logic/service/fight/effect/476.go new file mode 100644 index 00000000..dfbbcf3b --- /dev/null +++ b/logic/service/fight/effect/476.go @@ -0,0 +1,28 @@ +package effect + +import ( + "blazing/logic/service/fight/action" + "blazing/logic/service/fight/input" + "blazing/logic/service/fight/node" + + "github.com/alpacahq/alpacadecimal" +) + +// 476 - 后出手时恢复m点体力 +type Effect476 struct { + node.EffectNode +} + +func (e *Effect476) OnSkill() bool { + if !e.Input.FightC.IsFirst(e.Input.Player) { + return true + } + healAmount := alpacadecimal.NewFromInt(int64(e.Args()[0].IntPart())) + e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, healAmount) + + return true +} +func init() { + input.InitEffect(input.EffectType.Skill, 620, &Effect620{}) + +} diff --git a/logic/service/fight/effect/498.go b/logic/service/fight/effect/498.go new file mode 100644 index 00000000..955d1a96 --- /dev/null +++ b/logic/service/fight/effect/498.go @@ -0,0 +1,39 @@ +package effect + +import ( + "blazing/logic/service/fight/action" + "blazing/logic/service/fight/info" + "blazing/logic/service/fight/input" + "blazing/logic/service/fight/node" +) + +// 498 - n回合内致命一击几率上升1/m +type Effect498 struct { + node.EffectNode +} + +func (e *Effect498) ActionStart(a, b *action.SelectSkillAction) bool { + + //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().Opp.StatEffect_Exist(input.StatusSleep) { + return true + } + e.Ctx().SkillEntity.CritRate += int(e.Args()[1].IntPart()) + + return true +} +func (e *Effect498) SetArgs(t *input.Input, a ...int) { + e.EffectNode.SetArgs(t, a...) + e.EffectNode.Duration(a[0]) // 持续n回合 +} +func init() { + input.InitEffect(input.EffectType.Skill, 498, &Effect498{}) + +} diff --git a/logic/service/fight/effect/500.go b/logic/service/fight/effect/500.go new file mode 100644 index 00000000..6ff52b80 --- /dev/null +++ b/logic/service/fight/effect/500.go @@ -0,0 +1,29 @@ +package effect + +import ( + "blazing/logic/service/fight/info" + "blazing/logic/service/fight/input" + "blazing/logic/service/fight/node" +) + +// 500 - 若对手处于害怕状态则伤害翻倍 +type Effect500 struct { + node.EffectNode +} + +func (e *Effect500) SkillHit() bool { + if e.Ctx().SkillEntity == nil { + return true + } + + if e.Ctx().Opp.StatEffect_Exist(info.PetStatus.Fear) { + // 伤害翻倍 + e.Ctx().SkillEntity.Power *= 2 + } + + return true +} +func init() { + input.InitEffect(input.EffectType.Skill, 500, &Effect500{}) + +} diff --git a/logic/service/fight/effect/503.go b/logic/service/fight/effect/503.go new file mode 100644 index 00000000..16930c05 --- /dev/null +++ b/logic/service/fight/effect/503.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/alpacahq/alpacadecimal" +) + +// 503 - 若造成的伤害不足m,则回合结束时对手损失n点固定体力 +type Effect503 struct { + node.EffectNode + triggered bool + damageThreshold int +} + +func (e *Effect503) SkillUseed() bool { + damageDone := e.Ctx().Our.SumDamage + e.damageThreshold = int(e.Args()[0].IntPart()) + + if damageDone.IntPart() < int64(e.damageThreshold) { + e.triggered = true + } + return true +} + +func (e *Effect503) Action_end_ex() bool { + if e.triggered { + fixedDamage := alpacadecimal.NewFromInt(int64(e.Args()[1].IntPart())) + damageZone := &info.DamageZone{ + Type: info.DamageType.Fixed, + Damage: fixedDamage, + } + e.Ctx().Opp.Damage(e.Ctx().Our, damageZone) + e.triggered = false + } + return true +} +func init() { + input.InitEffect(input.EffectType.Skill, 503, &Effect503{}) + +} diff --git a/logic/service/fight/effect/620.go b/logic/service/fight/effect/620.go new file mode 100644 index 00000000..4b117ad6 --- /dev/null +++ b/logic/service/fight/effect/620.go @@ -0,0 +1,40 @@ +package effect + +import ( + "blazing/logic/service/fight/action" + "blazing/logic/service/fight/info" + "blazing/logic/service/fight/input" + "blazing/logic/service/fight/node" +) + +// 620 - n回合内致命一击率上升m/16 +type Effect620 struct { + node.EffectNode +} + +func (e *Effect620) ActionStart(a, b *action.SelectSkillAction) bool { + + //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().Opp.StatEffect_Exist(input.StatusSleep) { + return true + } + e.Ctx().SkillEntity.CritRate += int(e.Args()[1].IntPart()) + + return true +} + +func (e *Effect620) SetArgs(t *input.Input, a ...int) { + e.EffectNode.SetArgs(t, a...) + e.EffectNode.Duration(a[0]) // 持续n回合 +} +func init() { + input.InitEffect(input.EffectType.Skill, 620, &Effect620{}) + +} diff --git a/logic/service/fight/effect/back.go1 b/logic/service/fight/effect/back.go similarity index 73% rename from logic/service/fight/effect/back.go1 rename to logic/service/fight/effect/back.go index 05541612..b84bca82 100644 --- a/logic/service/fight/effect/back.go1 +++ b/logic/service/fight/effect/back.go @@ -10,120 +10,6 @@ import ( "github.com/alpacahq/alpacadecimal" ) -// 160 - n回合内,若对手MISS则下回合自身必定致命一击 -type Effect160 struct { - node.EffectNode -} - -func (e *Effect160) Skill_Use_ex() bool { - if !e.Hit() { - return true - } - - if e.Ctx().Opp.LastAttackMissed { - // 添加一个效果,下回合必定暴击 - nextAttackCritEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.NextCrit)) - if nextAttackCritEffect != nil { - nextAttackCritEffect.Duration(1) // 持续1回合 - e.Ctx().Our.AddEffect(e.Ctx().Our, nextAttackCritEffect) - } - } - return true -} - -func (e *Effect160) SetArgs(t *input.Input, a ...int) { - e.EffectNode.SetArgs(t, a...) - e.EffectNode.Duration(a[0]) // 持续n回合 -} - -// 172 - 2 若后出手,则给予对方损伤的1/n会回复自己的体力 -type Effect172 struct { - node.EffectNode -} - -func (e *Effect172) SkillHit_ex() bool { - if e.Ctx().Our.Speed < e.Ctx().Opp.Speed { // 后出手 - damage := e.Ctx().Opp.SumDamage - healAmount := damage.Div(e.Args()[0]) // 损伤的1/n - e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, healAmount) - } - return true -} - -// 406 - 2 n回合内受到攻击m%几率回复k点体力 -type Effect406 struct { - node.EffectNode -} - -func (e *Effect406) Skill_Use_ex() bool { - if !e.Hit() { - return true - } - - chance := e.Args()[1].IntPart() - success, _, _ := e.Input.Player.Roll(int(chance), 100) - if success { - healAmount := alpacadecimal.NewFromInt(int64(e.Args()[2].IntPart())) - e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, healAmount) - } - return true -} - -func (e *Effect406) SetArgs(t *input.Input, a ...int) { - e.EffectNode.SetArgs(t, a...) - e.EffectNode.Duration(a[0]) // 持续n回合 -} - -// 190 - n回合内,若受到攻击,消除对手所有能力强化状态 -type Effect190 struct { - node.EffectNode -} - -func (e *Effect190) Skill_Use_ex() bool { - if !e.Hit() { - return true - } - - // 消除对手所有能力强化状态 - e.Ctx().Opp.ResetPositiveBuff() - return true -} - -func (e *Effect190) SetArgs(t *input.Input, a ...int) { - e.EffectNode.SetArgs(t, a...) - e.EffectNode.Duration(a[0]) // 持续n回合 -} - -// 503 - 若造成的伤害不足m,则回合结束时对手损失n点固定体力 -type Effect503 struct { - node.EffectNode - triggered bool - damageThreshold int -} - -func (e *Effect503) SkillHit_ex() bool { - damageDone := e.Ctx().Our.SumDamage - e.damageThreshold = int(e.Args()[0].IntPart()) - - if damageDone.IntPart() < int64(e.damageThreshold) { - e.triggered = true - } - return true -} - -func (e *Effect503) Action_end_ex() bool { - if e.triggered { - fixedDamage := alpacadecimal.NewFromInt(int64(e.Args()[1].IntPart())) - damageZone := &info.DamageZone{ - Type: info.DamageType.Fixed, - Damage: fixedDamage, - } - e.Ctx().Opp.Damage(e.Ctx().Our, damageZone) - e.triggered = false - } - return true -} - // 181 - n%几率令对手XX,连续攻击每次提高m%几率最高提高k% type Effect181 struct { node.EffectNode @@ -164,24 +50,6 @@ func (e *Effect181) SetArgs(t *input.Input, a ...int) { e.maxChance = a[2] // 最大几率 } -// 499 - 后出手时下回合所有技能先制+m -type Effect499 struct { - node.EffectNode -} - -func (e *Effect499) OnSkill() bool { - if e.Ctx().Our.Speed < e.Ctx().Opp.Speed { // 后出手 - // 添加先制效果 - speedBoostEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.SpeedPlus)) - if speedBoostEffect != nil { - speedBoostEffect.Duration(1) // 持续1回合 - speedBoostEffect.SetArgs(e.Ctx().Our, int(e.Args()[0].IntPart())) // 先制+m - e.Ctx().Our.AddEffect(e.Ctx().Our, speedBoostEffect) - } - } - return true -} - // 441 - 每次攻击提升n%的致命几率,最高提升m% type Effect441 struct { node.EffectNode @@ -210,26 +78,6 @@ func (e *Effect441) SetArgs(t *input.Input, a ...int) { e.maxCritIncrease = a[1] } -// 194 - 造成伤害的1/n回复自身体力,若对手XX,则造成伤害的1/m回复自身体力 -type Effect194 struct { - node.EffectNode -} - -func (e *Effect194) SkillHit_ex() bool { - damageDone := e.Ctx().Our.SumDamage - - var healAmount alpacadecimal.Decimal - if e.Ctx().Opp.CurrentPet.HasAnyStatus() { // 假设有检查异常状态的方法 - healAmount = damageDone.Div(e.Args()[1]) // 1/m - } else { - healAmount = damageDone.Div(e.Args()[0]) // 1/n - } - - e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, healAmount) - - return true -} - // 169 - n回合内,每回合额外附加m%几率令对手XX type Effect169 struct { node.EffectNode @@ -360,32 +208,6 @@ func (e *Effect477) SetArgs(t *input.Input, a ...int) { e.EffectNode.Duration(a[0]) // 持续n回合 } -// 442 - m%令对手XX,每次造成的伤害值都将恢复自身体力 -type Effect442 struct { - node.EffectNode -} - -func (e *Effect442) OnSkill() bool { - if !e.Hit() { - return true - } - - chance := e.Args()[0].IntPart() - success, _, _ := e.Input.Player.Roll(int(chance), 100) - if success { - statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.Paralysis)) // 以麻痹为例 - if statusEffect != nil { - e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect) - } - } - - // 伤害值恢复自身体力 - damageDone := e.Ctx().Our.SumDamage - e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, damageDone) - - return true -} - // 173 - 先出手时,n%概率令对方xx type Effect173 struct { node.EffectNode @@ -633,49 +455,6 @@ func (e *Effect491) OnSkill() bool { return true } -// 490 - 造成的伤害大于m,则对自身速度+n -type Effect490 struct { - node.EffectNode -} - -func (e *Effect490) SkillHit_ex() bool { - damageThreshold := int(e.Args()[0].IntPart()) - speedBoost := int(e.Args()[1].IntPart()) - - if e.Ctx().Our.SumDamage.Cmp(alpacadecimal.NewFromInt(int64(damageThreshold))) > 0 { - // 提升自身速度等级 - speedUpEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.SpeedUp)) - if speedUpEffect != nil { - speedUpEffect.SetArgs(e.Ctx().Our, speedBoost) - e.Ctx().Our.AddEffect(e.Ctx().Our, speedUpEffect) - } - } - - return true -} - -// 140 - 降低对手1/n至1/m体力 -type Effect140 struct { - node.EffectNode -} - -func (e *Effect140) OnSkill() bool { - maxHp := e.Ctx().Opp.CurrentPet.GetMaxHP() - - // 随机降低1/n 到 1/m 的体力 - minRatio := alpacadecimal.NewFromFloat(1.0).Div(e.Args()[0]) // 1/n - maxRatio := alpacadecimal.NewFromFloat(1.0).Div(e.Args()[1]) // 1/m - - randDamage := minRatio.Add(maxRatio.Sub(minRatio).Div(alpacadecimal.NewFromInt(2))) - damageZone := &info.DamageZone{ - Type: info.DamageType.PercentageBased, - Damage: maxHp.Mul(randDamage), - } - e.Ctx().Opp.Damage(e.Ctx().Our, damageZone) - - return true -} - // 462 - n回合内受攻击时反弹m点固定伤害 type Effect462 struct { node.EffectNode @@ -702,61 +481,6 @@ func (e *Effect462) SetArgs(t *input.Input, a ...int) { e.EffectNode.Duration(a[0]) // 持续n回合 } -// 153 - n回合内,每回合对对方造成伤害的1/m恢复自身体力 -type Effect153 struct { - node.EffectNode -} - -func (e *Effect153) SkillHit_ex() bool { - damageDone := e.Ctx().Our.SumDamage - healAmount := damageDone.Div(e.Args()[1]) // 伤害的1/m - - e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, healAmount) - - return true -} - -func (e *Effect153) SetArgs(t *input.Input, a ...int) { - e.EffectNode.SetArgs(t, a...) - e.EffectNode.Duration(a[0]) // 持续n回合 -} - -// 423 - 直接造成等同于对手防御值的固定伤害 -type Effect423 struct { - node.EffectNode -} - -func (e *Effect423) OnSkill() bool { - defenseValue := alpacadecimal.NewFromInt(int64(e.Ctx().Opp.CurrentPet.Info.Def)) - - damageZone := &info.DamageZone{ - Type: info.DamageType.Fixed, - Damage: defenseValue, - } - e.Ctx().Opp.Damage(e.Ctx().Our, damageZone) - - return true -} - -// 450 - 随机恢复m到n点体力 -type Effect450 struct { - node.EffectNode -} - -func (e *Effect450) OnSkill() bool { - minHeal := e.Args()[0].IntPart() - maxHeal := e.Args()[1].IntPart() - - // 随机值在m到n之间 - rangeVal := maxHeal - minHeal - randomVal := int64(e.Input.FightC.GetRand().Int31n(int32(rangeVal)) + int32(minHeal)) - - healAmount := alpacadecimal.NewFromInt(randomVal) - e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, healAmount) - - return true -} - // 184 - 若对手处于能力提升状态,则m%自身XX等级k type Effect184 struct { node.EffectNode @@ -915,48 +639,6 @@ func (e *Effect523) Action_end_ex() bool { return true } -// 161 - n%降低自身当前体力值的1/m -type Effect161 struct { - node.EffectNode -} - -func (e *Effect161) OnSkill() bool { - chance := e.Args()[0].IntPart() - success, _, _ := e.Input.Player.Roll(int(chance), 100) - - if success { - currentHp := e.Ctx().Our.CurrentPet.GetHP() - damageRatio := alpacadecimal.NewFromFloat(1.0).Div(e.Args()[1]) // 1/m - damageAmount := currentHp.Mul(damageRatio) - - damageZone := &info.DamageZone{ - Type: info.DamageType.PercentageBased, - Damage: damageAmount, - } - e.Ctx().Our.Damage(e.Ctx().Our, damageZone) - } - - return true -} - -// 500 - 若对手处于害怕状态则伤害翻倍 -type Effect500 struct { - node.EffectNode -} - -func (e *Effect500) SkillHit() bool { - if e.Ctx().SkillEntity == nil { - return true - } - - if e.Ctx().Opp.CurrentPet.HasStatus(info.PetStatus.Fear) { - // 伤害翻倍 - e.Ctx().SkillEntity.Power *= 2 - } - - return true -} - // 177 - n回合内,若对手MISS则自身恢复1/m的最大体力值 type Effect177 struct { node.EffectNode @@ -977,29 +659,6 @@ func (e *Effect177) SetArgs(t *input.Input, a ...int) { e.EffectNode.Duration(a[0]) // 持续n回合 } -// 417 - n回合内自身攻击技能造成伤害的m%会恢复自身体力 -type Effect417 struct { - node.EffectNode -} - -func (e *Effect417) SkillHit_ex() bool { - if e.Ctx().SkillEntity != nil && e.Ctx().SkillEntity.Category() != info.Category.STATUS { - // 是攻击技能 - damageDone := e.Ctx().Our.SumDamage - healPercent := e.Args()[0].Div(alpacadecimal.NewFromInt(100)) // m% - healAmount := damageDone.Mul(healPercent) - - e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, healAmount) - } - - return true -} - -func (e *Effect417) SetArgs(t *input.Input, a ...int) { - e.EffectNode.SetArgs(t, a...) - e.EffectNode.Duration(a[0]) // 持续n回合 -} - // 178 - 造成伤害的1/n回复自身体力,若属性相同则造成伤害的1/m回复自身体力 type Effect178 struct { node.EffectNode @@ -1119,23 +778,6 @@ func (e *Effect496) SkillHit_ex() bool { return true } -// 404 - 恢复双方所有体力 -type Effect404 struct { - node.EffectNode -} - -func (e *Effect404) OnSkill() bool { - // 恢复我方所有体力 - ourMaxHp := e.Ctx().Our.CurrentPet.GetMaxHP() - e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, ourMaxHp) - - // 恢复对手所有体力 - oppMaxHp := e.Ctx().Opp.CurrentPet.GetMaxHP() - e.Ctx().Opp.Heal(e.Ctx().Opp, &action.SelectSkillAction{}, oppMaxHp) - - return true -} - // 430 - 消除对手能力强化状态,若消除状态成功,则自身XX等级m type Effect430 struct { node.EffectNode @@ -1283,24 +925,6 @@ func (e *Effect494) SkillHit() bool { return true } -// 620 - n回合内致命一击率上升m/16 -type Effect620 struct { - node.EffectNode -} - -func (e *Effect620) OnSkill() bool { - // 增加暴击率 - critIncrease := int(e.Args()[1].IntPart()) // m/16 - e.Ctx().Our.CurrentPet.CritRate += critIncrease - - return true -} - -func (e *Effect620) SetArgs(t *input.Input, a ...int) { - e.EffectNode.SetArgs(t, a...) - e.EffectNode.Duration(a[0]) // 持续n回合 -} - // 474 - 先出手时m%自身XX等级+n type Effect474 struct { node.EffectNode @@ -1349,39 +973,6 @@ func (e *Effect175) OnSkill() bool { return true } -// 410 - n%回复自身1/m体力值 -type Effect410 struct { - node.EffectNode -} - -func (e *Effect410) OnSkill() bool { - chance := e.Args()[0].IntPart() - success, _, _ := e.Input.Player.Roll(int(chance), 100) - - if success { - maxHp := e.Ctx().Our.CurrentPet.GetMaxHP() - healAmount := maxHp.Div(e.Args()[1]) // 1/m - - e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, healAmount) - } - - return true -} - -// 476 - 后出手时恢复m点体力 -type Effect476 struct { - node.EffectNode -} - -func (e *Effect476) OnSkill() bool { - if e.Ctx().Our.Speed < e.Ctx().Opp.Speed { // 后出手 - healAmount := alpacadecimal.NewFromInt(int64(e.Args()[0].IntPart())) - e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, healAmount) - } - - return true -} - // 440 - n回合内对手使用技能消耗的PP值变为m倍 type Effect440 struct { node.EffectNode @@ -1410,24 +1001,6 @@ func (e *Effect516) OnSkill() bool { return true } -// 431 - 若对手处于能力下降状态,则威力翻倍 -type Effect431 struct { - node.EffectNode -} - -func (e *Effect431) SkillHit() bool { - if e.Ctx().SkillEntity == nil { - return true - } - - if e.Ctx().Opp.CurrentPet.HasNegativeBuff() { // 对手处于能力下降状态 - // 威力翻倍 - e.Ctx().SkillEntity.Power *= 2 - } - - return true -} - // 434 - 若自身处于能力强化状态,则n%几率令对手XX type Effect434 struct { node.EffectNode @@ -1616,31 +1189,6 @@ func (e *Effect469) SetArgs(t *input.Input, a ...int) { e.EffectNode.Duration(a[0]) // 持续m回合 } -// 146 - n回合内,受到物理攻击时有m%几率使对方中毒 -type Effect146 struct { - node.EffectNode -} - -func (e *Effect146) Skill_Use_ex() bool { - if e.Ctx().SkillEntity != nil && e.Ctx().SkillEntity.Category() == info.Category.PHYSICAL { - chance := e.Args()[1].IntPart() // m% - success, _, _ := e.Input.Player.Roll(int(chance), 100) - if success { - poisonEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.Poisoned)) - if poisonEffect != nil { - e.Ctx().Opp.AddEffect(e.Ctx().Our, poisonEffect) - } - } - } - - return true -} - -func (e *Effect146) SetArgs(t *input.Input, a ...int) { - e.EffectNode.SetArgs(t, a...) - e.EffectNode.Duration(a[0]) // 持续n回合 -} - // 156 - n回合内,使得对手所有能力增强效果失效 type Effect156 struct { node.EffectNode @@ -1658,24 +1206,6 @@ func (e *Effect156) SetArgs(t *input.Input, a ...int) { e.EffectNode.Duration(a[0]) // 持续n回合 } -// 432 - n回合内对手所有攻击必定MISS,必中技能有效 -type Effect432 struct { - node.EffectNode -} - -func (e *Effect432) Skill_Use_ex() bool { - // 这里不能直接让攻击miss,因为需要在命中判定之前处理 - // 可以设置一个标志,让对手的攻击miss - e.Ctx().Opp.ForceMiss = true - - return true -} - -func (e *Effect432) SetArgs(t *input.Input, a ...int) { - e.EffectNode.SetArgs(t, a...) - e.EffectNode.Duration(a[0]) // 持续n回合 -} - // 488 - 若对手的体力小于400,则造成的伤害增加10% type Effect488 struct { node.EffectNode @@ -1696,24 +1226,6 @@ func (e *Effect488) SkillHit() bool { return true } -// 456 - 若对手体力不足n则直接秒杀 -type Effect456 struct { - node.EffectNode -} - -func (e *Effect456) OnSkill() bool { - opponentHp := e.Ctx().Opp.CurrentPet.GetHP() - threshold := alpacadecimal.NewFromInt(int64(e.Args()[0].IntPart())) - - if opponentHp.Cmp(threshold) < 0 { - // 直接秒杀对手 - e.Ctx().Opp.CurrentPet.Info.Hp = 0 - e.Ctx().Opp.CurrentPet.NotAlive = true - } - - return true -} - // 437 - 若对手处于能力强化状态,则对手XX等级m type Effect437 struct { node.EffectNode @@ -1840,37 +1352,6 @@ func (e *Effect471) OnSkill() bool { return true } -// 176 - n%几率令对手随机进入烧伤、冻伤、中毒、麻痹、害怕、睡眠中的一种异常状态 -type Effect176 struct { - node.EffectNode -} - -func (e *Effect176) OnSkill() bool { - chance := e.Args()[0].IntPart() - success, _, _ := e.Input.Player.Roll(int(chance), 100) - - if success { - statusTypes := []int{ - int(info.PetStatus.Burned), - int(info.PetStatus.Frozen), - int(info.PetStatus.Poisoned), - int(info.PetStatus.Paralysis), - int(info.PetStatus.Fear), - int(info.PetStatus.Sleep), - } - - randomIndex := int(e.Input.FightC.GetRand().Int31n(int32(len(statusTypes)))) - selectedStatus := statusTypes[randomIndex] - - statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, selectedStatus) - if statusEffect != nil { - e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect) - } - } - - return true -} - // 427 - n回合内每次直接攻击都会使对手防御和特防m type Effect427 struct { node.EffectNode @@ -2087,65 +1568,6 @@ func (e *Effect155) OnSkill() bool { return true } -// 149 - 命中后,n%令对方xx,m%令对方XX -type Effect149 struct { - node.EffectNode -} - -func (e *Effect149) OnSkill() bool { - if !e.Hit() { - return true - } - - // n%令对方xx - firstChance := e.Args()[0].IntPart() - success1, _, _ := e.Input.Player.Roll(int(firstChance), 100) - if success1 { - effectType1 := int(e.Args()[2].IntPart()) // 第一个异常状态类型 - - statusEffect1 := e.Ctx().Our.InitEffect(input.EffectType.Status, effectType1) - if statusEffect1 != nil { - e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect1) - } - } - - // m%令对方XX - secondChance := e.Args()[1].IntPart() - success2, _, _ := e.Input.Player.Roll(int(secondChance), 100) - if success2 { - effectType2 := int(e.Args()[3].IntPart()) // 第二个异常状态类型 - - statusEffect2 := e.Ctx().Our.InitEffect(input.EffectType.Status, effectType2) - if statusEffect2 != nil { - e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect2) - } - } - - return true -} - -// 449 - 若对手处于能力下降状态则N%几率XX -type Effect449 struct { - node.EffectNode -} - -func (e *Effect449) OnSkill() bool { - if e.Ctx().Opp.CurrentPet.HasNegativeBuff() { // 对手处于能力下降状态 - chance := e.Args()[0].IntPart() // N% - success, _, _ := e.Input.Player.Roll(int(chance), 100) - if success { - effectType := int(e.Args()[1].IntPart()) // XX类型 - - statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, effectType) - if statusEffect != nil { - e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect) - } - } - } - - return true -} - // 425 - 随机使对手n项属性m,并将该属性附加给自己 type Effect425 struct { node.EffectNode @@ -2341,28 +1763,6 @@ func (e *Effect443) SetArgs(t *input.Input, a ...int) { e.EffectNode.Duration(a[0]) // 持续n回合 } -// 200 - 若对手处于能力提升状态,n%几率令对手XX -type Effect200 struct { - node.EffectNode -} - -func (e *Effect200) OnSkill() bool { - if e.Ctx().Opp.CurrentPet.HasPositiveBuff() { // 对手处于能力提升状态 - chance := e.Args()[0].IntPart() - success, _, _ := e.Input.Player.Roll(int(chance), 100) - if success { - effectType := int(e.Args()[1].IntPart()) // XX类型 - - statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, effectType) - if statusEffect != nil { - e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect) - } - } - } - - return true -} - // 609 - 若对手XX,技能威力翻倍(XX代表异常状态:麻痹0,中毒1,烧伤2,冻伤5,害怕6,疲惫7,睡眠8,石化9,冰封15) type Effect609 struct { node.EffectNode @@ -2421,24 +1821,6 @@ func (e *Effect157) SetArgs(t *input.Input, a ...int) { e.EffectNode.Duration(a[0]) // 持续n回合 } -// 179 - 若属性相同则技能威力提升n -type Effect179 struct { - node.EffectNode -} - -func (e *Effect179) SkillHit() bool { - if e.Ctx().SkillEntity == nil { - return true - } - - if e.Ctx().Our.CurrentPet.Type == e.Ctx().Opp.CurrentPet.Type { - // 属性相同,技能威力提升n - e.Ctx().SkillEntity.Power += int(e.Args()[0].IntPart()) - } - - return true -} - // 412 - 若自身体力小于1/n,则每次攻击不消耗PP值 type Effect412 struct { node.EffectNode @@ -2501,24 +1883,6 @@ func (e *Effect199) SkillUseed() bool { return true } -// 498 - n回合内致命一击几率上升1/m -type Effect498 struct { - node.EffectNode -} - -func (e *Effect498) OnSkill() bool { - // 增加暴击率 - critIncrease := alpacadecimal.NewFromInt(1).Div(e.Args()[1]) // 1/m - e.Ctx().Our.CurrentPet.CritRate += int(critIncrease.IntPart()) - - return true -} - -func (e *Effect498) SetArgs(t *input.Input, a ...int) { - e.EffectNode.SetArgs(t, a...) - e.EffectNode.Duration(a[0]) // 持续n回合 -} - // 470 - n回合内若自身攻击技能命中则m%令对手p type Effect470 struct { node.EffectNode @@ -2587,28 +1951,6 @@ func (e *Effect506) OnSkill() bool { return true } -// 422 - 附加所造成伤害值X%的固定伤害 -type Effect422 struct { - node.EffectNode -} - -func (e *Effect422) SkillHit_ex() bool { - damageDone := e.Ctx().Our.SumDamage - percent := e.Args()[0].Div(alpacadecimal.NewFromInt(100)) // X% - - additionalDamage := damageDone.Mul(percent) - - if additionalDamage.Cmp(alpacadecimal.NewFromInt(0)) > 0 { - damageZone := &info.DamageZone{ - Type: info.DamageType.Fixed, - Damage: additionalDamage, - } - e.Ctx().Opp.Damage(e.Ctx().Our, damageZone) - } - - return true -} - // 513 - 处在烧伤、中毒、冻伤状态时威力翻倍,命中后解除这些异常状态 type Effect513 struct { node.EffectNode @@ -2639,30 +1981,6 @@ func (e *Effect513) SkillHit() bool { return true } -// 201 - 组队时恢复己方1/n的体力 -type Effect201 struct { - node.EffectNode -} - -func (e *Effect201) OnSkill() bool { - // 检查是否在组队战斗中 - if e.Ctx().IsTeamBattle { - // 计算恢复量 - team := e.Ctx().Our.TeamPets // 假设有队伍宠物列表 - for _, pet := range team { - if pet.Info.Hp > 0 { // 只恢复还活着的宠物 - maxHp := pet.GetMaxHP() - healAmount := maxHp.Div(e.Args()[0]) // 1/n - - // 恢复体力 - pet.Heal(pet, &action.SelectSkillAction{}, healAmount) - } - } - } - - return true -} - // 493 - m回合内若对手使用攻击技能则自身下n回合必定暴击 type Effect493 struct { node.EffectNode @@ -2715,23 +2033,6 @@ func (e *Effect428) isDisadvantageousMatch() bool { e.Ctx().Opp.CurrentPet.Type == element.ElementTypeWater } -// 458 - 若先出手则造成攻击伤害的n%恢复自身体力 -type Effect458 struct { - node.EffectNode -} - -func (e *Effect458) SkillHit_ex() bool { - if e.Ctx().Our.Speed > e.Ctx().Opp.Speed { // 先出手 - damageDone := e.Ctx().Our.SumDamage - healPercent := e.Args()[0].Div(alpacadecimal.NewFromInt(100)) // n% - healAmount := damageDone.Mul(healPercent) - - e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, healAmount) - } - - return true -} - // 166 - n回合内,若对手使用属性攻击则m%对手XX等级k type Effect166 struct { node.EffectNode @@ -2761,29 +2062,6 @@ func (e *Effect166) SetArgs(t *input.Input, a ...int) { e.EffectNode.Duration(a[0]) // 持续n回合 } -// 416 - n回合内,受到任何伤害,对手XX降低m个等级 -type Effect416 struct { - node.EffectNode -} - -func (e *Effect416) Skill_Use_ex() bool { - effectType := int(e.Args()[1].IntPart()) // XX类型 - effectValue := int(e.Args()[2].IntPart()) // 降低m个等级 - - statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, effectType) - if statusEffect != nil { - statusEffect.SetArgs(e.Ctx().Our, -effectValue) // 负值表示降低 - e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect) - } - - return true -} - -func (e *Effect416) SetArgs(t *input.Input, a ...int) { - e.EffectNode.SetArgs(t, a...) - e.EffectNode.Duration(a[0]) // 持续n回合 -} - // 435 - 牺牲自己,使下回合出场的精灵首次攻击必定命中,必定先手 type Effect435 struct { node.EffectNode @@ -2825,70 +2103,3 @@ func (e *Effect142) OnSkill() bool { return true } - -// 409 - n回合内,对手每回合速度等级m -type Effect409 struct { - node.EffectNode -} - -func (e *Effect409) OnSkill() bool { - speedEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.SpeedDown)) - if speedEffect != nil { - speedEffect.SetArgs(e.Ctx().Our, int(e.Args()[1].IntPart())) // 速度等级m(负值降低,正值提升,根据上下文推测应该是降低) - speedEffect.Duration(int(e.Args()[0].IntPart())) // n回合 - e.Ctx().Opp.AddEffect(e.Ctx().Our, speedEffect) - } - - return true -} - -// 460 - m%几率令对手害怕,若对手处于能力强化状态则额外附加n%几率 -type Effect460 struct { - node.EffectNode -} - -func (e *Effect460) OnSkill() bool { - baseChance := e.Args()[0].IntPart() // m% - - // 检查对手是否处于能力强化状态 - extraChance := 0 - if e.Ctx().Opp.CurrentPet.HasPositiveBuff() { - extraChance = int(e.Args()[1].IntPart()) // 额外n% - } - - totalChance := baseChance + extraChance - success, _, _ := e.Input.Player.Roll(totalChance, 100) - - if success { - fearEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.Fear)) - if fearEffect != nil { - e.Ctx().Opp.AddEffect(e.Ctx().Our, fearEffect) - } - } - - return true -} - -// 419 - m回合内,若对手处于能力强化状态,则每回合都会受到k点固定伤害 -type Effect419 struct { - node.EffectNode -} - -func (e *Effect419) Action_start() bool { - if e.Ctx().Opp.CurrentPet.HasPositiveBuff() { // 对手处于能力强化状态 - fixedDamage := alpacadecimal.NewFromInt(int64(e.Args()[1].IntPart())) // k点固定伤害 - - damageZone := &info.DamageZone{ - Type: info.DamageType.Fixed, - Damage: fixedDamage, - } - e.Ctx().Opp.Damage(e.Ctx().Our, damageZone) - } - - return true -} - -func (e *Effect419) SetArgs(t *input.Input, a ...int) { - e.EffectNode.SetArgs(t, a...) - e.EffectNode.Duration(a[0]) // 持续m回合 -} diff --git a/logic/service/fight/effect/effect_117.go b/logic/service/fight/effect/effect_117.go index d0eda329..5bc87e52 100644 --- a/logic/service/fight/effect/effect_117.go +++ b/logic/service/fight/effect/effect_117.go @@ -39,7 +39,7 @@ func (e *Effect117) OnSkill() bool { return true } // 获取状态效果 - eff := input.Geteffect(input.EffectType.Status, int(info.PetStatus.Fear)) + eff := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.Fear)) if eff == nil { return true } diff --git a/logic/service/fight/effect/effect_119_123.go b/logic/service/fight/effect/effect_119_123.go index f22f1556..decfca97 100644 --- a/logic/service/fight/effect/effect_119_123.go +++ b/logic/service/fight/effect/effect_119_123.go @@ -34,7 +34,7 @@ func (e *Effect119) DamageLock(damageValue *info.DamageZone) bool { // 奇数:30%对手疲惫1回合 ok, _, _ := e.Input.Player.Roll(30, 100) if ok { - eff := input.Geteffect(input.EffectType.Status, int(info.PetStatus.Tired)) + eff := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.Tired)) if eff == nil { return true } @@ -106,7 +106,7 @@ func (e *Effect121) OnSkill() bool { chance := int(e.Args()[0].IntPart()) ok, _, _ := e.Input.Player.Roll(chance, 100) if ok { - eff := input.Geteffect(input.EffectType.Status, int(info.PetStatus.Paralysis)) + eff := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.Paralysis)) if eff == nil { return true } diff --git a/logic/service/fight/effect/effect_140.go b/logic/service/fight/effect/effect_140.go new file mode 100644 index 00000000..4f0f1d14 --- /dev/null +++ b/logic/service/fight/effect/effect_140.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/alpacahq/alpacadecimal" +) + +// 140 - 降低对手1/n至1/m体力 +type Effect140 struct { + node.EffectNode +} + +func (e *Effect140) OnSkill() bool { + maxHp := e.Ctx().Opp.CurrentPet.GetMaxHP() + + // 随机降低1/n 到 1/m 的体力 + minRatio := alpacadecimal.NewFromFloat(1.0).Div(e.Args()[0]) // 1/n + maxRatio := alpacadecimal.NewFromFloat(1.0).Div(e.Args()[1]) // 1/m + + randDamage := minRatio.Add(maxRatio.Sub(minRatio).Div(alpacadecimal.NewFromInt(2))) + damageZone := &info.DamageZone{ + Type: info.DamageType.Percent, + Damage: maxHp.Mul(randDamage), + } + e.Ctx().Opp.Damage(e.Ctx().Our, damageZone) + + return true +} +func init() { + input.InitEffect(input.EffectType.Skill, 140, &Effect140{}) + +} diff --git a/logic/service/fight/effect/effect_153.go b/logic/service/fight/effect/effect_153.go new file mode 100644 index 00000000..4fb116ae --- /dev/null +++ b/logic/service/fight/effect/effect_153.go @@ -0,0 +1,30 @@ +package effect + +import ( + "blazing/logic/service/fight/action" + "blazing/logic/service/fight/input" + "blazing/logic/service/fight/node" +) + +// 153 - n回合内,每回合对对方造成伤害的1/m恢复自身体力 +type Effect153 struct { + node.EffectNode +} + +func (e *Effect153) SkillUseed() bool { + damageDone := e.Ctx().Our.SumDamage + healAmount := damageDone.Div(e.Args()[1]) // 伤害的1/m + + e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, healAmount) + + return true +} + +func (e *Effect153) SetArgs(t *input.Input, a ...int) { + e.EffectNode.SetArgs(t, a...) + e.EffectNode.Duration(a[0]) // 持续n回合 +} +func init() { + input.InitEffect(input.EffectType.Skill, 153, &Effect153{}) + +} diff --git a/logic/service/fight/effect/effect_160.go b/logic/service/fight/effect/effect_160.go new file mode 100644 index 00000000..a8fca04a --- /dev/null +++ b/logic/service/fight/effect/effect_160.go @@ -0,0 +1,55 @@ +package effect + +import ( + "blazing/logic/service/fight/action" + "blazing/logic/service/fight/info" + "blazing/logic/service/fight/input" + "blazing/logic/service/fight/node" +) + +// 160 - n回合内,若对手MISS则下回合自身必定致命一击 +type Effect160 struct { + node.EffectNode + can bool +} + +func (e *Effect160) 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.CritRate = 16 + e.can = false + e.Alive(false) + return true +} +func (e *Effect160) SkillHit_ex() bool { + + //fmt.Println(e.Ctx().SkillEntity) + if e.Ctx().SkillEntity == nil { + return true + } + + if e.Ctx().SkillEntity.AttackTime != 0 { + return true + } + e.can = true + e.Duration(1) + return true +} + +func (e *Effect160) SetArgs(t *input.Input, a ...int) { + e.EffectNode.SetArgs(t, a...) + e.EffectNode.Duration(a[0]) // 持续n回合 +} +func init() { + input.InitEffect(input.EffectType.Skill, 160, &Effect160{}) + +} diff --git a/logic/service/fight/effect/effect_161.go b/logic/service/fight/effect/effect_161.go new file mode 100644 index 00000000..7adf1bf0 --- /dev/null +++ b/logic/service/fight/effect/effect_161.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/alpacahq/alpacadecimal" +) + +// 161 - n%降低自身当前体力值的1/m +type Effect161 struct { + node.EffectNode +} + +func (e *Effect161) OnSkill() bool { + chance := e.Args()[0].IntPart() + success, _, _ := e.Input.Player.Roll(int(chance), 100) + + if success { + currentHp := e.Ctx().Our.CurrentPet.GetHP() + damageRatio := alpacadecimal.NewFromFloat(1.0).Div(e.Args()[1]) // 1/m + damageAmount := currentHp.Mul(damageRatio) + + damageZone := &info.DamageZone{ + Type: info.DamageType.Percent, + Damage: damageAmount, + } + e.Ctx().Our.Damage(e.Ctx().Our, damageZone) + } + + return true +} +func init() { + input.InitEffect(input.EffectType.Skill, 161, &Effect161{}) + +} diff --git a/logic/service/fight/effect/effect_172.go b/logic/service/fight/effect/effect_172.go new file mode 100644 index 00000000..23b3fc07 --- /dev/null +++ b/logic/service/fight/effect/effect_172.go @@ -0,0 +1,26 @@ +package effect + +import ( + "blazing/logic/service/fight/action" + "blazing/logic/service/fight/input" + "blazing/logic/service/fight/node" +) + +// 172 - 2 若后出手,则给予对方损伤的1/n会回复自己的体力 +type Effect172 struct { + node.EffectNode +} + +func (e *Effect172) OnSkill() bool { + if !e.Input.FightC.IsFirst(e.Input.Player) { + return true + } + damage := e.Ctx().Opp.SumDamage + healAmount := damage.Div(e.Args()[0]) // 损伤的1/n + e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, healAmount) + return true +} +func init() { + input.InitEffect(input.EffectType.Skill, 172, &Effect172{}) + +} diff --git a/logic/service/fight/effect/effect_404.go b/logic/service/fight/effect/effect_404.go new file mode 100644 index 00000000..7f7f2cc0 --- /dev/null +++ b/logic/service/fight/effect/effect_404.go @@ -0,0 +1,28 @@ +package effect + +import ( + "blazing/logic/service/fight/action" + "blazing/logic/service/fight/input" + "blazing/logic/service/fight/node" +) + +// 404 - 恢复双方所有体力 +type Effect404 struct { + node.EffectNode +} + +func (e *Effect404) OnSkill() bool { + // 恢复我方所有体力 + ourMaxHp := e.Ctx().Our.CurrentPet.GetMaxHP() + e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, ourMaxHp) + + // 恢复对手所有体力 + oppMaxHp := e.Ctx().Opp.CurrentPet.GetMaxHP() + e.Ctx().Opp.Heal(e.Ctx().Opp, &action.SelectSkillAction{}, oppMaxHp) + + return true +} +func init() { + input.InitEffect(input.EffectType.Skill, 404, &Effect404{}) + +} diff --git a/logic/service/fight/effect/effect_406.go b/logic/service/fight/effect/effect_406.go new file mode 100644 index 00000000..f39def91 --- /dev/null +++ b/logic/service/fight/effect/effect_406.go @@ -0,0 +1,34 @@ +package effect + +import ( + "blazing/logic/service/fight/action" + "blazing/logic/service/fight/input" + "blazing/logic/service/fight/node" + + "github.com/alpacahq/alpacadecimal" +) + +// 406 - 2 n回合内受到攻击m%几率回复k点体力 +type Effect406 struct { + node.EffectNode +} + +func (e *Effect406) Skill_Use_ex() bool { + + chance := e.Args()[1].IntPart() + success, _, _ := e.Input.Player.Roll(int(chance), 100) + if success { + healAmount := alpacadecimal.NewFromInt(int64(e.Args()[2].IntPart())) + e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, healAmount) + } + return true +} + +func (e *Effect406) SetArgs(t *input.Input, a ...int) { + e.EffectNode.SetArgs(t, a...) + e.EffectNode.Duration(a[0]) // 持续n回合 +} +func init() { + input.InitEffect(input.EffectType.Skill, 406, &Effect406{}) + +} diff --git a/logic/service/fight/effect/effect_409.go b/logic/service/fight/effect/effect_409.go new file mode 100644 index 00000000..aad5f61d --- /dev/null +++ b/logic/service/fight/effect/effect_409.go @@ -0,0 +1,26 @@ +package effect + +import ( + "blazing/logic/service/fight/info" + "blazing/logic/service/fight/input" + "blazing/logic/service/fight/node" +) + +// 409 - n回合内,对手每回合速度等级m +type Effect409 struct { + node.EffectNode +} + +func (e *Effect409) SetArgs(t *input.Input, a ...int) { + e.EffectNode.SetArgs(t, a...) + e.EffectNode.Duration(a[0]) // 持续n回合 +} +func (e *Effect409) Action_end() bool { + + e.Ctx().Opp.SetProp(e.Ctx().Our, 4, int8(int(e.Args()[1].IntPart())), info.AbilityOpType.SUB) + return true +} +func init() { + input.InitEffect(input.EffectType.Skill, 409, &Effect409{}) + +} diff --git a/logic/service/fight/effect/effect_416.go b/logic/service/fight/effect/effect_416.go new file mode 100644 index 00000000..253d40e6 --- /dev/null +++ b/logic/service/fight/effect/effect_416.go @@ -0,0 +1,30 @@ +package effect + +import ( + "blazing/logic/service/fight/info" + "blazing/logic/service/fight/input" + "blazing/logic/service/fight/node" +) + +// 416 - n回合内,受到任何伤害,对手XX降低m个等级 +type Effect416 struct { + node.EffectNode +} + +func (e *Effect416) Skill_Use_ex() bool { + effectType := int8(e.Args()[1].IntPart()) // XX类型 + effectValue := int8(e.Args()[2].IntPart()) // 降低m个等级 + + e.Ctx().Opp.SetProp(e.Ctx().Our, effectType, effectValue, info.AbilityOpType.SUB) + + return true +} + +func (e *Effect416) SetArgs(t *input.Input, a ...int) { + e.EffectNode.SetArgs(t, a...) + e.EffectNode.Duration(a[0]) // 持续n回合 +} +func init() { + input.InitEffect(input.EffectType.Skill, 416, &Effect416{}) + +} diff --git a/logic/service/fight/effect/effect_419.go b/logic/service/fight/effect/effect_419.go new file mode 100644 index 00000000..bbe59547 --- /dev/null +++ b/logic/service/fight/effect/effect_419.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/alpacahq/alpacadecimal" +) + +// 419 - m回合内,若对手处于能力强化状态,则每回合都会受到k点固定伤害 +type Effect419 struct { + node.EffectNode +} + +func (e *Effect419) Action_end() bool { + for _, V := range e.Ctx().Opp.Prop[:] { + if V > 0 { + fixedDamage := alpacadecimal.NewFromInt(int64(e.Args()[1].IntPart())) // k点固定伤害 + + damageZone := &info.DamageZone{ + Type: info.DamageType.Fixed, + Damage: fixedDamage, + } + e.Ctx().Opp.Damage(e.Ctx().Our, damageZone) + return true + } + + } + + return true +} + +func (e *Effect419) SetArgs(t *input.Input, a ...int) { + e.EffectNode.SetArgs(t, a...) + e.EffectNode.Duration(a[0]) // 持续m回合 +} +func init() { + input.InitEffect(input.EffectType.Skill, 419, &Effect419{}) + +} diff --git a/logic/service/fight/effect/effect_423.go b/logic/service/fight/effect/effect_423.go new file mode 100644 index 00000000..5b2ca096 --- /dev/null +++ b/logic/service/fight/effect/effect_423.go @@ -0,0 +1,30 @@ +package effect + +import ( + "blazing/logic/service/fight/info" + "blazing/logic/service/fight/input" + "blazing/logic/service/fight/node" + + "github.com/alpacahq/alpacadecimal" +) + +// 423 - 直接造成等同于对手防御值的固定伤害 +type Effect423 struct { + node.EffectNode +} + +func (e *Effect423) OnSkill() bool { + defenseValue := alpacadecimal.NewFromInt(int64(e.Ctx().Opp.CurrentPet.Info.Prop[1])) + + damageZone := &info.DamageZone{ + Type: info.DamageType.Fixed, + Damage: defenseValue, + } + e.Ctx().Opp.Damage(e.Ctx().Our, damageZone) + + return true +} +func init() { + input.InitEffect(input.EffectType.Skill, 423, &Effect423{}) + +} diff --git a/logic/service/fight/effect/effect_450.go b/logic/service/fight/effect/effect_450.go new file mode 100644 index 00000000..e65634be --- /dev/null +++ b/logic/service/fight/effect/effect_450.go @@ -0,0 +1,32 @@ +package effect + +import ( + "blazing/logic/service/fight/action" + "blazing/logic/service/fight/input" + "blazing/logic/service/fight/node" + + "github.com/alpacahq/alpacadecimal" +) + +// 450 - 随机恢复m到n点体力 +type Effect450 struct { + node.EffectNode +} + +func (e *Effect450) OnSkill() bool { + minHeal := e.Args()[0].IntPart() + maxHeal := e.Args()[1].IntPart() + + // 随机值在m到n之间 + rangeVal := maxHeal - minHeal + randomVal := int64(e.Input.FightC.GetRand().Int31n(int32(rangeVal)) + int32(minHeal)) + + healAmount := alpacadecimal.NewFromInt(randomVal) + e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, healAmount) + + return true +} +func init() { + input.InitEffect(input.EffectType.Skill, 450, &Effect450{}) + +} diff --git a/logic/service/fight/effect/effect_490.go b/logic/service/fight/effect/effect_490.go new file mode 100644 index 00000000..dd2b14ad --- /dev/null +++ b/logic/service/fight/effect/effect_490.go @@ -0,0 +1,30 @@ +package effect + +import ( + "blazing/logic/service/fight/info" + "blazing/logic/service/fight/input" + "blazing/logic/service/fight/node" + + "github.com/alpacahq/alpacadecimal" +) + +// 490 - 造成的伤害大于m,则对自身速度+n +type Effect490 struct { + node.EffectNode +} + +func (e *Effect490) Skill_Use_ex() bool { + damageThreshold := int(e.Args()[0].IntPart()) + speedBoost := int8(e.Args()[1].IntPart()) + + if e.Ctx().Our.SumDamage.Cmp(alpacadecimal.NewFromInt(int64(damageThreshold))) > 0 { + // 提升自身速度等级 + e.Ctx().Our.SetProp(e.Ctx().Our, 5, speedBoost, info.AbilityOpType.ADD) + } + + return true +} +func init() { + input.InitEffect(input.EffectType.Skill, 490, &Effect490{}) + +} diff --git a/logic/service/fight/effect/effect_499.go b/logic/service/fight/effect/effect_499.go new file mode 100644 index 00000000..eed87c62 --- /dev/null +++ b/logic/service/fight/effect/effect_499.go @@ -0,0 +1,41 @@ +package effect + +import ( + "blazing/logic/service/fight/action" + "blazing/logic/service/fight/input" + "blazing/logic/service/fight/node" +) + +// 499 - 后出手时下回合所有技能先制+m +type Effect499 struct { + node.EffectNode + can bool +} + +func (e *Effect499) ActionStartEx(fattack, sattack *action.SelectSkillAction) bool { + + if !e.can { + return true + } + // n%几率触发 + success, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100) + if success && e.Ctx().SkillEntity != nil { + // 先制+1(提升优先级) + e.Ctx().SkillEntity.AttackTime += uint32(e.Args()[1].IntPart()) + } + e.can = true + e.Alive(false) + return true +} +func (e *Effect499) OnSkill() bool { + if e.Input.FightC.IsFirst(e.Input.Player) { + return true + } + e.can = true + e.Duration(1) + return true +} +func init() { + input.InitEffect(input.EffectType.Skill, 499, &Effect499{}) + +} diff --git a/logic/service/fight/effect/effect_power_doblue.go b/logic/service/fight/effect/effect_power_doblue.go index 30b7705e..5a2585f9 100644 --- a/logic/service/fight/effect/effect_power_doblue.go +++ b/logic/service/fight/effect/effect_power_doblue.go @@ -80,7 +80,16 @@ func init() { registerStatusFunc(401, func(i, o *input.Input) bool { return i.CurrentPet.PetInfo.Type == o.CurrentPet.PetInfo.Type }) + registerStatusFunc(431, func(i, o *input.Input) bool { + for _, v := range o.Prop[:] { + + if v < 0 { + return true + } + } + return false + }) } type Effect129 struct { diff --git a/logic/service/fight/effect/effect_status.go b/logic/service/fight/effect/effect_status.go index bdb7a368..e8fef2ae 100644 --- a/logic/service/fight/effect/effect_status.go +++ b/logic/service/fight/effect/effect_status.go @@ -63,6 +63,7 @@ func (e *StatusSleep) Skill_Use_ex() bool { // 持续伤害状态基类(中毒、冻伤、烧伤等) type ContinuousDamage struct { BaseStatus + isheal bool //是否回血 } // 技能命中前触发伤害(1/8最大生命值真实伤害) @@ -73,6 +74,20 @@ func (e *ContinuousDamage) ActionStart(attacker, defender *action.SelectSkillAct Type: info.DamageType.True, Damage: damage, }) + if len(e.SideEffectArgs) == 0 { + return true + } + // 额外效果 + e.Ctx().Our.Damage(e.Input, &info.DamageZone{ + Type: info.DamageType.True, + Damage: damage, + }) + if e.Ctx().Opp.CurrentPet.GetHP().IntPart() == 0 { + return true + } + + // 给对方回血(不受回血限制影响) + e.Ctx().Opp.Heal(e.Ctx().Our, nil, damage) return true } diff --git a/logic/service/fight/input/effect.go b/logic/service/fight/input/effect.go index 051651a6..97dcc478 100644 --- a/logic/service/fight/input/effect.go +++ b/logic/service/fight/input/effect.go @@ -58,7 +58,7 @@ func GeteffectIDs(etype EnumEffectType) []uint32 { } // 这里的catchtime为0,取出来之后如果是魂印,要重新赋值 -func Geteffect[T int | byte | uint16](etype EnumEffectType, id T) Effect { +func geteffect[T int | byte | uint16](etype EnumEffectType, id T) Effect { pr := EffectIDCombiner{} pr.Combine(etype, 0, gconv.Uint16(id)) @@ -81,7 +81,7 @@ func Geteffect[T int | byte | uint16](etype EnumEffectType, id T) Effect { return nil } func (our *Input) InitEffect(etype EnumEffectType, id int) Effect { - ret := Geteffect(etype, id) + ret := geteffect(etype, id) ret.SetArgs(our) //输入参数是对方 return ret diff --git a/logic/service/fight/input/input.go b/logic/service/fight/input/input.go index 7ba7381b..215b78e6 100644 --- a/logic/service/fight/input/input.go +++ b/logic/service/fight/input/input.go @@ -70,7 +70,7 @@ func (our *Input) SortPet() { for _, s := range our.AllPet { if s.Info.Hp > 0 { for _, e1 := range s.Info.EffectInfo { - t := Geteffect(EffectType.NewSel, e1.EID) + t := our.InitEffect(EffectType.NewSel, int(e1.EID)) if t != nil { ef := t.ID() if cool.Config.ServerInfo.IsDebug != 0 { @@ -215,7 +215,7 @@ func (our *Input) GetStatusBonus() float64 { maxBonus := 1.0 // 默认无状态倍率 for statusIdx := 0; statusIdx < 20; statusIdx++ { - t := Geteffect(EffectType.Status, statusIdx) + t := our.InitEffect(EffectType.Status, statusIdx) // 检查状态是否存在(数组中值为1表示存在该状态) if t != nil && t.Stack() > 0 { @@ -243,7 +243,7 @@ func (our *Input) Parseskill(skill *action.SelectSkillAction) { for _, v := range skill.SideEffectS { - t := Geteffect(EffectType.Skill, v) + t := our.InitEffect(EffectType.Skill, v) args := xmlres.EffectArgs[v] //这里是给双方添加buff