private InfInt CalculateWaveHP(int dozen, int one, bool beforeFirstBoss) { _tempBigNumber.Set(1); for (int i = 0; i < dozen; i++) { _tempBigNumber.Multiply(_gameConfig.waveSettings.bossHPMultiplier); } if (beforeFirstBoss) { _tempBigNumber.Multiply(_gameConfig.waveSettings.firstWaveHP); } else { _tempBigNumber.Multiply(_gameConfig.waveSettings.firstBossHP); } _tmpBigNumber.Set(0); if (one > 1) { _tmpBigNumber.Set(_tempBigNumber); _tmpBigNumber.Multiply(one - 1); _tmpBigNumber.MultiplyInPercents(_gameConfig.waveSettings.waveMultiplier); } _tempBigNumber.Add(_tmpBigNumber); return(_tempBigNumber); }
static void Main(string[] args) { try { //InfInt test1 = new InfInt("400"); //InfInt test2 = new InfInt("1"); // InfInt test3 = new InfInt("1453242414"); Rational frac1 = new Rational(3, 18); Rational frac2 = new Rational(1, 7); //Console.WriteLine(frac1.ToString()); Console.WriteLine(frac2.RationalToDecimal()); Console.WriteLine($"subtract: {frac1 - frac2}"); //Console.WriteLine($"multiply: {frac1 * frac2}"); Console.WriteLine($"divide: {frac1 / frac2}"); InfInt test1 = new InfInt("40"); InfInt test2 = new InfInt("400"); InfInt test3 = new InfInt("1453242414"); infRational bigfrac = new infRational(test1, test2); infRational bigfrac2 = new infRational("23141", "312"); infRational bigfrac3 = new infRational("23141", "312"); Console.WriteLine($" Addition: {test1.Add(test2)}"); //Console.WriteLine($" subtraction: {test2.Subtract(test1)}"); //Console.WriteLine($"compareto: {test1.CompareTo(test2)}"); //Console.WriteLine($" divide: {test1.Divide(test2)}"); //Console.WriteLine($"multiply: {test1.Multiply(test2)}"); Console.WriteLine($"{bigfrac}"); Console.WriteLine($"{bigfrac2}"); Console.WriteLine($"{bigfrac2.CompareTo(bigfrac3)}"); } catch (DivideByZeroException e) { Console.WriteLine("Cannot Divide by zero"); } }
public InfInt GetSavedZombiesHP() { InfInt hp = new InfInt(); for (int i = 0; i < _zombies.Count; i++) { hp.Add(_zombies[i].HP); } return(hp); }
private void CalculateWaveHP(WaveType waveType) { if (_tutorialManager.ActiveTutorialStep.Action == TutorialAction.FirstWave || _tutorialManager.ActiveTutorialStep.Action == TutorialAction.SecondWave) { TutorialWaveSettings waveSettings = _tutorialManager.GetWave(); _currentWaveHP.Set(waveSettings.waveHP); _currentZombieCount = waveSettings.zombieCount; _currentDecadeZombieCount = _gameConfig.waveSettings.startZombieCount; _currentDecadeStartHP.Set(_gameConfig.waveSettings.firstWaveHP); return; } if (_tutorialManager.ActiveTutorialStep.Action == TutorialAction.ThirdWave || (WaveNumber == 1 && !_tutorialManager.IsTutorialEnabled)) { _currentZombieCount = _gameConfig.waveSettings.startZombieCount; _currentDecadeZombieCount = _gameConfig.waveSettings.startZombieCount; _currentWaveHP.Set(_gameConfig.waveSettings.firstWaveHP); _currentDecadeStartHP.Set(_gameConfig.waveSettings.firstWaveHP); return; } int firstBossWaveNumber = _gameConfig.waveSettings.firstBossWaveNumber; switch (waveType) { case WaveType.Boss: // босс волна _zombieCountBeforeBoss = _currentZombieCount; _currentZombieCount = 1; // босс всегда приходит один if (WaveNumber == firstBossWaveNumber) { _currentWaveHP.Set(_gameConfig.waveSettings.firstBossHP); } else { _currentWaveHP.Set(_currentDecadeStartHP); _currentWaveHP.Multiply(_gameConfig.waveSettings.bossHPMultiplier); } Debug.Log("BOSS wave = " + WaveNumber.ToString() + "; wave HP = " + _currentWaveHP.ToFullString() + "; zombie count = " + _currentZombieCount.ToString()); break; case WaveType.AfterBoss: _currentZombieCount = _zombieCountBeforeBoss; _currentDecadeZombieCount = _currentZombieCount; _currentDecadeStartHP.Set(_currentWaveHP); Debug.Log("AFTER BOSS wave = " + WaveNumber.ToString() + "; wave HP = " + _currentWaveHP.ToFullString() + "; zombie count = " + _currentZombieCount.ToString()); break; case WaveType.Test: _currentWaveHP.Set(_gameConfig.waveSettings.firstWaveHP); _currentDecadeStartHP.Set(_gameConfig.waveSettings.firstWaveHP); _zombieCountBeforeBoss = _gameConfig.waveSettings.startZombieCount; _currentZombieCount = _zombieCountBeforeBoss; _currentDecadeZombieCount = _gameConfig.waveSettings.startZombieCount; WaveNumber = _gameConfig.waveSettings.startWave; Debug.Log("TEST WAVE!"); break; case WaveType.TestBoss: _currentWaveHP.Set(_gameConfig.waveSettings.firstWaveHP); _currentDecadeStartHP.Set(_gameConfig.waveSettings.firstWaveHP); _zombieCountBeforeBoss = _gameConfig.waveSettings.startZombieCount; _currentZombieCount = 1; _currentDecadeZombieCount = _gameConfig.waveSettings.startZombieCount; WaveNumber = _gameConfig.waveSettings.startWave; Debug.Log("TEST BOSS WAVE!"); break; default: Debug.Log("prev wave hp = " + _currentWaveHP.ToString()); _tempBigNumber.Set(_currentDecadeStartHP); _tempBigNumber.MultiplyInPercents(_gameConfig.waveSettings.waveMultiplier); Debug.Log("temp big number = " + _tempBigNumber.ToString()); _currentWaveHP.Add(_tempBigNumber); Debug.Log("simple wave = " + WaveNumber.ToString() + "; wave HP = " + _currentWaveHP.ToFullString() + "; zombie count = " + _currentZombieCount.ToString()); break; } }