public static void DeductCost(GamePlayer Player, GameAction Action, MediaEvent Media) { Player.ThisRound.Money -= Action.MoneyCost; Player.ThisRound.TimeRemaining -= Action.TimeCost; }
public static bool CanUseBase(GamePlayer Player, GameAction Action, MediaEvent Media) { return(Player.ThisRound.Money >= Action.MoneyCost && Player.ThisRound.TimeRemaining >= Action.TimeCost); }
public static bool DidEvadeCriminalRisk(GamePlayer Player, GameAction Action) { return(Player.DidEvadeCriminalRisk(Action.RiskPercent)); }
public List <RoundAction> PossibleActions() { List <RoundAction> actions = new List <RoundAction>(); if (Dead) { return(actions); } // Add cancel actions for any partial projects. Number these options as -1, -2, -3... for tracking. int index = 1; foreach (PartialProject p in PartialProjects) { if (p.JailTime) { string action_s = p.QuartersRemaining == 1 ? "" : "s"; GameAction cancelAction = new GameAction() { Title = $"In Jail", Description = $"You're stuck here for another {p.QuartersRemaining} Quarter{action_s}", CostString = (Player, Action) => null, CommitAction = (Player, Action, Media) => { } }; actions.Add(new RoundAction(this, cancelAction, -index)); return(actions); // There can be no other actions in jail. } else { string action_s = p.QuartersRemaining == 1 ? "" : "s"; string remaining = $"{p.QuartersRemaining} Quarter{action_s} remaining. "; if (p.QuartersRemaining == 1) { remaining = "Completes this quarter. "; } GameAction cancelAction = new GameAction() { Title = $"Cancel '{p.Project.Title}'", Description = remaining + "Recover your time but lose all investment.", TimeCost = -p.Project.TimeCost, CancelTaskFor = p, CostString = (Player, Action) => null, BenefitString = (Player, Action) => $"Recover {GameFormat.FormatTime(p.Project.TimeCost)}", CommitAction = (Player, Action, Media) => { GameAction.DeductCost(Player, Action, Media); // Adds back the time because of TimeCost field manipulation above // Also remove this project from the partial project list Player.PartialProjects.Remove(Action.CancelTaskFor); } }; actions.Add(new RoundAction(this, cancelAction, -index)); } index++; } for (int i = 0; i < EngineData.Actions.Length; i++) { GameAction a = EngineData.Actions[i]; if (a.CanUseAction(this, a, null)) { actions.Add(new RoundAction(this, a, i)); } } return(actions); }