175 lines
4.8 KiB
Go
175 lines
4.8 KiB
Go
package effect
|
|
|
|
import (
|
|
"blazing/common/data/xmlres"
|
|
"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 815: 后出手时附加自身当前体力{0}%的百分比伤害
|
|
type Effect815 struct{ node.EffectNode }
|
|
|
|
func (e *Effect815) Skill_Use() bool {
|
|
if len(e.Args()) == 0 || e.IsFirst() {
|
|
return true
|
|
}
|
|
damage := e.Ctx().Our.CurrentPet.GetHP().Mul(e.Args()[0]).Div(hundred)
|
|
if damage.Cmp(alpacadecimal.Zero) <= 0 {
|
|
return true
|
|
}
|
|
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{Type: info.DamageType.Percent, Damage: damage})
|
|
return true
|
|
}
|
|
|
|
// Effect 816: 免疫对手下次攻击技能造成的伤害并直接扣除对手等量体力
|
|
type Effect816 struct{ node.EffectNode }
|
|
|
|
func (e *Effect816) Skill_Use() bool {
|
|
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 816)
|
|
if sub != nil {
|
|
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
|
|
}
|
|
return true
|
|
}
|
|
|
|
type Effect816Sub struct {
|
|
node.EffectNode
|
|
attackRemain int
|
|
extraRemain int
|
|
}
|
|
|
|
func (e *Effect816Sub) SetArgs(t *input.Input, a ...int) {
|
|
e.EffectNode.SetArgs(t, a...)
|
|
e.Duration(-1)
|
|
e.attackRemain = 1
|
|
}
|
|
|
|
func (e *Effect816Sub) DamageLockEx(zone *info.DamageZone) bool {
|
|
if zone == nil || e.attackRemain <= 0 || e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
|
|
return true
|
|
}
|
|
damage := zone.Damage
|
|
zone.Damage = alpacadecimal.Zero
|
|
e.attackRemain--
|
|
if move, ok := xmlres.SkillMap[int(e.Ctx().SkillEntity.Info.ID)]; ok && move.MaxPP > 0 && int(e.Ctx().SkillEntity.Info.PP) == move.MaxPP {
|
|
e.extraRemain++
|
|
}
|
|
if damage.Cmp(alpacadecimal.Zero) > 0 {
|
|
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{Type: info.DamageType.Fixed, Damage: damage})
|
|
}
|
|
if e.attackRemain <= 0 && e.extraRemain <= 0 {
|
|
e.Alive(false)
|
|
}
|
|
return true
|
|
}
|
|
|
|
func (e *Effect816Sub) DamageDivEx(zone *info.DamageZone) bool {
|
|
if zone == nil || e.extraRemain <= 0 {
|
|
return true
|
|
}
|
|
if zone.Type != info.DamageType.Fixed && zone.Type != info.DamageType.Percent {
|
|
return true
|
|
}
|
|
zone.Damage = alpacadecimal.Zero
|
|
e.extraRemain--
|
|
if e.attackRemain <= 0 && e.extraRemain <= 0 {
|
|
e.Alive(false)
|
|
}
|
|
return true
|
|
}
|
|
|
|
// Effect 817: {0}回合内受到攻击则对手下回合受到的伤害翻倍
|
|
type Effect817 struct{ node.EffectNode }
|
|
|
|
func (e *Effect817) Skill_Use() bool {
|
|
if len(e.Args()) == 0 {
|
|
return true
|
|
}
|
|
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 817, int(e.Args()[0].IntPart()))
|
|
if sub != nil {
|
|
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
|
|
}
|
|
return true
|
|
}
|
|
|
|
type Effect817Sub struct {
|
|
RoundEffectArg0Base
|
|
triggered bool
|
|
}
|
|
|
|
func (e *Effect817Sub) DamageSubEx(zone *info.DamageZone) bool {
|
|
if zone == nil || zone.Damage.Cmp(alpacadecimal.Zero) <= 0 {
|
|
return true
|
|
}
|
|
e.triggered = true
|
|
return true
|
|
}
|
|
|
|
func (e *Effect817Sub) TurnEnd() {
|
|
if e.triggered {
|
|
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 8171)
|
|
if sub != nil {
|
|
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
|
|
}
|
|
e.Alive(false)
|
|
return
|
|
}
|
|
e.RoundEffectArg0Base.TurnEnd()
|
|
}
|
|
|
|
type Effect817BoostSub struct{ FixedDuration1Base }
|
|
|
|
func (e *Effect817BoostSub) Damage_Mul(zone *info.DamageZone) bool {
|
|
if zone == nil || zone.Type != info.DamageType.Red {
|
|
return true
|
|
}
|
|
zone.Damage = zone.Damage.Mul(alpacadecimal.NewFromInt(2))
|
|
return true
|
|
}
|
|
|
|
// Effect 818: 出手时本回合若受到伤害,则将伤害反馈给对手
|
|
type Effect818 struct{ node.EffectNode }
|
|
|
|
func (e *Effect818) OnSkill() bool {
|
|
if e.Ctx().Opp.SumDamage.Cmp(alpacadecimal.Zero) <= 0 {
|
|
return true
|
|
}
|
|
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{Type: info.DamageType.Fixed, Damage: e.Ctx().Opp.SumDamage})
|
|
return true
|
|
}
|
|
|
|
// Effect 819: 出手时本回合若未受到攻击伤害,则附加自身{0}值{1}%的百分比伤害,并恢复等量体力
|
|
type Effect819 struct{ node.EffectNode }
|
|
|
|
func (e *Effect819) OnSkill() bool {
|
|
if len(e.Args()) < 2 || e.Ctx().Opp.SumDamage.Cmp(alpacadecimal.Zero) > 0 {
|
|
return true
|
|
}
|
|
propID := int(e.Args()[0].IntPart())
|
|
if propID < 0 || propID >= 6 {
|
|
return true
|
|
}
|
|
damage := e.Ctx().Our.GetProp(propID).Mul(e.Args()[1]).Div(hundred)
|
|
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
|
|
}
|
|
|
|
func init() {
|
|
input.InitEffect(input.EffectType.Skill, 815, &Effect815{})
|
|
input.InitEffect(input.EffectType.Skill, 816, &Effect816{})
|
|
input.InitEffect(input.EffectType.Sub, 816, &Effect816Sub{})
|
|
input.InitEffect(input.EffectType.Skill, 817, &Effect817{})
|
|
input.InitEffect(input.EffectType.Sub, 817, &Effect817Sub{})
|
|
input.InitEffect(input.EffectType.Sub, 8171, &Effect817BoostSub{})
|
|
input.InitEffect(input.EffectType.Skill, 818, &Effect818{})
|
|
input.InitEffect(input.EffectType.Skill, 819, &Effect819{})
|
|
}
|