Skip to content

Commit

Permalink
Merge pull request #130 from Die4Ever/develop v1.5.5 Beta
Browse files Browse the repository at this point in the history
v1.5.5 Beta
  • Loading branch information
Die4Ever authored Mar 25, 2021
2 parents b0eb36d + e70fef7 commit ae4308f
Show file tree
Hide file tree
Showing 25 changed files with 649 additions and 107 deletions.
58 changes: 58 additions & 0 deletions DXRBalance/DeusEx/Classes/DeusExMover.uc
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
class DeusExMover injects DeusExMover;

function TakeDamage(int Damage, Pawn instigatedBy, Vector hitlocation, Vector momentum, name damageType)
{
if (bDestroyed)
return;

if ((damageType == 'TearGas') || (damageType == 'PoisonGas') || (damageType == 'HalonGas'))
return;

if ((damageType == 'Stunned') || (damageType == 'Radiation'))
return;

if ((DamageType == 'EMP') || (DamageType == 'NanoVirus') || (DamageType == 'Shocked'))
return;

if (bBreakable)
{
// add up the damage
if (Damage >= minDamageThreshold)
doorStrength -= CalcDamage(Damage, damageType);
// else
// doorStrength -= Damage * 0.001; // damage below the threshold does 1/10th the damage

doorStrength = FClamp(doorStrength, 0.0, 1.0);
if (doorStrength ~= 0.0)
BlowItUp(instigatedBy);
}
}

function float CalcDamage(float Damage, name damageType)
{
if (Damage < minDamageThreshold) return 0;

if ((damageType == 'TearGas') || (damageType == 'PoisonGas') || (damageType == 'HalonGas'))
return 0;

if ((damageType == 'Stunned') || (damageType == 'Radiation'))
return 0;

if ((DamageType == 'EMP') || (DamageType == 'NanoVirus') || (DamageType == 'Shocked'))
return 0;

switch(ExplodeSound1) {
case Sound'DeusExSounds.Generic.GlassBreakLarge':
return Damage * 0.01;
case Sound'DeusExSounds.Generic.GlassBreakSmall':
return Damage * 0.01;
case Sound'DeusExSounds.Generic.WoodBreakSmall':
return Damage * 0.005;
case Sound'DeusExSounds.Generic.SmallExplosion1':
return Damage * 0.002;
default:
//log("WARNING: "$self$": CalcDamage unknown ExplodeSound1: "$ExplodeSound1);
return Damage * 0.002;
}
return Damage * 0.002;
}
31 changes: 28 additions & 3 deletions DXRFixes/DeusEx/Classes/FrobDisplayWindow.uc
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
class FrobDisplayWindow injects FrobDisplayWindow;

var localized string msgDamageThreshold;
var localized string msgShot;
var localized string msgShots;

function DrawWindow(GC gc)
{
Expand Down Expand Up @@ -283,7 +285,10 @@ function MoverDrawBars(GC gc, Mover m, float infoX, float infoY, float infoW, fl
local DeusExMover dxMover;
local string strInfo;
local color col;
local int numTools, numLines;
local int numTools, numLines, numShots;
local float damage;
local name damageType;
local DeusExWeapon w;
numLines = 4;
Expand All @@ -310,7 +315,25 @@ function MoverDrawBars(GC gc, Mover m, float infoX, float infoY, float infoW, fl
strInfo = numTools @ msgPicks;
}
gc.DrawText(infoX+(infoW-barLength-2), infoY+4+(infoH-8)/numLines, barLength, ((infoH-8)/numLines)-2, strInfo);
if ((dxMover != None) && dxMover.bLocked && dxMover.bBreakable)
{
w = DeusExWeapon(player.inHand);
if( w != None ) {
damageType = w.WeaponDamageType();
damage = dxMover.CalcDamage(w.GetDamage(), damageType) * w.GetNumHits();
if( damage > 0 ) {
numshots = int((dxMover.doorStrength / damage) + 0.99);
if( numshots == 1 )
strInfo = strInfo $ CR() $ numshots @ msgShot;
else
strInfo = strInfo $ CR() $ numshots @ msgShots;
} else {
strInfo = strInfo $ CR() $ msgInf @ msgShots;
}
}
}
gc.DrawText(infoX+(infoW-barLength-2), infoY+4+(infoH-8)/numLines, barLength, ((infoH-8)/numLines)*2-2, strInfo);
}
function DeviceDrawBars(GC gc, HackableDevices device, float infoX, float infoY, float infoW, float infoH)
Expand Down Expand Up @@ -344,5 +367,7 @@ function DeviceDrawBars(GC gc, HackableDevices device, float infoX, float infoY,
defaultproperties
{
msgDamageThreshold="Dmg Thresh:"
msgDamageThreshold="Min Dmg:"
msgShot="shot"
msgShots="shots"
}
56 changes: 56 additions & 0 deletions DXRFixes/DeusEx/Classes/MissionEndgame.uc
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
class MissionEndgame injects MissionEndgame;

function PostPostBeginPlay()
{
savedSoundVolume = SoundVolume;
Super.PostPostBeginPlay();
}

// ----------------------------------------------------------------------
// InitStateMachine()
// ----------------------------------------------------------------------

function InitStateMachine()
{
Super(MissionScript).InitStateMachine();

// Destroy all flags!
//if (flags != None)
// flags.DeleteAllFlags();

// Set the PlayerTraveling flag (always want it set for
// the intro and endgames)
flags.SetBool('PlayerTraveling', True, True, 0);
}

// ----------------------------------------------------------------------
// FirstFrame()
//
// Stuff to check at first frame
// ----------------------------------------------------------------------

function FirstFrame()
{
Super(MissionScript).FirstFrame();

endgameTimer = 0.0;

if (Player != None)
{
// Make sure all the flags are deleted.
//DeusExRootWindow(Player.rootWindow).ResetFlags();

// Start the conversation
if (localURL == "ENDGAME1")
Player.StartConversationByName('Endgame1', Player, False, True);
else if (localURL == "ENDGAME2")
Player.StartConversationByName('Endgame2', Player, False, True);
else if (localURL == "ENDGAME3")
Player.StartConversationByName('Endgame3', Player, False, True);

// turn down the sound so we can hear the speech
savedSoundVolume = SoundVolume;
SoundVolume = 32;
Player.SetInstantSoundVolume(SoundVolume);
}
}
12 changes: 9 additions & 3 deletions DXRModules/DeusEx/Classes/DXRAugmentations.uc
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ var config float max_aug_str;
function CheckConfig()
{
if( config_version < class'DXRFlags'.static.VersionToInt(1,4,8) ) {
min_aug_str = 0.5;
max_aug_str = 1.5;
min_aug_str = default.min_aug_str;
max_aug_str = default.max_aug_str;
}
Super.CheckConfig();
}
Expand Down Expand Up @@ -180,4 +180,10 @@ function string DescriptionLevel(Actor act, int i, out string word)
err("DescriptionLevel failed for aug "$a);
return "err";
}
}
}

defaultproperties
{
min_aug_str=0.5
max_aug_str=1.5
}
8 changes: 8 additions & 0 deletions DXRModules/DeusEx/Classes/DXRAutosave.uc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@ class DXRAutosave extends DXRBase transient;
var transient bool bNeedSave;
var config float save_delay;

function CheckConfig()
{
if( config_version < class'DXRFlags'.static.VersionToInt(1,4,8) ) {
save_delay = default.save_delay;
}
Super.CheckConfig();
}

function FirstEntry()
{
Super.FirstEntry();
Expand Down
25 changes: 23 additions & 2 deletions DXRModules/DeusEx/Classes/DXRCrowdControl.uc
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ function CheckConfig()
if ( crowd_control_addr=="" ) {
crowd_control_addr = "localhost";
}
if (numStupidQuestions == 0 ) {
if (numStupidQuestions == 0 || config_version < class'DXRFlags'.static.VersionToInt(1,5,5) ) {
InitStupidQuestions();
StupidQuestionsToSave();
SaveConfig();
Expand Down Expand Up @@ -241,7 +241,7 @@ function InitStupidQuestions() {
_StupidQuestions[numStupidQuestions].answers[1] = "Yes";
numStupidQuestions++;

_StupidQuestions[numStupidQuestions].Question = "Are Pop Tarts are a ravioli?";
_StupidQuestions[numStupidQuestions].Question = "Are Pop Tarts a ravioli?";
_StupidQuestions[numStupidQuestions].numAnswers = 2;
_StupidQuestions[numStupidQuestions].answers[0] = "No";
_StupidQuestions[numStupidQuestions].answers[1] = "Yes";
Expand Down Expand Up @@ -280,6 +280,27 @@ function getRandomQuestion(out string question, out int numAnswers,
ansThree = _StupidQuestions[curStupidQuestion].answers[2];
}

function IncHandledEffects()
{
local int numEffects;

numEffects = dxr.Player.FlagBase.GetInt('cc_numCCEffects');
dxr.Player.FlagBase.SetInt('cc_numCCEffects',numEffects+1,,999);
}

function AddDXRCredits(CreditsWindow cw)
{
local int numEffects;

numEffects = dxr.Player.FlagBase.GetInt('cc_numCCEffects');

if (numEffects>0) {
cw.PrintText("Number of Crowd Control Effects:"@numEffects);
cw.PrintLn();
}
}


function RunTests()
{
local DXRandoCrowdControlLink t;
Expand Down
47 changes: 43 additions & 4 deletions DXRModules/DeusEx/Classes/DXRFlags.uc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ class DXRFlags extends DXRBase transient;
var transient FlagBase f;

//rando flags
var int seed;
var int seed, playthrough_id;
var int flagsversion;//if you load an old game with a newer version of the randomizer, we'll need to set defaults for new flags
var int gamemode;//0=original, 1=rearranged, 2=horde, 3=kill bob page, 4=stick to the prod, 5=stick to the prod +, 6=how about some soy food
var int loadout;//0=none, 1=stick with the prod, 2=stick with the prod plus
Expand Down Expand Up @@ -93,6 +93,7 @@ function InitDefaults()
doormutuallyexclusive = 3;

seed = 0;
playthrough_id = class'DataStorage'.static._SystemTime(Level);
if( dxr != None ) RollSeed();
gamemode = 0;
loadout = 0;
Expand Down Expand Up @@ -141,6 +142,7 @@ function CheckConfig()

function LoadFlags()
{
local DataStorage ds;
local int stored_version;
info("LoadFlags()");

Expand Down Expand Up @@ -213,15 +215,24 @@ function LoadFlags()
loadout = f.GetInt('Rando_loadout');
newgameplus_loops = f.GetInt('Rando_newgameplus_loops');
}
if( stored_version >= VersionToInt(1,5,5) ) {
playthrough_id = f.GetInt('Rando_playthrough_id');
}

if(stored_version < flagsversion ) {
info("upgraded flags from "$stored_version$" to "$flagsversion);
SaveFlags();
} else if (stored_version > flagsversion ) {
warning("downgraded flags from "$stored_version$" to "$flagsversion);
SaveFlags();
}

LogFlags("LoadFlags");
dxr.Player.ClientMessage("Deus Ex Randomizer " $ VersionString() $ " seed: " $ seed $ ", difficulty: " $ dxr.Player.CombatDifficulty $ ", New Game+ Loops: "$newgameplus_loops$", flags: " $ FlagsHash() );
SetTimer(1.0, True);

ds = class'DataStorage'.static.GetObj(dxr.player);
if( ds != None ) ds.playthrough_id = playthrough_id;
}

function SaveFlags()
Expand All @@ -232,6 +243,8 @@ function SaveFlags()
f.SetInt('Rando_seed', seed,, 999);
dxr.seed = seed;

f.SetInt('Rando_playthrough_id', playthrough_id,, 999);

f.SetInt('Rando_version', flagsversion,, 999);
f.SetInt('Rando_gamemode', gamemode,, 999);
f.SetInt('Rando_loadout', loadout,, 999);
Expand Down Expand Up @@ -278,7 +291,16 @@ function SaveFlags()

function LogFlags(string prefix)
{
info(prefix$" - " $ VersionString() $ ", " $ "seed: "$seed$", difficulty: " $ dxr.Player.CombatDifficulty $ ", flagshash: " $ FlagsHash() $ ", " $ StringifyFlags() );
info(prefix$" - " $ VersionString() $ ", " $ "seed: "$seed$", difficulty: " $ dxr.Player.CombatDifficulty $ ", flagshash: " $ FlagsHash() $ ", playthrough_id: "$playthrough_id$", " $ StringifyFlags() );
}
function AddDXRCredits(CreditsWindow cw)
{
cw.PrintHeader("DXRFlags");
cw.PrintText(VersionString() $ ", " $ "seed: "$seed$", difficulty: " $ dxr.Player.CombatDifficulty $ ", flagshash: " $ FlagsHash() $ ", playthrough_id: "$playthrough_id);
cw.PrintText(StringifyFlags());
cw.PrintLn();
}
function string StringifyFlags()
Expand Down Expand Up @@ -324,12 +346,12 @@ static function string VersionToString(int major, int minor, int patch)
static function int VersionNumber()
{
return VersionToInt(1, 5, 4);
return VersionToInt(1, 5, 5);
}
static function string VersionString()
{
return VersionToString(1, 5, 5) $ " Alpha";
return VersionToString(1, 5, 5) $ " Beta";
}
function MaxRando()
Expand All @@ -340,6 +362,7 @@ function MaxRando()
function NewGamePlus()
{
local DeusExPlayer p;
local DataStorage ds;
if( flagsversion == 0 ) {
warning("NewGamePlus() flagsversion == 0");
LoadFlags();
Expand All @@ -348,6 +371,9 @@ function NewGamePlus()
info("NewGamePlus()");
seed++;
playthrough_id = class'DataStorage'.static._SystemTime(Level);
ds = class'DataStorage'.static.GetObj(dxr.player);
if( ds != None ) ds.playthrough_id = playthrough_id;
newgameplus_loops++;
p.CombatDifficulty *= 1.2;
minskill = minskill*1.2;// int *= float doesn't give as good accuracy as int = int*float
Expand Down Expand Up @@ -426,6 +452,7 @@ function ExtendedTests()
TestRngExp(25, 150, 100, i);
TestTime();
TestStorage();
}
function TestTime()
Expand Down Expand Up @@ -514,6 +541,18 @@ function TestTime()
ds.Destroy();
}
function TestStorage()
{
local DataStorage ds;
local int i;
ds = Spawn(class'DataStorage');
for(i=0;i <3 ;i++) {
ds.SetConfig(i, i);
testint( int(ds.GetConfigKey(i)), i, "GetConfigKey("$i$")");
}
ds.Destroy();
}
function TestRngExp(int minrange, int maxrange, int mid, float curve)
{
local int min, max, avg, lows, highs, mids, times;
Expand Down
Loading

0 comments on commit ae4308f

Please sign in to comment.