refactor(fight): 优化战斗逻辑代码结构,清理冗余代码
This commit is contained in:
@@ -126,9 +126,7 @@ func (h Controller) OnReadyToFight(data *fight.ReadyToFightInboundInfo, c *playe
|
||||
|
||||
// 接收战斗或者取消战斗的包
|
||||
func (h Controller) OnPlayerHandleFightInvite(data *fight.HandleFightInviteInboundInfo, c *player.Player) (result *fight.NullOutboundInfo, err errorcode.ErrorCode) {
|
||||
if !c.CanFight() {
|
||||
return nil, errorcode.ErrorCodes.ErrPokemonNotEligible
|
||||
}
|
||||
|
||||
if ok, p1 := c.AgreeBattle(data.UserID, data.Flag, data.Mode); ok {
|
||||
fight.NewFight(data.Mode, info.BattleStatus.FIGHT_WITH_PLAYER, c, p1) ///开始对战,房主方以及被邀请方
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user