Files
bl/logic/service/fight/boss/NewSeIdx_15.go
xinian 8116130cc8 feat: 添加宠物天敌属性及相关战斗效果
为宠物添加NaturalEnemy属性,并在战斗中实现遇到天敌时的特殊效果:
1. 战斗开始时连续害怕n回合
2. 对天敌的伤害减少n%
2026-01-29 15:39:10 +08:00

43 lines
1.2 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/common/data/xmlres"
"blazing/logic/service/fight/info"
"blazing/logic/service/fight/input"
"strings"
"github.com/alpacahq/alpacadecimal"
"github.com/gogf/gf/v2/util/gconv"
"github.com/samber/lo"
)
// 15. 若遇到天敌, 则整个战斗中对天敌的伤害减少 n%;a1: 0-100 百分比)
// TODO: 实现若遇到天敌, 则整个战斗中对天敌的伤害减少 n%;a1: 0-100 百分比)的核心逻辑
type NewSel15 struct {
NewSel0
}
func (e *NewSel15) Damage_Mul(t *info.DamageZone) bool {
//魂印特性有不在场的情况,绑定时候将精灵和特性绑定
if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime {
return true
}
evs := gconv.Uint32s(strings.Split(xmlres.PetMAP[int(e.Ctx().Our.CurrentPet.ID)].NaturalEnemy, " "))
_, ok := lo.Find(evs, func(t uint32) bool {
return t == uint32(e.Ctx().Opp.CurrentPet.ID)
})
if !ok {
return true
}
if t.Type == info.DamageType.Red {
reduceRatio := alpacadecimal.NewFromInt(100).Sub(e.Args()[0]).Div(alpacadecimal.NewFromInt(100))
t.Damage = t.Damage.Mul(reduceRatio)
}
return true
}
func init() {
input.InitEffect(input.EffectType.NewSel, 15, &NewSel15{})
}