/* * public double X2Profit { * get { * int countOfValidBonuses = x2ProfitBonuses.Count(date => date > Services.TimeService.Now); * return (countOfValidBonuses > 0) ? countOfValidBonuses * 2 : 1; * } * } * * public double X2Time { * get { * int countOfValidBonuses = x2TimeBonuses.Count(date => date > Services.TimeService.Now); * return (countOfValidBonuses > 0) ? countOfValidBonuses * 2 : 1.0; * } * }*/ public void ClearExpiredBoosts(int currentTime) { ProfitBoosts.ClearExpired(currentTime); TimeBoosts.ClearExpired(currentTime); foreach (var gen in generatorList) { gen.ClearExpiredBoosts(currentTime); } }
public void Clear() { foreach (var generator in Generators) { generator.Value.ClearExceptPermanents(); generator.Value.DropAutomatic(); } ProfitBoosts.ClearTemp(); TimeBoosts.ClearTemp(); }
public void ResetByPlanets() { foreach (var generator in Generators) { generator.Value.ClearExceptPermanents(); generator.Value.DropAutomatic(); generator.Value.ClearBoostsByPlanet(); generator.Value.ResetByPlanets(); } ProfitBoosts.ClearTemp(); TimeBoosts.ClearTemp(); ProfitBoosts.ClearTimed(); TimeBoosts.ClearTimed(); }
/// <summary> /// Remove boosts of type sourceType from global collection and from generators /// </summary> /// <param name="sourceType">Type of boost to remove</param> /// <returns>Total count of removed boosts</returns> public int RemoveTypedBoosts(BoostSourceType sourceType) { int globalProfitCount = ProfitBoosts.Remove(sourceType); int globalTimeCount = TimeBoosts.Remove(sourceType); int generatorCount = 0; foreach (var kvp in Generators) { generatorCount += kvp.Value.RemoveProfitBoosts(sourceType); generatorCount += kvp.Value.RemoveTimeBoosts(sourceType); } return(generatorCount + globalProfitCount + globalTimeCount); }
public void ResetByInvestors() { foreach (var generator in Generators) { generator.Value.ClearExceptPermanents(true); generator.Value.ClearBoostsByInvestors(); //generator.Value.ClearTimedBoosts(); generator.Value.ResetByInvestors(); } ProfitBoosts.ClearTemp(); TimeBoosts.ClearTemp(); ProfitBoosts.ClearTimed(); TimeBoosts.ClearTimed(); }
public GeneratorInfoSave GetSave() { return(new GeneratorInfoSave { generatorId = GeneratorId, isResearched = IsResearched, isEnhanced = IsEnhanced, generateTimer = GenerateTimer, isGenerationStarted = IsGenerationStarted, isAutomatic = IsAutomatic, state = (int)State, buyCountButtonState = BuyCountButtonState, profitBoosts = ProfitBoosts.GetSave(), timeBoosts = TimeBoosts.GetSave() }); }
public override string ToString() { StringBuilder sb = new StringBuilder(); sb.AppendLine("GLOBAL PROFIT BOOSTS =>"); sb.AppendLine(ProfitBoosts.ToString()); sb.AppendLine(); sb.AppendLine("GLOBAL TIME BOOSTS =>"); sb.AppendLine(TimeBoosts.ToString()); sb.AppendLine("--------------------"); Generators.Values.ToList().ForEach(g => { sb.AppendLine(g.ToString()); }); return(sb.ToString()); }
public void ResetFull() { ClearGenerators(); ProfitBoosts.ClearTemp(); TimeBoosts.ClearTemp(); }
public bool RemoveProfitBoost(string boostId) => ProfitBoosts.Remove(boostId);
public void AddProfitBoost(BoostInfo boost) => ProfitBoosts.Add(boost);
public void ClearBoostsByPlanet() { ProfitBoosts.ClearTemp(); TimeBoosts.ClearTemp(); IsEnhanced = false; }
//public void ClearTimedBoosts() { // ProfitBoosts.ClearTimed(); // TimeBoosts.ClearTimed(); //} public void ClearBoostsByInvestors() { ProfitBoosts.ClearTemp(); TimeBoosts.ClearTemp(kEnhanceBoostName); }
public double GetProfitBoostValue(string boostId) => ProfitBoosts.GetBoostValue(boostId);
public int RemoveProfitBoosts(BoostSourceType sourceType) => ProfitBoosts.Remove(sourceType);
public void ClearExpiredBoosts(int currentTime) { ProfitBoosts.ClearExpired(currentTime); TimeBoosts.ClearExpired(currentTime); }