Files
bl/logic/service/fight/boss/NewSeIdx_49.go
xinian 9c6f3988de
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
refactor: 重构 CurrentPet 为 CurPet
2026-04-04 04:34:43 +08:00

80 lines
2.0 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"
"github.com/alpacahq/alpacadecimal"
)
// 49. 受到物理攻击或特殊攻击后下n回合受物理攻击或特殊攻击伤害减免m%a1: n, a2: m
// TODO: 需要记录受到的攻击类型并实现持续减伤效果
type NewSel49 struct {
NewSel0
// 记录受到攻击的类型1=物理攻击2=特殊攻击
attackType int
// 记录剩余减伤回合数
remainingTurns int
}
func (e *NewSel49) Action_end_ex() bool {
//魂印特性有不在场的情况,绑定时候将精灵和特性绑定
if e.ID().GetCatchTime() != e.Ctx().Our.CurPet[0].Info.CatchTime {
return true
}
// 记录受到攻击的类型
if e.Ctx().SkillEntity == nil {
return true
}
if e.Ctx().SkillEntity.Category() == info.Category.PHYSICAL {
e.attackType = 1
e.remainingTurns = int(e.Args()[0].IntPart())
} else if e.Ctx().SkillEntity.Category() == info.Category.SPECIAL {
e.attackType = 2
e.remainingTurns = int(e.Args()[0].IntPart())
}
return true
}
func (e *NewSel49) DamageDivEx(t *info.DamageZone) bool {
//魂印特性有不在场的情况,绑定时候将精灵和特性绑定
if e.ID().GetCatchTime() != e.Ctx().Our.CurPet[0].Info.CatchTime {
return true
}
// 检查是否还有减伤效果
if e.remainingTurns <= 0 {
return true
}
// 检查攻击类型是否匹配
if e.Ctx().SkillEntity == nil {
return true
}
attackCategory := e.Ctx().SkillEntity.Category()
if (e.attackType == 1 && attackCategory == info.Category.PHYSICAL) ||
(e.attackType == 2 && attackCategory == info.Category.SPECIAL) {
// 减免m%伤害
percent := alpacadecimal.NewFromInt(100).Sub(e.Args()[1])
t.Damage = t.Damage.Mul(percent).Div(alpacadecimal.NewFromInt(100))
}
return true
}
func (e *NewSel49) TurnEnd() {
// 每回合减少减伤效果剩余回合数
if e.remainingTurns > 0 {
e.remainingTurns--
}
}
func init() {
input.InitEffect(input.EffectType.NewSel, 49, &NewSel49{})
}