All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
feat(fight_boss): 优化BOSS战斗奖励逻辑并修复宠物等级突破100级限制 重构了handleMapBossFightRewards函数,将奖励逻辑分离到独立的处理函数中, 增加了shouldGrantBossWinBonus条件判断,确保只有满足条件时才发放胜利奖励。 同时修复了宠物等级系统,允许宠物等级突破100级限制但面板属性仍保持100级上限, 改进了经验获取和面板更新逻辑。 fix(item_use): 添加全能性格转化剂使用验证 添加了UniversalNatureItemID常量定义,增加对道具ID和性格配置的有效性验证, 确保只有正确的道具和性格类型才能被使用。 refactor(fight): 统一战斗结束原因处理逻辑 引入normalizeFightOverReason函数来标准化战斗结束原因, 统一了不同模块中的战斗结果映射逻辑,提高了代码一致性。 perf(pet): 优化宠物升级和经验计算性能 移除了等级100的硬性限制,在保证面板属性不超限的前提下允许宠物等级继续增长, 优化了经验分配和面板重新计算的逻辑流程。 ```
76 lines
2.3 KiB
Go
76 lines
2.3 KiB
Go
package controller
|
|
|
|
import (
|
|
"blazing/common/data/xmlres"
|
|
"blazing/common/socket/errorcode"
|
|
"blazing/logic/service/fight"
|
|
"blazing/logic/service/pet"
|
|
"blazing/logic/service/player"
|
|
)
|
|
|
|
// PetReleaseToWarehouse 将精灵从仓库包中放生
|
|
func (h Controller) PetReleaseToWarehouse(
|
|
data *PET_ROWEI, player *player.Player) (result *fight.NullOutboundInfo, err errorcode.ErrorCode) {
|
|
_, _, inBag := player.FindPet(data.CatchTime)
|
|
_, _, inBackup := player.FindBackupPet(data.CatchTime)
|
|
freeForbidden := xmlres.PetMAP[int(data.ID)].FreeForbidden
|
|
if inBag || inBackup || freeForbidden == 1 {
|
|
return nil, errorcode.ErrorCodes.ErrCannotReleaseNonWarehouse
|
|
}
|
|
|
|
if !player.Service.Pet.UpdateFree(data.CatchTime, 1) {
|
|
return nil, errorcode.ErrorCodes.ErrSystemError
|
|
}
|
|
|
|
return nil, 0
|
|
}
|
|
|
|
// PetOneCure 单体治疗
|
|
func (h Controller) PetOneCure(
|
|
data *PetOneCureInboundInfo, player *player.Player) (result *pet.PetOneCureOutboundInfo, err errorcode.ErrorCode) {
|
|
if player.IsArenaHealLocked() {
|
|
return result, errorcode.ErrorCodes.ErrChampionCannotHeal
|
|
}
|
|
|
|
if slot, ok := player.FindPetBagSlot(data.CatchTime); ok {
|
|
currentPet := slot.PetInfoPtr()
|
|
if currentPet != nil {
|
|
defer currentPet.Cure()
|
|
}
|
|
}
|
|
|
|
return &pet.PetOneCureOutboundInfo{
|
|
CatchTime: data.CatchTime,
|
|
}, 0
|
|
}
|
|
|
|
// PetFirst 精灵首发
|
|
func (h Controller) PetFirst(
|
|
data *PetDefaultInboundInfo, player *player.Player) (result *pet.PetDefaultOutboundInfo, err errorcode.ErrorCode) {
|
|
if player.IsArenaSwitchLocked() {
|
|
return result, errorcode.ErrorCodes.ErrChampionCannotSwitch
|
|
}
|
|
|
|
result = &pet.PetDefaultOutboundInfo{}
|
|
index, _, ok := player.FindPet(data.CatchTime)
|
|
if ok && index != 0 {
|
|
player.Info.PetList[index], player.Info.PetList[0] = player.Info.PetList[0], player.Info.PetList[index]
|
|
result.IsDefault = 1
|
|
}
|
|
|
|
return result, 0
|
|
}
|
|
|
|
// SetPetExp 设置宠物经验
|
|
func (h Controller) SetPetExp(
|
|
data *PetSetExpInboundInfo,
|
|
player *player.Player) (result *pet.PetSetExpOutboundInfo, err errorcode.ErrorCode) {
|
|
_, currentPet, found := player.FindPet(data.CatchTime)
|
|
if !found || currentPet.Level >= 100 {
|
|
return &pet.PetSetExpOutboundInfo{Exp: player.Info.ExpPool}, errorcode.ErrorCodes.ErrSystemError
|
|
}
|
|
|
|
player.AddPetExp(currentPet, data.Exp)
|
|
return &pet.PetSetExpOutboundInfo{Exp: player.Info.ExpPool}, 0
|
|
}
|