feat(fight): 优化战斗逻辑与精灵切换流程
- 在多个战斗控制器方法中添加 defer 调用,确保战斗操作正确延迟执行 - 修改 ChangePet 方法返回值类型,增强接口一致性 - 修复战斗准备阶段逻辑,重构战斗开始信息构建过程 - 移除冗余广播调用,调整 PVE 战斗初始化流程 - 更新 README 中的 pprof 命令地址并完善项目介绍部分 fix(effect): 修复效果叠加逻辑与ID解析问题 - 效果叠加时默认增加一层,而非直接相加参数 - 修正 EffectIDCombiner 类型、CatchTime 的掩码偏移计算错误 - 添加重复效果日志输出,便于调试追踪 feat(boss): 完善BOSS特性实现逻辑 - 修正 NewSel17 特性
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user