package parkour import ( "go_dreamfactory/comm" "go_dreamfactory/lego/sys/timewheel" "go_dreamfactory/pb" cfg "go_dreamfactory/sys/configure/structs" "sync" ) type Recommend struct { parkour *pb.DBParkour user *pb.DBUser member *pb.DBRaceMember } ///捕羊大赛对象 type RaceItem struct { Id string //战斗id lock sync.Mutex //战斗锁 防止计时器和消息同时操作对象 Rtype pb.RaceType //比赛类型 RedMember []*pb.DBRaceMember //红方成员 RedScore int32 //红方分值 BuleMember []*pb.DBRaceMember //蓝方成员 Session map[string]comm.IUserSession BuleScore int32 //蓝方分值 overtimer *timewheel.Task //准备倒计时定时器 } type AILevel int32 const ( AILevelS AILevel = iota AILevelSS AILevelSSS ) type AIHandleType int32 const ( AIHandle_Null AIHandleType = iota //空操作 AIHandle_Avoid //躲避障碍 AIHandle_Shot //射门 AIHandle_AddBlood //加血 ) type AIHandle struct { htype AIHandleType cd int32 weight int32 } func NewAI(battleid string, uid string, conf *cfg.GameBukashiAiData) (_ai *AI) { _ai = &AI{ Bid: battleid, Uid: uid, Conf: conf, Handles: make([]*AIHandle, 0), CD: conf.BehaviorCD, } _ai.Handles = append(_ai.Handles, &AIHandle{ htype: AIHandle_Null, weight: conf.EmptyWeight, }) _ai.Handles = append(_ai.Handles, &AIHandle{ htype: AIHandle_Avoid, weight: conf.BumpWeight, cd: conf.BumpCD, }) _ai.Handles = append(_ai.Handles, &AIHandle{ htype: AIHandle_AddBlood, weight: conf.HpBumpWeight, cd: conf.HpBumpCD, }) _ai.Handles = append(_ai.Handles, &AIHandle{ htype: AIHandle_Shot, weight: conf.CatchQteWeight, cd: conf.CatchQteCD, }) return } //捕羊大赛AI对象 type AI struct { Bid string //战场id Uid string //用户id Conf *cfg.GameBukashiAiData //配置 Handles []*AIHandle //操作列表 CD int32 //CD }