feat(fight): 优化战斗逻辑与精灵切换流程

- 在多个战斗控制器方法中添加 defer 调用,确保战斗操作正确延迟执行
- 修改 ChangePet 方法返回值类型,增强接口一致性
- 修复战斗准备阶段逻辑,重构战斗开始信息构建过程
- 移除冗余广播调用,调整 PVE 战斗初始化流程
- 更新 README 中的 pprof 命令地址并完善项目介绍部分

fix(effect): 修复效果叠加逻辑与ID解析问题

- 效果叠加时默认增加一层,而非直接相加参数
- 修正 EffectIDCombiner 类型、CatchTime 的掩码偏移计算错误
- 添加重复效果日志输出,便于调试追踪

feat(boss): 完善BOSS特性实现逻辑

- 修正 NewSel17 特性
This commit is contained in:
2025-11-29 19:26:56 +08:00
parent f1c75abde6
commit 11f6817d62
23 changed files with 7269 additions and 6572 deletions

View File

@@ -14,7 +14,7 @@ func (h Controller) OnReadyToFight(data *fight.ReadyToFightInboundInfo, c *playe
if c.FightC == nil {
return nil, errorcode.ErrorCodes.ErrBattleEnded
}
c.FightC.ReadyFight(c)
defer c.FightC.ReadyFight(c)
return nil, -1
}
@@ -23,7 +23,7 @@ func (h Controller) UseSkill(data *fight.UseSkillInInfo, c *player.Player) (resu
if c.FightC == nil {
return nil, errorcode.ErrorCodes.ErrBattleEnded
}
c.FightC.UseSkill(c, (data.SkillId))
defer c.FightC.UseSkill(c, data.SkillId)
return nil, 0
}
@@ -42,17 +42,17 @@ func (h Controller) Escape(data *fight.EscapeFightInboundInfo, c *player.Player)
return nil, errorcode.ErrorCodes.ErrCannotFleePlayerBattle
}
c.FightC.Over(c, info.BattleOverReason.PlayerEscape)
defer c.FightC.Over(c, info.BattleOverReason.PlayerEscape)
return nil, 0
}
// 切换精灵
func (h Controller) ChangePet(data *fight.ChangePetInboundInfo, c *player.Player) (result *fight.NullOutboundInfo, err errorcode.ErrorCode) {
func (h Controller) ChangePet(data *fight.ChangePetInboundInfo, c *player.Player) (result *info.ChangePetInfo, err errorcode.ErrorCode) {
if c.FightC == nil {
return nil, errorcode.ErrorCodes.ErrBattleEnded
}
c.FightC.ChangePet(c, data.CatchTime)
defer c.FightC.ChangePet(c, data.CatchTime)
return nil, -1
}
@@ -61,7 +61,7 @@ func (h Controller) Capture(data *fight.CatchMonsterInboundInfo, c *player.Playe
if c.FightC == nil {
return nil, errorcode.ErrorCodes.ErrBattleEnded
}
c.FightC.Capture(c, data.CapsuleId)
defer c.FightC.Capture(c, data.CapsuleId)
return nil, -1
}
@@ -71,7 +71,7 @@ func (h Controller) LoadPercent(data *fight.LoadPercentInboundInfo, c *player.Pl
return nil, -1
}
c.FightC.LoadPercent(c, int32(data.Percent))
defer c.FightC.LoadPercent(c, int32(data.Percent))
return nil, -1
}
func (h Controller) UsePetItemInboundInfo(data *fight.UsePetItemInboundInfo, c *player.Player) (result *info.UsePetIteminfo, err errorcode.ErrorCode) {
@@ -80,7 +80,7 @@ func (h Controller) UsePetItemInboundInfo(data *fight.UsePetItemInboundInfo, c *
return nil, errorcode.ErrorCodes.ErrBattleEnded
}
c.FightC.UseItem(c, data.CatchTime, data.ItemId)
defer c.FightC.UseItem(c, data.CatchTime, data.ItemId)
return nil, -1
}
@@ -89,7 +89,7 @@ func (h Controller) FightChat(data *fight.ChatInfo, c *player.Player) (result *f
return nil, errorcode.ErrorCodes.ErrBattleEnded
}
c.FightC.Chat(c, data.Message)
defer c.FightC.Chat(c, data.Message)
return nil, -1
}

View File

@@ -147,7 +147,7 @@ func (h Controller) ARENA_OWENR_ACCE(data *fight.ARENA_OWENR_ACCE, c *player.Pla
s := c.GetSpace()
if atomic.LoadUint32(&c.GetSpace().Owner.UserID) != c.GetInfo().UserID && c.GetInfo().UserID != atomic.LoadUint32(&c.GetSpace().Owner.ChallengerID) { //说明已经有人了
return nil, errorcode.ErrorCodes.ErrChampionCannotCancel
return nil, -1
}
s.Owner.Set(c)

View File

@@ -173,7 +173,7 @@ func (h *Controller) PlayerShowPet(
copier.Copy(&result, onpet)
result.Flag = data.Flag
result.UserID = data.Head.UserID
c.GetSpace().Broadcast(c, data.Head.CMD, result)
defer c.GetSpace().Broadcast(c, data.Head.CMD, result)
}
return
@@ -188,7 +188,8 @@ func (h *Controller) PetOneCure(
_, onpet, ok := c.FindPet(data.CatchTime)
if ok {
onpet.Cure()
defer onpet.Cure()
}
return &pet.PetOneCureOutboundInfo{
@@ -226,7 +227,7 @@ func (h Controller) SetPetExp(data *pet.PetSetExpInboundInfo, c *player.Player)
_, onpet, ok := c.FindPet(data.CatchTime)
if ok {
c.AddPetExp(onpet, data.Exp)
defer c.AddPetExp(onpet, data.Exp)
}
return &pet.PetSetExpOutboundInfo{