diff --git a/DXRCore/DeusEx/Classes/DXRMenuSetupRando.uc b/DXRCore/DeusEx/Classes/DXRMenuSetupRando.uc index b94f6f7ce..c71854c62 100644 --- a/DXRCore/DeusEx/Classes/DXRMenuSetupRando.uc +++ b/DXRCore/DeusEx/Classes/DXRMenuSetupRando.uc @@ -80,6 +80,9 @@ function BindControls(optional string action) EnumOption("Pause", 1, f.settings.menus_pause); EnumOption("Don't Pause", 0, f.settings.menus_pause); + NewMenuItem("New Game+ Scaling %", "Scales the curve of New Game+ changes over successive loops."); + Slider(f.moresettings.newgameplus_curve_scalar, 0, 200); + NewGroup("Bingo"); NewMenuItem("Bingo Win", "How many completed lines to instantly win"); diff --git a/DXRModules/DeusEx/Classes/DXRFlags.uc b/DXRModules/DeusEx/Classes/DXRFlags.uc index 5fa2e9557..8d5116615 100644 --- a/DXRModules/DeusEx/Classes/DXRFlags.uc +++ b/DXRModules/DeusEx/Classes/DXRFlags.uc @@ -176,6 +176,7 @@ function CheckConfig() difficulty_settings[i].energy = 200; difficulty_settings[i].starting_map = 0; more_difficulty_settings[i].grenadeswap = 100; + more_difficulty_settings[i].newgameplus_curve_scalar = 100; i++; #endif @@ -246,6 +247,7 @@ function CheckConfig() difficulty_settings[i].energy = 100; difficulty_settings[i].starting_map = 0; more_difficulty_settings[i].grenadeswap = 100; + more_difficulty_settings[i].newgameplus_curve_scalar = 100; i++; #ifdef hx @@ -315,6 +317,7 @@ function CheckConfig() difficulty_settings[i].energy = 100; difficulty_settings[i].starting_map = 0; more_difficulty_settings[i].grenadeswap = 100; + more_difficulty_settings[i].newgameplus_curve_scalar = 100; i++; #ifdef hx @@ -384,6 +387,7 @@ function CheckConfig() difficulty_settings[i].energy = 100; difficulty_settings[i].starting_map = 0; more_difficulty_settings[i].grenadeswap = 100; + more_difficulty_settings[i].newgameplus_curve_scalar = 100; i++; #ifdef hx @@ -453,6 +457,7 @@ function CheckConfig() difficulty_settings[i].energy = 80; difficulty_settings[i].starting_map = 0; more_difficulty_settings[i].grenadeswap = 100; + more_difficulty_settings[i].newgameplus_curve_scalar = 100; i++; for(i=0; i 0) { // rollback settings to the default for the current difficulty // we only want to do this on maxrando because we want to retain the user's custom choices + bingo_win = settings.bingo_win; + bingo_freespaces = settings.bingo_freespaces; + newgameplus_curve_scalar = moresettings.newgameplus_curve_scalar; SetDifficulty(difficulty); ExecMaxRando(); + settings.bingo_win = bingo_win; + settings.bingo_freespaces = bingo_freespaces; + moresettings.newgameplus_curve_scalar = newgameplus_curve_scalar; + // increase difficulty on each flag like exp = newgameplus_loops; x *= 1.2 ^ exp; exp = newgameplus_loops; } + dxr.SetSeed(dxr.Crc("NG+ curve tweak " $ (seed - newgameplus_loops))); + p.CombatDifficulty = DXRFlags(self).GetDifficulty(difficulty).CombatDifficulty; + + p.CombatDifficulty = NewGamePlusVal(p.CombatDifficulty, 1.3, exp, 0, 15); // Anything over 15 is kind of unreasonably impossible + settings.minskill = NewGamePlusVal(settings.minskill, 1.1, exp, 10, 400); + settings.maxskill = NewGamePlusVal(settings.maxskill, 1.1, exp, 10, 700); + settings.enemiesrandomized = NewGamePlusVal(settings.enemiesrandomized, 1.2, exp, 10, 1000); + settings.enemystats = NewGamePlusVal(settings.enemystats, 1.2, exp, 5, 100); + settings.hiddenenemiesrandomized = NewGamePlusVal(settings.hiddenenemiesrandomized, 1.2, exp, 10, 1000); + settings.ammo = NewGamePlusVal(settings.ammo, 0.9, exp, 5, 100); + settings.medkits = NewGamePlusVal(settings.medkits, 0.9, exp, 5, 100); + settings.multitools = NewGamePlusVal(settings.multitools, 0.9, exp, 5, 100); + settings.lockpicks = NewGamePlusVal(settings.lockpicks, 0.9, exp, 5, 100); + settings.biocells = NewGamePlusVal(settings.biocells, 0.9, exp, 5, 100); + settings.medbots = NewGamePlusVal(settings.medbots, 0.9, exp, 3, 100); + settings.repairbots = NewGamePlusVal(settings.repairbots, 0.9, exp, 3, 100); + settings.turrets_add = NewGamePlusVal(settings.turrets_add, 1.3, exp, 3, 1000); + settings.merchants = NewGamePlusVal(settings.merchants, 0.9, exp, 5, 100); + SetGlobalSeed("NewGamePlus"); - p.CombatDifficulty=FClamp(p.CombatDifficulty*1.3,0,15); //Anything over 15 is kind of unreasonably impossible - NewGamePlusVal(settings.minskill, 1.1, exp, 10, 400); - NewGamePlusVal(settings.maxskill, 1.1, exp, 10, 700); - NewGamePlusVal(settings.enemiesrandomized, 1.2, exp, 10, 1000); - NewGamePlusVal(settings.enemystats, 1.2, exp, 5, 100); - NewGamePlusVal(settings.hiddenenemiesrandomized, 1.2, exp, 10, 1000); - NewGamePlusVal(settings.ammo, 0.9, exp, 5, 100); - NewGamePlusVal(settings.medkits, 0.9, exp, 5, 100); - NewGamePlusVal(settings.multitools, 0.9, exp, 5, 100); - NewGamePlusVal(settings.lockpicks, 0.9, exp, 5, 100); - NewGamePlusVal(settings.biocells, 0.9, exp, 5, 100); - NewGamePlusVal(settings.medbots, 0.9, exp, 3, 100); - NewGamePlusVal(settings.repairbots, 0.9, exp, 3, 100); - NewGamePlusVal(settings.turrets_add, 1.3, exp, 3, 1000); - NewGamePlusVal(settings.merchants, 0.9, exp, 5, 100); - settings.bingo_win = bingo_win; - settings.bingo_freespaces = bingo_freespaces; if (randomStart!=0){ settings.starting_map = class'DXRStartMap'.static.ChooseRandomStartMap(self, randomStart); } @@ -340,42 +348,49 @@ simulated function MaxRandoValPair(out int min, out int max) } } -function NewGamePlusVal(out int val, float curve, float exp, int min, int max) +function float NewGamePlusVal(float val, float curve, float exp, float min, float max) { - val = val * (curve ** exp);// int *= float doesn't give as good accuracy as int = int*float - val = Self.Min(val, max); - val = Self.Max(val, min); + local bool increases; + local float tweak; + + increases = curve > 1.0; + + tweak = rngfn() * 0.045; + curve = 1.0 + ((curve - 1.0) * float(moresettings.newgameplus_curve_scalar) / 100.0) + tweak; + if (increases) { + curve = FMax(curve, 1.02); + } else { + curve = FMin(curve, 0.98); + } + val = val * curve ** exp; + + return FClamp(val, min, max); } function ExtendedTests() { local int val, i, oldSeed; + local float fval; local string s; Super.ExtendedTests(); - val = 5; - NewGamePlusVal(val, 1.2, 3, 1, 100); + val = NewGamePlusVal(5, 1.2, 3, 1, 100); testint(val, 8, "NewGamePlusVal 1.2 goes up"); - val = 5; - NewGamePlusVal(val, 0.8, 3, 1, 100); + val = NewGamePlusVal(5, 0.8, 3, 1, 100); testint(val, 2, "NewGamePlusVal 1.2 goes down"); - val = 5; - NewGamePlusVal(val, 0.8, 3, 5, 100); + val = NewGamePlusVal(5, 0.8, 3, 5, 100); testint(val, 5, "NewGamePlusVal with minimum stays the same"); // can't explain that! - val = 5; - NewGamePlusVal(val, 1.2, 3, 1, 5); + val = NewGamePlusVal(5, 1.2, 3, 1, 5); testint(val, 5, "NewGamePlusVal 1.2 with maximum"); - val = 0; - NewGamePlusVal(val, 1.2, 3, -10, 100); + val = NewGamePlusVal(0, 1.2, 3, -10, 100); testint(val, 0, "NewGamePlusVal 1.2 val==0"); - val = -5; - NewGamePlusVal(val, 1.2, 3, -6, 100); + val = NewGamePlusVal(-5, 1.2, 3, -6, 100); testint(val, -6, "NewGamePlusVal 1.2 negative value"); oldSeed = dxr.seed; @@ -386,4 +401,14 @@ function ExtendedTests() } test(true, "DXRStartMap " $ s); dxr.seed = oldSeed; + + oldSeed = dxr.SetSeed(9876); // first two rngfn values are: 0.759380, -0.177720 + + fval = NewGamePlusVal(50.0, 0.99, 3, 0, 100); + test(fval < 50.0, "NewGamePlusVal doesn't switch from decreasing to increasing"); + + fval = NewGamePlusVal(50.0, 1.01, 3, 0, 100); + test(fval > 50.0, "NewGamePlusVal doesn't switch from increasing to decreasing"); + + dxr.SetSeed(oldSeed); } diff --git a/DeusEx.u b/DeusEx.u index 6a533e91e..51b37ec3d 100644 Binary files a/DeusEx.u and b/DeusEx.u differ