Esempio n. 1
0
        /// <summary>
        /// Berechnet die Kosten anhand der übergebenen Ameise.
        /// </summary>
        /// <param name="ant">Die Ameise</param>
        public static double calculateCost(Ant ant)
        {
            if (ant.ViewRange < VIEWRANGE_MIN || ant.ViewRange > VIEWRANGE_MAX) {
                throw new ArgumentException(String.Format(Messages.ERROR_INVALID_VALUE, ant.ViewRange, Messages.VIEWRANGE, VIEWRANGE_MIN, VIEWRANGE_MAX));
            }

            if (ant.isCarry()) {
                return calculateCostCarry(ant.ViewRange, ant.MoveRangeFactor, ant.MaxInventory, ant.Health, ant.Owner.AI.Playername);
            } else if (ant.isScout()) {
                return calculateCostScout(ant.ViewRange, ant.MoveRangeFactor, ant.MaxInventory, ant.Health, ant.Owner.AI.Playername);
            } else if (ant.isWarrior()) {
                return calculateCostWarrior((ant as Warrior).AttackPower, ant.ViewRange, ant.MoveRangeFactor, ant.MaxInventory, ant.Health, ant.Owner.AI.Playername);
            }
            throw new RuntimeException("Unknown ant type.");
        }
Esempio n. 2
0
 /// <summary>
 /// Erhöht die Anzahl der Ameisen eines Ameisentyps um eins.
 /// </summary>
 /// <param name="ant">Die neue Ameise.</param>
 public void incrementAnts(Ant ant)
 {
     AntCount++;
     if (ant.isCarry()) {
         CarryCount++;
     } else if (ant.isScout()) {
         ScoutCount++;
     } else if (ant.isWarrior()) {
         WarriorCount++;
     } else {
         throw new RuntimeException("Unknown ant type.");
     }
 }
Esempio n. 3
0
 /// <summary>
 /// Verringert die Anzahl der Ameisen eines Ameisentyps um eins.
 /// </summary>
 /// <param name="ant">Die zu verringernde Ameise.</param>
 public void decreaseAnts(Ant ant)
 {
     DeathCount++;
     AntCount--;
     if (ant.isCarry()) {
         CarryCount--;
     } else if (ant.isScout()) {
         ScoutCount--;
     } else if (ant.isWarrior()) {
         WarriorCount--;
     } else {
         throw new RuntimeException("Unknown ant type.");
     }
 }