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{}) }