Files
bl/logic/service/fight/effect/871_875.go

201 lines
5.4 KiB
Go
Raw Normal View History

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 871: 下{0}回合,每回合攻击技能造成的伤害不少于{1}
type Effect871 struct{ node.EffectNode }
func (e *Effect871) Skill_Use() bool {
if len(e.Args()) < 2 {
return true
}
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 871, int(e.Args()[0].IntPart()), int(e.Args()[1].IntPart()))
if sub != nil {
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
}
return true
}
type Effect871Sub struct{ RoundEffectArg0Base }
func (e *Effect871Sub) DamageFloor(zone *info.DamageZone) bool {
if zone == nil || zone.Type != info.DamageType.Red || len(e.Args()) < 2 || e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS || e.Ctx().SkillEntity.AttackTime == 0 {
return true
}
if zone.Damage.Cmp(e.Args()[1]) < 0 {
zone.Damage = e.Args()[1]
}
return true
}
// Effect 872: 吸取对手能力提升状态,吸取成功则{0}回合内令对手使用的属性技能无效
type Effect872 struct{ node.EffectNode }
func (e *Effect872) OnSkill() 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) {
e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), v)
cleared = true
}
}
if !cleared {
return true
}
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 872, int(e.Args()[0].IntPart()))
if sub != nil {
e.Ctx().Opp.AddEffect(e.Ctx().Our, sub)
}
return true
}
type Effect872Sub struct{ RoundEffectArg0Base }
func (e *Effect872Sub) ActionStart(a, b *action.SelectSkillAction) bool {
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() != info.Category.STATUS {
return true
}
e.Ctx().SkillEntity.SetNoSide()
e.Ctx().SkillEntity.AttackTime = 0
return true
}
// Effect 873: 消耗自身全部体力,消除对手能力提升状态和回合类效果,使己方下只出场精灵下次攻击必定先手、必定命中且造成的伤害翻倍
type Effect873 struct{ node.EffectNode }
func (e *Effect873) Skill_Use() bool {
for i, v := range e.Ctx().Opp.Prop[:] {
if v > 0 {
e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), 0)
}
}
e.Ctx().Opp.CancelTurn(e.Ctx().Our)
e.Ctx().Our.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Fixed,
Damage: e.Ctx().Our.CurrentPet.GetHP(),
})
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 873)
if sub != nil {
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
}
return true
}
type Effect873Sub struct{ node.EffectNode }
func (e *Effect873Sub) SetArgs(t *input.Input, a ...int) {
e.EffectNode.SetArgs(t, a...)
e.CanStack(false)
e.Duration(-1)
}
func (e *Effect873Sub) ComparePre(fattack, sattack *action.SelectSkillAction) bool {
current := actionByPlayer(fattack, sattack, e.Ctx().Our.UserID)
if current == nil || current.SkillEntity == nil || current.SkillEntity.Category() == info.Category.STATUS {
return true
}
current.SkillEntity.XML.Priority += 7
return true
}
func (e *Effect873Sub) ActionStart(a, b *action.SelectSkillAction) bool {
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
e.Ctx().SkillEntity.XML.MustHit = 1
return true
}
func (e *Effect873Sub) Damage_Mul(zone *info.DamageZone) bool {
if zone == nil || zone.Type != info.DamageType.Red || e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
zone.Damage = zone.Damage.Mul(alpacadecimal.NewFromInt(2))
e.Alive(false)
return true
}
// Effect 874: {0}回合内若对手造成的伤害低于{1}则免疫该伤害
type Effect874 struct{ node.EffectNode }
func (e *Effect874) Skill_Use() bool {
if len(e.Args()) < 2 {
return true
}
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 874, int(e.Args()[0].IntPart()), int(e.Args()[1].IntPart()))
if sub != nil {
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
}
return true
}
type Effect874Sub struct{ RoundEffectArg0Base }
func (e *Effect874Sub) DamageLockEx(zone *info.DamageZone) bool {
if zone == nil || len(e.Args()) < 2 {
return true
}
if zone.Damage.Cmp(e.Args()[1]) < 0 {
zone.Damage = alpacadecimal.Zero
}
return true
}
func (e *Effect874Sub) DamageDivEx(zone *info.DamageZone) bool {
if zone == nil || len(e.Args()) < 2 {
return true
}
if zone.Damage.Cmp(e.Args()[1]) < 0 {
zone.Damage = alpacadecimal.Zero
}
return true
}
// Effect 875: 消耗自身全部体力对手所有技能PP值归零全属性-1
type Effect875 struct{ node.EffectNode }
func (e *Effect875) Skill_Use() bool {
zeroAllSkillPP(e.Ctx().Opp)
applyAllPropDown(e.Ctx().Our, e.Ctx().Opp, 1)
e.Ctx().Our.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Fixed,
Damage: e.Ctx().Our.CurrentPet.GetHP(),
})
return true
}
func init() {
input.InitEffect(input.EffectType.Skill, 871, &Effect871{})
input.InitEffect(input.EffectType.Sub, 871, &Effect871Sub{})
input.InitEffect(input.EffectType.Skill, 872, &Effect872{})
input.InitEffect(input.EffectType.Sub, 872, &Effect872Sub{})
input.InitEffect(input.EffectType.Skill, 873, &Effect873{})
input.InitEffect(input.EffectType.Sub, 873, &Effect873Sub{})
input.InitEffect(input.EffectType.Skill, 874, &Effect874{})
input.InitEffect(input.EffectType.Sub, 874, &Effect874Sub{})
input.InitEffect(input.EffectType.Skill, 875, &Effect875{})
}