108 lines
2.9 KiB
Go
108 lines
2.9 KiB
Go
package effect
|
|
|
|
import (
|
|
"blazing/logic/service/fight/info"
|
|
"blazing/logic/service/fight/input"
|
|
"blazing/logic/service/fight/node"
|
|
|
|
"github.com/alpacahq/alpacadecimal"
|
|
)
|
|
|
|
// Effect 1082: 造成的伤害低于{0}则附加自身最大体力{1}%的百分比伤害
|
|
type Effect1082 struct{ node.EffectNode }
|
|
|
|
func (e *Effect1082) Skill_Use() bool {
|
|
if len(e.Args()) < 2 || e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS || e.Ctx().SkillEntity.AttackTime == 0 {
|
|
return true
|
|
}
|
|
if e.Ctx().Our.SumDamage.Cmp(e.Args()[0]) >= 0 {
|
|
return true
|
|
}
|
|
|
|
damage := e.Ctx().Our.CurPet[0].GetMaxHP().Mul(e.Args()[1]).Div(hundred)
|
|
if damage.Cmp(alpacadecimal.Zero) > 0 {
|
|
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
|
|
Type: info.DamageType.Percent,
|
|
Damage: damage,
|
|
})
|
|
}
|
|
return true
|
|
}
|
|
|
|
// Effect 1083: 若后出手则消除对手回合类效果
|
|
type Effect1083 struct{ node.EffectNode }
|
|
|
|
func (e *Effect1083) Skill_Use() bool {
|
|
if e.IsFirst() {
|
|
return true
|
|
}
|
|
e.Ctx().Opp.CancelTurn(e.Ctx().Our)
|
|
return true
|
|
}
|
|
|
|
// Effect 1084: 附加{0}点固定伤害,对手处于异常状态时固定伤害翻倍
|
|
type Effect1084 struct{ node.EffectNode }
|
|
|
|
func (e *Effect1084) Skill_Use() bool {
|
|
if len(e.Args()) == 0 || e.Args()[0].Cmp(alpacadecimal.Zero) <= 0 {
|
|
return true
|
|
}
|
|
|
|
damage := e.Args()[0]
|
|
if e.Ctx().Opp.StatEffect_Exist_all() {
|
|
damage = damage.Mul(alpacadecimal.NewFromInt(2))
|
|
}
|
|
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
|
|
Type: info.DamageType.Fixed,
|
|
Damage: damage,
|
|
})
|
|
return true
|
|
}
|
|
|
|
// Effect 1085: {0}回合内受到的伤害低于{1}则附加{2}点固定伤害
|
|
type Effect1085 struct{ RoundEffectArg0Base }
|
|
|
|
func (e *Effect1085) DamageSubEx(zone *info.DamageZone) bool {
|
|
if zone == nil || zone.Type != info.DamageType.Red || len(e.Args()) < 3 {
|
|
return true
|
|
}
|
|
if zone.Damage.Cmp(alpacadecimal.Zero) <= 0 || zone.Damage.Cmp(e.Args()[1]) >= 0 {
|
|
return true
|
|
}
|
|
if e.Args()[2].Cmp(alpacadecimal.Zero) <= 0 {
|
|
return true
|
|
}
|
|
|
|
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
|
|
Type: info.DamageType.Fixed,
|
|
Damage: e.Args()[2],
|
|
})
|
|
return true
|
|
}
|
|
|
|
// Effect 1086: 自身体力低于对手时造成的伤害提高{0}%
|
|
type Effect1086 struct{ node.EffectNode }
|
|
|
|
func (e *Effect1086) Damage_Mul(zone *info.DamageZone) bool {
|
|
if zone == nil || zone.Type != info.DamageType.Red || len(e.Args()) == 0 {
|
|
return true
|
|
}
|
|
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
|
|
return true
|
|
}
|
|
if e.Ctx().Our.CurPet[0].GetHP().Cmp(e.Ctx().Opp.CurPet[0].GetHP()) >= 0 {
|
|
return true
|
|
}
|
|
|
|
zone.Damage = zone.Damage.Mul(hundred.Add(e.Args()[0])).Div(hundred)
|
|
return true
|
|
}
|
|
|
|
func init() {
|
|
input.InitEffect(input.EffectType.Skill, 1082, &Effect1082{})
|
|
input.InitEffect(input.EffectType.Skill, 1083, &Effect1083{})
|
|
input.InitEffect(input.EffectType.Skill, 1084, &Effect1084{})
|
|
input.InitEffect(input.EffectType.Skill, 1085, &Effect1085{})
|
|
input.InitEffect(input.EffectType.Skill, 1086, &Effect1086{})
|
|
}
|