public void SetFrom(StatisticsSet other) { foreach (var lKey in other.mValuesByKey.Keys) { this.Set(lKey, other.GetDouble(lKey)); } }
public void FinializeDay(StatisticsSet dayStats) { this.Statistics.Increment(StatisticKeys.TotalDays); var lRemainingPollen = dayStats.GetDouble(StatisticKeys.RemainingPollen); var lCollectedPollen = dayStats.GetDouble(StatisticKeys.PollenCollected); var lSalvagedPollen = lRemainingPollen * this.Attributes.GetDouble(AttributeKeys.SalvageRate); var lTotalCollectedPollen = lCollectedPollen += lSalvagedPollen; this.Statistics.Increment(StatisticKeys.RemainingPollen, lTotalCollectedPollen); var lHoneyGenStats = this.Hive.GenerateHoney(this.Statistics, this.Attributes); this.Statistics.IncrementFrom(lHoneyGenStats); dayStats.SetFrom(lHoneyGenStats); dayStats.Set(StatisticKeys.SalvagedPollen, lSalvagedPollen); this.ChangeDayManager(); }
public StatisticsSet GenerateHoney(StatisticsSet stats, AttributeSet attributes) { var lPollenRequirement = attributes.GetDouble(AttributeKeys.PollenRequirement); var lMaximumBatchCount = Math.Floor(attributes.GetDouble(AttributeKeys.HoneyBatchCount)); var lTheoreticalBatchCount = Math.Floor(stats.GetDouble(StatisticKeys.RemainingPollen) / lPollenRequirement); var lBatchCount = (long)Math.Min(lMaximumBatchCount, lTheoreticalBatchCount); var lPollenRequired = lBatchCount * lPollenRequirement; var lHoneyGenerated = lBatchCount * attributes.GetDouble(AttributeKeys.HoneyYield); stats.Decrement(StatisticKeys.RemainingPollen, lPollenRequired); stats.Increment(StatisticKeys.HoneyAvailable, lHoneyGenerated); var lResult = StatisticsSet.CreateEmpty(); lResult.Set(StatisticKeys.HoneyBatchCount, lBatchCount); lResult.Set(StatisticKeys.PollenProcessed, lPollenRequired); lResult.Set(StatisticKeys.HoneyProduced, lHoneyGenerated); return(lResult); }
public void IncrementFrom(StatisticsSet other, string key) { this.Set(key, other.GetDouble(key)); }