Пример #1
0
        /*
         *             Item botitem;
         *  string botId;
         *  Mob newMob;
         *  if (r.Next(10) < 3)
         *  {
         *      botId = "bo" + GlobalVars.runningBotCount.ToString();
         *      GlobalVars.runningBotCount = (GlobalVars.runningBotCount + 1)%9999;
         *      botitem =  new Item(pos, Vector.Zero, new Hashtable(),
         *  (MmoActorOperationHandler)serverPeer.CurrentOperationHandler, botId, (byte)ItemType.Bot, world);
         *      newMob = new Mob(botitem, mother, BotType.Swarm);
         *  }
         *  else
         *  {
         *      botId = "bf" + GlobalVars.runningBotCount.ToString();
         *      GlobalVars.runningBotCount = (GlobalVars.runningBotCount + 1)%9999;
         *      botitem = new Item(pos, Vector.Zero, new Hashtable(),
         * (MmoActorOperationHandler)serverPeer.CurrentOperationHandler, botId, (byte)ItemType.Bot, world);
         *      newMob = new Mob(botitem, mother, BotType.FastSwarm);
         *  }
         *  GlobalVars.log.InfoFormat("adding bot " + botId);
         *
         */
        public static void AddMobToMotherrHelper(Vector pos, MobMother mother, World world)
        {
            bool   isFastSwarm = r.Next(10) > 3 ? true : false;
            string botId;

            if (!isFastSwarm)
            {
                botId = "bo" + GlobalVars.runningBotCount.ToString();
            }
            else
            {
                botId = "bf" + GlobalVars.runningBotCount.ToString();
            }
            GlobalVars.log.InfoFormat("adding bot " + botId);
            GlobalVars.runningBotCount = (GlobalVars.runningBotCount + 1) % 9999;
            Item botitem = new Item(pos, Vector.Zero, new Hashtable(),
                                    (MmoActorOperationHandler)serverPeer.CurrentOperationHandler, botId, (byte)ItemType.Bot, world);
            Mob newMob;

            if (!isFastSwarm)
            {
                newMob = new Mob(botitem, mother, BotType.Swarm);
            }
            else
            {
                newMob = new Mob(botitem, mother, BotType.FastSwarm);
            }
            newMob.ChooseNewTargetPosAndSetVel();
            mother.childMobs.Add(newMob);
            SpawnMobHelper(newMob);
        }
Пример #2
0
 public Mob(Item item, MobMother mother, BotType type)
 {
     this.mobItem = item;
     this.mother  = mother;
     this.type    = type;
     this.state   = BotState.Patroling;
     if (type == BotType.Swarm)
     {
         hp = GlobalVars.SwarmMobHP;
     }
     else if (type == BotType.Strong)
     {
         hp = GlobalVars.StrongMobHP;
     }
     else if (type == BotType.Mother)
     {
         hp = GlobalVars.MotherHP;
     }
     else if (type == BotType.FastSwarm)
     {
         hp = GlobalVars.FastSwarmMobHP;
     }
     isDead             = false;
     timeTillReload     = 0;
     timeSinceVelUpdate = 0;
 }
Пример #3
0
        private static void AddMotherBotHelper(Vector pos, World world)
        {
            string botId = "mb" + GlobalVars.motherBotCount.ToString();

            GlobalVars.log.InfoFormat("adding bot " + botId);
            GlobalVars.motherBotCount = (GlobalVars.motherBotCount + 1) % 99;
            Item mobitem = new Item(pos, Vector.Zero, new Hashtable(),
                                    (MmoActorOperationHandler)serverPeer.CurrentOperationHandler, botId, (byte)ItemType.Bot, world);
            MobMother newMother = new MobMother(mobitem, BotType.Mother);

            motherMobs.Add(newMother);
            SpawnMobHelper(newMother);
        }
Пример #4
0
 // remove recently deceased mobs from list
 private static void RemoveDeadMobsFromMother(MobMother mm)
 {
     mm.childMobs.RemoveAll(item => item.isDead == true);
 }