feat(effect): 实现effects 1770-1794战斗效果 - 实现Effect 1770: 开启战魂附体效果,免疫对手下1次攻击技能伤害, 若对手攻击技能PP值为满则额外免疫下1次固定伤害和百分比伤害 - 实现Effect 1771-1779相关战斗效果,包括能力状态反转、固定伤害计算等功能 - 实现Effect 1780-1794系列效果,包含伤害计算、护盾机制、切换限制等功能
1002 lines
24 KiB
Go
1002 lines
24 KiB
Go
package effect
|
||
|
||
import (
|
||
"blazing/common/data/xmlres"
|
||
"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 1770: 开启战魂附体:免疫对手下1次攻击技能造成的伤害,若对手使用的攻击技能PP值为满则自身额外免疫下1次受到的固定伤害和百分比伤害
|
||
type Effect1770 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect1770) Skill_Use() bool {
|
||
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1770)
|
||
if sub != nil {
|
||
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
|
||
}
|
||
return true
|
||
}
|
||
|
||
type Effect1770Sub struct {
|
||
node.EffectNode
|
||
blockedSkill *info.SkillEntity
|
||
attackUsed bool
|
||
extraPending bool
|
||
}
|
||
|
||
func (e *Effect1770Sub) SetArgs(t *input.Input, a ...int) {
|
||
e.EffectNode.SetArgs(t, a...)
|
||
e.Duration(-1)
|
||
}
|
||
|
||
func (e *Effect1770Sub) TurnEnd() {
|
||
e.blockedSkill = nil
|
||
if e.attackUsed && !e.extraPending {
|
||
e.Alive(false)
|
||
return
|
||
}
|
||
e.EffectNode.TurnEnd()
|
||
}
|
||
|
||
func (e *Effect1770Sub) DamageLockEx(zone *info.DamageZone) bool {
|
||
if zone == nil || zone.Damage.Cmp(alpacadecimal.Zero) <= 0 {
|
||
return true
|
||
}
|
||
|
||
current := e.Ctx().SkillEntity
|
||
if current != nil && current.Category() != info.Category.STATUS && current.AttackTime != 0 {
|
||
if e.blockedSkill != nil && e.blockedSkill != current {
|
||
e.blockedSkill = nil
|
||
}
|
||
if !e.attackUsed {
|
||
e.attackUsed = true
|
||
e.blockedSkill = current
|
||
zone.Damage = alpacadecimal.Zero
|
||
if skill, ok := xmlres.SkillMap[int(current.Info.ID)]; ok && current.Info.PP >= uint32(skill.MaxPP) {
|
||
e.extraPending = true
|
||
}
|
||
return true
|
||
}
|
||
if e.blockedSkill == current {
|
||
zone.Damage = alpacadecimal.Zero
|
||
return true
|
||
}
|
||
}
|
||
|
||
if e.extraPending && (zone.Type == info.DamageType.Fixed || zone.Type == info.DamageType.Percent) {
|
||
zone.Damage = alpacadecimal.Zero
|
||
e.extraPending = false
|
||
e.Alive(false)
|
||
}
|
||
return true
|
||
}
|
||
|
||
func totalNegativePropLevels(in *input.Input) int64 {
|
||
if in == nil {
|
||
return 0
|
||
}
|
||
total := int64(0)
|
||
for _, v := range in.Prop[:] {
|
||
if v < 0 {
|
||
total += int64(-v)
|
||
}
|
||
}
|
||
return total
|
||
}
|
||
|
||
func clearSubEffects(target *input.Input) bool {
|
||
if target == nil {
|
||
return false
|
||
}
|
||
cleared := false
|
||
for _, eff := range target.Effects {
|
||
if eff == nil || !eff.Alive() {
|
||
continue
|
||
}
|
||
if eff.ID().GetEffectType() == input.EffectType.Sub {
|
||
eff.Alive(false)
|
||
cleared = true
|
||
}
|
||
}
|
||
return cleared
|
||
}
|
||
|
||
func countTurnEffects(target *input.Input) int {
|
||
if target == nil {
|
||
return 0
|
||
}
|
||
|
||
count := 0
|
||
for _, effect := range target.Effects {
|
||
if effect == nil || !effect.Alive() {
|
||
continue
|
||
}
|
||
if effect.Duration() > 0 {
|
||
count++
|
||
}
|
||
}
|
||
return count
|
||
}
|
||
|
||
// Effect 1771: 反转对手能力提升状态,反转成功则{0}回合内对手的能力下降状态无法被解除或反转
|
||
type Effect1771 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect1771) Skill_Use() bool {
|
||
if len(e.Args()) == 0 {
|
||
return true
|
||
}
|
||
|
||
reversed := false
|
||
for i, v := range e.Ctx().Opp.Prop[:] {
|
||
if v <= 0 {
|
||
continue
|
||
}
|
||
if e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), -2*v) {
|
||
reversed = true
|
||
}
|
||
}
|
||
if !reversed {
|
||
return true
|
||
}
|
||
|
||
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1771, int(e.Args()[0].IntPart()))
|
||
if sub != nil {
|
||
e.Ctx().Opp.AddEffect(e.Ctx().Our, sub)
|
||
}
|
||
return true
|
||
}
|
||
|
||
type Effect1771Sub struct {
|
||
RoundEffectArg0Base
|
||
}
|
||
|
||
func (e *Effect1771Sub) PropBefer(source *input.Input, prop int8, level int8) bool {
|
||
if source != e.Ctx().Our {
|
||
return true
|
||
}
|
||
if prop < 0 || int(prop) >= len(e.Ctx().Our.Prop) {
|
||
return true
|
||
}
|
||
if level >= 0 {
|
||
return true
|
||
}
|
||
return false
|
||
}
|
||
|
||
// Effect 1772: 附加对手能力下降等级总和和X{0}的固定伤害
|
||
type Effect1772 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect1772) OnSkill() bool {
|
||
if len(e.Args()) == 0 {
|
||
return true
|
||
}
|
||
total := totalNegativePropLevels(e.Ctx().Opp)
|
||
if total <= 0 {
|
||
return true
|
||
}
|
||
|
||
damage := e.Args()[0].Add(alpacadecimal.NewFromInt(total))
|
||
if damage.Cmp(alpacadecimal.Zero) <= 0 {
|
||
return true
|
||
}
|
||
|
||
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
|
||
Type: info.DamageType.Fixed,
|
||
Damage: damage,
|
||
})
|
||
return true
|
||
}
|
||
|
||
// Effect 1773: 附加双方能力下降等级总和和X{0}的固定伤害
|
||
type Effect1773 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect1773) OnSkill() bool {
|
||
if len(e.Args()) == 0 {
|
||
return true
|
||
}
|
||
total := totalNegativePropLevels(e.Ctx().Opp) + totalNegativePropLevels(e.Ctx().Our)
|
||
if total <= 0 {
|
||
return true
|
||
}
|
||
|
||
damage := e.Args()[0].Add(alpacadecimal.NewFromInt(total))
|
||
if damage.Cmp(alpacadecimal.Zero) <= 0 {
|
||
return true
|
||
}
|
||
|
||
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
|
||
Type: info.DamageType.Fixed,
|
||
Damage: damage,
|
||
})
|
||
return true
|
||
}
|
||
|
||
// Effect 1774: 若对手当回合使用的技能为攻击技能则自身额外先制+1
|
||
type Effect1774 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect1774) ComparePre(fattack, sattack *action.SelectSkillAction) bool {
|
||
current := actionByPlayer(fattack, sattack, e.Ctx().Our.UserID)
|
||
if current == nil || current.SkillEntity == nil {
|
||
return true
|
||
}
|
||
other := actionByPlayer(fattack, sattack, e.Ctx().Opp.UserID)
|
||
if other == nil || other.SkillEntity == nil || other.SkillEntity.Category() == info.Category.STATUS {
|
||
return true
|
||
}
|
||
|
||
current.SkillEntity.XML.Priority += 1
|
||
return true
|
||
}
|
||
|
||
// Effect 1775: 令对手下{0}次使用的技能PP值归零
|
||
type Effect1775 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect1775) Skill_Use() bool {
|
||
if len(e.Args()) == 0 {
|
||
return true
|
||
}
|
||
|
||
effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1775, int(e.Args()[0].IntPart()))
|
||
if effect != nil {
|
||
e.Ctx().Opp.AddEffect(e.Ctx().Our, effect)
|
||
}
|
||
return true
|
||
}
|
||
|
||
type Effect1775Sub struct {
|
||
RoundEffectArg0Base
|
||
}
|
||
|
||
func (e *Effect1775Sub) HookPP(count *int) bool {
|
||
if count == nil || e.Duration() <= 0 {
|
||
return true
|
||
}
|
||
|
||
*count = 0
|
||
e.Alive(false)
|
||
return true
|
||
}
|
||
|
||
// Effect 1776: 吸取对手能力提升状态,吸取成功则{0}回合内对手攻击技能无法造成伤害且命中失效
|
||
type Effect1776 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect1776) 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) {
|
||
absorbed = true
|
||
e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), v)
|
||
}
|
||
}
|
||
if !absorbed {
|
||
return true
|
||
}
|
||
|
||
effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1776, int(e.Args()[0].IntPart()))
|
||
if effect != nil {
|
||
e.Ctx().Opp.AddEffect(e.Ctx().Our, effect)
|
||
}
|
||
return true
|
||
}
|
||
|
||
type Effect1776Sub struct {
|
||
RoundEffectArg0Base
|
||
}
|
||
|
||
func (e *Effect1776Sub) SkillHit_ex() bool {
|
||
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
|
||
return true
|
||
}
|
||
e.Ctx().SkillEntity.SetMiss()
|
||
return true
|
||
}
|
||
|
||
func (e *Effect1776Sub) DamageLockEx(zone *info.DamageZone) bool {
|
||
if zone == nil || zone.Type != info.DamageType.Red {
|
||
return true
|
||
}
|
||
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
|
||
return true
|
||
}
|
||
|
||
zone.Damage = alpacadecimal.Zero
|
||
return true
|
||
}
|
||
|
||
// Effect 1777: 消除对手回合类效果,若对手不处于回合类效果则{0}%令对手{1}
|
||
type Effect1777 struct{ node.EffectNode }
|
||
|
||
func (e *Effect1777) Skill_Use() bool {
|
||
if len(e.Args()) < 2 {
|
||
return true
|
||
}
|
||
if !clearTargetEffects(e.Ctx().Our, e.Ctx().Opp) {
|
||
if ok, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100); ok {
|
||
addStatusEffect(e.Ctx().Our, e.Ctx().Opp, int(e.Args()[1].IntPart()))
|
||
}
|
||
}
|
||
return true
|
||
}
|
||
|
||
// Effect 1778: 回合结束后若本回合未受到攻击则使对手下{0}回合先制+{1}
|
||
type Effect1778 struct {
|
||
node.EffectNode
|
||
attacked bool
|
||
}
|
||
|
||
func (e *Effect1778) DamageLockEx(zone *info.DamageZone) bool {
|
||
if zone != nil && zone.Type == info.DamageType.Red && zone.Damage.Cmp(alpacadecimal.Zero) > 0 {
|
||
e.attacked = true
|
||
}
|
||
return true
|
||
}
|
||
|
||
func (e *Effect1778) TurnEnd() {
|
||
if len(e.Args()) >= 2 && !e.attacked {
|
||
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1778, int(e.Args()[0].IntPart()), int(e.Args()[1].IntPart()))
|
||
if sub != nil {
|
||
e.Ctx().Opp.AddEffect(e.Ctx().Our, sub)
|
||
}
|
||
}
|
||
e.attacked = false
|
||
e.EffectNode.TurnEnd()
|
||
}
|
||
|
||
type Effect1778Sub struct {
|
||
RoundEffectArg0Base
|
||
}
|
||
|
||
func (e *Effect1778Sub) 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 1779: 对手主动切换时吸取场上精灵最大体力的1/{1}
|
||
type Effect1779 struct{ node.EffectNode }
|
||
|
||
func (e *Effect1779) SwitchIn(in *input.Input) bool {
|
||
if len(e.Args()) < 2 || in != e.Ctx().Opp {
|
||
return true
|
||
}
|
||
heal := e.Ctx().Opp.CurrentPet.GetMaxHP().Div(e.Args()[1])
|
||
if heal.Cmp(alpacadecimal.Zero) > 0 {
|
||
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, heal)
|
||
}
|
||
return true
|
||
}
|
||
|
||
// Effect 1780: 消耗自身全部体力,减弱对手并让己方登场精灵获得护盾
|
||
type Effect1780 struct{ node.EffectNode }
|
||
|
||
func (e *Effect1780) OnSkill() bool {
|
||
if len(e.Args()) < 5 || e.Ctx().Our == nil || e.Ctx().Our.CurrentPet == nil || e.Ctx().Opp == nil || e.Ctx().Opp.CurrentPet == nil {
|
||
return true
|
||
}
|
||
|
||
selfHP := e.Ctx().Our.CurrentPet.GetHP()
|
||
if selfHP.Cmp(alpacadecimal.Zero) > 0 {
|
||
e.Ctx().Our.Damage(e.Ctx().Our, &info.DamageZone{Type: info.DamageType.True, Damage: selfHP})
|
||
}
|
||
|
||
if e.Args()[0].Cmp(alpacadecimal.Zero) > 0 {
|
||
damage := e.Ctx().Opp.CurrentPet.GetHP().Div(e.Args()[0])
|
||
if damage.Cmp(alpacadecimal.Zero) > 0 {
|
||
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{Type: info.DamageType.Fixed, Damage: damage})
|
||
}
|
||
}
|
||
|
||
shield := alpacadecimal.Zero
|
||
if e.Args()[1].Cmp(alpacadecimal.Zero) > 0 {
|
||
shield = e.Ctx().Opp.CurrentPet.GetMaxHP().Div(e.Args()[1])
|
||
}
|
||
if shield.Cmp(alpacadecimal.Zero) > 0 {
|
||
if capShield := e.Args()[4]; capShield.Cmp(alpacadecimal.Zero) > 0 {
|
||
current := e.Ctx().Our.CurrentShield()
|
||
if current.Cmp(capShield) < 0 {
|
||
remain := capShield.Sub(current)
|
||
if shield.Cmp(remain) > 0 {
|
||
shield = remain
|
||
}
|
||
} else {
|
||
shield = alpacadecimal.Zero
|
||
}
|
||
}
|
||
if shield.Cmp(alpacadecimal.Zero) > 0 {
|
||
e.Ctx().Our.AddShield(shield)
|
||
}
|
||
}
|
||
|
||
if e.Args()[2].Cmp(alpacadecimal.Zero) > 0 {
|
||
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1780, int(e.Args()[2].IntPart()), int(e.Args()[3].IntPart()))
|
||
if sub != nil {
|
||
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
|
||
}
|
||
}
|
||
return true
|
||
}
|
||
|
||
type Effect1780Sub struct {
|
||
node.EffectNode
|
||
remaining int
|
||
}
|
||
|
||
func (e *Effect1780Sub) SetArgs(t *input.Input, a ...int) {
|
||
e.EffectNode.SetArgs(t, a...)
|
||
e.Duration(-1)
|
||
if len(a) > 0 {
|
||
e.remaining = a[0]
|
||
}
|
||
}
|
||
|
||
func (e *Effect1780Sub) ComparePre(fattack, sattack *action.SelectSkillAction) bool {
|
||
if e.remaining <= 0 {
|
||
e.Alive(false)
|
||
return true
|
||
}
|
||
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())
|
||
e.remaining--
|
||
if e.remaining <= 0 {
|
||
e.Alive(false)
|
||
}
|
||
return true
|
||
}
|
||
|
||
// Effect 1781: 若自身拥有的护盾值高于{0}则令自身{1}回合内对回合类效果无法被消除
|
||
type Effect1781 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect1781) Skill_Use() bool {
|
||
if len(e.Args()) < 2 {
|
||
return true
|
||
}
|
||
if e.Ctx().Our.CurrentShield().Cmp(e.Args()[0]) <= 0 {
|
||
return true
|
||
}
|
||
|
||
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1781, int(e.Args()[1].IntPart()))
|
||
if sub != nil {
|
||
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
|
||
}
|
||
return true
|
||
}
|
||
|
||
type Effect1781Sub struct {
|
||
RoundEffectArg0Base
|
||
}
|
||
|
||
func (e *Effect1781Sub) PropBefer(source *input.Input, prop int8, level int8) bool {
|
||
if source != e.Ctx().Opp {
|
||
return true
|
||
}
|
||
if prop < 0 || int(prop) >= len(e.Ctx().Our.Prop) {
|
||
return true
|
||
}
|
||
if level < 0 {
|
||
return false
|
||
}
|
||
return true
|
||
}
|
||
|
||
// Effect 1782: 自身存在护盾则先制+2
|
||
type Effect1782 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect1782) ComparePre(fattack, sattack *action.SelectSkillAction) bool {
|
||
current := actionByPlayer(fattack, sattack, e.Ctx().Our.UserID)
|
||
if current == nil || current.SkillEntity == nil || e.Ctx().Our.CurrentShield().Cmp(alpacadecimal.Zero) <= 0 {
|
||
return true
|
||
}
|
||
|
||
current.SkillEntity.XML.Priority += 2
|
||
return true
|
||
}
|
||
|
||
// Effect 1783: 消除敌我双方回合类效果,消除任意一项成功则敌我双方同时进入{0}状态,若任意一方回合类效果无法被消除则令对手下{1}回合无法主动切换精灵
|
||
type Effect1783 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect1783) Skill_Use() bool {
|
||
if len(e.Args()) < 2 {
|
||
return true
|
||
}
|
||
|
||
cleared := false
|
||
for _, target := range []*input.Input{e.Ctx().Our, e.Ctx().Opp} {
|
||
for _, eff := range target.Effects {
|
||
if eff == nil || !eff.Alive() {
|
||
continue
|
||
}
|
||
id := eff.ID()
|
||
if id.GetEffectType() != input.EffectType.Sub {
|
||
continue
|
||
}
|
||
eff.Alive(false)
|
||
cleared = true
|
||
}
|
||
}
|
||
|
||
if cleared {
|
||
st := e.Ctx().Our.InitEffect(input.EffectType.Status, int(e.Args()[0].IntPart()))
|
||
if st != nil {
|
||
e.Ctx().Our.AddEffect(e.Ctx().Our, st)
|
||
}
|
||
oppStatus := e.Ctx().Our.InitEffect(input.EffectType.Status, int(e.Args()[0].IntPart()))
|
||
if oppStatus != nil {
|
||
e.Ctx().Opp.AddEffect(e.Ctx().Our, oppStatus)
|
||
}
|
||
return true
|
||
}
|
||
|
||
if e.Args()[1].Cmp(alpacadecimal.Zero) > 0 {
|
||
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1783, int(e.Args()[1].IntPart()))
|
||
if sub != nil {
|
||
e.Ctx().Opp.AddEffect(e.Ctx().Our, sub)
|
||
e.Ctx().Opp.CanChange = 1
|
||
}
|
||
}
|
||
return true
|
||
}
|
||
|
||
type Effect1783Sub struct {
|
||
node.EffectNode
|
||
remaining int
|
||
}
|
||
|
||
func (e *Effect1783Sub) SetArgs(t *input.Input, a ...int) {
|
||
e.EffectNode.SetArgs(t, a...)
|
||
e.Duration(-1)
|
||
if len(a) > 0 {
|
||
e.remaining = a[0]
|
||
}
|
||
}
|
||
|
||
func (e *Effect1783Sub) TurnEnd() {
|
||
if e.remaining <= 0 {
|
||
e.Ctx().Our.CanChange = 0
|
||
e.Alive(false)
|
||
return
|
||
}
|
||
e.remaining--
|
||
if e.remaining <= 0 {
|
||
e.Ctx().Our.CanChange = 0
|
||
e.Alive(false)
|
||
return
|
||
}
|
||
if e.Ctx().Our != nil && e.Ctx().Our.CurrentPet != nil && e.Ctx().Our.CurrentPet.Info.Hp > 0 {
|
||
e.Ctx().Our.CanChange = 1
|
||
}
|
||
}
|
||
|
||
func (e *Effect1783Sub) SwitchOut(in *input.Input) bool {
|
||
if in == e.Ctx().Our {
|
||
e.Ctx().Our.CanChange = 0
|
||
}
|
||
return true
|
||
}
|
||
|
||
// Effect 1784: {0}回合内对手使用技能时自身免疫对手1次非致命一击造成的攻击伤害
|
||
type Effect1784 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect1784) Skill_Use() bool {
|
||
if len(e.Args()) == 0 {
|
||
return true
|
||
}
|
||
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1784, int(e.Args()[0].IntPart()))
|
||
if sub != nil {
|
||
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
|
||
}
|
||
return true
|
||
}
|
||
|
||
type Effect1784Sub struct {
|
||
RoundEffectArg0Base
|
||
}
|
||
|
||
func (e *Effect1784Sub) DamageLockEx(zone *info.DamageZone) bool {
|
||
if zone == nil || zone.Type != info.DamageType.Red || e.Ctx().Our == nil || e.Ctx().Our.CurrentPet == nil {
|
||
return true
|
||
}
|
||
currentHP := e.Ctx().Our.CurrentPet.GetHP()
|
||
if zone.Damage.Cmp(currentHP) >= 0 {
|
||
return true
|
||
}
|
||
zone.Damage = alpacadecimal.Zero
|
||
e.Alive(false)
|
||
return true
|
||
}
|
||
|
||
// Effect 1791: 消除双方护盾并附加护盾值{0}%的百分比伤害,若护盾值总和超过{1}点则转变为附加护盾值{2}%的百分比伤害
|
||
// Effect 1785: {0}回合内每回合使用技能吸取对手最大体力的1/{1},满体力时额外恢复己方所有不在场精灵{2}点体力
|
||
type Effect1785 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect1785) Skill_Use() bool {
|
||
if len(e.Args()) < 3 {
|
||
return true
|
||
}
|
||
|
||
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1785, 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 Effect1785Sub struct {
|
||
RoundEffectArg0Base
|
||
}
|
||
|
||
func (e *Effect1785Sub) OnSkill() bool {
|
||
if len(e.Args()) < 3 || e.Ctx().Our == nil || e.Ctx().Our.CurrentPet == nil || e.Ctx().Opp == nil || e.Ctx().Opp.CurrentPet == nil {
|
||
return true
|
||
}
|
||
if e.Ctx().SkillEntity == nil || e.Args()[1].Cmp(alpacadecimal.Zero) <= 0 {
|
||
return true
|
||
}
|
||
|
||
fullHP := e.Ctx().Our.CurrentPet.GetHP().Cmp(e.Ctx().Our.CurrentPet.GetMaxHP()) >= 0
|
||
amount := e.Ctx().Opp.CurrentPet.GetMaxHP().Div(e.Args()[1])
|
||
if amount.Cmp(alpacadecimal.Zero) <= 0 {
|
||
return true
|
||
}
|
||
|
||
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
|
||
Type: info.DamageType.Percent,
|
||
Damage: amount,
|
||
})
|
||
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, amount)
|
||
if fullHP {
|
||
healBench(e.Ctx().Our, e.Args()[2])
|
||
}
|
||
return true
|
||
}
|
||
|
||
// Effect 1790: 预留
|
||
type Effect1790 struct{ node.EffectNode }
|
||
|
||
func (e *Effect1790) Skill_Use() bool { return true }
|
||
|
||
// Effect 1786: {0}回合内若自身回合类效果被消除则对手下{1}次使用的攻击技能附加效果失效
|
||
type Effect1786 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect1786) Skill_Use() bool {
|
||
if len(e.Args()) < 2 {
|
||
return true
|
||
}
|
||
|
||
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1786, int(e.Args()[0].IntPart()), int(e.Args()[1].IntPart()))
|
||
if sub == nil {
|
||
return true
|
||
}
|
||
if s, ok := sub.(*Effect1786Sub); ok {
|
||
s.previous = countTurnEffects(e.Ctx().Our)
|
||
}
|
||
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
|
||
return true
|
||
}
|
||
|
||
type Effect1786Sub struct {
|
||
RoundEffectArg0Base
|
||
previous int
|
||
remainingTurn int
|
||
triggered bool
|
||
}
|
||
|
||
func (e *Effect1786Sub) SetArgs(t *input.Input, a ...int) {
|
||
e.EffectNode.SetArgs(t, a...)
|
||
e.Duration(-1)
|
||
if len(a) > 0 {
|
||
e.remainingTurn = a[0]
|
||
}
|
||
}
|
||
|
||
func (e *Effect1786Sub) TurnEnd() {
|
||
e.EffectNode.TurnEnd()
|
||
if e.triggered || e.remainingTurn <= 0 {
|
||
return
|
||
}
|
||
|
||
current := countTurnEffects(e.Ctx().Our)
|
||
if e.previous <= 0 || current > 0 {
|
||
e.previous = current
|
||
e.remainingTurn--
|
||
if e.remainingTurn <= 0 {
|
||
e.Alive(false)
|
||
}
|
||
return
|
||
}
|
||
|
||
sub := e.Ctx().Opp.InitEffect(input.EffectType.Sub, 1786, int(e.Args()[1].IntPart()))
|
||
if sub != nil {
|
||
e.Ctx().Opp.AddEffect(e.Ctx().Our, sub)
|
||
}
|
||
e.triggered = true
|
||
e.Alive(false)
|
||
}
|
||
|
||
type Effect1786Debuff struct {
|
||
node.EffectNode
|
||
remaining int
|
||
}
|
||
|
||
func (e *Effect1786Debuff) SetArgs(t *input.Input, a ...int) {
|
||
e.EffectNode.SetArgs(t, a...)
|
||
e.Duration(-1)
|
||
if len(a) > 0 {
|
||
e.remaining = a[0]
|
||
}
|
||
}
|
||
|
||
func (e *Effect1786Debuff) SkillHit_ex() 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.remaining--
|
||
if e.remaining <= 0 {
|
||
e.Alive(false)
|
||
}
|
||
return true
|
||
}
|
||
|
||
// Effect 1787: 沙之力量觉醒,使自身下{0}次攻击获得鳞天之尘效果
|
||
type Effect1787 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect1787) Skill_Use() bool { return true }
|
||
|
||
// Effect 1788: {0}%令对手{1},未触发则附加自身最大体力的{2}%的百分比伤害,若对手免疫百分比伤害则转变为真实伤害
|
||
type Effect1788 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect1788) Skill_Use() bool {
|
||
if len(e.Args()) < 3 {
|
||
return true
|
||
}
|
||
|
||
success, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100)
|
||
if success {
|
||
status := e.Ctx().Our.InitEffect(input.EffectType.Status, int(e.Args()[1].IntPart()))
|
||
if status != nil {
|
||
e.Ctx().Opp.AddEffect(e.Ctx().Our, status)
|
||
}
|
||
return true
|
||
}
|
||
|
||
damage := e.Ctx().Our.CurrentPet.GetMaxHP().Mul(e.Args()[2]).Div(hundred)
|
||
if damage.Cmp(alpacadecimal.Zero) <= 0 {
|
||
return true
|
||
}
|
||
|
||
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
|
||
Type: info.DamageType.Percent,
|
||
Damage: damage,
|
||
})
|
||
return true
|
||
}
|
||
|
||
// Effect 1789: 预留效果
|
||
type Effect1789 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect1789) Skill_Use() bool { return true }
|
||
|
||
type Effect1791 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect1791) OnSkill() bool {
|
||
if len(e.Args()) < 3 {
|
||
return true
|
||
}
|
||
|
||
total := e.Ctx().Our.ConsumeAllShield().Add(e.Ctx().Opp.ConsumeAllShield())
|
||
if total.Cmp(alpacadecimal.Zero) <= 0 {
|
||
return true
|
||
}
|
||
|
||
percent := e.Args()[0]
|
||
if total.Cmp(e.Args()[1]) > 0 {
|
||
percent = e.Args()[2]
|
||
}
|
||
damage := e.Ctx().Opp.CurrentPet.GetHP().Mul(percent).Div(hundred)
|
||
if damage.Cmp(alpacadecimal.Zero) <= 0 {
|
||
return true
|
||
}
|
||
|
||
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
|
||
Type: info.DamageType.Percent,
|
||
Damage: damage,
|
||
})
|
||
return true
|
||
}
|
||
|
||
// Effect 1792: 使对手直接受到{0}点光·暗影系伤害并获得等量护盾(不可叠加),若自身没有护盾则效果翻倍
|
||
type Effect1792 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect1792) OnSkill() bool {
|
||
if len(e.Args()) == 0 {
|
||
return true
|
||
}
|
||
|
||
damage := e.Args()[0]
|
||
if e.Ctx().Our.CurrentShield().Cmp(alpacadecimal.Zero) <= 0 {
|
||
damage = damage.Mul(alpacadecimal.NewFromInt(2))
|
||
}
|
||
if damage.Cmp(alpacadecimal.Zero) <= 0 {
|
||
return true
|
||
}
|
||
|
||
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
|
||
Type: info.DamageType.True,
|
||
Damage: damage,
|
||
})
|
||
e.Ctx().Our.AddShield(damage)
|
||
return true
|
||
}
|
||
|
||
// Effect 1793: {0}次受到攻击伤害时,若伤害高于{1},则自身恢复全部体力
|
||
type Effect1793 struct {
|
||
node.EffectNode
|
||
remaining int
|
||
}
|
||
|
||
func (e *Effect1793) Skill_Use() bool {
|
||
if len(e.Args()) < 2 {
|
||
return true
|
||
}
|
||
e.remaining = int(e.Args()[0].IntPart())
|
||
if e.remaining <= 0 {
|
||
return true
|
||
}
|
||
|
||
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1793, int(e.Args()[0].IntPart()), int(e.Args()[1].IntPart()))
|
||
if sub != nil {
|
||
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
|
||
}
|
||
return true
|
||
}
|
||
|
||
type Effect1793Sub struct {
|
||
RoundEffectArg0Base
|
||
}
|
||
|
||
func (e *Effect1793Sub) DamageLockEx(zone *info.DamageZone) bool {
|
||
if zone == nil || zone.Type != info.DamageType.Red {
|
||
return true
|
||
}
|
||
if zone.Damage.Cmp(e.Args()[1]) <= 0 {
|
||
return true
|
||
}
|
||
|
||
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, e.Ctx().Our.CurrentPet.GetMaxHP())
|
||
e.Alive(false)
|
||
return true
|
||
}
|
||
|
||
// Effect 1794: 技能无效时,恢复自身最大体力的1/2且下一次受到的攻击伤害额外减少50%
|
||
type Effect1794 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect1794) Skill_Use() bool {
|
||
if len(e.Args()) < 3 {
|
||
return true
|
||
}
|
||
|
||
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, e.Ctx().Our.CurrentPet.GetMaxHP().Div(alpacadecimal.NewFromInt(2)))
|
||
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1794, int(e.Args()[1].IntPart()), int(e.Args()[2].IntPart()))
|
||
if sub != nil {
|
||
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
|
||
}
|
||
return true
|
||
}
|
||
|
||
type Effect1794Sub struct {
|
||
RoundEffectArg0Base
|
||
}
|
||
|
||
func (e *Effect1794Sub) DamageLockEx(zone *info.DamageZone) bool {
|
||
if zone == nil || zone.Type != info.DamageType.Red {
|
||
return true
|
||
}
|
||
|
||
reduce := zone.Damage.Mul(alpacadecimal.NewFromInt(50)).Div(hundred)
|
||
if reduce.Cmp(zone.Damage) >= 0 {
|
||
zone.Damage = alpacadecimal.Zero
|
||
} else {
|
||
zone.Damage = zone.Damage.Sub(reduce)
|
||
}
|
||
e.Alive(false)
|
||
return true
|
||
}
|
||
|
||
func init() {
|
||
input.InitEffect(input.EffectType.Skill, 1770, &Effect1770{})
|
||
input.InitEffect(input.EffectType.Sub, 1770, &Effect1770Sub{})
|
||
input.InitEffect(input.EffectType.Skill, 1771, &Effect1771{})
|
||
input.InitEffect(input.EffectType.Sub, 1771, &Effect1771Sub{})
|
||
input.InitEffect(input.EffectType.Skill, 1772, &Effect1772{})
|
||
input.InitEffect(input.EffectType.Skill, 1773, &Effect1773{})
|
||
input.InitEffect(input.EffectType.Skill, 1774, &Effect1774{})
|
||
input.InitEffect(input.EffectType.Skill, 1775, &Effect1775{})
|
||
input.InitEffect(input.EffectType.Sub, 1775, &Effect1775Sub{})
|
||
input.InitEffect(input.EffectType.Skill, 1776, &Effect1776{})
|
||
input.InitEffect(input.EffectType.Sub, 1776, &Effect1776Sub{})
|
||
input.InitEffect(input.EffectType.Skill, 1785, &Effect1785{})
|
||
input.InitEffect(input.EffectType.Sub, 1785, &Effect1785Sub{})
|
||
input.InitEffect(input.EffectType.Skill, 1786, &Effect1786{})
|
||
input.InitEffect(input.EffectType.Sub, 1786, &Effect1786Sub{})
|
||
input.InitEffect(input.EffectType.Sub, 1786, &Effect1786Debuff{})
|
||
input.InitEffect(input.EffectType.Skill, 1787, &Effect1787{})
|
||
input.InitEffect(input.EffectType.Skill, 1788, &Effect1788{})
|
||
input.InitEffect(input.EffectType.Skill, 1789, &Effect1789{})
|
||
input.InitEffect(input.EffectType.Skill, 1780, &Effect1780{})
|
||
input.InitEffect(input.EffectType.Sub, 1780, &Effect1780Sub{})
|
||
input.InitEffect(input.EffectType.Skill, 1781, &Effect1781{})
|
||
input.InitEffect(input.EffectType.Sub, 1781, &Effect1781Sub{})
|
||
input.InitEffect(input.EffectType.Skill, 1782, &Effect1782{})
|
||
input.InitEffect(input.EffectType.Skill, 1783, &Effect1783{})
|
||
input.InitEffect(input.EffectType.Sub, 1783, &Effect1783Sub{})
|
||
input.InitEffect(input.EffectType.Skill, 1784, &Effect1784{})
|
||
input.InitEffect(input.EffectType.Sub, 1784, &Effect1784Sub{})
|
||
input.InitEffect(input.EffectType.Skill, 1790, &Effect1790{})
|
||
input.InitEffect(input.EffectType.Skill, 1791, &Effect1791{})
|
||
input.InitEffect(input.EffectType.Skill, 1792, &Effect1792{})
|
||
input.InitEffect(input.EffectType.Skill, 1793, &Effect1793{})
|
||
input.InitEffect(input.EffectType.Sub, 1793, &Effect1793Sub{})
|
||
input.InitEffect(input.EffectType.Skill, 1794, &Effect1794{})
|
||
input.InitEffect(input.EffectType.Sub, 1794, &Effect1794Sub{})
|
||
}
|