864 lines
23 KiB
Go
864 lines
23 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"
|
||
)
|
||
|
||
func countStatusEffects2220(target *input.Input) int {
|
||
if target == nil {
|
||
return 0
|
||
}
|
||
count := 0
|
||
for _, eff := range target.Effects {
|
||
if eff == nil || !eff.Alive() {
|
||
continue
|
||
}
|
||
if eff.ID().GetEffectType() == input.EffectType.Status {
|
||
count++
|
||
}
|
||
}
|
||
return count
|
||
}
|
||
|
||
func clearRoundEffects2229(target *input.Input) bool {
|
||
if target == nil {
|
||
return false
|
||
}
|
||
cleared := false
|
||
for _, eff := range target.Effects {
|
||
if eff == nil || !eff.Alive() {
|
||
continue
|
||
}
|
||
if eff.ID().GetEffectType() != input.EffectType.Sub {
|
||
continue
|
||
}
|
||
if eff.Duration() <= 0 {
|
||
continue
|
||
}
|
||
eff.Alive(false)
|
||
cleared = true
|
||
}
|
||
return cleared
|
||
}
|
||
|
||
func triggerOwnNewSelEffects2229(target *input.Input) {
|
||
if target == nil || target.CurPet[0] == nil {
|
||
return
|
||
}
|
||
catchTime := target.CurPet[0].Info.CatchTime
|
||
for _, eff := range target.Effects {
|
||
if eff == nil || !eff.Alive() || eff.ID().GetEffectType() != input.EffectType.NewSel {
|
||
continue
|
||
}
|
||
if eff.ID().GetCatchTime() != catchTime {
|
||
continue
|
||
}
|
||
eff.SwitchIn(target)
|
||
}
|
||
}
|
||
|
||
// Effect 2220: 将自身攻击和特攻中最高的能力值作为自身的能力值进行攻击
|
||
type Effect2220 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2220) SkillHit() bool {
|
||
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
|
||
return true
|
||
}
|
||
atk := e.Ctx().Our.GetProp(0)
|
||
spAtk := e.Ctx().Our.GetProp(2)
|
||
if spAtk.Cmp(atk) > 0 {
|
||
e.Ctx().SkillEntity.XML.Category = int(info.Category.SPECIAL)
|
||
} else if atk.Cmp(spAtk) > 0 {
|
||
e.Ctx().SkillEntity.XML.Category = int(info.Category.PHYSICAL)
|
||
}
|
||
return true
|
||
}
|
||
|
||
// Effect 2221: {0}回合内每回合{1}%闪避对手攻击,对手攻击技能命中时令对手随机{2}个技能PP值归0
|
||
type Effect2221 struct{ RoundEffectArg0Base }
|
||
|
||
func (e *Effect2221) SkillHit_ex() bool {
|
||
if len(e.Args()) < 3 || e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
|
||
return true
|
||
}
|
||
if e.Ctx().SkillEntity.AttackTime == 2 {
|
||
return true
|
||
}
|
||
if ok, _, _ := e.Input.Player.Roll(int(e.Args()[1].IntPart()), 100); ok {
|
||
e.Ctx().SkillEntity.SetMiss()
|
||
return true
|
||
}
|
||
zeroRandomSkillPP(e.Ctx().Opp, int(e.Args()[2].IntPart()))
|
||
return true
|
||
}
|
||
|
||
// Effect 2222: 对手体力满时造成伤害提升
|
||
type Effect2222 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2222) Damage_Mul(zone *info.DamageZone) bool {
|
||
if zone == nil || zone.Type != info.DamageType.Red || len(e.Args()) == 0 {
|
||
return true
|
||
}
|
||
if e.Ctx().Opp == nil || e.Ctx().Opp.CurPet[0] == nil {
|
||
return true
|
||
}
|
||
if e.Ctx().Opp.CurPet[0].GetHP().Cmp(e.Ctx().Opp.CurPet[0].GetMaxHP()) >= 0 {
|
||
zone.Damage = zone.Damage.Mul(hundred.Add(e.Args()[0])).Div(hundred)
|
||
}
|
||
return true
|
||
}
|
||
|
||
// Effect 2223: 若对手当回合切换精灵则造成伤害提升
|
||
type Effect2223 struct {
|
||
node.EffectNode
|
||
opponentSwitched bool
|
||
}
|
||
|
||
func (e *Effect2223) ComparePre(fattack, sattack *action.SelectSkillAction) bool {
|
||
e.opponentSwitched = false
|
||
ourAction := actionByPlayer(fattack, sattack, e.Ctx().Our.UserID)
|
||
if ourAction == nil || ourAction.SkillEntity == nil {
|
||
return true
|
||
}
|
||
if oppAction := actionByPlayer(fattack, sattack, e.Ctx().Opp.UserID); oppAction != nil {
|
||
return true
|
||
}
|
||
e.opponentSwitched = e.Ctx().Opp != nil && e.Ctx().Opp.CanChange == 1
|
||
return true
|
||
}
|
||
|
||
func (e *Effect2223) Damage_Mul(zone *info.DamageZone) bool {
|
||
if zone == nil || zone.Type != info.DamageType.Red || len(e.Args()) == 0 {
|
||
return true
|
||
}
|
||
if e.opponentSwitched {
|
||
zone.Damage = zone.Damage.Mul(hundred.Add(e.Args()[0])).Div(hundred)
|
||
}
|
||
return true
|
||
}
|
||
|
||
// Effect 2224: 若对手当回合选择属性技能则造成伤害提升
|
||
type Effect2224 struct {
|
||
node.EffectNode
|
||
oppSelectedStatus bool
|
||
}
|
||
|
||
func (e *Effect2224) ComparePre(fattack, sattack *action.SelectSkillAction) bool {
|
||
e.oppSelectedStatus = false
|
||
oppAction := actionByPlayer(fattack, sattack, e.Ctx().Opp.UserID)
|
||
if oppAction == nil || oppAction.SkillEntity == nil {
|
||
return true
|
||
}
|
||
e.oppSelectedStatus = oppAction.SkillEntity.Category() == info.Category.STATUS
|
||
return true
|
||
}
|
||
|
||
func (e *Effect2224) Damage_Mul(zone *info.DamageZone) bool {
|
||
if zone == nil || zone.Type != info.DamageType.Red || len(e.Args()) == 0 {
|
||
return true
|
||
}
|
||
if e.oppSelectedStatus {
|
||
zone.Damage = zone.Damage.Mul(hundred.Add(e.Args()[0])).Div(hundred)
|
||
}
|
||
return true
|
||
}
|
||
|
||
// Effect 2225: 减少对手体力上限
|
||
type Effect2225 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2225) Skill_Use() bool {
|
||
if len(e.Args()) == 0 || e.Ctx().Opp == nil || e.Ctx().Opp.CurPet[0] == nil {
|
||
return true
|
||
}
|
||
|
||
maxHP := e.Ctx().Opp.CurPet[0].GetMaxHP()
|
||
if e.Args()[0].Cmp(alpacadecimal.Zero) <= 0 {
|
||
return true
|
||
}
|
||
loss := maxHP.Div(e.Args()[0])
|
||
if loss.Cmp(alpacadecimal.Zero) <= 0 {
|
||
return true
|
||
}
|
||
|
||
newMax := maxHP.Sub(loss)
|
||
if newMax.Cmp(alpacadecimal.NewFromInt(1)) < 0 {
|
||
newMax = alpacadecimal.NewFromInt(1)
|
||
}
|
||
e.Ctx().Opp.CurPet[0].Info.MaxHp = uint32(newMax.IntPart())
|
||
if e.Ctx().Opp.CurPet[0].Info.Hp > e.Ctx().Opp.CurPet[0].Info.MaxHp {
|
||
e.Ctx().Opp.CurPet[0].Info.Hp = e.Ctx().Opp.CurPet[0].Info.MaxHp
|
||
}
|
||
return true
|
||
}
|
||
|
||
// Effect 2226: 解除双方所有异常状态,解除成功则免疫下{0}次对手的攻击
|
||
type Effect2226 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2226) Skill_Use() bool {
|
||
if len(e.Args()) == 0 {
|
||
return true
|
||
}
|
||
|
||
cleared := false
|
||
for _, target := range []*input.Input{e.Ctx().Our, e.Ctx().Opp} {
|
||
for _, eff := range target.Effects {
|
||
if eff == nil || !eff.Alive() {
|
||
continue
|
||
}
|
||
if eff.ID().GetEffectType() != input.EffectType.Status {
|
||
continue
|
||
}
|
||
eff.Alive(false)
|
||
cleared = true
|
||
}
|
||
}
|
||
if !cleared {
|
||
return true
|
||
}
|
||
|
||
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 2226, int(e.Args()[0].IntPart()))
|
||
if sub != nil {
|
||
e.Ctx().Opp.AddEffect(e.Ctx().Our, sub)
|
||
}
|
||
return true
|
||
}
|
||
|
||
type Effect2226Sub struct {
|
||
node.EffectNode
|
||
remaining int
|
||
}
|
||
|
||
func (e *Effect2226Sub) SetArgs(t *input.Input, a ...int) {
|
||
e.EffectNode.SetArgs(t, a...)
|
||
e.Duration(-1)
|
||
if len(a) > 0 {
|
||
e.remaining = a[0]
|
||
}
|
||
}
|
||
|
||
func (e *Effect2226Sub) ActionStart(a, b *action.SelectSkillAction) bool {
|
||
if e.remaining <= 0 {
|
||
e.Alive(false)
|
||
return true
|
||
}
|
||
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
|
||
return true
|
||
}
|
||
|
||
e.Ctx().SkillEntity.SetMiss()
|
||
e.remaining--
|
||
if e.remaining <= 0 {
|
||
e.Alive(false)
|
||
}
|
||
return true
|
||
}
|
||
|
||
// Effect 2228: {0}回合内对手造成的固定伤害和百分比伤害减少{1}%
|
||
type Effect2228 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2228) Skill_Use() bool {
|
||
if len(e.Args()) < 2 || e.Ctx().Our == nil {
|
||
return true
|
||
}
|
||
|
||
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 2228, int(e.Args()[0].IntPart()), int(e.Args()[1].IntPart()))
|
||
if sub != nil {
|
||
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
|
||
}
|
||
return true
|
||
}
|
||
|
||
type Effect2228Sub struct {
|
||
RoundEffectArg0Base
|
||
reduce alpacadecimal.Decimal
|
||
}
|
||
|
||
func (e *Effect2228Sub) SetArgs(t *input.Input, a ...int) {
|
||
e.RoundEffectArg0Base.SetArgs(t, a...)
|
||
if len(a) > 1 {
|
||
e.reduce = alpacadecimal.NewFromInt(int64(a[1]))
|
||
}
|
||
}
|
||
|
||
func (e *Effect2228Sub) DamageDivEx(zone *info.DamageZone) bool {
|
||
if zone == nil {
|
||
return true
|
||
}
|
||
if zone.Type != info.DamageType.Fixed && zone.Type != info.DamageType.Percent {
|
||
return true
|
||
}
|
||
zone.Damage = zone.Damage.Mul(hundred.Sub(e.reduce)).Div(hundred)
|
||
return true
|
||
}
|
||
|
||
// Effect 2227: 清除对手能力提升状态,清除成功后对手{0}回合内无法主动切换精灵
|
||
type Effect2227 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2227) Skill_Use() bool {
|
||
if len(e.Args()) == 0 || e.Ctx().Opp == nil {
|
||
return true
|
||
}
|
||
if !clearPositiveProps(e.Ctx().Opp, e.Ctx().Our) {
|
||
return true
|
||
}
|
||
sub := e.Ctx().Opp.InitEffect(input.EffectType.Sub, 2227, int(e.Args()[0].IntPart()))
|
||
if sub != nil {
|
||
e.Ctx().Opp.AddEffect(e.Ctx().Our, sub)
|
||
}
|
||
return true
|
||
}
|
||
|
||
type Effect2227Sub struct {
|
||
node.EffectNode
|
||
remaining int
|
||
}
|
||
|
||
func (e *Effect2227Sub) 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]
|
||
}
|
||
t.CanChange = 1
|
||
}
|
||
|
||
func (e *Effect2227Sub) TurnEnd() {
|
||
if e.remaining <= 0 {
|
||
e.Ctx().Our.CanChange = 0
|
||
e.Alive(false)
|
||
return
|
||
}
|
||
e.remaining--
|
||
if e.remaining <= 0 {
|
||
e.Ctx().Our.CanChange = 0
|
||
e.Alive(false)
|
||
return
|
||
}
|
||
if e.Ctx().Our != nil && e.Ctx().Our.CurPet[0] != nil && e.Ctx().Our.CurPet[0].Info.Hp > 0 {
|
||
e.Ctx().Our.CanChange = 1
|
||
}
|
||
}
|
||
|
||
func (e *Effect2227Sub) SwitchOut(in *input.Input) bool {
|
||
if in == e.Ctx().Our && e.Ctx().Our != nil {
|
||
e.Ctx().Our.CanChange = 0
|
||
}
|
||
return true
|
||
}
|
||
|
||
// Effect 2229: {0}回合内使用技能则全属性+1,自身回合类效果、能力提升效果被消除、吸取时触发自身的登场效果
|
||
type Effect2229 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2229) Skill_Use() bool {
|
||
if len(e.Args()) == 0 || e.Ctx().Our == nil {
|
||
return true
|
||
}
|
||
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 2229, int(e.Args()[0].IntPart()))
|
||
if sub != nil {
|
||
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
|
||
}
|
||
return true
|
||
}
|
||
|
||
type Effect2229Sub struct{ RoundEffectArg0Base }
|
||
|
||
func (e *Effect2229Sub) OnSkill() bool {
|
||
applyAllPropUp(e.Ctx().Our, 1)
|
||
return true
|
||
}
|
||
|
||
func (e *Effect2229Sub) PropBefer(source *input.Input, prop, level int8) bool {
|
||
if source != e.Ctx().Our || level >= 0 {
|
||
return true
|
||
}
|
||
if int(prop) < 0 || int(prop) >= len(e.Ctx().Our.Prop) {
|
||
return true
|
||
}
|
||
if e.Ctx().Our.Prop[prop] > 0 {
|
||
triggerOwnNewSelEffects2229(e.Ctx().Our)
|
||
}
|
||
return true
|
||
}
|
||
|
||
func (e *Effect2229Sub) Heal_Pre(ac action.BattleActionI, value *int) bool {
|
||
if value != nil && *value > 0 {
|
||
triggerOwnNewSelEffects2229(e.Ctx().Our)
|
||
}
|
||
return true
|
||
}
|
||
|
||
// Effect 2230: {0}回合内每回合恢复自身最大体力的1/{1},若未恢复体力则{2}%令对手{3}
|
||
type Effect2230 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2230) Skill_Use() bool {
|
||
if len(e.Args()) < 4 {
|
||
return true
|
||
}
|
||
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 2230, 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().Our.AddEffect(e.Ctx().Our, sub)
|
||
}
|
||
return true
|
||
}
|
||
|
||
type Effect2230Sub struct{ RoundEffectArg0Base }
|
||
|
||
func (e *Effect2230Sub) OnSkill() bool {
|
||
if len(e.Args()) < 4 || e.Ctx().Our.CurPet[0] == nil || e.Ctx().Opp.CurPet[0] == nil {
|
||
return true
|
||
}
|
||
|
||
fullHP := e.Ctx().Our.CurPet[0].GetHP().Cmp(e.Ctx().Our.CurPet[0].GetMaxHP()) >= 0
|
||
if !fullHP {
|
||
heal := e.Ctx().Our.CurPet[0].GetMaxHP().Div(e.Args()[1])
|
||
if heal.Cmp(alpacadecimal.Zero) > 0 {
|
||
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, heal)
|
||
}
|
||
} else {
|
||
success, _, _ := e.Input.Player.Roll(int(e.Args()[2].IntPart()), 100)
|
||
if success {
|
||
addStatusEffect(e.Ctx().Our, e.Ctx().Opp, int(e.Args()[3].IntPart()))
|
||
}
|
||
}
|
||
return true
|
||
}
|
||
|
||
// Effect 2231: {0}回合内命中时消耗自身体力的1/{1}并造成等量百分比伤害
|
||
type Effect2231 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2231) Skill_Use() bool {
|
||
if len(e.Args()) < 2 {
|
||
return true
|
||
}
|
||
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 2231, int(e.Args()[0].IntPart()), int(e.Args()[1].IntPart()))
|
||
if sub != nil {
|
||
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
|
||
}
|
||
return true
|
||
}
|
||
|
||
type Effect2231Sub struct{ RoundEffectArg0Base }
|
||
|
||
func (e *Effect2231Sub) OnSkill() bool {
|
||
if len(e.Args()) < 2 || e.Ctx().Our.CurPet[0] == nil || e.Ctx().Opp.CurPet[0] == nil {
|
||
return true
|
||
}
|
||
|
||
lost := e.Ctx().Our.CurPet[0].GetMaxHP().Div(e.Args()[1])
|
||
if lost.Cmp(alpacadecimal.Zero) <= 0 {
|
||
return true
|
||
}
|
||
|
||
e.Ctx().Our.Damage(e.Ctx().Our, &info.DamageZone{Type: info.DamageType.Fixed, Damage: lost})
|
||
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{Type: info.DamageType.Percent, Damage: lost})
|
||
return true
|
||
}
|
||
|
||
// Effect 2232: 使用技能PP不受限
|
||
type Effect2232 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2232) HookPP(count *int) bool { return true }
|
||
|
||
// Effect 2233: {0}回合内对手每处于{1}种异常状态,受到{2}点固定伤害
|
||
type Effect2233 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2233) Skill_Use() bool {
|
||
if len(e.Args()) < 3 {
|
||
return true
|
||
}
|
||
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 2233, int(e.Args()[0].IntPart()), int(e.Args()[1].IntPart()), int(e.Args()[2].IntPart()))
|
||
if sub != nil {
|
||
e.Ctx().Opp.AddEffect(e.Ctx().Our, sub)
|
||
}
|
||
return true
|
||
}
|
||
|
||
type Effect2233Sub struct{ RoundEffectArg0Base }
|
||
|
||
func (e *Effect2233Sub) Action_end() bool {
|
||
if len(e.Args()) < 3 || e.Ctx().Opp == nil {
|
||
return true
|
||
}
|
||
count := countStatusEffects2220(e.Ctx().Opp)
|
||
group := int(e.Args()[1].IntPart())
|
||
if count <= 0 || group <= 0 {
|
||
return true
|
||
}
|
||
damage := (count / group) * int(e.Args()[2].IntPart())
|
||
if damage > 0 {
|
||
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{Type: info.DamageType.Fixed, Damage: alpacadecimal.NewFromInt(int64(damage))})
|
||
}
|
||
return true
|
||
}
|
||
|
||
// Effect 2234: 自身处于能力下降时{0}%令对手{1}
|
||
type Effect2234 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2234) OnSkill() bool {
|
||
if len(e.Args()) < 2 || !e.Ctx().Our.HasPropSub() {
|
||
return true
|
||
}
|
||
success, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100)
|
||
if !success {
|
||
return true
|
||
}
|
||
addStatusEffect(e.Ctx().Our, e.Ctx().Opp, int(e.Args()[1].IntPart()))
|
||
return true
|
||
}
|
||
|
||
// Effect 2235: 全属性1级时,命运星效果翻倍
|
||
type Effect2235 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2235) SkillHit() bool {
|
||
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
|
||
return true
|
||
}
|
||
for _, level := range e.Ctx().Our.Prop[:] {
|
||
if level < 1 {
|
||
return true
|
||
}
|
||
}
|
||
e.Ctx().SkillEntity.XML.Power *= 2
|
||
return true
|
||
}
|
||
|
||
// Effect 2236: 使自身下{0}次可翻倍的支援效果翻倍
|
||
type Effect2236 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2236) Skill_Use() bool {
|
||
if len(e.Args()) == 0 {
|
||
return true
|
||
}
|
||
|
||
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 2236, int(e.Args()[0].IntPart()))
|
||
if sub != nil {
|
||
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
|
||
}
|
||
return true
|
||
}
|
||
|
||
type Effect2236Sub struct {
|
||
RoundEffectArg0Base
|
||
remaining int
|
||
}
|
||
|
||
func (e *Effect2236Sub) SetArgs(t *input.Input, a ...int) {
|
||
e.EffectNode.SetArgs(t, a...)
|
||
e.Duration(-1)
|
||
if len(a) > 0 {
|
||
e.remaining = a[0]
|
||
}
|
||
}
|
||
|
||
func (e *Effect2236Sub) Heal_Pre(ac action.BattleActionI, value *int) bool {
|
||
if value == nil || *value <= 0 || e.remaining <= 0 {
|
||
return true
|
||
}
|
||
if _, ok := ac.(*action.SelectSkillAction); !ok {
|
||
return true
|
||
}
|
||
|
||
*value *= 2
|
||
e.remaining--
|
||
if e.remaining <= 0 {
|
||
e.Alive(false)
|
||
}
|
||
return true
|
||
}
|
||
|
||
// Effect 2237: 对手每比己方多存活一只精灵,威力提升{0}点
|
||
type Effect2237 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2237) SkillHit() bool {
|
||
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS || len(e.Args()) == 0 {
|
||
return true
|
||
}
|
||
count := 0
|
||
for _, pet := range e.Ctx().Opp.AllPet {
|
||
if pet != nil && pet.Info.Hp > 0 {
|
||
count++
|
||
}
|
||
}
|
||
e.Ctx().SkillEntity.XML.Power += count * int(e.Args()[0].IntPart())
|
||
return true
|
||
}
|
||
|
||
// Effect 2238: 若自身回合类效果被消除则免疫下{1}次受到的异常状态
|
||
type Effect2238 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2238) Skill_Use() bool {
|
||
if len(e.Args()) < 2 {
|
||
return true
|
||
}
|
||
if !clearTargetEffects(e.Ctx().Our, e.Ctx().Our) {
|
||
return true
|
||
}
|
||
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 2238, int(e.Args()[1].IntPart()))
|
||
if sub != nil {
|
||
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
|
||
}
|
||
return true
|
||
}
|
||
|
||
type Effect2238Sub struct {
|
||
node.EffectNode
|
||
remaining int
|
||
}
|
||
|
||
func (e *Effect2238Sub) SetArgs(t *input.Input, a ...int) {
|
||
e.EffectNode.SetArgs(t, a...)
|
||
e.Duration(-1)
|
||
if len(a) > 0 {
|
||
e.remaining = a[0]
|
||
}
|
||
}
|
||
|
||
func (e *Effect2238Sub) EFFect_Befer(in *input.Input, effEffect input.Effect) bool {
|
||
if e.remaining <= 0 {
|
||
e.Alive(false)
|
||
return true
|
||
}
|
||
if in != e.Ctx().Our || !input.IS_Stat(effEffect) {
|
||
return true
|
||
}
|
||
e.remaining--
|
||
if e.remaining <= 0 {
|
||
e.Alive(false)
|
||
}
|
||
return false
|
||
}
|
||
|
||
// Effect 2239: 免疫下{0}次对手的攻击,对手使用{1}系攻击时此效果失效
|
||
type Effect2239 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2239) Skill_Use() bool {
|
||
if len(e.Args()) < 2 {
|
||
return true
|
||
}
|
||
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 2239, int(e.Args()[0].IntPart()), int(e.Args()[1].IntPart()))
|
||
if sub != nil {
|
||
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
|
||
}
|
||
return true
|
||
}
|
||
|
||
type Effect2239Sub struct {
|
||
node.EffectNode
|
||
remaining int
|
||
}
|
||
|
||
func (e *Effect2239Sub) SetArgs(t *input.Input, a ...int) {
|
||
e.EffectNode.SetArgs(t, a...)
|
||
e.Duration(-1)
|
||
if len(a) > 0 {
|
||
e.remaining = a[0]
|
||
}
|
||
}
|
||
|
||
func (e *Effect2239Sub) SkillHit_ex() bool {
|
||
if e.Ctx().SkillEntity == nil || e.remaining <= 0 {
|
||
return true
|
||
}
|
||
if len(e.Args()) > 1 && e.Ctx().SkillEntity.Category() == info.EnumCategory(e.Args()[1].IntPart()) {
|
||
e.Alive(false)
|
||
}
|
||
return true
|
||
}
|
||
|
||
func (e *Effect2239Sub) DamageLockEx(zone *info.DamageZone) bool {
|
||
if zone == nil || zone.Type != info.DamageType.Red || e.remaining <= 0 {
|
||
return true
|
||
}
|
||
zone.Damage = alpacadecimal.Zero
|
||
e.remaining--
|
||
if e.remaining <= 0 {
|
||
e.Alive(false)
|
||
}
|
||
return true
|
||
}
|
||
|
||
// Effect 2242: 技能PP不满时先制
|
||
type Effect2242 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2242) ComparePre(fattack, sattack *action.SelectSkillAction) bool {
|
||
current := actionByPlayer(fattack, sattack, e.Ctx().Our.UserID)
|
||
if current == nil || current.SkillEntity == nil || e.Ctx().SkillEntity == nil {
|
||
return true
|
||
}
|
||
if skill, ok := xmlres.SkillMap[int(e.Ctx().SkillEntity.Info.ID)]; ok && e.Ctx().SkillEntity.Info.PP < uint32(skill.MaxPP) {
|
||
current.SkillEntity.XML.Priority += 1
|
||
}
|
||
return true
|
||
}
|
||
|
||
// Effect 2244: {0}回合内免疫受到的非限制类异常状态
|
||
type Effect2244 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2244) Skill_Use() bool {
|
||
if len(e.Args()) == 0 {
|
||
return true
|
||
}
|
||
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 2244, int(e.Args()[0].IntPart()))
|
||
if sub != nil {
|
||
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
|
||
}
|
||
return true
|
||
}
|
||
|
||
type Effect2244Sub struct{ RoundEffectArg0Base }
|
||
|
||
func (e *Effect2244Sub) EFFect_Befer(in *input.Input, effEffect input.Effect) bool {
|
||
if in != e.Ctx().Our || !input.IS_Stat(effEffect) {
|
||
return true
|
||
}
|
||
return false
|
||
}
|
||
|
||
// Effect 2240: 解除自身异常状态,解除成功则本次攻击威力提高{0}%
|
||
type Effect2240 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2240) SkillHit() bool {
|
||
if len(e.Args()) == 0 || e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
|
||
return true
|
||
}
|
||
|
||
cleared := false
|
||
for _, eff := range e.Ctx().Our.Effects {
|
||
if eff == nil || !eff.Alive() {
|
||
continue
|
||
}
|
||
if eff.ID().GetEffectType() != input.EffectType.Status {
|
||
continue
|
||
}
|
||
eff.Alive(false)
|
||
cleared = true
|
||
}
|
||
if !cleared {
|
||
return true
|
||
}
|
||
|
||
e.Ctx().SkillEntity.XML.Power = e.Ctx().SkillEntity.XML.Power * (100 + int(e.Args()[0].IntPart())) / 100
|
||
return true
|
||
}
|
||
|
||
type Effect2240Sub struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect2240Sub) SkillHit() bool {
|
||
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
|
||
return true
|
||
}
|
||
e.Ctx().SkillEntity.XML.Power += int(e.Args()[0].IntPart())
|
||
return true
|
||
}
|
||
|
||
// Effect 2241: 消除对手能力提升状态,消除成功则{0}回合内对手体力恢复效果减少{1}%
|
||
type Effect2241 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2241) Skill_Use() bool {
|
||
if len(e.Args()) < 2 {
|
||
return true
|
||
}
|
||
|
||
if !clearPositiveProps(e.Ctx().Opp, e.Ctx().Our) {
|
||
return true
|
||
}
|
||
|
||
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 2241, int(e.Args()[0].IntPart()), int(e.Args()[1].IntPart()))
|
||
if sub != nil {
|
||
e.Ctx().Opp.AddEffect(e.Ctx().Our, sub)
|
||
}
|
||
return true
|
||
}
|
||
|
||
type Effect2241Sub struct {
|
||
RoundEffectArg0Base
|
||
}
|
||
|
||
func (e *Effect2241Sub) Heal_Pre(_ action.BattleActionI, amount *int) bool {
|
||
if amount == nil || *amount <= 0 || len(e.Args()) < 2 {
|
||
return true
|
||
}
|
||
*amount = *amount * (100 - int(e.Args()[1].IntPart())) / 100
|
||
return true
|
||
}
|
||
|
||
// Effect 2243: 若先出手则自身下次受到致死伤害时重生
|
||
type Effect2243 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2243) Skill_Use() bool {
|
||
if !e.IsFirst() {
|
||
return true
|
||
}
|
||
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 2243)
|
||
if sub != nil {
|
||
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
|
||
}
|
||
return true
|
||
}
|
||
|
||
type Effect2243Sub struct{ FixedDuration1Base }
|
||
|
||
func (e *Effect2243Sub) DamageLock(zone *info.DamageZone) bool {
|
||
if zone == nil || zone.Damage.Cmp(alpacadecimal.Zero) <= 0 {
|
||
return true
|
||
}
|
||
if e.Ctx().Our.CurPet[0].GetHP().Cmp(zone.Damage) > 0 {
|
||
return true
|
||
}
|
||
|
||
zone.Damage = alpacadecimal.Zero
|
||
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, e.Ctx().Our.CurPet[0].GetMaxHP())
|
||
return true
|
||
}
|
||
|
||
func init() {
|
||
input.InitEffect(input.EffectType.Skill, 2220, &Effect2220{})
|
||
input.InitEffect(input.EffectType.Skill, 2221, &Effect2221{})
|
||
input.InitEffect(input.EffectType.Skill, 2222, &Effect2222{})
|
||
input.InitEffect(input.EffectType.Skill, 2223, &Effect2223{})
|
||
input.InitEffect(input.EffectType.Skill, 2224, &Effect2224{})
|
||
input.InitEffect(input.EffectType.Skill, 2225, &Effect2225{})
|
||
input.InitEffect(input.EffectType.Skill, 2226, &Effect2226{})
|
||
input.InitEffect(input.EffectType.Sub, 2226, &Effect2226Sub{})
|
||
input.InitEffect(input.EffectType.Skill, 2227, &Effect2227{})
|
||
input.InitEffect(input.EffectType.Sub, 2227, &Effect2227Sub{})
|
||
input.InitEffect(input.EffectType.Skill, 2228, &Effect2228{})
|
||
input.InitEffect(input.EffectType.Sub, 2228, &Effect2228Sub{})
|
||
input.InitEffect(input.EffectType.Skill, 2229, &Effect2229{})
|
||
input.InitEffect(input.EffectType.Sub, 2229, &Effect2229Sub{})
|
||
input.InitEffect(input.EffectType.Skill, 2230, &Effect2230{})
|
||
input.InitEffect(input.EffectType.Sub, 2230, &Effect2230Sub{})
|
||
input.InitEffect(input.EffectType.Skill, 2231, &Effect2231{})
|
||
input.InitEffect(input.EffectType.Sub, 2231, &Effect2231Sub{})
|
||
input.InitEffect(input.EffectType.Skill, 2232, &Effect2232{})
|
||
input.InitEffect(input.EffectType.Skill, 2233, &Effect2233{})
|
||
input.InitEffect(input.EffectType.Sub, 2233, &Effect2233Sub{})
|
||
input.InitEffect(input.EffectType.Skill, 2234, &Effect2234{})
|
||
input.InitEffect(input.EffectType.Skill, 2235, &Effect2235{})
|
||
input.InitEffect(input.EffectType.Skill, 2236, &Effect2236{})
|
||
input.InitEffect(input.EffectType.Sub, 2236, &Effect2236Sub{})
|
||
input.InitEffect(input.EffectType.Skill, 2237, &Effect2237{})
|
||
input.InitEffect(input.EffectType.Skill, 2238, &Effect2238{})
|
||
input.InitEffect(input.EffectType.Sub, 2238, &Effect2238Sub{})
|
||
input.InitEffect(input.EffectType.Skill, 2239, &Effect2239{})
|
||
input.InitEffect(input.EffectType.Sub, 2239, &Effect2239Sub{})
|
||
input.InitEffect(input.EffectType.Skill, 2240, &Effect2240{})
|
||
input.InitEffect(input.EffectType.Sub, 2240, &Effect2240Sub{})
|
||
input.InitEffect(input.EffectType.Skill, 2241, &Effect2241{})
|
||
input.InitEffect(input.EffectType.Sub, 2241, &Effect2241Sub{})
|
||
input.InitEffect(input.EffectType.Skill, 2242, &Effect2242{})
|
||
input.InitEffect(input.EffectType.Skill, 2243, &Effect2243{})
|
||
input.InitEffect(input.EffectType.Sub, 2243, &Effect2243Sub{})
|
||
input.InitEffect(input.EffectType.Skill, 2244, &Effect2244{})
|
||
input.InitEffect(input.EffectType.Sub, 2244, &Effect2244Sub{})
|
||
}
|