From 8116130cc82dac797d5b4751bf76c479351d7326 Mon Sep 17 00:00:00 2001 From: xinian Date: Thu, 29 Jan 2026 15:39:10 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E5=AE=A0=E7=89=A9?= =?UTF-8?q?=E5=A4=A9=E6=95=8C=E5=B1=9E=E6=80=A7=E5=8F=8A=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E6=88=98=E6=96=97=E6=95=88=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 为宠物添加NaturalEnemy属性,并在战斗中实现遇到天敌时的特殊效果: 1. 战斗开始时连续害怕n回合 2. 对天敌的伤害减少n% --- common/data/xmlres/pet.go | 1 + logic/service/fight/boss/NewSeIdx_14.go | 19 ++++++++++++++++- logic/service/fight/boss/NewSeIdx_15.go | 27 +++++++++++++++++++++++++ 3 files changed, 46 insertions(+), 1 deletion(-) diff --git a/common/data/xmlres/pet.go b/common/data/xmlres/pet.go index fd67567f..0793b24d 100644 --- a/common/data/xmlres/pet.go +++ b/common/data/xmlres/pet.go @@ -44,6 +44,7 @@ type PetInfo struct { AddSeParam int `xml:"AddSeParam,attr"` // 附加状态参数 Recycle int `xml:"Recycle,attr"` // 是否可回收 LearnableMoves LearnableMoves `xml:"LearnableMoves"` // 可学习的技能 + NaturalEnemy string `xml:"NaturalEnemy,attr"` //天敌 } func (basic *PetInfo) GetBasic() uint32 { diff --git a/logic/service/fight/boss/NewSeIdx_14.go b/logic/service/fight/boss/NewSeIdx_14.go index 9518143f..97b36c34 100644 --- a/logic/service/fight/boss/NewSeIdx_14.go +++ b/logic/service/fight/boss/NewSeIdx_14.go @@ -1,8 +1,14 @@ 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) @@ -17,8 +23,19 @@ func (e *NewSel14) TurnStart(fattack *action.SelectSkillAction, sattack *action. 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)) - //xmlres.PetMAP[e.Ctx().Our.CurrentPet.ID].SpAtk + // 6. 给对手添加状态 + //然后这里是被动添加,所以对方不能消除 + e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect) } func init() { input.InitEffect(input.EffectType.NewSel, 14, &NewSel14{}) diff --git a/logic/service/fight/boss/NewSeIdx_15.go b/logic/service/fight/boss/NewSeIdx_15.go index 0f54fcb3..1efd47fe 100644 --- a/logic/service/fight/boss/NewSeIdx_15.go +++ b/logic/service/fight/boss/NewSeIdx_15.go @@ -1,7 +1,14 @@ 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 百分比) @@ -10,6 +17,26 @@ 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{}) }