199 lines
5.3 KiB
Go
199 lines
5.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 825: 若对手处于能力提升状态则附加对手最大体力1/{0}的百分比伤害
|
||
|
|
type Effect825 struct{ node.EffectNode }
|
||
|
|
|
||
|
|
func (e *Effect825) OnSkill() bool {
|
||
|
|
if len(e.Args()) == 0 || e.Args()[0].Cmp(alpacadecimal.Zero) <= 0 || !e.Ctx().Opp.HasPropADD() {
|
||
|
|
return true
|
||
|
|
}
|
||
|
|
|
||
|
|
damage := e.Ctx().Opp.CurrentPet.GetMaxHP().Div(e.Args()[0])
|
||
|
|
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 826: 当回合击败对手则对手下只出场精灵随机进入{0}种异常状态
|
||
|
|
type Effect826 struct{ node.EffectNode }
|
||
|
|
|
||
|
|
func (e *Effect826) 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().Opp.InitEffect(input.EffectType.Sub, 826, int(e.Args()[0].IntPart()))
|
||
|
|
if sub != nil {
|
||
|
|
e.Ctx().Opp.AddEffect(e.Ctx().Our, sub)
|
||
|
|
}
|
||
|
|
return true
|
||
|
|
}
|
||
|
|
|
||
|
|
type Effect826Sub struct{ node.EffectNode }
|
||
|
|
|
||
|
|
func (e *Effect826Sub) SetArgs(t *input.Input, a ...int) {
|
||
|
|
e.EffectNode.SetArgs(t, a...)
|
||
|
|
e.CanStack(false)
|
||
|
|
e.Duration(1)
|
||
|
|
}
|
||
|
|
|
||
|
|
func (e *Effect826Sub) SwitchIn(in *input.Input) bool {
|
||
|
|
if in != e.Ctx().Our || len(e.Args()) == 0 {
|
||
|
|
return true
|
||
|
|
}
|
||
|
|
|
||
|
|
applyRandomStatuses1507(e.Ctx().Opp, e.Ctx().Our, int(e.Args()[0].IntPart()))
|
||
|
|
e.Alive(false)
|
||
|
|
return true
|
||
|
|
}
|
||
|
|
|
||
|
|
// Effect 827: 消除对手能力提升状态,消除成功则令自身下{0}回合必定先出手且下{1}回合造成的攻击伤害翻倍
|
||
|
|
type Effect827 struct{ node.EffectNode }
|
||
|
|
|
||
|
|
func (e *Effect827) Skill_Use() bool {
|
||
|
|
if len(e.Args()) < 2 {
|
||
|
|
return true
|
||
|
|
}
|
||
|
|
|
||
|
|
cleared := false
|
||
|
|
for i, v := range e.Ctx().Opp.Prop[:] {
|
||
|
|
if v <= 0 {
|
||
|
|
continue
|
||
|
|
}
|
||
|
|
if e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), 0) {
|
||
|
|
cleared = true
|
||
|
|
}
|
||
|
|
}
|
||
|
|
if !cleared {
|
||
|
|
return true
|
||
|
|
}
|
||
|
|
|
||
|
|
prioritySub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 827, int(e.Args()[0].IntPart()))
|
||
|
|
if prioritySub != nil {
|
||
|
|
e.Ctx().Our.AddEffect(e.Ctx().Our, prioritySub)
|
||
|
|
}
|
||
|
|
damageSub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 8271, int(e.Args()[1].IntPart()))
|
||
|
|
if damageSub != nil {
|
||
|
|
e.Ctx().Our.AddEffect(e.Ctx().Our, damageSub)
|
||
|
|
}
|
||
|
|
return true
|
||
|
|
}
|
||
|
|
|
||
|
|
type Effect827PrioritySub struct{ RoundEffectArg0Base }
|
||
|
|
|
||
|
|
func (e *Effect827PrioritySub) ComparePre(fattack, sattack *action.SelectSkillAction) bool {
|
||
|
|
current := actionByPlayer(fattack, sattack, e.Ctx().Our.UserID)
|
||
|
|
if current == nil || current.SkillEntity == nil {
|
||
|
|
return true
|
||
|
|
}
|
||
|
|
|
||
|
|
current.SkillEntity.XML.Priority += 7
|
||
|
|
return true
|
||
|
|
}
|
||
|
|
|
||
|
|
type Effect827DamageSub struct{ RoundEffectArg0Base }
|
||
|
|
|
||
|
|
func (e *Effect827DamageSub) 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 828: 若自身处于能力提升状态则先制+1
|
||
|
|
type Effect828 struct{ node.EffectNode }
|
||
|
|
|
||
|
|
func (e *Effect828) ComparePre(fattack, sattack *action.SelectSkillAction) bool {
|
||
|
|
if !e.Ctx().Our.HasPropADD() {
|
||
|
|
return true
|
||
|
|
}
|
||
|
|
|
||
|
|
current := actionByPlayer(fattack, sattack, e.Ctx().Our.UserID)
|
||
|
|
if current != nil && current.SkillEntity != nil {
|
||
|
|
current.SkillEntity.XML.Priority += 1
|
||
|
|
}
|
||
|
|
return true
|
||
|
|
}
|
||
|
|
|
||
|
|
// Effect 829: 下{0}回合对手每回合受到相当于本次伤害的1/{1}的百分比伤害(可以叠加)
|
||
|
|
type Effect829 struct{ node.EffectNode }
|
||
|
|
|
||
|
|
func (e *Effect829) Skill_Use() bool {
|
||
|
|
if len(e.Args()) < 2 || e.Args()[1].Cmp(alpacadecimal.Zero) <= 0 || e.Ctx().Our.SumDamage.Cmp(alpacadecimal.Zero) <= 0 {
|
||
|
|
return true
|
||
|
|
}
|
||
|
|
|
||
|
|
damage := e.Ctx().Our.SumDamage.Div(e.Args()[1])
|
||
|
|
if damage.Cmp(alpacadecimal.Zero) <= 0 {
|
||
|
|
return true
|
||
|
|
}
|
||
|
|
|
||
|
|
sub := e.Ctx().Opp.InitEffect(input.EffectType.Sub, 829, int(e.Args()[0].IntPart()), int(damage.IntPart()))
|
||
|
|
if effect, ok := sub.(*Effect829Sub); ok {
|
||
|
|
effect.damage = damage
|
||
|
|
}
|
||
|
|
if sub != nil {
|
||
|
|
e.Ctx().Opp.AddEffect(e.Ctx().Our, sub)
|
||
|
|
}
|
||
|
|
return true
|
||
|
|
}
|
||
|
|
|
||
|
|
type Effect829Sub struct {
|
||
|
|
node.EffectNode
|
||
|
|
damage alpacadecimal.Decimal
|
||
|
|
}
|
||
|
|
|
||
|
|
func (e *Effect829Sub) SetArgs(t *input.Input, a ...int) {
|
||
|
|
e.EffectNode.SetArgs(t, a...)
|
||
|
|
e.CanStack(true)
|
||
|
|
if len(a) > 0 {
|
||
|
|
e.Duration(a[0])
|
||
|
|
}
|
||
|
|
if len(a) > 1 {
|
||
|
|
e.damage = alpacadecimal.NewFromInt(int64(a[1]))
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
func (e *Effect829Sub) TurnEnd() {
|
||
|
|
if e.damage.Cmp(alpacadecimal.Zero) > 0 && e.Ctx().Our.CurrentPet != nil && e.Ctx().Our.CurrentPet.Info.Hp > 0 {
|
||
|
|
damage := e.damage
|
||
|
|
if e.Stack() > 1 {
|
||
|
|
damage = damage.Mul(alpacadecimal.NewFromInt(int64(e.Stack())))
|
||
|
|
}
|
||
|
|
e.Ctx().Our.Damage(e.Ctx().Opp, &info.DamageZone{
|
||
|
|
Type: info.DamageType.Percent,
|
||
|
|
Damage: damage,
|
||
|
|
})
|
||
|
|
}
|
||
|
|
e.EffectNode.TurnEnd()
|
||
|
|
}
|
||
|
|
|
||
|
|
func init() {
|
||
|
|
input.InitEffect(input.EffectType.Skill, 825, &Effect825{})
|
||
|
|
input.InitEffect(input.EffectType.Skill, 826, &Effect826{})
|
||
|
|
input.InitEffect(input.EffectType.Sub, 826, &Effect826Sub{})
|
||
|
|
input.InitEffect(input.EffectType.Skill, 827, &Effect827{})
|
||
|
|
input.InitEffect(input.EffectType.Sub, 827, &Effect827PrioritySub{})
|
||
|
|
input.InitEffect(input.EffectType.Sub, 8271, &Effect827DamageSub{})
|
||
|
|
input.InitEffect(input.EffectType.Skill, 828, &Effect828{})
|
||
|
|
input.InitEffect(input.EffectType.Skill, 829, &Effect829{})
|
||
|
|
input.InitEffect(input.EffectType.Sub, 829, &Effect829Sub{})
|
||
|
|
}
|