237 lines
5.3 KiB
Go
237 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 1258: 造成的攻击伤害若高于{0}则自身免疫下{1}次受到的异常状态
|
|
type Effect1258 struct {
|
|
node.EffectNode
|
|
}
|
|
|
|
func (e *Effect1258) Skill_Use() bool {
|
|
if len(e.Args()) < 2 || e.Ctx().Our.SumDamage.Cmp(e.Args()[0]) <= 0 {
|
|
return true
|
|
}
|
|
|
|
effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1258, int(e.Args()[1].IntPart()))
|
|
if effect != nil {
|
|
e.Ctx().Our.AddEffect(e.Ctx().Our, effect)
|
|
}
|
|
return true
|
|
}
|
|
|
|
type Effect1258Sub struct {
|
|
node.EffectNode
|
|
remaining int
|
|
}
|
|
|
|
func (e *Effect1258Sub) SetArgs(t *input.Input, a ...int) {
|
|
e.EffectNode.SetArgs(t, a...)
|
|
e.Duration(-1)
|
|
if len(a) > 0 {
|
|
e.remaining = a[0]
|
|
}
|
|
}
|
|
|
|
func (e *Effect1258Sub) 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 1259: {0}回合内有{1}%概率免疫对手攻击伤害,未触发则对手{2}
|
|
type Effect1259 struct {
|
|
RoundEffectArg0Base
|
|
}
|
|
|
|
func (e *Effect1259) DamageLockEx(zone *info.DamageZone) bool {
|
|
if zone == nil || zone.Type != info.DamageType.Red || len(e.Args()) < 3 {
|
|
return true
|
|
}
|
|
|
|
success, _, _ := e.Input.Player.Roll(int(e.Args()[1].IntPart()), 100)
|
|
if success {
|
|
zone.Damage = alpacadecimal.Zero
|
|
return true
|
|
}
|
|
|
|
statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(e.Args()[2].IntPart()))
|
|
if statusEffect != nil {
|
|
e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect)
|
|
}
|
|
return true
|
|
}
|
|
|
|
// Effect 1260: 将自身能力下降状态双倍反馈给对手,反馈成功则{0}回合内免疫能力下降效果
|
|
type Effect1260 struct {
|
|
node.EffectNode
|
|
}
|
|
|
|
func (e *Effect1260) OnSkill() bool {
|
|
if len(e.Args()) == 0 {
|
|
return true
|
|
}
|
|
|
|
reflected := false
|
|
for i, v := range e.Ctx().Our.Prop[:] {
|
|
if v >= 0 {
|
|
continue
|
|
}
|
|
if e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), 2*v) {
|
|
reflected = true
|
|
}
|
|
}
|
|
if !reflected {
|
|
return true
|
|
}
|
|
|
|
effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1260, int(e.Args()[0].IntPart()))
|
|
if effect != nil {
|
|
e.Ctx().Our.AddEffect(e.Ctx().Our, effect)
|
|
}
|
|
return true
|
|
}
|
|
|
|
type Effect1260Sub struct {
|
|
RoundEffectArg0Base
|
|
}
|
|
|
|
func (e *Effect1260Sub) PropBefer(in *input.Input, prop int8, level int8) bool {
|
|
if in == e.Ctx().Opp && level < 0 {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
|
|
// Effect 1261: 吸取对手能力提升状态,吸取成功则附加{0}点固定伤害
|
|
type Effect1261 struct {
|
|
node.EffectNode
|
|
}
|
|
|
|
func (e *Effect1261) OnSkill() bool {
|
|
if len(e.Args()) == 0 {
|
|
return true
|
|
}
|
|
|
|
absorbed := false
|
|
for i, v := range e.Ctx().Opp.Prop[:] {
|
|
if v <= 0 {
|
|
continue
|
|
}
|
|
if !e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), 0) {
|
|
continue
|
|
}
|
|
absorbed = true
|
|
e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), v)
|
|
}
|
|
if !absorbed {
|
|
return true
|
|
}
|
|
|
|
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
|
|
Type: info.DamageType.Fixed,
|
|
Damage: e.Args()[0],
|
|
})
|
|
return true
|
|
}
|
|
|
|
// Effect 1262: 获得{0}点护盾,护盾消失时使对手下{1}次攻击技能无效
|
|
type Effect1262 struct {
|
|
node.EffectNode
|
|
}
|
|
|
|
func (e *Effect1262) Skill_Use() bool {
|
|
if len(e.Args()) < 2 || e.Args()[0].Cmp(alpacadecimal.Zero) <= 0 {
|
|
return true
|
|
}
|
|
|
|
e.Ctx().Our.AddShield(e.Args()[0])
|
|
effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1262, int(e.Args()[1].IntPart()))
|
|
if effect != nil {
|
|
e.Ctx().Our.AddEffect(e.Ctx().Our, effect)
|
|
}
|
|
return true
|
|
}
|
|
|
|
type Effect1262Sub struct {
|
|
node.EffectNode
|
|
triggered bool
|
|
}
|
|
|
|
func (e *Effect1262Sub) SetArgs(t *input.Input, a ...int) {
|
|
e.EffectNode.SetArgs(t, a...)
|
|
e.Duration(-1)
|
|
}
|
|
|
|
func (e *Effect1262Sub) Damage_Shield(zone *info.DamageZone) bool {
|
|
if e.triggered || e.Ctx().Our.CurrentShield().Cmp(alpacadecimal.Zero) > 0 {
|
|
return true
|
|
}
|
|
|
|
e.triggered = true
|
|
effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 2062, int(e.Args()[0].IntPart()))
|
|
if effect != nil {
|
|
e.Ctx().Opp.AddEffect(e.Ctx().Our, effect)
|
|
}
|
|
e.Alive(false)
|
|
return true
|
|
}
|
|
|
|
type Effect1262DisableSub struct {
|
|
node.EffectNode
|
|
remaining int
|
|
}
|
|
|
|
func (e *Effect1262DisableSub) SetArgs(t *input.Input, a ...int) {
|
|
e.EffectNode.SetArgs(t, a...)
|
|
e.Duration(-1)
|
|
if len(a) > 0 {
|
|
e.remaining = a[0]
|
|
}
|
|
}
|
|
|
|
func (e *Effect1262DisableSub) 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
|
|
}
|
|
|
|
func init() {
|
|
input.InitEffect(input.EffectType.Skill, 1258, &Effect1258{})
|
|
input.InitEffect(input.EffectType.Sub, 1258, &Effect1258Sub{})
|
|
input.InitEffect(input.EffectType.Skill, 1259, &Effect1259{})
|
|
input.InitEffect(input.EffectType.Skill, 1260, &Effect1260{})
|
|
input.InitEffect(input.EffectType.Sub, 1260, &Effect1260Sub{})
|
|
input.InitEffect(input.EffectType.Skill, 1261, &Effect1261{})
|
|
input.InitEffect(input.EffectType.Skill, 1262, &Effect1262{})
|
|
input.InitEffect(input.EffectType.Sub, 1262, &Effect1262Sub{})
|
|
input.InitEffect(input.EffectType.Sub, 2062, &Effect1262DisableSub{})
|
|
}
|