Ejemplo n.º 1
0
        public static UnitPower AttackPower(Army attackingArmy)
        {
            UnitPower result = new UnitPower();

            foreach (var kvp in attackingArmy)
            {
                switch (ArmyStats.UnitType[kvp.Key])
                {
                case UnitType.Infantry: result.Infantry += ArmyStats.AttackPower[kvp.Key] * kvp.Value; break;

                case UnitType.Cavalry: result.Cavalry += ArmyStats.AttackPower[kvp.Key] * kvp.Value; break;

                case UnitType.Archer: result.Archer += ArmyStats.AttackPower[kvp.Key] * kvp.Value; break;
                }
            }
            return(result);
        }
Ejemplo n.º 2
0
        public static UnitPower DefensePower(Army defendingArmy)
        {
            UnitPower result = new UnitPower();

            if (defendingArmy == null)
            {
                return(result);
            }

            foreach (var kvp in defendingArmy)
            {
                result.Infantry += ArmyStats.DefensePower[kvp.Key].Infantry * kvp.Value;
                result.Cavalry  += ArmyStats.DefensePower[kvp.Key].Cavalry * kvp.Value;
                result.Archer   += ArmyStats.DefensePower[kvp.Key].Archer * kvp.Value;
            }

            return(result);
        }