Files
bl/logic/service/fight/effect/1072_1076.go
2026-03-31 10:40:22 +08:00

160 lines
4.7 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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 1072: 附加自身当前体力{0}%的百分比伤害,连续使用每次增加{1}%,最高{2}%
type Effect1072 struct {
node.EffectNode
bonus int
}
func (e *Effect1072) OnSkill() bool {
if len(e.Args()) < 3 {
return true
}
percent := int(e.Args()[0].IntPart()) + e.bonus
maxPercent := int(e.Args()[2].IntPart())
if percent > maxPercent {
percent = maxPercent
}
if percent <= 0 {
return true
}
damage := e.Ctx().Our.CurrentPet.GetHP().Mul(alpacadecimal.NewFromInt(int64(percent))).Div(hundred)
if damage.Cmp(alpacadecimal.Zero) > 0 {
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{Type: info.DamageType.Percent, Damage: damage})
}
e.bonus += int(e.Args()[1].IntPart())
return true
}
// Effect 1073: {0}回合内受到的伤害大于{1}则主动恢复自身全部体力并造成等同于恢复量的固定伤害
type Effect1073 struct{ node.EffectNode }
func (e *Effect1073) Skill_Use() bool {
if len(e.Args()) < 2 {
return true
}
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1073, int(e.Args()[0].IntPart()), int(e.Args()[1].IntPart()))
if sub != nil {
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
}
return true
}
type Effect1073Sub struct {
RoundEffectArg0Base
pending bool
}
func (e *Effect1073Sub) DamageLockEx(zone *info.DamageZone) bool {
if zone == nil || zone.Type != info.DamageType.Red || len(e.Args()) < 2 {
return true
}
if zone.Damage.Cmp(e.Args()[1]) <= 0 {
return true
}
e.pending = true
return true
}
func (e *Effect1073Sub) Action_end_ex() bool {
if !e.pending {
return true
}
e.pending = false
missing := e.Ctx().Our.CurrentPet.GetMaxHP().Sub(e.Ctx().Our.CurrentPet.GetHP())
if missing.Cmp(alpacadecimal.Zero) <= 0 {
return true
}
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, missing)
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{Type: info.DamageType.Fixed, Damage: missing})
return true
}
// Effect 1074: 造成的伤害大于{0}则对手{1}%{2},未触发则自身下{3}回合攻击有{4}%的概率使对手{5}
type Effect1074 struct{ node.EffectNode }
func (e *Effect1074) Skill_Use() bool {
if len(e.Args()) < 6 {
return true
}
if e.Ctx().Our.SumDamage.Cmp(e.Args()[0]) > 0 {
success, _, _ := e.Input.Player.Roll(int(e.Args()[1].IntPart()), 100)
if success {
applyStatusByID(e.Ctx().Our, e.Ctx().Opp, int(e.Args()[2].IntPart()))
return true
}
}
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1074, int(e.Args()[3].IntPart()), int(e.Args()[4].IntPart()), int(e.Args()[5].IntPart()))
if sub != nil {
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
}
return true
}
type Effect1074Sub struct{ RoundEffectArg0Base }
func (e *Effect1074Sub) OnSkill() bool {
if len(e.Args()) < 3 || e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
success, _, _ := e.Input.Player.Roll(int(e.Args()[1].IntPart()), 100)
if success {
applyStatusByID(e.Ctx().Our, e.Ctx().Opp, int(e.Args()[2].IntPart()))
}
return true
}
// Effect 1075: 恢复自身最大体力的1/{0}自身体力低于1/{1}时回满
type Effect1075 struct{ node.EffectNode }
func (e *Effect1075) OnSkill() bool {
if len(e.Args()) < 2 || e.Args()[0].Cmp(alpacadecimal.Zero) <= 0 || e.Args()[1].Cmp(alpacadecimal.Zero) <= 0 {
return true
}
currentHP := e.Ctx().Our.CurrentPet.GetHP()
heal := e.Ctx().Our.CurrentPet.GetMaxHP().Div(e.Args()[0])
if currentHP.Mul(e.Args()[1]).Cmp(e.Ctx().Our.CurrentPet.GetMaxHP()) < 0 {
heal = e.Ctx().Our.CurrentPet.GetMaxHP().Sub(currentHP)
}
if heal.Cmp(alpacadecimal.Zero) <= 0 {
return true
}
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, heal)
return true
}
// Effect 1076: 对手不处于能力提升状态时先制+2
type Effect1076 struct{ node.EffectNode }
func (e *Effect1076) ComparePre(fattack, sattack *action.SelectSkillAction) bool {
if e.Ctx().Opp.HasPropADD() {
return true
}
current := actionByPlayer(fattack, sattack, e.Ctx().Our.UserID)
if current == nil || current.SkillEntity == nil {
return true
}
current.SkillEntity.XML.Priority += 2
return true
}
func init() {
input.InitEffect(input.EffectType.Skill, 1072, &Effect1072{})
input.InitEffect(input.EffectType.Skill, 1073, &Effect1073{})
input.InitEffect(input.EffectType.Sub, 1073, &Effect1073Sub{})
input.InitEffect(input.EffectType.Skill, 1074, &Effect1074{})
input.InitEffect(input.EffectType.Sub, 1074, &Effect1074Sub{})
input.InitEffect(input.EffectType.Skill, 1075, &Effect1075{})
input.InitEffect(input.EffectType.Skill, 1076, &Effect1076{})
}