refactor(fight): 增加战斗控制器空指针检查,优化逃跑和切换精灵逻辑
This commit is contained in:
@@ -164,15 +164,17 @@ func (h Controller) UseSkill(data *fight.UseSkillInInfo, c *player.Player) (resu
|
||||
|
||||
// 战斗逃跑
|
||||
func (h Controller) Escape(data *fight.EscapeFightInboundInfo, c *player.Player) (result *fight.NullOutboundInfo, err errorcode.ErrorCode) {
|
||||
|
||||
c.FightC.Over(c, info.BattleOverReason.PlayerEscape)
|
||||
if c.FightC != nil {
|
||||
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) {
|
||||
|
||||
c.FightC.ChangePet(c, data.CatchTime)
|
||||
if c.FightC != nil {
|
||||
c.FightC.ChangePet(c, data.CatchTime)
|
||||
}
|
||||
return nil, -1
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user