203 lines
4.5 KiB
Go
203 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 1218: 未击败对手则下{0}回合自身先制+{1}
|
|
type Effect1218 struct {
|
|
node.EffectNode
|
|
}
|
|
|
|
func (e *Effect1218) Skill_Use() bool {
|
|
if len(e.Args()) < 2 || e.Ctx().Opp.CurrentPet.Info.Hp == 0 {
|
|
return true
|
|
}
|
|
|
|
addSubEffect(e.Ctx().Our, e.Ctx().Our, &e.EffectNode, &Effect1218Sub{}, -1)
|
|
return true
|
|
}
|
|
|
|
type Effect1218Sub struct {
|
|
RoundEffectArg0Base
|
|
}
|
|
|
|
func (e *Effect1218Sub) 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 += int(e.Args()[1].IntPart())
|
|
return true
|
|
}
|
|
|
|
// Effect 1219: 消除对手回合类效果,消除成功则下回合受到的伤害转化为自身体力
|
|
type Effect1219 struct {
|
|
node.EffectNode
|
|
}
|
|
|
|
func (e *Effect1219) Skill_Use() bool {
|
|
before := activeTurnEffectCount(e.Ctx().Opp)
|
|
e.Ctx().Opp.CancelTurn(e.Ctx().Our)
|
|
if before <= 0 {
|
|
return true
|
|
}
|
|
|
|
effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1219)
|
|
if effect != nil {
|
|
e.Ctx().Our.AddEffect(e.Ctx().Our, effect)
|
|
}
|
|
return true
|
|
}
|
|
|
|
type Effect1219Sub struct {
|
|
FixedDuration1Base
|
|
}
|
|
|
|
func (e *Effect1219Sub) DamageLockEx(zone *info.DamageZone) bool {
|
|
if zone == nil || zone.Type != info.DamageType.Red {
|
|
return true
|
|
}
|
|
if zone.Damage.Cmp(alpacadecimal.Zero) <= 0 {
|
|
return true
|
|
}
|
|
|
|
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, zone.Damage)
|
|
zone.Damage = alpacadecimal.Zero
|
|
return true
|
|
}
|
|
|
|
// Effect 1220: 消除对手能力提升状态,消除成功则下{0}回合自身攻击必定致命一击
|
|
type Effect1220 struct {
|
|
node.EffectNode
|
|
}
|
|
|
|
func (e *Effect1220) Skill_Use() bool {
|
|
if len(e.Args()) == 0 {
|
|
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
|
|
}
|
|
|
|
effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1220, int(e.Args()[0].IntPart()))
|
|
if effect != nil {
|
|
e.Ctx().Our.AddEffect(e.Ctx().Our, effect)
|
|
}
|
|
return true
|
|
}
|
|
|
|
type Effect1220Sub struct {
|
|
RoundEffectArg0Base
|
|
}
|
|
|
|
func (e *Effect1220Sub) ActionStart(a, b *action.SelectSkillAction) bool {
|
|
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
|
|
return true
|
|
}
|
|
|
|
e.Ctx().SkillEntity.XML.CritRate = 16
|
|
return true
|
|
}
|
|
|
|
// Effect 1221: 反转自身能力下降状态,反转成功则自身免疫下{0}次受到的异常状态
|
|
type Effect1221 struct {
|
|
node.EffectNode
|
|
}
|
|
|
|
func (e *Effect1221) OnSkill() bool {
|
|
if len(e.Args()) == 0 {
|
|
return true
|
|
}
|
|
|
|
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 {
|
|
return true
|
|
}
|
|
|
|
effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1221, int(e.Args()[0].IntPart()))
|
|
if effect != nil {
|
|
e.Ctx().Our.AddEffect(e.Ctx().Our, effect)
|
|
}
|
|
return true
|
|
}
|
|
|
|
type Effect1221Sub struct {
|
|
node.EffectNode
|
|
remaining int
|
|
}
|
|
|
|
func (e *Effect1221Sub) SetArgs(t *input.Input, a ...int) {
|
|
e.EffectNode.SetArgs(t, a...)
|
|
e.Duration(-1)
|
|
if len(a) > 0 {
|
|
e.remaining = a[0]
|
|
}
|
|
}
|
|
|
|
func (e *Effect1221Sub) EFFect_Befer(in *input.Input, effEffect input.Effect) bool {
|
|
if e.remaining <= 0 {
|
|
e.Alive(false)
|
|
return true
|
|
}
|
|
if in != e.Ctx().Opp || !input.IS_Stat(effEffect) {
|
|
return true
|
|
}
|
|
|
|
e.remaining--
|
|
if e.remaining <= 0 {
|
|
e.Alive(false)
|
|
}
|
|
return false
|
|
}
|
|
|
|
// Effect 1222: 先出手时使对手随机{0}个技能PP值归零
|
|
type Effect1222 struct {
|
|
node.EffectNode
|
|
}
|
|
|
|
func (e *Effect1222) OnSkill() bool {
|
|
if len(e.Args()) == 0 || !e.IsFirst() {
|
|
return true
|
|
}
|
|
|
|
zeroRandomSkillPP(e.Ctx().Opp, int(e.Args()[0].IntPart()))
|
|
return true
|
|
}
|
|
|
|
func init() {
|
|
input.InitEffect(input.EffectType.Skill, 1218, &Effect1218{})
|
|
input.InitEffect(input.EffectType.Sub, 1218, &Effect1218Sub{})
|
|
input.InitEffect(input.EffectType.Skill, 1219, &Effect1219{})
|
|
input.InitEffect(input.EffectType.Sub, 1219, &Effect1219Sub{})
|
|
input.InitEffect(input.EffectType.Skill, 1220, &Effect1220{})
|
|
input.InitEffect(input.EffectType.Sub, 1220, &Effect1220Sub{})
|
|
input.InitEffect(input.EffectType.Skill, 1221, &Effect1221{})
|
|
input.InitEffect(input.EffectType.Sub, 1221, &Effect1221Sub{})
|
|
input.InitEffect(input.EffectType.Skill, 1222, &Effect1222{})
|
|
}
|