Esempio n. 1
0
    private double GetEstimatedDamage(UnitStack attacker, UnitStack defender, Combat.TurnPhase phase)
    {
        int intPhase = (int)phase;

        if (attacker.GetAffectingSpells().Count == 0 && defender.GetAffectingSpells().Count == 0)
        {
            int attackerTypeId = attacker.GetUnitType().GetId();
            if (_expectedDamage.ContainsKey(attackerTypeId))
            {
                Dictionary <int, Dictionary <int, double> > attackerRecords = _expectedDamage[attackerTypeId];
                int defenderTypeId = defender.GetUnitType().GetId();
                if (attackerRecords.ContainsKey(defenderTypeId))
                {
                    Dictionary <int, double> defenderRecords = attackerRecords[defenderTypeId];
                    if (defenderRecords.ContainsKey(intPhase))
                    {
                        return(defenderRecords[intPhase]);
                    }
                }
            }
        }

        // "not found"
        return(-1);
    }
Esempio n. 2
0
 private void SetEstimatedDamage(UnitStack attacker, UnitStack defender, Combat.TurnPhase phase, double damage)
 {
     if (attacker.GetAffectingSpells().Count == 0 && defender.GetAffectingSpells().Count == 0)
     {
         int attackerTypeId = attacker.GetUnitType().GetId();
         if (!_expectedDamage.ContainsKey(attackerTypeId))
         {
             _expectedDamage[attackerTypeId] = new Dictionary <int, Dictionary <int, double> >();
         }
         int defenderTypeId = defender.GetUnitType().GetId();
         if (!_expectedDamage[attackerTypeId].ContainsKey(defenderTypeId))
         {
             _expectedDamage[attackerTypeId][defenderTypeId] = new Dictionary <int, double>();
         }
         _expectedDamage[attackerTypeId][defenderTypeId][(int)phase] = damage;
     }
     FileLogger.Trace("ESTIMATE", "Estimated damage of " + attacker.GetUnitType().GetName() +
                      " vs " + defender.GetUnitType().GetName() + " during " +
                      phase + " phase is " + damage);
 }