public int Calculate(ProvinceRevision revision, Buildings building)
        {
            var triple = new BuildingTriple(revision.Power, revision.CultureLevel, building);
            int turnsNeeded;
            if (turns.TryGetValue(triple, out turnsNeeded))
            {
                return turnsNeeded;
            }

            return 99;

            // TODO productionCapacity && productionCost should be removed.
            int capacity = productionCapacity.Calculate(revision);
            int cost = productionCost.Calculate(revision, building);

            return cost / capacity;
        }
 public int Calculate(ProvinceRevision revision, Buildings target)
 {
     switch (target)
     {
         case Buildings.Soldiers:
             return 5;
         case Buildings.Fortification:
             return 50;
         case Buildings.Farm:
             return (revision.FarmsCount + 1) * (revision.FarmsCount + 1);
         case Buildings.Culture:
             return 60;
         //                case Buildings.Unknown:
         //                    break;
         default:
             throw new ArgumentOutOfRangeException("target");
     }
 }
Пример #3
0
        internal Buildings GetNextBuilding(ProvinceRevision lastRevision, Buildings lastBuilt)
        {
            if (lastBuilt == Buildings.Soldiers)
            {
                if (lastRevision.FarmsCount == 1
                        && lastRevision.SoldiersCount == 2)
                {
                    return Buildings.Soldiers;
                }

                if (lastRevision.SoldiersCount < lastRevision.FarmsCount * 2)
                {
                    return Buildings.Soldiers;
                }

                return Buildings.Farm;
            }

            return lastBuilt;
        }
 public void Add(ProvinceRevision revision)
 {
     revisions.Add(revision);
 }