/// <summary> /// Steals half of the current treasury funds to the players private Swiss bank account. /// </summary> /// <returns>The details of the bank transfer consisting of the previous treasury balance and the amount stolen.</returns> public SwissBankAccountTransfer TransferToSwissBankAccount() { int treasuryPreviousBalance = GetTreasuryBalance(); int amountStolen = treasuryPreviousBalance / 2; if (amountStolen > 0) { if (!HasSwissBankAccount()) { OpenSwissBankAccount(); } ChangeTreasuryBalance(-amountStolen); DepositToSwissBankAccount(amountStolen); } // TODO: confirm logic when amount can't be transfer, for example when treasury is bankrupt var swissBankAccountTransfer = new SwissBankAccountTransfer() { AmountStolen = amountStolen, TreasuryPreviousBalance = treasuryPreviousBalance }; return(swissBankAccountTransfer); }
/// <summary> /// Attempts to process the selected presidential decision taking into account the non-standard decisions such as loan /// increase bodyguard and transfer to Swiss bank account. /// </summary> /// <param name="decision"></param> /// <returns><c>true</c> if a decision has been chosen and executed; otherwise, <c>false</c>.</returns> private bool TryProcessSelectedDecision(Decision decision) { bool hasDecisionBeenCompleted = false; if (decision.DecisionSubType == DecisionSubType.TransferToSwissAccount) { SwissBankAccountTransfer transfer = engine.TransferToSwissBankAccount(); Account account = engine.GetAccount(); userInterface.DisplayTransferToSwissBankAccount(transfer, account); hasDecisionBeenCompleted = true; } else if (decision.DecisionSubType == DecisionSubType.AskForAmericanLoan) { AskForLoan(LenderCountry.America); hasDecisionBeenCompleted = true; } else if (decision.DecisionSubType == DecisionSubType.AskForRussianLoan) { AskForLoan(LenderCountry.Russia); hasDecisionBeenCompleted = true; } else { if (DoesPlayerAcceptAdvice()) { userInterface.DisplayAdviceScreen(decision); } if (DoesPlayerConfirmDecision(decision)) { if (decision.DecisionSubType == DecisionSubType.IncreaseBodyGuard) { engine.IncreaseBodyguard(); } else { if (decision.DecisionSubType == DecisionSubType.PurchaseHelicopter) { engine.PurchasedHelicopter(); } engine.MarkDecisionAsUsed(decision.Text); } engine.ApplyDecisionEffects(decision); hasDecisionBeenCompleted = true; } } return(hasDecisionBeenCompleted); }
/// <summary> /// Displays the screen. /// </summary> /// <param name="swissBankAccountTransfer">The details of the Swiss account transfer.</param> /// <param name="account">The current treasury and costs information.</param> public void Show(SwissBankAccountTransfer swissBankAccountTransfer, Account account) { Console.BackgroundColor = ConsoleColor.DarkYellow; Console.ForegroundColor = ConsoleColor.Black; ConsoleEx.Clear(); ConsoleEx.WriteAt(1, 4, "TRANSFER to a SWISS BANK ACCOUNT", ConsoleColor.Black, ConsoleColor.DarkYellow); if (swissBankAccountTransfer.AmountStolen > 0) { ConsoleEx.WriteAt(1, 7, $"The TREASURY held ${swissBankAccountTransfer.TreasuryPreviousBalance},000"); ConsoleEx.WriteAt(1, 10, $"${swissBankAccountTransfer.AmountStolen},000 has been TRANSFERRED"); } else { ConsoleEx.WriteAt(8, 11, "NO TRANSFER made"); // TODO: fix placement } accountControl.Show(account); pressAnyKeyControl.Show(); }
public void DisplayTransferToSwissBankAccount(SwissBankAccountTransfer swissBankAccountTransfer, Account account) => transferToSwissBankAccountScreen.Show(swissBankAccountTransfer, account);