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

43 lines
1.3 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/action"
"blazing/logic/service/fight/info"
"blazing/logic/service/fight/input"
"strings"
"github.com/gogf/gf/v2/util/gconv"
"github.com/samber/lo"
)
// 14. 若遇到天敌, 则战斗开始时连续害怕 n 回合;a1: n
// TODO: 实现若遇到天敌, 则战斗开始时连续害怕 n 回合;a1: n的核心逻辑
type NewSel14 struct {
NewSel0
conut int
}
func (e *NewSel14) TurnStart(fattack *action.SelectSkillAction, sattack *action.SelectSkillAction) {
// TODO: 实现若遇到天敌, 则战斗开始时连续害怕 n 回合;a1: n的核心逻辑
if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime {
return
}
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
}
// 5. 获取状态效果实例并设置参数
statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.Fear))
// 6. 给对手添加状态
//然后这里是被动添加,所以对方不能消除
e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect)
}
func init() {
input.InitEffect(input.EffectType.NewSel, 14, &NewSel14{})
}