public void CompleteRound() { // Update tracking values LastRound = (PlayerValues)Values.Clone(); // LastRound = Values at the start of the previous round Values = (PlayerValues)ThisRound.Clone(); // Values = Values at the start of the current round. (only true during the round) // Track peak money, fans BestMoney = Math.Max(Values.Money, BestMoney); BestFans = Math.Max(Values.FanCount, BestFans); BestRank = Math.Min(Values.Rank, BestRank); WorkedDays += 90 - Values.TimeRemaining; LazyDays += Values.TimeRemaining; // Future: Update life expectancy based on stress. // Prepare for next round - Do this here, so we capture the partial project completion in the changes for next quarter. ThisRound = (PlayerValues)Values.Clone(); // Complete partial projects that are done. foreach (PartialProject p in PartialProjects) { if (p.JailTime) { JailQuarters++; } p.QuartersRemaining--; if (p.QuartersRemaining == 0) { // Complete the project if (p.JailTime) { // Get out of jail! InJail = false; } else { p.Project.FinalCompletion(this, p.Project, p.Media); } } } PartialProjects.RemoveAll((p) => p.QuartersRemaining == 0); // Keep track of old news for human players if (Human) { OldNews.InsertRange(0, GetPlayerNews()); if (OldNews.Count > 50) { OldNews.RemoveRange(50, OldNews.Count - 50); } } }
public void BeginRound() { if (LastRound == null) { LastRound = (PlayerValues)Values.Clone(); // First round only, as these aren't prepared ThisRound = (PlayerValues)Values.Clone(); } ThisRound.TimeRemaining = 90; // 90 days per quarter, roughly // Public perception wanders a bit ImproveSentiment(-0.01, 0.01, ref ThisRound.PublicSentiment); // Add fans based on public perception and existing fanbase double sentimentPercent = 0.05 * AffinityAsPercent(ThisRound.PublicSentiment); AddFans(sentimentPercent, sentimentPercent + 0.04, ref ThisRound.FanCount); // Make some money based on the size of the fanbase. double moneyPerFan = Parent.NextPercent(0.08, 0.28); long addMoney = (long)Math.Round(ThisRound.FanCount * moneyPerFan); ThisRound.Money += addMoney; // Add some decay to the number of fans double decayRate = 0.01; if (Dead) { decayRate = 0.04; } long lostFans = (long)Math.Round(ThisRound.FanCount * decayRate); ThisRound.FanCount -= lostFans; // If dead, decay sentiment if (Dead) { ThisRound.PublicSentiment = (int)Math.Round(ThisRound.PublicSentiment * 0.95); } // Deduct time for partial projects that are in progress. foreach (PartialProject p in PartialProjects) { if (p.Project != null) { int days = p.Project.TimeCost; ThisRound.TimeRemaining -= days; } } }
public object Clone() { PlayerValues newValues = (PlayerValues)this.MemberwiseClone(); return(newValues); }