222 lines
5.8 KiB
Go
222 lines
5.8 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 1620: 对手基础速度值高于{0}则下回合先制-1
|
|
type Effect1620 struct{ node.EffectNode }
|
|
|
|
func (e *Effect1620) Skill_Use() bool {
|
|
if len(e.Args()) < 1 || e.Ctx().Opp == nil || e.Ctx().Opp.CurPet[0] == nil {
|
|
return true
|
|
}
|
|
threshold := e.Args()[0].IntPart()
|
|
if threshold < 0 {
|
|
threshold = 0
|
|
}
|
|
if int64(e.Ctx().Opp.CurPet[0].PetInfo.Spd) <= threshold {
|
|
return true
|
|
}
|
|
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1620, -1)
|
|
if sub != nil {
|
|
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
|
|
}
|
|
return true
|
|
}
|
|
|
|
type Effect1620Sub struct {
|
|
node.EffectNode
|
|
priority int
|
|
}
|
|
|
|
func (e *Effect1620Sub) SetArgs(t *input.Input, a ...int) {
|
|
e.EffectNode.SetArgs(t, a...)
|
|
e.Duration(1)
|
|
e.CanStack(false)
|
|
if len(a) > 0 {
|
|
e.priority = a[0]
|
|
}
|
|
}
|
|
|
|
func (e *Effect1620Sub) 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 += e.priority
|
|
return true
|
|
}
|
|
|
|
// Effect 1621: {0}%令对手所有技能PP值-{1},自身满体力时效果翻倍
|
|
type Effect1621 struct{ node.EffectNode }
|
|
|
|
func (e *Effect1621) Skill_Use() bool {
|
|
if len(e.Args()) < 2 || e.Ctx().Opp == nil || e.Ctx().Opp.CurPet[0] == nil {
|
|
return true
|
|
}
|
|
if ok, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100); !ok {
|
|
return true
|
|
}
|
|
amount := int(e.Args()[1].IntPart())
|
|
if amount <= 0 {
|
|
return true
|
|
}
|
|
if e.Ctx().Our != nil && e.Ctx().Our.CurPet[0] != nil &&
|
|
e.Ctx().Our.CurPet[0].Info.Hp == e.Ctx().Our.CurPet[0].Info.MaxHp {
|
|
amount *= 2
|
|
}
|
|
e.Ctx().Opp.DelPP(amount)
|
|
return true
|
|
}
|
|
|
|
// Effect 1622: {0}回合内每回合{1}%对手属性技能无效,未触发则下{2}次受到的攻击伤害减少{3}%
|
|
type Effect1622 struct{ node.EffectNode }
|
|
|
|
func (e *Effect1622) Skill_Use() bool {
|
|
if len(e.Args()) < 4 || e.Ctx().Opp == nil {
|
|
return true
|
|
}
|
|
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1622,
|
|
int(e.Args()[0].IntPart()),
|
|
int(e.Args()[1].IntPart()),
|
|
int(e.Args()[2].IntPart()),
|
|
int(e.Args()[3].IntPart()),
|
|
)
|
|
if sub != nil {
|
|
e.Ctx().Opp.AddEffect(e.Ctx().Our, sub)
|
|
}
|
|
return true
|
|
}
|
|
|
|
type Effect1622Sub struct{ RoundEffectArg0Base }
|
|
|
|
func (e *Effect1622Sub) SkillHit_ex() bool {
|
|
if len(e.Args()) < 4 || e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() != info.Category.STATUS {
|
|
return true
|
|
}
|
|
if ok, _, _ := e.Input.Player.Roll(int(e.Args()[1].IntPart()), 100); ok {
|
|
e.Ctx().SkillEntity.SetNoSide()
|
|
e.Ctx().SkillEntity.AttackTime = 0
|
|
return true
|
|
}
|
|
count := int(e.Args()[2].IntPart())
|
|
percent := int(e.Args()[3].IntPart())
|
|
if count <= 0 || percent <= 0 {
|
|
return true
|
|
}
|
|
sub := e.Ctx().Opp.InitEffect(input.EffectType.Sub, 16221, count, percent)
|
|
if sub != nil {
|
|
e.Ctx().Opp.AddEffect(e.Ctx().Opp, sub)
|
|
}
|
|
return true
|
|
}
|
|
|
|
type Effect1622DamageSub struct {
|
|
node.EffectNode
|
|
remaining int
|
|
reduction alpacadecimal.Decimal
|
|
}
|
|
|
|
func (e *Effect1622DamageSub) SetArgs(t *input.Input, a ...int) {
|
|
e.EffectNode.SetArgs(t, a...)
|
|
e.CanStack(false)
|
|
e.Duration(-1)
|
|
if len(a) > 0 {
|
|
e.remaining = a[0]
|
|
}
|
|
if len(a) > 1 {
|
|
if a[1] < 0 {
|
|
a[1] = 0
|
|
}
|
|
e.reduction = alpacadecimal.NewFromInt(int64(a[1]))
|
|
}
|
|
}
|
|
|
|
func (e *Effect1622DamageSub) DamageDivEx(zone *info.DamageZone) bool {
|
|
if zone == nil || zone.Type != info.DamageType.Red || e.remaining <= 0 || e.reduction.Cmp(alpacadecimal.Zero) <= 0 {
|
|
return true
|
|
}
|
|
if zone.Damage.Cmp(alpacadecimal.Zero) <= 0 {
|
|
return true
|
|
}
|
|
factor := hundred.Sub(e.reduction)
|
|
if factor.Cmp(alpacadecimal.Zero) < 0 {
|
|
factor = alpacadecimal.Zero
|
|
}
|
|
zone.Damage = zone.Damage.Mul(factor).Div(hundred)
|
|
e.remaining--
|
|
if e.remaining <= 0 {
|
|
e.Alive(false)
|
|
}
|
|
return true
|
|
}
|
|
|
|
// Effect 1623: 若对手是{0}精灵则下{1}回合对手受到的伤害提高{2}%
|
|
type Effect1623 struct{ node.EffectNode }
|
|
|
|
func (e *Effect1623) Skill_Use() bool {
|
|
if len(e.Args()) < 3 || e.Ctx().Opp == nil || e.Ctx().Opp.CurPet[0] == nil {
|
|
return true
|
|
}
|
|
if int(e.Ctx().Opp.CurPet[0].PetInfo.Type) != int(e.Args()[0].IntPart()) {
|
|
return true
|
|
}
|
|
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1623,
|
|
int(e.Args()[1].IntPart()),
|
|
int(e.Args()[2].IntPart()),
|
|
)
|
|
if sub != nil {
|
|
e.Ctx().Opp.AddEffect(e.Ctx().Our, sub)
|
|
}
|
|
return true
|
|
}
|
|
|
|
type Effect1623Sub struct{ RoundEffectArg0Base }
|
|
|
|
func (e *Effect1623Sub) Damage_Mul(zone *info.DamageZone) bool {
|
|
if zone == nil || zone.Type != info.DamageType.Red || len(e.Args()) < 2 {
|
|
return true
|
|
}
|
|
if zone.Damage.Cmp(alpacadecimal.Zero) <= 0 {
|
|
return true
|
|
}
|
|
percent := e.Args()[1]
|
|
if percent.Cmp(alpacadecimal.Zero) <= 0 {
|
|
return true
|
|
}
|
|
zone.Damage = zone.Damage.Mul(hundred.Add(percent)).Div(hundred)
|
|
return true
|
|
}
|
|
|
|
// Effect 1624: 对手不处于异常状态时随机附加{0}种异常状态
|
|
type Effect1624 struct{ node.EffectNode }
|
|
|
|
func (e *Effect1624) Skill_Use() bool {
|
|
if len(e.Args()) < 1 || e.Ctx().Opp == nil || e.Args()[0].IntPart() <= 0 {
|
|
return true
|
|
}
|
|
if e.Ctx().Opp.StatEffect_Exist_all() {
|
|
return true
|
|
}
|
|
applyRandomStatuses1394(e.Ctx().Our, e.Ctx().Opp, int(e.Args()[0].IntPart()))
|
|
return true
|
|
}
|
|
|
|
func init() {
|
|
input.InitEffect(input.EffectType.Skill, 1620, &Effect1620{})
|
|
input.InitEffect(input.EffectType.Sub, 1620, &Effect1620Sub{})
|
|
input.InitEffect(input.EffectType.Skill, 1621, &Effect1621{})
|
|
input.InitEffect(input.EffectType.Skill, 1622, &Effect1622{})
|
|
input.InitEffect(input.EffectType.Sub, 1622, &Effect1622Sub{})
|
|
input.InitEffect(input.EffectType.Sub, 16221, &Effect1622DamageSub{})
|
|
input.InitEffect(input.EffectType.Skill, 1623, &Effect1623{})
|
|
input.InitEffect(input.EffectType.Sub, 1623, &Effect1623Sub{})
|
|
input.InitEffect(input.EffectType.Skill, 1624, &Effect1624{})
|
|
}
|