Exemplo n.º 1
0
 public void LogSurvivors()
 {
     foreach (T member in MembersAlive)
     {
         CombatLog.Save($"{member.Name} survived with {member.HitPoints:F2} hit points left.");
     }
 }
Exemplo n.º 2
0
 public void LogSurvivors()
 {
     foreach (Indian member in IndiansAlive)
     {
         CombatLog.Save(member.Name + " survived with " + member.HitPoints + " hit points left");
     }
 }
Exemplo n.º 3
0
        public double DealDamage()
        {
            double damage = 0.0;
            Weapon w      = _weapons.GetRandomWeapon();

            if (w != null)
            {
                damage = w.Damage * GetExperticeMultiplier(w.ID);
                CombatLog.Save($"{Name} dealt {damage:F2} damage with a {w.ID} {w.Type}");
            }

            return(damage);
        }
Exemplo n.º 4
0
        public void ReceiveDamage(double damagePoints)
        {
            if (damagePoints > 0)
            {
                _hitPoints = _hitPoints - damagePoints;
                CombatLog.Save($"{Name} receives {damagePoints:F2} damage, and is down to {_hitPoints:F2} hit points");

                if (Dead)
                {
                    CombatLog.Save("");
                    CombatLog.Save(Name + " died!");
                    CombatLog.Save("");
                }
            }
        }
Exemplo n.º 5
0
        public void ReceiveDamage(double damagePoints)
        {
            if (damagePoints > 0)
            {
                _hitPoints = _hitPoints - damagePoints;
                string message = Name + " receives " + damagePoints + " damage, and is down to " + _hitPoints + " hit points";
                CombatLog.Save(message);

                if (Dead)
                {
                    CombatLog.Save("");
                    CombatLog.Save(Name + " died!");
                    CombatLog.Save("");
                }
            }
        }
Exemplo n.º 6
0
        //private static void round_OnRoundExecution()
        //{
        //    Round.IsRunning = true;
        //    System.Threading.Thread.Sleep(20000);
        //    Round.IsRunning = false;
        //}
        private void round_OnRoundExecution()
        {
            Round.IsRunning = true;

            Game.Log.Clear();
            World davi = World.Load(1);
            World golias = World.Load(2);

            Attackers attackers = new Attackers();
            Defenders defenders = new Defenders();

            int number = 1;
            attackers.Units = new List<Unit>();
            Unit unit = null;
            Unit baseUnit = null;
            foreach (WorldUnits worldUnit in davi.Units)
            {
                baseUnit = Unit.Find(worldUnit.UnitId);
                if (baseUnit != null)
                {
                    for (int j = 0; j < worldUnit.Quantity; j++)
                    {
                        unit = (Unit)baseUnit.Clone();
                        unit.Number = number;
                        unit.PositionInCombat = Unit.CombatPosition.attacker;
                        attackers.Units.Add(unit);
                        number += 1;
                    }
                }
            }

            number = 1;
            defenders.Units = new List<Unit>();
            unit = null;
            baseUnit = null;
            foreach (WorldUnits worldUnit in golias.Units)
            {
                baseUnit = Unit.Find(worldUnit.UnitId);
                if (baseUnit != null)
                {
                    for (int j = 0; j < worldUnit.Quantity; j++)
                    {
                        unit = (Unit)baseUnit.Clone();
                        unit.Number = number;
                        unit.PositionInCombat = Unit.CombatPosition.defender;
                        defenders.Units.Add(unit);
                        number += 1;
                    }
                }
            }

            attackers.Units = Util.ScrambleList<Unit>(attackers.Units);
            defenders.Units = Util.ScrambleList<Unit>(defenders.Units);

            Hero hero = null;
            attackers.Heroes = new List<Hero>();
            hero = Hero.Find(davi.HeroId);
            hero.SetPowers();
            attackers.Heroes.Add(hero);
            defenders.Heroes = new List<Hero>();
            hero = Hero.Find(golias.HeroId);
            hero.SetPowers();
            defenders.Heroes.Add(hero);

            int turns = attackers.Units.Count.BiggerThan(defenders.Units.Count) ? attackers.Units.Count : defenders.Units.Count;
            int rounds = 1; //round will be always one! refactor later

            HeroesPowers(turns, attackers, defenders);

            int i = 1;
            while (i <= rounds && defenders.Units.Count + defenders.Heroes.Count > 0 && attackers.Units.Count + attackers.Heroes.Count > 0)
            {
                Game.Log.Add(string.Format("<h2>Round {0}</h2><p>Atacando: {1} unidades</p><p>Defendendo: {2} unidades</p>", i, attackers.Units.Count, defenders.Units.Count));
                Game.StartCombat(turns, attackers, defenders);

                #region LOG
                Game.Log.Add(attackers.PV());
                Game.Log.Add(defenders.PV());
                RoundReport(i, attackers, defenders);
                #endregion

                //#region RESET
                //generate.RoundResetUnitLives(attackers.Units);
                //generate.RoundResetUnitLives(defenders.Units);
                //attackers.ResetHeroes();
                //defenders.ResetHeroes();
                //#endregion

                turns = attackers.Units.Count.BiggerThan(defenders.Units.Count) ? attackers.Units.Count : defenders.Units.Count;
                HeroesPowers(turns, attackers, defenders);
                i++;
            }
            Round.IsRunning = false;
            CombatLog l = new CombatLog() { Log = string.Join("<br/>", Game.Log.ToArray()), CombatId = 1 };
            l.Save();
        }
Exemplo n.º 7
0
        public double DealDamage()
        {
            // Select weapon
            double damage = 0.0;
            int    weapon = NumberGenerator.Next(1, 9);

            if (weapon == 1 && _rifle1 != null)
            {
                damage = _rifle1.Damage * GetExperticeMultiplier("Krieghoff");
                CombatLog.Save(Name + " dealt " + damage + " damage with a Krieghoff rifle");
            }

            if (weapon == 2 && _rifle2 != null)
            {
                damage = _rifle2.Damage * GetExperticeMultiplier("Remington");
                CombatLog.Save(Name + " dealt " + damage + " damage with a Remington rifle");
            }

            if (weapon == 3 && _rifle3 != null)
            {
                damage = _rifle3.Damage * GetExperticeMultiplier("Winchester");
                CombatLog.Save(Name + " dealt " + damage + " damage with a Winchester rifle");
            }

            if (weapon == 4 && _gun1 != null)
            {
                damage = _gun1.Damage * GetExperticeMultiplier("Colt");
                CombatLog.Save(Name + " dealt " + damage + " damage with a Colt gun");
            }

            if (weapon == 5 && _gun2 != null)
            {
                damage = _gun2.Damage * GetExperticeMultiplier("RugerRevolver");
                CombatLog.Save(Name + " dealt " + damage + " damage with a RugerRevolver gun");
            }

            if (weapon == 6 && _gun3 != null)
            {
                damage = _gun3.Damage * GetExperticeMultiplier("SmithWesson");
                CombatLog.Save(Name + " dealt " + damage + " damage with a SmithWesson gun");
            }

            if (weapon == 7 && _knife1 != null)
            {
                damage = _knife1.Damage * GetExperticeMultiplier("BowieKnife");
                CombatLog.Save(Name + " dealt " + damage + " damage with a BowieKnife knife");
            }

            if (weapon == 8 && _knife2 != null)
            {
                damage = _knife2.Damage * GetExperticeMultiplier("DundeeKnife");
                CombatLog.Save(Name + " dealt " + damage + " damage with a DundeeKnife knife");
            }

            if (weapon == 9 && _knife3 != null)
            {
                damage = _knife3.Damage * GetExperticeMultiplier("GutterKnife");
                CombatLog.Save(Name + " dealt " + damage + " damage with a GutterKnife knife");
            }
            return(damage);
        }
Exemplo n.º 8
0
        public double DealDamage()
        {
            // Select weapon
            double damage = 0.0;
            int    weapon = NumberGenerator.Next(1, 9);

            if (weapon == 1 && _rifle1 != null)
            {
                damage = _rifle1.Damage * GetExperticeMultiplier("Krieghoff");
                CombatLog.Save(Name + " dealt " + damage + " damage with a Krieghoff rifle");
            }

            if (weapon == 2 && _rifle2 != null)
            {
                damage = _rifle2.Damage * GetExperticeMultiplier("Remington");
                CombatLog.Save(Name + " dealt " + damage + " damage with a Remington rifle");
            }

            if (weapon == 3 && _rifle3 != null)
            {
                damage = _rifle3.Damage * GetExperticeMultiplier("Winchester");
                CombatLog.Save(Name + " dealt " + damage + " damage with a Winchester rifle");
            }

            if (weapon == 4 && _bow1 != null)
            {
                damage = _bow1.Damage * GetExperticeMultiplier("JuniorBow");
                CombatLog.Save(Name + " dealt " + damage + " damage with a JuniorBow bow");
            }

            if (weapon == 5 && _bow2 != null)
            {
                damage = _bow2.Damage * GetExperticeMultiplier("LongBow");
                CombatLog.Save(Name + " dealt " + damage + " damage with a LongBow bow");
            }

            if (weapon == 6 && _bow3 != null)
            {
                damage = _bow3.Damage * GetExperticeMultiplier("StrikerBow");
                CombatLog.Save(Name + " dealt " + damage + " damage with a StrikerBow bow");
            }

            if (weapon == 7 && _axe1 != null)
            {
                damage = _axe1.Damage * GetExperticeMultiplier("Damascus");
                CombatLog.Save(Name + " dealt " + damage + " damage with a Damascus axe");
            }

            if (weapon == 8 && _axe2 != null)
            {
                damage = _axe2.Damage * GetExperticeMultiplier("DoubleAxe");
                CombatLog.Save(Name + " dealt " + damage + " damage with a DoubleAxe axe");
            }

            if (weapon == 9 && _axe3 != null)
            {
                damage = _axe3.Damage * GetExperticeMultiplier("Tomahawk");
                CombatLog.Save(Name + " dealt " + damage + " damage with a Tomahawk axe");
            }

            return(damage);
        }