Exemple #1
0
        public void Upgrade(MetricUpgrade upgrade_)
        {
            if (!temporaryUpgradeMap.ContainsKey(upgrade_))
            {
                temporaryUpgradeMap.Add(upgrade_, 0);
            }

            var metricUpgrade    = skillUpgrade[upgrade_.Metric];
            var temporaryUpgrade = temporaryUpgradeMap[upgrade_];
            var temporaryLevel   = metricUpgrade.Level + temporaryUpgrade;

            if (metricUpgrade.Level < 0 && temporaryUpgrade == 0)
            {
                throw new WestException("Tried upgrading a skill the wrong way");
            }

            if (MetricUpgrade.WeightedLevel(temporaryLevel, 1) >= 1.0f)
            {
                throw new WestException("Tried upgrading a capped metric");
            }

            if (metricUpgrade.Level >= 0 && OverallWeight() >= 1.0f)
            {
                throw new WestException("Tried upgrading a capped skill");
            }

            if (temporaryLevel >= 0 && SpecializationPoints() == 0)
            {
                throw new WestException("No more spec poitns to spend");
            }

            pointsSpent += (temporaryLevel >= 0) ? 1 : -1;
            ++temporaryUpgradeMap[upgrade_];
            SkillSpecialized();
        }
Exemple #2
0
 public double WeightedLevel(MetricUpgrade upgrade_)
 {
     if (temporaryUpgradeMap.ContainsKey(upgrade_))
     {
         return(MetricUpgrade.WeightedLevel(temporaryUpgradeMap[upgrade_] + upgrade_.Level, 1));
     }
     return(upgrade_.WeightedLevel());
 }