Ejemplo n.º 1
0
 private void InitializeNewDinosaurList(float health, float powerLevel, float maxPower, float attackPower)
 {
     for (int i = 0; i < 3; i++)
     {
         Warriors.Add(new Dinosaur(this, dinosaurTypes[i], health, powerLevel, maxPower, attackPower));
     }
 }
Ejemplo n.º 2
0
 // Instantiates three new Robots based on hard coded names into the Robot List.
 private void InitializeNewRobotList(float health, float powerLevel, float maxPowerLevel)
 {
     string[] names = { "FrazelBot", "Storm 9000", "LED-Tron" };
     for (int i = 0; i < 3; i++)
     {
         Warriors.Add(new Robot(this, ref availableWeapons, names[i], health, powerLevel, maxPowerLevel, 0));
     }
 }
Ejemplo n.º 3
0
        //-----------------------Al inciar Form-------------------------------
        //Carga información de los Warriors Locales y del usuario(visitante)
        public void CargaSeleccionLocal(List <int> warriorSelect)
        {
            for (int i = 0; i < warriorSelect.Count; i++)
            {
                Warriors warrior = new Warriors();
                switch (warriorSelect[i])
                {
                case 1:
                    warrior.LocacionImagenPosicionado = Metal_Warriors.Properties.Resources.NitroPosicionado;
                    warrior.LocacionImagenDañado      = Metal_Warriors.Properties.Resources.NitroDañado;
                    warrior.LocacionImagenDestruido   = Metal_Warriors.Properties.Resources.NitroDestruido;
                    warrior.VecesDañado = 0;
                    LocalWarrior.Add(warrior);
                    break;

                case 2:
                    warrior.LocacionImagenPosicionado = Metal_Warriors.Properties.Resources.PrometheusPosicionado;
                    warrior.LocacionImagenDañado      = Metal_Warriors.Properties.Resources.PromeheusDañado;
                    warrior.LocacionImagenDestruido   = Metal_Warriors.Properties.Resources.PrometheusDestruido;
                    warrior.VecesDañado = 0;
                    LocalWarrior.Add(warrior);
                    break;

                case 3:
                    warrior.LocacionImagenPosicionado = Metal_Warriors.Properties.Resources.HavocPosicionado;
                    warrior.LocacionImagenDañado      = Metal_Warriors.Properties.Resources.HavocDañado;
                    warrior.LocacionImagenDestruido   = Metal_Warriors.Properties.Resources.HavocDestruido;
                    warrior.VecesDañado = 0;
                    LocalWarrior.Add(warrior);
                    break;

                case 4:
                    warrior.LocacionImagenPosicionado = Metal_Warriors.Properties.Resources.BallisticPosicionado;
                    warrior.LocacionImagenDañado      = Metal_Warriors.Properties.Resources.BallisticDañado;
                    warrior.LocacionImagenDestruido   = Metal_Warriors.Properties.Resources.BallisticDestruido;
                    warrior.VecesDañado = 0;
                    LocalWarrior.Add(warrior);
                    break;

                case 5:
                    warrior.LocacionImagenPosicionado = Metal_Warriors.Properties.Resources.DrachePosicionado;
                    warrior.LocacionImagenDañado      = Metal_Warriors.Properties.Resources.DracheDañado;
                    warrior.LocacionImagenDestruido   = Metal_Warriors.Properties.Resources.DracheDestruido;
                    warrior.VecesDañado = 0;
                    LocalWarrior.Add(warrior);
                    break;

                case 6:
                    warrior.LocacionImagenPosicionado = Metal_Warriors.Properties.Resources.SpiderPosicionado;
                    warrior.LocacionImagenDañado      = Metal_Warriors.Properties.Resources.SpiderDañado;
                    warrior.LocacionImagenDestruido   = Metal_Warriors.Properties.Resources.SpiderDestruido;
                    warrior.VecesDañado = 0;
                    LocalWarrior.Add(warrior);
                    break;
                }
            }
        }
Ejemplo n.º 4
0
 // Called if a robot has died and removes them from Robot List.
 public void RemoveRobot(Warrior robot)
 {
     if (Warriors.Contains(robot))
     {
         Warriors.Remove(robot);
     }
     else
     {
         throw new IndexOutOfRangeException();
     }
 }
Ejemplo n.º 5
0
 public void RemoveDinosaur(Warrior dinosaur)
 {
     if (Warriors.Contains(dinosaur))
     {
         Warriors.Remove(dinosaur);
     }
     else
     {
         throw new IndexOutOfRangeException();
     }
 }
Ejemplo n.º 6
0
        /// <summary>
        /// Gets a Warrior client from the list of active Warrior clients. The client selected is the
        /// one in which the currently logged-in player matches the specified name.
        /// </summary>
        /// <param name="name">The name of the player logged into the client.</param>
        /// <returns>The Warrior client that is logged in as the specified player.</returns>

        public WarriorClient GetWarrior(string name)
        {
            var client = Warriors.FirstOrDefault(x => string.Equals(name, x.Self.Name, StringComparison.OrdinalIgnoreCase));

            if (client == null)
            {
                ThrowNullReferenceException("Warrior", name);
            }

            return(client);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Squad"/> class.
        /// </summary>
        /// <param name="nameSquad">Name Squad.</param>
        /// <param name="quantityWarriors">Quantity Warriors in squad.</param>
        public Squad(string nameSquad, int quantityWarriors)
        {
            NameSquad = nameSquad;

            int temp   = rand.Next(0, quantityWarriors);
            int bers   = temp;
            int prist  = temp;
            int mag    = temp;
            int shield = temp;

            while (bers == prist)
            {
                temp  = rand.Next(0, quantityWarriors);
                prist = temp;
            }

            while (bers == mag || prist == mag)
            {
                temp = rand.Next(0, quantityWarriors);
                mag  = temp;
            }

            while (bers == shield || prist == shield || mag == shield)
            {
                temp   = rand.Next(0, quantityWarriors);
                shield = temp;
            }

            for (int i = 0; i < quantityWarriors; i++)
            {
                if (i == bers)
                {
                    Warriors.Add(new BerserkWarrior());
                }

                if (i == prist)
                {
                    Warriors.Add(new PriestWarrior());
                }

                if (i == mag)
                {
                    Warriors.Add(new MagWarrior());
                }

                if (i == shield)
                {
                    Warriors.Add(new ShieldWarrior());
                }

                Warriors.Add(new Warrior());
            }
        }
Ejemplo n.º 8
0
        public IWarrior AddWarrior(IWarrior warrior)
        {
            IWarrior newWarrior = warrior.GetAnInstance();

            Warriors.Add(newWarrior);

            newWarrior.PropertiesChanged += NewWarrior_PropertiesChanged;

            if (newWarrior is IHenchMen)
            {
                IHenchMen henchMan = newWarrior as IHenchMen;
                henchMan.IncreaseGroupByOne();
            }

            InvokeEvent(WarBandChanged);
            InvokeEvent(WarBandWariorListChanged);

            return(newWarrior);
        }
Ejemplo n.º 9
0
 public void RemoveWarrior(IWarrior warrior)
 {
     Warriors.Remove(warrior);
     InvokeEvent(WarBandChanged);
     InvokeEvent(WarBandWariorListChanged);
 }
Ejemplo n.º 10
0
        public void CargaSeleccionVisitante(List <int> warriorSelect)
        {
            for (int i = 0; i < warriorSelect.Count; i++)
            {
                Warriors warrior = new Warriors();
                switch (warriorSelect[i])
                {
                case 1:
                    warrior.LocacionImagen             = Metal_Warriors.Properties.Resources.Nitro;
                    warrior.LocacionImagenSeleccionado = Metal_Warriors.Properties.Resources.NitroSelect;
                    warrior.LocacionImagenPosicionado  = Metal_Warriors.Properties.Resources.NitroPosicionado;
                    warrior.LocacionImagenDañado       = Metal_Warriors.Properties.Resources.NitroDañado;
                    warrior.LocacionImagenDestruido    = Metal_Warriors.Properties.Resources.NitroDestruido;
                    warrior.LocacionImagenLucha        = Metal_Warriors.Properties.Resources.NitroLuchaVisitante;
                    warrior.VecesDañado = 0;
                    warrior.Posicionado = false;
                    VisitanteWarrior.Add(warrior);
                    break;

                case 2:
                    warrior.LocacionImagen             = Metal_Warriors.Properties.Resources.Prometheus;
                    warrior.LocacionImagenSeleccionado = Metal_Warriors.Properties.Resources.PrometheusSelect;
                    warrior.LocacionImagenPosicionado  = Metal_Warriors.Properties.Resources.PrometheusPosicionado;
                    warrior.LocacionImagenDañado       = Metal_Warriors.Properties.Resources.PromeheusDañado;
                    warrior.LocacionImagenDestruido    = Metal_Warriors.Properties.Resources.PrometheusDestruido;
                    warrior.LocacionImagenLucha        = Metal_Warriors.Properties.Resources.PrometheusVisitante;
                    warrior.VecesDañado = 0;
                    warrior.Posicionado = false;
                    VisitanteWarrior.Add(warrior);
                    break;

                case 3:
                    warrior.LocacionImagen             = Metal_Warriors.Properties.Resources.Havoc;
                    warrior.LocacionImagenSeleccionado = Metal_Warriors.Properties.Resources.HavocSelect;
                    warrior.LocacionImagenPosicionado  = Metal_Warriors.Properties.Resources.HavocPosicionado;
                    warrior.LocacionImagenDañado       = Metal_Warriors.Properties.Resources.HavocDañado;
                    warrior.LocacionImagenDestruido    = Metal_Warriors.Properties.Resources.HavocDestruido;
                    warrior.LocacionImagenLucha        = Metal_Warriors.Properties.Resources.HavocVisitante;
                    warrior.VecesDañado = 0;
                    warrior.Posicionado = false;
                    VisitanteWarrior.Add(warrior);
                    break;

                case 4:
                    warrior.LocacionImagen             = Metal_Warriors.Properties.Resources.Ballistic;
                    warrior.LocacionImagenSeleccionado = Metal_Warriors.Properties.Resources.BallisticSelect;
                    warrior.LocacionImagenPosicionado  = Metal_Warriors.Properties.Resources.BallisticPosicionado;
                    warrior.LocacionImagenDañado       = Metal_Warriors.Properties.Resources.BallisticDañado;
                    warrior.LocacionImagenDestruido    = Metal_Warriors.Properties.Resources.BallisticDestruido;
                    warrior.LocacionImagenLucha        = Metal_Warriors.Properties.Resources.BallisticVisitante;
                    warrior.VecesDañado = 0;
                    warrior.Posicionado = false;
                    VisitanteWarrior.Add(warrior);
                    break;

                case 5:
                    warrior.LocacionImagen             = Metal_Warriors.Properties.Resources.Drache;
                    warrior.LocacionImagenSeleccionado = Metal_Warriors.Properties.Resources.DracheSelect;
                    warrior.LocacionImagenPosicionado  = Metal_Warriors.Properties.Resources.DrachePosicionado;
                    warrior.LocacionImagenDañado       = Metal_Warriors.Properties.Resources.DracheDañado;
                    warrior.LocacionImagenDestruido    = Metal_Warriors.Properties.Resources.DracheDestruido;
                    warrior.LocacionImagenLucha        = Metal_Warriors.Properties.Resources.DracheVisitatne;
                    warrior.VecesDañado = 0;
                    warrior.Posicionado = false;
                    VisitanteWarrior.Add(warrior);
                    break;

                case 6:
                    warrior.LocacionImagen             = Metal_Warriors.Properties.Resources.Spider;
                    warrior.LocacionImagenSeleccionado = Metal_Warriors.Properties.Resources.SpiderSelect;
                    warrior.LocacionImagenPosicionado  = Metal_Warriors.Properties.Resources.SpiderPosicionado;
                    warrior.LocacionImagenDañado       = Metal_Warriors.Properties.Resources.SpiderDañado;
                    warrior.LocacionImagenDestruido    = Metal_Warriors.Properties.Resources.SpiderDestruido;
                    warrior.LocacionImagenLucha        = Metal_Warriors.Properties.Resources.SpiderVisitante;
                    warrior.VecesDañado = 0;
                    warrior.Posicionado = false;
                    VisitanteWarrior.Add(warrior);
                    break;
                }
            }
        }
Ejemplo n.º 11
0
        public static void Setup()
        {
            ArrayList spots = new ArrayList();

            foreach (Item spot in World.Items.Values)
            {
                if (spot is WorkingSpots && Utility.RandomMinMax(1, 4) != 1)
                {
                    spots.Add(spot);
                }
            }
            for (int i = 0; i < spots.Count; ++i)
            {
                Item spot = ( Item )spots[i];
                if (spot.Name == "alchemist")
                {
                    Mobile citizen = new TradesmanAlchemist(); citizen.MoveToWorld(spot.Location, spot.Map); ((BaseCreature)citizen).Home = spot.Location; ((BaseCreature)citizen).RangeHome = 0; citizen.OnAfterSpawn(); Add(citizen, spot, 2);
                }
                else if (spot.Name == "archer")
                {
                    Mobile citizen = new TrainingBow(); citizen.MoveToWorld(spot.Location, spot.Map); ((BaseCreature)citizen).Home = spot.Location; ((BaseCreature)citizen).RangeHome = 0; citizen.OnAfterSpawn(); Add(citizen, spot, 6);
                }
                else if (spot.Name == "fighter")
                {
                    Mobile citizen = new TrainingSingle(); citizen.MoveToWorld(spot.Location, spot.Map); ((BaseCreature)citizen).Home = spot.Location; ((BaseCreature)citizen).RangeHome = 0; citizen.OnAfterSpawn(); Add(citizen, spot, 1);
                }
                else if (spot.Name == "fisherman")
                {
                    Mobile citizen = new TrainingFishing(); citizen.MoveToWorld(spot.Location, spot.Map); ((BaseCreature)citizen).Home = spot.Location; ((BaseCreature)citizen).RangeHome = 0; citizen.OnAfterSpawn(); Add(citizen, spot, 6);
                }
                else if (spot.Name == "lumber")
                {
                    Mobile citizen = new TradesmanLumber(); citizen.MoveToWorld(spot.Location, spot.Map); ((BaseCreature)citizen).Home = spot.Location; ((BaseCreature)citizen).RangeHome = 0; citizen.OnAfterSpawn(); Add(citizen, spot, 2);
                }
                else if (spot.Name == "lumberjack")
                {
                    Mobile citizen = new TradesmanLogger(); citizen.MoveToWorld(spot.Location, spot.Map); ((BaseCreature)citizen).Home = spot.Location; ((BaseCreature)citizen).RangeHome = 0; citizen.OnAfterSpawn(); Add(citizen, spot, 1);
                }
                else if (spot.Name == "miner")
                {
                    Mobile citizen = new TradesmanMiner(); citizen.MoveToWorld(spot.Location, spot.Map); ((BaseCreature)citizen).Home = spot.Location; ((BaseCreature)citizen).RangeHome = 0; citizen.OnAfterSpawn(); Add(citizen, spot, 1);
                }
                else if (spot.Name == "smelter")
                {
                    Mobile citizen = new TradesmanSmelter(); citizen.MoveToWorld(spot.Location, spot.Map); ((BaseCreature)citizen).Home = spot.Location; ((BaseCreature)citizen).RangeHome = 0; citizen.OnAfterSpawn(); Add(citizen, spot, 1);
                }
                else if (spot.Name == "smith")
                {
                    Mobile citizen = new TradesmanSmith(); citizen.MoveToWorld(spot.Location, spot.Map); ((BaseCreature)citizen).Home = spot.Location; ((BaseCreature)citizen).RangeHome = 0; citizen.OnAfterSpawn(); Add(citizen, spot, 1);
                }
                else if (spot.Name == "tanner")
                {
                    Mobile citizen = new TradesmanLeather(); citizen.MoveToWorld(spot.Location, spot.Map); ((BaseCreature)citizen).Home = spot.Location; ((BaseCreature)citizen).RangeHome = 0; citizen.OnAfterSpawn(); Add(citizen, spot, 1);
                }
                else if (spot.Name == "warrior")
                {
                    Mobile citizen = new Warriors(); citizen.MoveToWorld(spot.Location, spot.Map); ((BaseCreature)citizen).Home = spot.Location; ((BaseCreature)citizen).RangeHome = 0; citizen.OnAfterSpawn(); Add(citizen, spot, 1);
                }
                else if (spot.Name == "wizard")
                {
                    Mobile citizen = new TrainingMagery(); citizen.MoveToWorld(spot.Location, spot.Map); ((BaseCreature)citizen).Home = spot.Location; ((BaseCreature)citizen).RangeHome = 0; citizen.OnAfterSpawn(); Add(citizen, spot, 4);
                }
            }
        }
Ejemplo n.º 12
0
        public static void Add(Mobile citizen, Item spots, int range)
        {
            bool hasCitizen = false;

            ArrayList items = new ArrayList();

            foreach (Item item in spots.GetItemsInRange(range))
            {
                if (item is WorkingSpots && item != spots)
                {
                    hasCitizen = true;
                    items.Add(item);
                }
            }
            for (int i = 0; i < items.Count; ++i)
            {
                if (hasCitizen)
                {
                    Item spot = ( Item )items[i];
                    if (spot.Name == "anvil" && (citizen is TradesmanSmelter || citizen is TradesmanSmith))
                    {
                        Item item = new AnvilHit(); item.MoveToWorld(spot.Location, spot.Map); item.Weight = -2.0;
                    }
                    else if (spot.Name == "dummy" && citizen is TrainingSingle)
                    {
                        Item item = new TrainingDummy(); item.MoveToWorld(spot.Location, spot.Map); item.Weight = -2.0;
                    }
                    else if (spot.Name == "forge" && (citizen is TradesmanSmelter || citizen is TradesmanSmith))
                    {
                        Item item = new ForgeHit(); item.MoveToWorld(spot.Location, spot.Map); item.Weight = -2.0;
                    }
                    else if (spot.Name == "hidden anvil" && (citizen is TradesmanSmelter || citizen is TradesmanSmith))
                    {
                        Item item = new AnvilHit(); item.MoveToWorld(spot.Location, spot.Map); item.Visible = false; item.Weight = -2.0;
                    }
                    else if (spot.Name == "hidden forge" && (citizen is TradesmanSmelter || citizen is TradesmanSmith))
                    {
                        Item item = new ForgeHit(); item.MoveToWorld(spot.Location, spot.Map); item.Visible = false; item.Weight = -2.0;
                    }
                    else if (spot.Name == "hidden hide" && citizen is TradesmanLeather)
                    {
                        Item item = new LeatherHit(); item.MoveToWorld(spot.Location, spot.Map); item.Visible = false; item.Weight = -2.0;
                    }
                    else if (spot.Name == "hide" && citizen is TradesmanLeather)
                    {
                        Item item = new LeatherHit(); item.MoveToWorld(spot.Location, spot.Map); item.Weight = -2.0;
                    }
                    else if (spot.Name == "pentagram" && citizen is TrainingMagery)
                    {
                        Item item = new MagicHit(); item.MoveToWorld(spot.Location, spot.Map); item.Visible = false; item.OnAfterSpawn(); item.Weight = -2.0;
                    }
                    else if (spot.Name == "potion" && citizen is TradesmanAlchemist)
                    {
                        Item item = new CauldronHit(); item.MoveToWorld(spot.Location, spot.Map); item.Weight = -2.0;
                    }
                    else if (spot.Name == "rock" && citizen is TradesmanMiner)
                    {
                        Item item = new RockHit(); item.MoveToWorld(spot.Location, spot.Map); item.Visible = false; item.Weight = -2.0;
                    }
                    else if (spot.Name == "saw" && citizen is TradesmanLumber)
                    {
                        Item item = new SawHit(); item.MoveToWorld(spot.Location, spot.Map); item.Visible = false; item.Weight = -2.0;
                    }
                    else if (spot.Name == "target" && citizen is TrainingBow)
                    {
                        Item item = new ArcheryButte(); item.MoveToWorld(spot.Location, spot.Map); item.Weight = -2.0;
                    }
                    else if (spot.Name == "tree" && citizen is TradesmanLogger)
                    {
                        Item item = new TreeHit(); item.MoveToWorld(spot.Location, spot.Map); item.Visible = false; item.Weight = -2.0;
                    }
                    else if (spot.Name == "water" && citizen is TrainingFishing)
                    {
                        Item item = new WaterHit(); item.MoveToWorld(spot.Location, spot.Map); item.Visible = false; item.Weight = -2.0;
                    }
                    else if (spot.Name == "knight" && citizen is Warriors)
                    {
                        Mobile knight = new Warriors(); knight.MoveToWorld(spot.Location, spot.Map); ((BaseCreature)knight).Home = spot.Location; ((BaseCreature)knight).RangeHome = 0; knight.OnAfterSpawn();
                    }
                }
            }
            //if ( !hasCitizen && spots.Name != "fighter" && spots.Name != "archer" ){ Console.WriteLine("" + spots.Name + " " + spots.X + ", " + spots.Y + ""); }
        }
Ejemplo n.º 13
0
 public void RemoveWarior(Warrior warrior)
 {
     Warriors.Remove(warrior);
 }
Ejemplo n.º 14
0
 public void AddWarior(Warrior warrior)
 {
     Warriors.Add(warrior);
 }