Files
bl/logic/service/fight/effect/810_814.go
2026-03-31 08:19:53 +08:00

161 lines
3.8 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/info"
"blazing/logic/service/fight/input"
"blazing/logic/service/fight/node"
"github.com/alpacahq/alpacadecimal"
)
// Effect 810: 每次命中对手后此技能威力下降{0}点
type Effect810 struct {
node.EffectNode
powerDown int
skillID int
}
func (e *Effect810) SkillHit() bool {
if len(e.Args()) == 0 || e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
currentSkillID := e.Ctx().SkillEntity.XML.ID
if e.skillID != 0 && e.skillID != currentSkillID {
e.skillID = 0
e.powerDown = 0
}
e.skillID = currentSkillID
power := e.Ctx().SkillEntity.XML.Power - e.powerDown
if power < 1 {
power = 1
}
e.Ctx().SkillEntity.XML.Power = power
return true
}
func (e *Effect810) Skill_Use() bool {
if len(e.Args()) == 0 || e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
if e.Ctx().SkillEntity.AttackTime == 0 {
return true
}
e.powerDown += int(e.Args()[0].IntPart())
return true
}
// Effect 811: 使自身下次受到的伤害减少n点n等于本回合自身造成的伤害
type Effect811 struct {
node.EffectNode
}
func (e *Effect811) Skill_Use() bool {
if e.Ctx().Our.SumDamage.Cmp(alpacadecimal.Zero) <= 0 {
return true
}
effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 811, int(e.Ctx().Our.SumDamage.IntPart()))
if effect != nil {
e.Ctx().Our.AddEffect(e.Ctx().Our, effect)
}
return true
}
type Effect811Sub struct {
node.EffectNode
}
func (e *Effect811Sub) SetArgs(t *input.Input, a ...int) {
e.EffectNode.SetArgs(t, a...)
e.Duration(-1)
}
func (e *Effect811Sub) DamageSubEx(zone *info.DamageZone) bool {
if zone == nil || zone.Type != info.DamageType.Red || len(e.Args()) == 0 {
return true
}
if zone.Damage.Cmp(e.Args()[0]) > 0 {
zone.Damage = zone.Damage.Sub(e.Args()[0])
} else {
zone.Damage = alpacadecimal.Zero
}
e.Alive(false)
return true
}
// Effect 812: 自身速度能力每提升1段则回合结束时减少对手1/{0}最大体力
type Effect812 struct {
node.EffectNode
}
func (e *Effect812) TurnEnd() {
if len(e.Args()) == 0 || e.Args()[0].Cmp(alpacadecimal.Zero) <= 0 {
return
}
if e.Ctx().Our.Prop[4] <= 0 {
return
}
base := e.Ctx().Opp.CurrentPet.GetMaxHP().Div(e.Args()[0])
damage := base.Mul(alpacadecimal.NewFromInt(int64(e.Ctx().Our.Prop[4])))
if damage.Cmp(alpacadecimal.Zero) <= 0 {
return
}
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Percent,
Damage: damage,
})
}
// Effect 813: 将自身的能力下降状态双倍反馈给对手
type Effect813 struct {
node.EffectNode
}
func (e *Effect813) OnSkill() bool {
for i, v := range e.Ctx().Our.Prop[:] {
if v >= 0 {
continue
}
e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), v*2)
}
return true
}
// Effect 814: 先出手时附加自身双防值总和{0}%的百分比伤害
type Effect814 struct {
node.EffectNode
}
func (e *Effect814) OnSkill() bool {
if len(e.Args()) == 0 || !e.IsFirst() {
return true
}
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
totalDefense := e.Ctx().Our.GetProp(1).Add(e.Ctx().Our.GetProp(3))
damage := totalDefense.Mul(e.Args()[0]).Div(hundred)
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
}
func init() {
input.InitEffect(input.EffectType.Skill, 810, &Effect810{})
input.InitEffect(input.EffectType.Skill, 811, &Effect811{})
input.InitEffect(input.EffectType.Sub, 811, &Effect811Sub{})
input.InitEffect(input.EffectType.Skill, 812, &Effect812{})
input.InitEffect(input.EffectType.Skill, 813, &Effect813{})
input.InitEffect(input.EffectType.Skill, 814, &Effect814{})
}