internal static void SetMinimumLoanAmount(long offset = 0) { var currentLoan = AICompany.GetLoanAmount(); if (currentLoan == 0) { return; } var interval = AICompany.GetLoanInterval(); var maxLoan = AICompany.GetMaxLoanAmount(); var currentMoney = AICompany.GetBankBalance(AICompany.COMPANY_SELF) - currentLoan; long loan = 0; while (((currentMoney + loan) < offset) && (loan < maxLoan)) { loan += interval; } if (loan != currentLoan) { AICompany.SetLoanAmount(loan); } }
internal static void EnsureMoney(long amount) { var currentLoan = AICompany.GetLoanAmount(); var interval = AICompany.GetLoanInterval(); var maxLoan = AICompany.GetMaxLoanAmount(); var currentMoney = AICompany.GetBankBalance(AICompany.COMPANY_SELF); var loan = currentLoan; while ((currentMoney < amount) && (loan < maxLoan)) { loan += interval; currentMoney += interval; } if (loan != currentLoan) { AICompany.SetLoanAmount(loan); } }