159 lines
4.3 KiB
Go
159 lines
4.3 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 836: 自身体力高于对手时先制+{0}
|
|
type Effect836 struct{ node.EffectNode }
|
|
|
|
func (e *Effect836) ComparePre(fattack, sattack *action.SelectSkillAction) bool {
|
|
if len(e.Args()) == 0 || e.Ctx().Our.CurrentPet.GetHP().Cmp(e.Ctx().Opp.CurrentPet.GetHP()) <= 0 {
|
|
return true
|
|
}
|
|
|
|
current := actionByPlayer(fattack, sattack, e.Ctx().Our.UserID)
|
|
if current != nil && current.SkillEntity != nil {
|
|
current.SkillEntity.XML.Priority += int(e.Args()[0].IntPart())
|
|
}
|
|
return true
|
|
}
|
|
|
|
// Effect 837: 吸取对手{0}点固定体力,每次使用额外附加{1}点,最高{2}点
|
|
type Effect837 struct{ AddLvelEffect }
|
|
|
|
func (e *Effect837) Skill_Use() bool {
|
|
if len(e.Args()) < 3 {
|
|
return true
|
|
}
|
|
|
|
damage := e.Args()[0]
|
|
if e.UseSkillCount > 1 {
|
|
damage = damage.Add(e.Args()[1].Mul(alpacadecimal.NewFromInt(e.UseSkillCount - 1)))
|
|
}
|
|
if damage.Cmp(e.Args()[2]) > 0 {
|
|
damage = e.Args()[2]
|
|
}
|
|
if damage.Cmp(alpacadecimal.Zero) <= 0 {
|
|
return true
|
|
}
|
|
|
|
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
|
|
Type: info.DamageType.Fixed,
|
|
Damage: damage,
|
|
})
|
|
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, damage)
|
|
return true
|
|
}
|
|
|
|
// Effect 838: 若当回合未击败对手,则下回合附加{0}点固定伤害
|
|
type Effect838 struct{ node.EffectNode }
|
|
|
|
func (e *Effect838) 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, 838, int(e.Args()[0].IntPart()))
|
|
if sub != nil {
|
|
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
|
|
}
|
|
return true
|
|
}
|
|
|
|
type Effect838Sub struct{ node.EffectNode }
|
|
|
|
func (e *Effect838Sub) SetArgs(t *input.Input, a ...int) {
|
|
e.EffectNode.SetArgs(t, a...)
|
|
e.Duration(1)
|
|
}
|
|
|
|
func (e *Effect838Sub) Skill_Use() bool {
|
|
if len(e.Args()) == 0 || e.Args()[0].Cmp(alpacadecimal.Zero) <= 0 {
|
|
return true
|
|
}
|
|
|
|
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
|
|
Type: info.DamageType.Fixed,
|
|
Damage: e.Args()[0],
|
|
})
|
|
e.Alive(false)
|
|
return true
|
|
}
|
|
|
|
// Effect 839: 附加自身最大体力{0}%的百分比伤害并恢复等量体力
|
|
type Effect839 struct{ node.EffectNode }
|
|
|
|
func (e *Effect839) Skill_Use() bool {
|
|
if len(e.Args()) == 0 {
|
|
return true
|
|
}
|
|
|
|
amount := e.Ctx().Our.CurrentPet.GetMaxHP().Mul(e.Args()[0]).Div(hundred)
|
|
if amount.Cmp(alpacadecimal.Zero) <= 0 {
|
|
return true
|
|
}
|
|
|
|
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
|
|
Type: info.DamageType.Percent,
|
|
Damage: amount,
|
|
})
|
|
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, amount)
|
|
return true
|
|
}
|
|
|
|
// Effect 840: 击败对手则对方下只精灵出战时己方在场精灵吸取其最大体力的1/{0}
|
|
type Effect840 struct{ node.EffectNode }
|
|
|
|
func (e *Effect840) Skill_Use() bool {
|
|
if len(e.Args()) == 0 || e.Args()[0].Cmp(alpacadecimal.Zero) <= 0 || e.Ctx().Opp.CurrentPet == nil || e.Ctx().Opp.CurrentPet.Info.Hp > 0 {
|
|
return true
|
|
}
|
|
|
|
sub := e.Ctx().Opp.InitEffect(input.EffectType.Sub, 840, int(e.Args()[0].IntPart()))
|
|
if sub != nil {
|
|
e.Ctx().Opp.AddEffect(e.Ctx().Our, sub)
|
|
}
|
|
return true
|
|
}
|
|
|
|
type Effect840Sub struct{ node.EffectNode }
|
|
|
|
func (e *Effect840Sub) SetArgs(t *input.Input, a ...int) {
|
|
e.EffectNode.SetArgs(t, a...)
|
|
e.CanStack(false)
|
|
e.Duration(1)
|
|
}
|
|
|
|
func (e *Effect840Sub) SwitchIn(in *input.Input) bool {
|
|
if in != e.Ctx().Our || len(e.Args()) == 0 || e.Args()[0].Cmp(alpacadecimal.Zero) <= 0 {
|
|
return true
|
|
}
|
|
|
|
drain := e.Ctx().Our.CurrentPet.GetMaxHP().Div(e.Args()[0])
|
|
if drain.Cmp(alpacadecimal.Zero) > 0 {
|
|
e.Ctx().Our.Damage(e.Ctx().Opp, &info.DamageZone{
|
|
Type: info.DamageType.Percent,
|
|
Damage: drain,
|
|
})
|
|
e.Ctx().Opp.Heal(e.Ctx().Opp, &action.SelectSkillAction{}, drain)
|
|
}
|
|
e.Alive(false)
|
|
return true
|
|
}
|
|
|
|
func init() {
|
|
input.InitEffect(input.EffectType.Skill, 836, &Effect836{})
|
|
input.InitEffect(input.EffectType.Skill, 837, &Effect837{})
|
|
input.InitEffect(input.EffectType.Skill, 838, &Effect838{})
|
|
input.InitEffect(input.EffectType.Sub, 838, &Effect838Sub{})
|
|
input.InitEffect(input.EffectType.Skill, 839, &Effect839{})
|
|
input.InitEffect(input.EffectType.Skill, 840, &Effect840{})
|
|
input.InitEffect(input.EffectType.Sub, 840, &Effect840Sub{})
|
|
}
|