242 lines
6.4 KiB
Go
242 lines
6.4 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 1193: 当自身血量少于1/2时先制+2
|
|
type Effect1193 struct{ node.EffectNode }
|
|
|
|
func (e *Effect1193) ComparePre(fattack, sattack *action.SelectSkillAction) bool {
|
|
if e.Ctx().Our.CurrentPet.GetHP().Mul(alpacadecimal.NewFromInt(2)).Cmp(e.Ctx().Our.CurrentPet.GetMaxHP()) >= 0 {
|
|
return true
|
|
}
|
|
current := actionByPlayer(fattack, sattack, e.Ctx().Our.UserID)
|
|
if current != nil && current.SkillEntity != nil {
|
|
current.SkillEntity.XML.Priority += 2
|
|
}
|
|
return true
|
|
}
|
|
|
|
// Effect 1194: 反转自身能力下降状态,反转成功则自身{0}回合内免疫能力下降状态
|
|
type Effect1194 struct{ node.EffectNode }
|
|
|
|
func (e *Effect1194) 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 {
|
|
return true
|
|
}
|
|
|
|
addSubEffect(e.Ctx().Our, e.Ctx().Our, &e.EffectNode, &Effect47{}, -1)
|
|
return true
|
|
}
|
|
|
|
// Effect 1195: {0}回合内自身受到攻击{1}%使对手{2},若未触发则对手受到{3}点固定伤害
|
|
type Effect1195 struct{ RoundEffectArg0Base }
|
|
|
|
func (e *Effect1195) DamageSubEx(zone *info.DamageZone) bool {
|
|
if zone == nil || zone.Type != info.DamageType.Red || len(e.Args()) < 4 {
|
|
return true
|
|
}
|
|
if zone.Damage.Cmp(alpacadecimal.Zero) <= 0 {
|
|
return true
|
|
}
|
|
|
|
if ok, _, _ := e.Input.Player.Roll(int(e.Args()[1].IntPart()), 100); ok {
|
|
applyStatusByID(e.Ctx().Our, e.Ctx().Opp, int(e.Args()[2].IntPart()))
|
|
return true
|
|
}
|
|
|
|
if e.Args()[3].Cmp(alpacadecimal.Zero) > 0 {
|
|
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
|
|
Type: info.DamageType.Fixed,
|
|
Damage: e.Args()[3],
|
|
})
|
|
}
|
|
return true
|
|
}
|
|
|
|
// Effect 1196: {0}回合内每回合{1}%令对手使用的攻击技能无效,未触发则令对手下{2}次使用的属性技能无效
|
|
type Effect1196 struct{ node.EffectNode }
|
|
|
|
func (e *Effect1196) Skill_Use() bool {
|
|
if len(e.Args()) < 3 {
|
|
return true
|
|
}
|
|
|
|
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1196, int(e.Args()[0].IntPart()), int(e.Args()[1].IntPart()), int(e.Args()[2].IntPart()))
|
|
if sub != nil {
|
|
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
|
|
}
|
|
return true
|
|
}
|
|
|
|
type Effect1196Sub struct{ RoundEffectArg0Base }
|
|
|
|
func (e *Effect1196Sub) ActionStart(a, b *action.SelectSkillAction) bool {
|
|
if len(e.Args()) < 3 || 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.SetMiss()
|
|
return true
|
|
}
|
|
|
|
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 11961, int(e.Args()[2].IntPart()))
|
|
if sub != nil {
|
|
e.Ctx().Opp.AddEffect(e.Ctx().Our, sub)
|
|
}
|
|
return true
|
|
}
|
|
|
|
type Effect1196StatusLockSub struct {
|
|
node.EffectNode
|
|
remaining int
|
|
}
|
|
|
|
func (e *Effect1196StatusLockSub) SetArgs(t *input.Input, a ...int) {
|
|
e.EffectNode.SetArgs(t, a...)
|
|
e.Duration(-1)
|
|
if len(a) > 0 {
|
|
e.remaining = a[0]
|
|
}
|
|
}
|
|
|
|
func (e *Effect1196StatusLockSub) 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.SetNoSide()
|
|
e.Ctx().SkillEntity.AttackTime = 0
|
|
e.remaining--
|
|
if e.remaining <= 0 {
|
|
e.Alive(false)
|
|
}
|
|
return true
|
|
}
|
|
|
|
// Effect 1197: 获得{0}点护盾,护盾消失时附加{1}点固定伤害同时使自身下{2}次攻击造成的伤害翻倍
|
|
type Effect1197 struct{ node.EffectNode }
|
|
|
|
func (e *Effect1197) Skill_Use() bool {
|
|
if len(e.Args()) < 3 || e.Args()[0].Cmp(alpacadecimal.Zero) <= 0 {
|
|
return true
|
|
}
|
|
|
|
e.Ctx().Our.AddShield(e.Args()[0])
|
|
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1197, int(e.Args()[1].IntPart()), int(e.Args()[2].IntPart()))
|
|
if sub != nil {
|
|
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
|
|
}
|
|
return true
|
|
}
|
|
|
|
type Effect1197Sub struct{ node.EffectNode }
|
|
|
|
func (e *Effect1197Sub) SetArgs(t *input.Input, a ...int) {
|
|
e.EffectNode.SetArgs(t, a...)
|
|
e.CanStack(false)
|
|
e.Duration(-1)
|
|
}
|
|
|
|
func (e *Effect1197Sub) Damage_Shield(zone *info.DamageZone) bool {
|
|
if zone == nil || zone.Damage.Cmp(alpacadecimal.Zero) <= 0 || e.Ctx().Our.CurrentShield().Cmp(alpacadecimal.Zero) > 0 {
|
|
return true
|
|
}
|
|
if len(e.Args()) < 2 {
|
|
return true
|
|
}
|
|
|
|
if e.Args()[0].Cmp(alpacadecimal.Zero) > 0 {
|
|
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
|
|
Type: info.DamageType.Fixed,
|
|
Damage: e.Args()[0],
|
|
})
|
|
}
|
|
boost := e.Ctx().Our.InitEffect(input.EffectType.Sub, 11971, int(e.Args()[1].IntPart()))
|
|
if boost != nil {
|
|
e.Ctx().Our.AddEffect(e.Ctx().Our, boost)
|
|
}
|
|
e.Alive(false)
|
|
return true
|
|
}
|
|
|
|
type Effect1197BoostSub struct {
|
|
node.EffectNode
|
|
remaining int
|
|
}
|
|
|
|
func (e *Effect1197BoostSub) SetArgs(t *input.Input, a ...int) {
|
|
e.EffectNode.SetArgs(t, a...)
|
|
e.Duration(-1)
|
|
if len(a) > 0 {
|
|
e.remaining = a[0]
|
|
}
|
|
}
|
|
|
|
func (e *Effect1197BoostSub) Damage_Mul(zone *info.DamageZone) bool {
|
|
if zone == nil || zone.Type != info.DamageType.Red || e.remaining <= 0 {
|
|
return true
|
|
}
|
|
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
|
|
return true
|
|
}
|
|
|
|
zone.Damage = zone.Damage.Mul(alpacadecimal.NewFromInt(2))
|
|
e.remaining--
|
|
if e.remaining <= 0 {
|
|
e.Alive(false)
|
|
}
|
|
return true
|
|
}
|
|
|
|
// Effect 1190: 消除对手回合类效果,消除成功对手{0}
|
|
type Effect1190 struct{ node.EffectNode }
|
|
|
|
func (e *Effect1190) Skill_Use() bool {
|
|
before := activeTurnEffectCount(e.Ctx().Opp)
|
|
e.Ctx().Opp.CancelTurn(e.Ctx().Our)
|
|
if before <= 0 {
|
|
return true
|
|
}
|
|
|
|
for i, v := range e.SideEffectArgs[:min(len(e.SideEffectArgs), 6)] {
|
|
if v == 0 {
|
|
continue
|
|
}
|
|
e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), int8(v))
|
|
}
|
|
return true
|
|
}
|
|
|
|
func init() {
|
|
input.InitEffect(input.EffectType.Skill, 1193, &Effect1193{})
|
|
input.InitEffect(input.EffectType.Skill, 1194, &Effect1194{})
|
|
input.InitEffect(input.EffectType.Skill, 1195, &Effect1195{})
|
|
input.InitEffect(input.EffectType.Skill, 1196, &Effect1196{})
|
|
input.InitEffect(input.EffectType.Sub, 1196, &Effect1196Sub{})
|
|
input.InitEffect(input.EffectType.Sub, 11961, &Effect1196StatusLockSub{})
|
|
input.InitEffect(input.EffectType.Skill, 1197, &Effect1197{})
|
|
input.InitEffect(input.EffectType.Sub, 1197, &Effect1197Sub{})
|
|
input.InitEffect(input.EffectType.Sub, 11971, &Effect1197BoostSub{})
|
|
}
|