From a905954b5cb5fda163ce49d6489673713a2a37ba Mon Sep 17 00:00:00 2001 From: xinian Date: Mon, 6 Apr 2026 03:47:17 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E5=AE=A0=E7=89=A9?= =?UTF-8?q?=E8=AE=AD=E7=BB=83=E5=8A=A0=E6=88=90=E6=95=88=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- logic/service/fight/boss/NewSeIdx_247.go | 24 +++++++++ modules/player/model/pet.go | 63 ++++++++++++++++++++++-- 2 files changed, 83 insertions(+), 4 deletions(-) diff --git a/logic/service/fight/boss/NewSeIdx_247.go b/logic/service/fight/boss/NewSeIdx_247.go index 1a87d4d7b..96ea9ed8b 100644 --- a/logic/service/fight/boss/NewSeIdx_247.go +++ b/logic/service/fight/boss/NewSeIdx_247.go @@ -2,6 +2,7 @@ package effect import ( "blazing/logic/service/fight/action" + "blazing/logic/service/fight/info" "blazing/logic/service/fight/input" ) @@ -70,6 +71,29 @@ func (e *NewSel247) TurnEnd() { } } +type NewSel239 struct { + NewSel0 +} + +func (e *NewSel239) ActionStart(a, b *action.SelectSkillAction) bool { + if !e.IsOwner() { + return true + } + if e.Ctx().SkillEntity == nil { + return true + } + if e.Ctx().SkillEntity.Category() == info.Category.STATUS { + return true + } + if len(e.Args()) == 0 { + return true + } + + e.Ctx().SkillEntity.XML.Power += int(e.Args()[0].IntPart()) + return true +} + func init() { + input.InitEffect(input.EffectType.NewSel, 239, &NewSel239{}) input.InitEffect(input.EffectType.NewSel, 247, &NewSel247{}) } diff --git a/modules/player/model/pet.go b/modules/player/model/pet.go index cccf6ea4b..ef0b47fc5 100644 --- a/modules/player/model/pet.go +++ b/modules/player/model/pet.go @@ -384,10 +384,15 @@ func (pet *PetInfo) RnadEffect() { // 8 :体力提升加成 const ( - maxHPUpEffectIdx uint16 = 60000 - maxHPUpEffectStatus byte = 8 - maxHPUpEffectEID uint16 = 26 - maxHPUpEffectCap = 20 + maxHPUpEffectIdx uint16 = 60000 + maxHPUpEffectStatus byte = 8 + maxHPUpEffectEID uint16 = 26 + maxHPUpEffectCap = 20 + trainingEffectStatus byte = 5 + trainingAttrEffectIdx uint16 = 60001 + trainingPowerEffectIdx uint16 = 60002 + trainingAttrEffectEID uint16 = 247 + trainingPowerEffectEID uint16 = 239 ) // 繁殖加成,体力提升加成 ,这里是防止和其他重复所以定义不同类别,但是实际上,能量珠那些事调用不同id的effect实现 @@ -400,6 +405,56 @@ func (pet *PetInfo) GetEffect(ptype int) (int, *PetEffectInfo, bool) { } +func (pet *PetInfo) getEffectByStatusAndEID(status byte, eid uint16) (int, *PetEffectInfo, bool) { + return utils.FindWithIndex(pet.EffectInfo, func(item PetEffectInfo) bool { + return item.Status == status && item.EID == eid + }) +} + +func ensureEffectArgsLen(args []int, size int) []int { + if len(args) >= size { + return args + } + next := make([]int, size) + copy(next, args) + return next +} + +func (pet *PetInfo) addTrainingEffectDelta(idx uint16, eid uint16, argsLen int, argIndex int, value int) bool { + if pet == nil || value <= 0 || argIndex < 0 || argIndex >= argsLen { + return false + } + + if _, eff, ok := pet.getEffectByStatusAndEID(trainingEffectStatus, eid); ok { + if eff.Idx == 0 { + eff.Idx = idx + } + eff.Status = trainingEffectStatus + eff.EID = eid + eff.Args = ensureEffectArgsLen(eff.Args, argsLen) + eff.Args[argIndex] += value + return true + } + + args := make([]int, argsLen) + args[argIndex] = value + pet.EffectInfo = append(pet.EffectInfo, PetEffectInfo{ + Idx: idx, + Status: trainingEffectStatus, + EID: eid, + Args: args, + }) + return true +} + +func (pet *PetInfo) AddTrainingAttrBonus(attr int, value int) bool { + return pet.addTrainingEffectDelta(trainingAttrEffectIdx, trainingAttrEffectEID, 6, attr, value) +} + +func (pet *PetInfo) AddTrainingPowerBonus(value int) bool { + return pet.addTrainingEffectDelta(trainingPowerEffectIdx, trainingPowerEffectEID, 2, 0, value) +} + func (pet *PetInfo) AddMaxHPUpEffect(itemID uint32, value int) bool { if pet == nil || value <= 0 { return false