145 lines
4.2 KiB
Go
145 lines
4.2 KiB
Go
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"
|
|
)
|
|
|
|
// Effect 1087: 反转自身能力下降状态,反转成功则对手下{0}回合技能无效
|
|
type Effect1087 struct{ node.EffectNode }
|
|
|
|
func (e *Effect1087) Skill_Use() bool {
|
|
if len(e.Args()) == 0 {
|
|
return true
|
|
}
|
|
|
|
reversed := false
|
|
for i, v := range e.Ctx().Our.Prop[:] {
|
|
if v >= 0 {
|
|
continue
|
|
}
|
|
if e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), -2*v) {
|
|
reversed = true
|
|
}
|
|
}
|
|
if !reversed {
|
|
return true
|
|
}
|
|
|
|
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1087, int(e.Args()[0].IntPart()))
|
|
if sub != nil {
|
|
e.Ctx().Opp.AddEffect(e.Ctx().Our, sub)
|
|
}
|
|
return true
|
|
}
|
|
|
|
type Effect1087Sub struct{ RoundEffectArg0Base }
|
|
|
|
func (e *Effect1087Sub) ActionStart(a, b *action.SelectSkillAction) bool {
|
|
if e.Ctx().SkillEntity == nil {
|
|
return true
|
|
}
|
|
e.Ctx().SkillEntity.SetMiss()
|
|
return true
|
|
}
|
|
|
|
// Effect 1088: 造成的攻击伤害高于{0}则吸取对手最大体力的1/{1}
|
|
type Effect1088 struct{ node.EffectNode }
|
|
|
|
func (e *Effect1088) 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 || e.Args()[1].Cmp(alpacadecimal.Zero) <= 0 {
|
|
return true
|
|
}
|
|
|
|
damage := e.Ctx().Opp.CurrentPet.GetMaxHP().Div(e.Args()[1])
|
|
if damage.Cmp(alpacadecimal.Zero) > 0 {
|
|
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{Type: info.DamageType.Percent, Damage: damage})
|
|
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, damage)
|
|
}
|
|
return true
|
|
}
|
|
|
|
// Effect 1089: {0}回合内对手使用攻击技能后随机附加给对手{1}种异常状态
|
|
type Effect1089 struct{ RoundEffectArg0Base }
|
|
|
|
func (e *Effect1089) Skill_Use_ex() bool {
|
|
if len(e.Args()) < 2 || e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
|
|
return true
|
|
}
|
|
applyRandomStatusToOpp(e.Ctx().Our, e.Ctx().Opp, int(e.Args()[1].IntPart()))
|
|
return true
|
|
}
|
|
|
|
// Effect 1090: 击败对手则{0}回合内令对手攻击技能无法造成伤害且命中效果失效
|
|
type Effect1090 struct{ node.EffectNode }
|
|
|
|
func (e *Effect1090) Skill_Use() bool {
|
|
if len(e.Args()) == 0 || e.Ctx().Opp.CurrentPet == nil || e.Ctx().Opp.CurrentPet.Info.Hp > 0 {
|
|
return true
|
|
}
|
|
|
|
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1090, int(e.Args()[0].IntPart()))
|
|
if sub != nil {
|
|
e.Ctx().Opp.AddEffect(e.Ctx().Our, sub)
|
|
}
|
|
return true
|
|
}
|
|
|
|
type Effect1090Sub struct{ RoundEffectArg0Base }
|
|
|
|
func (e *Effect1090Sub) ActionStart(a, b *action.SelectSkillAction) bool {
|
|
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
|
|
return true
|
|
}
|
|
e.Ctx().SkillEntity.SetNoSide()
|
|
e.Ctx().SkillEntity.AttackTime = 0
|
|
return true
|
|
}
|
|
|
|
// Effect 1091: 未击败对手则自身下{0}回合免疫并反弹异常状态
|
|
type Effect1091 struct{ node.EffectNode }
|
|
|
|
func (e *Effect1091) Skill_Use() bool {
|
|
if len(e.Args()) == 0 || e.Ctx().Opp.CurrentPet == nil || e.Ctx().Opp.CurrentPet.Info.Hp <= 0 {
|
|
return true
|
|
}
|
|
|
|
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1091, int(e.Args()[0].IntPart()))
|
|
if sub != nil {
|
|
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
|
|
}
|
|
return true
|
|
}
|
|
|
|
type Effect1091Sub struct{ RoundEffectArg0Base }
|
|
|
|
func (e *Effect1091Sub) EFFect_Befer(in *input.Input, effEffect input.Effect) bool {
|
|
if in != e.Ctx().Opp || !input.IS_Stat(effEffect) {
|
|
return true
|
|
}
|
|
|
|
statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(effEffect.ID().Suffix()))
|
|
if statusEffect != nil {
|
|
e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect)
|
|
}
|
|
return false
|
|
}
|
|
|
|
func init() {
|
|
input.InitEffect(input.EffectType.Skill, 1087, &Effect1087{})
|
|
input.InitEffect(input.EffectType.Sub, 1087, &Effect1087Sub{})
|
|
input.InitEffect(input.EffectType.Skill, 1088, &Effect1088{})
|
|
input.InitEffect(input.EffectType.Skill, 1089, &Effect1089{})
|
|
input.InitEffect(input.EffectType.Skill, 1090, &Effect1090{})
|
|
input.InitEffect(input.EffectType.Sub, 1090, &Effect1090Sub{})
|
|
input.InitEffect(input.EffectType.Skill, 1091, &Effect1091{})
|
|
input.InitEffect(input.EffectType.Sub, 1091, &Effect1091Sub{})
|
|
}
|