187 lines
4.5 KiB
Go
187 lines
4.5 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 820: 未击败对手下{0}回合自身攻击先制+{1}
|
|
type Effect820 struct{ node.EffectNode }
|
|
|
|
func (e *Effect820) Skill_Use() bool {
|
|
if len(e.Args()) < 2 || e.Ctx().Opp.CurrentPet == nil || e.Ctx().Opp.CurrentPet.Info.Hp <= 0 {
|
|
return true
|
|
}
|
|
|
|
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 820, int(e.Args()[0].IntPart()), int(e.Args()[1].IntPart()))
|
|
if sub != nil {
|
|
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
|
|
}
|
|
return true
|
|
}
|
|
|
|
type Effect820Sub struct{ RoundEffectArg0Base }
|
|
|
|
func (e *Effect820Sub) ComparePre(fattack, sattack *action.SelectSkillAction) bool {
|
|
current := actionByPlayer(fattack, sattack, e.Ctx().Our.UserID)
|
|
if current == nil || current.SkillEntity == nil || current.SkillEntity.Category() == info.Category.STATUS || len(e.Args()) < 2 {
|
|
return true
|
|
}
|
|
|
|
current.SkillEntity.XML.Priority += int(e.Args()[1].IntPart())
|
|
return true
|
|
}
|
|
|
|
// Effect 821: {0}回合内自身的回合类效果无法被消除,后出手时回合数+1
|
|
type Effect821 struct{ node.EffectNode }
|
|
|
|
func (e *Effect821) Skill_Use() bool {
|
|
if len(e.Args()) == 0 {
|
|
return true
|
|
}
|
|
|
|
rounds := int(e.Args()[0].IntPart())
|
|
if !e.IsFirst() {
|
|
rounds++
|
|
}
|
|
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 821, rounds)
|
|
if sub != nil {
|
|
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
|
|
}
|
|
return true
|
|
}
|
|
|
|
type Effect821Sub struct {
|
|
node.EffectNode
|
|
remaining int
|
|
}
|
|
|
|
func (e *Effect821Sub) SetArgs(t *input.Input, a ...int) {
|
|
e.EffectNode.SetArgs(t, a...)
|
|
e.Duration(-1)
|
|
if len(a) > 0 {
|
|
e.remaining = a[0]
|
|
}
|
|
}
|
|
|
|
func (e *Effect821Sub) Skill_Use_ex() bool {
|
|
for _, eff := range e.Ctx().Our.Effects {
|
|
if eff == nil || eff == e || eff.Alive() {
|
|
continue
|
|
}
|
|
if eff.ID().GetEffectType() == input.EffectType.Status || eff.Duration() <= 0 {
|
|
continue
|
|
}
|
|
eff.Alive(true)
|
|
}
|
|
return true
|
|
}
|
|
|
|
func (e *Effect821Sub) TurnEnd() {
|
|
e.remaining--
|
|
if e.remaining <= 0 {
|
|
e.Alive(false)
|
|
}
|
|
}
|
|
|
|
// Effect 822: 吸收对手的能力提升同时反转对手的能力提升
|
|
type Effect822 struct{ node.EffectNode }
|
|
|
|
func (e *Effect822) OnSkill() bool {
|
|
for i, v := range e.Ctx().Opp.Prop[:] {
|
|
if v <= 0 {
|
|
continue
|
|
}
|
|
if e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), -2*v) {
|
|
e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), v)
|
|
}
|
|
}
|
|
return true
|
|
}
|
|
|
|
// Effect 823: 当回合未击败对手,则下{0}回合必定先出手
|
|
type Effect823 struct{ node.EffectNode }
|
|
|
|
func (e *Effect823) 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, 823, int(e.Args()[0].IntPart()))
|
|
if sub != nil {
|
|
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
|
|
}
|
|
return true
|
|
}
|
|
|
|
type Effect823Sub struct {
|
|
node.EffectNode
|
|
remaining int
|
|
}
|
|
|
|
func (e *Effect823Sub) SetArgs(t *input.Input, a ...int) {
|
|
e.EffectNode.SetArgs(t, a...)
|
|
e.Duration(-1)
|
|
if len(a) > 0 {
|
|
e.remaining = a[0]
|
|
}
|
|
}
|
|
|
|
func (e *Effect823Sub) ComparePre(fattack, sattack *action.SelectSkillAction) bool {
|
|
if e.remaining <= 0 {
|
|
e.Alive(false)
|
|
return true
|
|
}
|
|
|
|
current := actionByPlayer(fattack, sattack, e.Ctx().Our.UserID)
|
|
if current == nil || current.SkillEntity == nil {
|
|
return true
|
|
}
|
|
|
|
current.SkillEntity.XML.Priority += 7
|
|
e.remaining--
|
|
if e.remaining <= 0 {
|
|
e.Alive(false)
|
|
}
|
|
return true
|
|
}
|
|
|
|
// Effect 824: 若对手不处于{0}状态则吸取对手1/{1}最大体力
|
|
type Effect824 struct{ node.EffectNode }
|
|
|
|
func (e *Effect824) Skill_Use() bool {
|
|
if len(e.Args()) < 2 || e.Args()[1].Cmp(alpacadecimal.Zero) <= 0 {
|
|
return true
|
|
}
|
|
if e.Ctx().Opp.StatEffect_Exist(info.EnumPetStatus(e.Args()[0].IntPart())) {
|
|
return true
|
|
}
|
|
|
|
drain := e.Ctx().Opp.CurrentPet.GetMaxHP().Div(e.Args()[1])
|
|
if drain.Cmp(alpacadecimal.Zero) <= 0 {
|
|
return true
|
|
}
|
|
|
|
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
|
|
Type: info.DamageType.Percent,
|
|
Damage: drain,
|
|
})
|
|
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, drain)
|
|
return true
|
|
}
|
|
|
|
func init() {
|
|
input.InitEffect(input.EffectType.Skill, 820, &Effect820{})
|
|
input.InitEffect(input.EffectType.Sub, 820, &Effect820Sub{})
|
|
input.InitEffect(input.EffectType.Skill, 821, &Effect821{})
|
|
input.InitEffect(input.EffectType.Sub, 821, &Effect821Sub{})
|
|
input.InitEffect(input.EffectType.Skill, 822, &Effect822{})
|
|
input.InitEffect(input.EffectType.Skill, 823, &Effect823{})
|
|
input.InitEffect(input.EffectType.Sub, 823, &Effect823Sub{})
|
|
input.InitEffect(input.EffectType.Skill, 824, &Effect824{})
|
|
}
|