package controller import ( "blazing/common/data/xmlres" "blazing/common/socket/errorcode" "blazing/logic/service/fight" "blazing/logic/service/fight/info" "blazing/logic/service/player" "blazing/modules/blazing/model" ) func (h Controller) PlayerFightBoss(data *fight.ChallengeBossInboundInfo, c *player.Player) (result *fight.NullOutboundInfo, err errorcode.ErrorCode) { var petid int var mo *model.PetInfo if c.Info.MapID == 515 && data.BossId == 0 { //说明是新手,随机生成 switch c.Info.PetList[0].ID { case 1: petid = 4 case 7: petid = 1 case 4: petid = 7 } mo = model.GenPetInfo( int(petid), 24, //24个体 -1, 0, //野怪没特性 0, 2) } if c.FightC != nil { return nil, errorcode.ErrorCodes.ErrOnlineOver6HoursCannotFight } moinfo := &model.PlayerInfo{} moinfo.Nick = xmlres.PetMAP[int(mo.ID)].DefName moinfo.PetList = append(moinfo.PetList, *mo) ai := player.NewAI_player(moinfo) fight.NewFight(info.BattleMode.PVE, c, ai) return nil, -1 } // 战斗野怪 func (h Controller) OnPlayerFightNpcMonster(data *fight.FightNpcMonsterInboundInfo, c *player.Player) (result *fight.NullOutboundInfo, err errorcode.ErrorCode) { refpet := c.OgreInfo.Data[data.Number] if refpet.Id == 0 { return nil, errorcode.ErrorCodes.ErrPokemonNotExists } mo := model.GenPetInfo( int(refpet.Id), -1, -1, 0, //野怪没特性 int(refpet.Shiny), int(refpet.Lv)) if c.FightC != nil { return nil, errorcode.ErrorCodes.ErrOnlineOver6HoursCannotFight } moinfo := &model.PlayerInfo{} moinfo.Nick = xmlres.PetMAP[int(mo.ID)].DefName moinfo.PetList = append(moinfo.PetList, *mo) ai := player.NewAI_player(moinfo) fight.NewFight(info.BattleMode.PVE, c, ai) return nil, -1 } // 准备战斗 func (h Controller) OnReadyToFight(data *fight.ReadyToFightInboundInfo, c *player.Player) (result *fight.NullOutboundInfo, err errorcode.ErrorCode) { c.FightC.ReadyFight(c) return nil, -1 } // 接收战斗或者取消战斗的包 func (h Controller) OnPlayerHandleFightInvite(data *fight.HandleFightInviteInboundInfo, c *player.Player) (result *fight.NullOutboundInfo, err errorcode.ErrorCode) { if ok, p1 := c.AgreeBattle(data.UserID, data.Flag, data.Mode); ok { fight.NewFight(info.EnumBattleMode(data.Mode), p1, c) ///开始对战,房主方以及被邀请方 } return nil, -1 } // 邀请其他人进行战斗 func (h Controller) OnPlayerInviteOtherFight(data *fight.InviteToFightInboundInfo, c *player.Player) (result *fight.NullOutboundInfo, err errorcode.ErrorCode) { c.InvitePlayerToBattle(&info.PVPinfo{PlayerID: data.UserID, Mode: data.Mode}) return nil, 0 } // 使用技能包 func (h Controller) UseSkill(data *fight.UseSkillInboundInfo, c *player.Player) (result *fight.NullOutboundInfo, err errorcode.ErrorCode) { c.FightC.UseSkill(c, int32(data.SkillId)) return nil, 0 } // 战斗逃跑 func (h Controller) Escape(data *fight.EscapeFightInboundInfo, c *player.Player) (result *fight.NullOutboundInfo, err errorcode.ErrorCode) { 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) return nil, -1 } // 切换精灵 func (h Controller) Capture(data *fight.CatchMonsterInboundInfo, c *player.Player) (result *info.CatchMonsterOutboundInfo, err errorcode.ErrorCode) { c.FightC.Capture(c, (data.CapsuleId)) return nil, -1 }