204 lines
5.0 KiB
Go
204 lines
5.0 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 1348: {0}回合内若对手使用属性技能则造成伤害前令对手随机进入{1}种异常状态,未触发则消除对手回合类效果
|
|
type Effect1348 struct {
|
|
RoundEffectArg0Base
|
|
pending bool
|
|
triggered bool
|
|
}
|
|
|
|
func (e *Effect1348) Skill_Use_ex() bool {
|
|
if len(e.Args()) < 2 || e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() != info.Category.STATUS {
|
|
return true
|
|
}
|
|
|
|
e.pending = true
|
|
return true
|
|
}
|
|
|
|
func (e *Effect1348) SkillHit() bool {
|
|
if !e.pending || len(e.Args()) < 2 || e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
|
|
return true
|
|
}
|
|
|
|
applyRandomStatuses1394(e.Ctx().Our, e.Ctx().Opp, int(e.Args()[1].IntPart()))
|
|
e.pending = false
|
|
e.triggered = true
|
|
return true
|
|
}
|
|
|
|
func (e *Effect1348) TurnEnd() {
|
|
if !e.triggered && e.Duration() == 1 {
|
|
e.Ctx().Opp.CancelTurn(e.Ctx().Our)
|
|
}
|
|
e.EffectNode.TurnEnd()
|
|
}
|
|
|
|
// Effect 1349: 自身处于能力提升状态时80%打出致命一击
|
|
type Effect1349 struct{ node.EffectNode }
|
|
|
|
func (e *Effect1349) SkillHit() bool {
|
|
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
|
|
return true
|
|
}
|
|
if !e.Ctx().Our.HasPropADD() {
|
|
return true
|
|
}
|
|
|
|
ok, _, _ := e.Input.Player.Roll(80, 100)
|
|
if ok {
|
|
e.Ctx().SkillEntity.XML.CritRate = 16
|
|
}
|
|
return true
|
|
}
|
|
|
|
// Effect 1350: 反转自身能力下降状态,反转成功则对手下{0}回合攻击技能无效
|
|
type Effect1350 struct{ node.EffectNode }
|
|
|
|
func (e *Effect1350) Skill_Use() bool {
|
|
reversed := false
|
|
for i, v := range e.Ctx().Our.Prop[:] {
|
|
if v >= 0 {
|
|
continue
|
|
}
|
|
if e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), -2*v) {
|
|
reversed = true
|
|
}
|
|
}
|
|
if !reversed || len(e.Args()) == 0 || e.Args()[0].Cmp(alpacadecimal.Zero) <= 0 {
|
|
return true
|
|
}
|
|
|
|
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1350, int(e.Args()[0].IntPart()))
|
|
if sub != nil {
|
|
e.Ctx().Opp.AddEffect(e.Ctx().Our, sub)
|
|
}
|
|
return true
|
|
}
|
|
|
|
type Effect1350Sub struct{ RoundEffectArg0Base }
|
|
|
|
func (e *Effect1350Sub) ActionStart(a, b *action.SelectSkillAction) bool {
|
|
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
|
|
return true
|
|
}
|
|
|
|
e.Ctx().SkillEntity.SetMiss()
|
|
return true
|
|
}
|
|
|
|
// Effect 1351: 获得{0}点护罩,护罩消失时使对手下{1}次攻击技能无效
|
|
type Effect1351 struct{ node.EffectNode }
|
|
|
|
func (e *Effect1351) Skill_Use() bool {
|
|
if len(e.Args()) < 2 || e.Args()[0].Cmp(alpacadecimal.Zero) <= 0 {
|
|
return true
|
|
}
|
|
|
|
e.Ctx().Our.AddShield(e.Args()[0])
|
|
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1351, int(e.Args()[1].IntPart()))
|
|
if sub != nil {
|
|
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
|
|
}
|
|
return true
|
|
}
|
|
|
|
type Effect1351Sub struct {
|
|
node.EffectNode
|
|
triggered bool
|
|
}
|
|
|
|
func (e *Effect1351Sub) SetArgs(t *input.Input, a ...int) {
|
|
e.EffectNode.SetArgs(t, a...)
|
|
e.Duration(-1)
|
|
}
|
|
|
|
func (e *Effect1351Sub) ShieldChange(before, after alpacadecimal.Decimal) bool {
|
|
if e.triggered || before.Cmp(alpacadecimal.Zero) <= 0 || after.Cmp(alpacadecimal.Zero) > 0 || len(e.Args()) == 0 {
|
|
return true
|
|
}
|
|
|
|
e.triggered = true
|
|
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 2351, int(e.Args()[0].IntPart()))
|
|
if sub != nil {
|
|
e.Ctx().Opp.AddEffect(e.Ctx().Our, sub)
|
|
}
|
|
e.Alive(false)
|
|
return true
|
|
}
|
|
|
|
type Effect1351DisableSub struct {
|
|
node.EffectNode
|
|
remaining int
|
|
}
|
|
|
|
func (e *Effect1351DisableSub) SetArgs(t *input.Input, a ...int) {
|
|
e.EffectNode.SetArgs(t, a...)
|
|
e.Duration(-1)
|
|
if len(a) > 0 {
|
|
e.remaining = a[0]
|
|
}
|
|
}
|
|
|
|
func (e *Effect1351DisableSub) 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 1352: 解除自身能力下降状态,解除成功则自身全属性+{0}
|
|
type Effect1352 struct{ node.EffectNode }
|
|
|
|
func (e *Effect1352) OnSkill() bool {
|
|
if len(e.Args()) == 0 {
|
|
return true
|
|
}
|
|
|
|
cleared := false
|
|
for i, v := range e.Ctx().Our.Prop[:] {
|
|
if v < 0 && e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), 0) {
|
|
cleared = true
|
|
}
|
|
}
|
|
if !cleared {
|
|
return true
|
|
}
|
|
|
|
boost := int8(e.Args()[0].IntPart())
|
|
for i := range e.Ctx().Our.Prop[:] {
|
|
e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), boost)
|
|
}
|
|
return true
|
|
}
|
|
|
|
func init() {
|
|
input.InitEffect(input.EffectType.Skill, 1348, &Effect1348{})
|
|
input.InitEffect(input.EffectType.Skill, 1349, &Effect1349{})
|
|
input.InitEffect(input.EffectType.Skill, 1350, &Effect1350{})
|
|
input.InitEffect(input.EffectType.Sub, 1350, &Effect1350Sub{})
|
|
input.InitEffect(input.EffectType.Skill, 1351, &Effect1351{})
|
|
input.InitEffect(input.EffectType.Sub, 1351, &Effect1351Sub{})
|
|
input.InitEffect(input.EffectType.Sub, 2351, &Effect1351DisableSub{})
|
|
input.InitEffect(input.EffectType.Skill, 1352, &Effect1352{})
|
|
}
|