Skip to content

Commit

Permalink
Merge pull request #132 from Die4Ever/develop
Browse files Browse the repository at this point in the history
v1.5.5
  • Loading branch information
Die4Ever authored Mar 27, 2021
2 parents ae4308f + a01d119 commit 539eb69
Show file tree
Hide file tree
Showing 22 changed files with 379 additions and 60 deletions.
2 changes: 1 addition & 1 deletion DXRBalance/DeusEx/Classes/DeusExMover.uc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class DeusExMover injects DeusExMover;
class DeusExMover merges DeusExMover;

function TakeDamage(int Damage, Pawn instigatedBy, Vector hitlocation, Vector momentum, name damageType)
{
Expand Down
30 changes: 30 additions & 0 deletions DXRFixes/DeusEx/Classes/FixLoadGameSort.uc
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
class FixLoadGameSort injects MenuScreenLoadGame;
// https://github.com/Die4Ever/deus-ex-randomizer/issues/133

function CreateGamesList()
{
Super.CreateGamesList();
lstGames.SetColumnType(2, COLTYPE_String);
}

function AddSaveRow(DeusExSaveInfo saveInfo, int saveIndex)
{
if (saveInfo != None)
{
lstGames.AddRow( saveInfo.Description $ ";" $
BuildTimeStringFromInfo(saveInfo) $ ";" $
BuildTimeStringSeconds(saveInfo) $ ";" $
BuildTimeStringFromInfo(saveInfo) $ ";" $
String(saveInfo.DirectoryIndex));
}
}
function String BuildTimeStringSeconds(DeusExSaveInfo s)
{
local String retValue;
retValue = s.Year $"-"$ TwoDigits(s.Month) $"-"$ TwoDigits(s.Day);
retValue = retValue @ TwoDigits(s.Hour) $ ":" $ TwoDigits(s.Minute) $ ":" $ TwoDigits(s.Second);

return retValue;
}
20 changes: 17 additions & 3 deletions DXRFixes/DeusEx/Classes/FrobDisplayWindow.uc
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,15 @@ function DrawWindowBase(GC gc, actor frobTarget)
gc.DrawBox(infoX+1, infoY+1, infoW-2, infoH-2, 0, 0, 1, Texture'Solid');
}

function int Ceil(float f)
{
local int ret;
ret = f;
if( float(ret) < f )
ret++;
return ret;
}

function string GetStrInfo(Actor a)
{
if ( Mover(a) != None )
Expand Down Expand Up @@ -289,6 +298,7 @@ function MoverDrawBars(GC gc, Mover m, float infoX, float infoY, float infoW, fl
local float damage;
local name damageType;
local DeusExWeapon w;
local float lockStrength;
numLines = 4;
Expand All @@ -308,7 +318,8 @@ function MoverDrawBars(GC gc, Mover m, float infoX, float infoY, float infoW, fl
// draw the absolute number of lockpicks on top of the colored bar
if ((dxMover != None) && dxMover.bLocked && dxMover.bPickable)
{
numTools = int((dxMover.lockStrength / player.SkillSystem.GetSkillLevelValue(class'SkillLockpicking')) + 0.99);
lockStrength = Ceil(dxMover.lockStrength*100)/100.0;
numTools = Ceil((lockStrength / player.SkillSystem.GetSkillLevelValue(class'SkillLockpicking')));
if (numTools == 1)
strInfo = numTools @ msgPick;
else
Expand All @@ -322,7 +333,7 @@ function MoverDrawBars(GC gc, Mover m, float infoX, float infoY, float infoW, fl
damageType = w.WeaponDamageType();
damage = dxMover.CalcDamage(w.GetDamage(), damageType) * w.GetNumHits();
if( damage > 0 ) {
numshots = int((dxMover.doorStrength / damage) + 0.99);
numshots = Ceil((dxMover.doorStrength / damage));
if( numshots == 1 )
strInfo = strInfo $ CR() $ numshots @ msgShot;
else
Expand All @@ -340,6 +351,7 @@ function DeviceDrawBars(GC gc, HackableDevices device, float infoX, float infoY,
{
local string strInfo;
local int numTools, numLines;
local float hackStrength;
local color col;
numLines = 2;
Expand All @@ -356,7 +368,9 @@ function DeviceDrawBars(GC gc, HackableDevices device, float infoX, float infoY,
// draw the absolute number of multitools on top of the colored bar
if ((device.bHackable) && (device.hackStrength != 0.0))
{
numTools = int((device.hackStrength / player.SkillSystem.GetSkillLevelValue(class'SkillTech')) + 0.99);
// due to the way HackableDevices uses a timer, it seems to use very slightly more tools than it's supposed to sometimes, rounding up to the next 100th of a hackStrength
hackStrength = Ceil(device.hackStrength*100)/100.0;
numTools = Ceil((hackStrength / player.SkillSystem.GetSkillLevelValue(class'SkillTech')));
if (numTools == 1)
strInfo = numTools @ msgTool;
else
Expand Down
9 changes: 5 additions & 4 deletions DXRFixes/DeusEx/Classes/ScriptedPawn.uc
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
class ScriptedPawn merges ScriptedPawn;
// doesn't work with injects due to use of Self
function Carcass SpawnCarcass()

function PlayDying(name damageType, vector hitLoc)
{
local Inventory item, nextItem;
local bool gibbed, drop, melee;
Expand All @@ -13,11 +14,11 @@ function Carcass SpawnCarcass()
melee = item.IsA('WeaponProd') || item.IsA('WeaponBaton') || item.IsA('WeaponCombatKnife') || item.Isa('WeaponCrowbar') || item.IsA('WeaponNanoSword') || item.Isa('WeaponSword');
drop = (item.IsA('NanoKey') && gibbed) || (melee && !gibbed);//don't give the melee weapon if we're getting gibbed, that would make the game easier and this is supposed to be a QoL change not a balance change
if( drop ) {
DeleteInventory(item);
item.DropFrom(Location);
class'DXRActorsBase'.static.ThrowItem(self, item);
item.Velocity *= vect(-1, -1, 1.3);
}
item = nextItem;
}

return _SpawnCarcass();
_PlayDying(damageType, hitLoc);
}
3 changes: 2 additions & 1 deletion DXRModules/DeusEx/Classes/DXRAugmentations.uc
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,10 @@ function RandomizeAugCannisters()

function static RandomizeAugCannister(DXRando dxr, AugmentationCannister a)
{
local int attempts;
a.AddAugs[0] = PickRandomAug(dxr);
a.AddAugs[1] = a.AddAugs[0];
while( a.AddAugs[1] == a.AddAugs[0] )
for( attempts = 0; attempts<100 && a.AddAugs[1] == a.AddAugs[0]; attempts++ )
{
a.AddAugs[1] = PickRandomAug(dxr);
}
Expand Down
23 changes: 23 additions & 0 deletions DXRModules/DeusEx/Classes/DXRFixup.uc
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,13 @@ function FirstEntry()
Super.FirstEntry();
l( "mission " $ dxr.dxInfo.missionNumber @ dxr.localURL$" FirstEntry()");

SetSeed( "DXRFixup FirstEntry" );

IncreaseBrightness(dxr.flags.brightness);
OverwriteDecorations();
FixFlagTriggers();

SetSeed( "DXRFixup FirstEntry missions" );

switch(dxr.dxInfo.missionNumber) {
case 2:
Expand Down Expand Up @@ -112,7 +116,12 @@ function AnyEntry()
Super.AnyEntry();
l( "mission " $ dxr.dxInfo.missionNumber @ dxr.localURL$" AnyEntry()");

SetSeed( "DXRFixup AnyEntry" );

FixSamCarter();
FixAmmoShurikenName();

SetSeed( "DXRFixup AnyEntry missions" );

switch(dxr.dxInfo.missionNumber) {
case 4:
Expand Down Expand Up @@ -187,6 +196,20 @@ function FixSamCarter()
}
}

function FixAmmoShurikenName()
{
local AmmoShuriken a;

class'AmmoShuriken'.default.ItemName = "Throwing Knives";
class'AmmoShuriken'.default.ItemArticle = "some";
class'AmmoShuriken'.default.beltDescription="THW KNIFE";
foreach AllActors(class'AmmoShuriken', a) {
a.ItemName = a.default.ItemName;
a.ItemArticle = a.default.ItemArticle;
a.beltDescription = a.default.beltDescription;
}
}

function IncreaseBrightness(int brightness)
{
local ZoneInfo z;
Expand Down
9 changes: 7 additions & 2 deletions DXRModules/DeusEx/Classes/DXRFlags.uc
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ static function int VersionNumber()
static function string VersionString()
{
return VersionToString(1, 5, 5) $ " Beta";
return VersionToString(1, 5, 5) $ "";
}
function MaxRando()
Expand Down Expand Up @@ -547,9 +547,14 @@ function TestStorage()
local int i;
ds = Spawn(class'DataStorage');
for(i=0;i <3 ;i++) {
ds.SetConfig(i, i);
ds.SetConfig(i, i, 100);
testint( int(ds.GetConfigKey(i)), i, "GetConfigKey("$i$")");
}
ds.EndPlaythrough();
for(i=0;i <3 ;i++) {
teststring( ds.GetConfigKey(i), "", "GetConfigKey("$i$") cleared after EndPlaythrough()");
}
ds.config_dirty = false;// don't bother writing to disk
ds.Destroy();
}
Expand Down
2 changes: 2 additions & 0 deletions DXRModules/DeusEx/Classes/DXRKeys.uc
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ function RandomizeDoors()
foreach AllActors(class'DeusExMover', d) {
if( d.bPickable ) {
d.lockStrength = FClamp(rngrange(d.lockStrength, min_lock_adjust, max_lock_adjust), 0, 1);
d.lockStrength = int(d.lockStrength*100)/100.0;
d.initiallockStrength = d.lockStrength;
}
if( d.bBreakable ) {
Expand Down Expand Up @@ -423,6 +424,7 @@ function MakePickable(DeusExMover d)
if( d.bPickable == false ) {
d.bPickable = true;
d.lockStrength = FClamp(rngrange(1, min_door_adjust, max_door_adjust), 0, 1);
d.lockStrength = int(d.lockStrength*100)/100.0;
d.initiallockStrength = d.lockStrength;
}
}
Expand Down
8 changes: 4 additions & 4 deletions DXRModules/DeusEx/Classes/DXRMissions.uc
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function CheckConfig()
local int i;
local string map;

if( config_version < class'DXRFlags'.static.VersionToInt(1,5,0) ) {
if( config_version < class'DXRFlags'.static.VersionToInt(1,5,5) ) {
allow_vanilla = false;

i=0;
Expand Down Expand Up @@ -572,12 +572,12 @@ function CheckConfig()

map = "03_nyc_batterypark";
important_locations[i].map_name = map;
important_locations[i].location = vect(-4819.345215,3478.138916,-304.225006);//'HarleyFilben0'
important_locations[i].location = vect(-4857.345215,3452.138916,-301.399628);//'HarleyFilben0'
important_locations[i].is_player_start = true;
i++;

important_locations[i].map_name = map;
important_locations[i].location = vect(-2763.231689,1370.594604,369.799988);//'BumMale4'
important_locations[i].location = vect(-2771.231689,1412.594604,373.603882);//'BumMale4'
important_locations[i].rotation = rot(0,7272,0);
important_locations[i].is_player_start = true;
i++;
Expand Down Expand Up @@ -963,7 +963,7 @@ function FirstEntry()
if( dxr.localURL == "01_NYC_UNATCOISLAND" ) {
dxr.flags.f.SetBool('MeetPaul_Played', true,, 2);
}
if( dxr.localURL == "02_NYC_BATTERYPARK" ) {
else if( dxr.localURL == "02_NYC_BATTERYPARK" ) {
foreach AllActors(class'AnnaNavarre', anna) {
anna.SetOrders('Standing');
anna.SetLocation( vect(1082.845703, 1807.538818, 335.101776) );
Expand Down
7 changes: 5 additions & 2 deletions DXRModules/DeusEx/Classes/DXRPasswords.uc
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,8 @@ function _RandoHackable(HackableDevices h)
{
if( h.bHackable ) {
h.hackStrength = FClamp(rngrange(h.hackStrength, min_hack_adjust, max_hack_adjust), 0, 1);
h.hackStrength = int(h.hackStrength*100)/100.0;
h.initialhackStrength = h.hackStrength;
}
}
Expand Down Expand Up @@ -319,8 +321,9 @@ function MakeAllHackable(int deviceshackable)
if( h.bHackable == false && chance_single(deviceshackable) ) {
l("found unhackable device: " $ ActorToString(h) $ ", tag: " $ h.Tag $ " in " $ dxr.localURL);
h.bHackable = true;
h.hackStrength = 1;
h.initialhackStrength = 1;
h.hackStrength = FClamp(rngrange(1, min_hack_adjust, max_hack_adjust), 0, 1);
h.hackStrength = int(h.hackStrength*100)/100.0;
h.initialhackStrength = h.hackStrength;
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions DXRModules/DeusEx/Classes/DXRReduceItems.uc
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ function SetMaxCopies(class<DeusExPickup> type, int percent)
local DeusExPickup p;
foreach AllActors(class'DeusExPickup', p) {
if( ! p.IsA(type.name) ) continue;
p.maxCopies = p.default.maxCopies * percent / 100;
p.maxCopies = float(p.default.maxCopies) * float(percent) / 100.0 * 0.75;
if( p.NumCopies > p.maxCopies ) p.NumCopies = p.maxCopies;
}
}
Expand All @@ -212,7 +212,7 @@ function SetMaxAmmo(class<Ammo> type, int percent)
local Ammo a;
foreach AllActors(class'Ammo', a) {
if( ! a.IsA(type.name) ) continue;
a.MaxAmmo = a.default.MaxAmmo * percent / 100 / 3;
a.MaxAmmo = float(a.default.MaxAmmo) * float(percent) / 100.0 * 0.75;
if( a.AmmoAmount > a.MaxAmmo ) a.AmmoAmount = a.MaxAmmo;
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class DXRGameTimer extends DXRBase;
class DXRStats extends DXRBase;

function AnyEntry()
{
Expand Down Expand Up @@ -152,8 +152,52 @@ function String GetTotalTimeString()
}
static function IncStatFlag(DeusExPlayer p, name flagname)
{
local int val;
val = p.FlagBase.GetInt(flagname);
p.FlagBase.SetInt(flagname,val+1,,999);
}
static function IncDataStorageStat(DeusExPlayer p, name valname)
{
local DataStorage datastorage;
local int val;
datastorage = class'DataStorage'.static.GetObj(p);
val = int(datastorage.GetConfigKey(valname));
datastorage.SetConfig(valname, val+1, 3600*24*366);
}
static function AddShotFired(DeusExPlayer p)
{
IncStatFlag(p,'DXRStats_shotsfired');
}
static function AddWeaponSwing(DeusExPlayer p)
{
IncStatFlag(p,'DXRStats_weaponswings');
}
static function AddJump(DeusExPlayer p)
{
IncStatFlag(p,'DXRStats_jumps');
}
static function AddDeath(DeusExPlayer p)
{
IncDataStorageStat(p,'DXRStats_deaths');
}
function int GetDataStorageStat(name valname)
{
local DataStorage datastorage;
datastorage = class'DataStorage'.static.GetObj(dxr.Player);
return int(datastorage.GetConfigKey(valname));
}
function AddDXRCredits(CreditsWindow cw)
{
local int fired,swings,jumps,deaths;
cw.PrintHeader("In-Game Time");
cw.PrintText("1 - Liberty Island:"@GetMissionTimeString(1));
Expand All @@ -171,7 +215,22 @@ function AddDXRCredits(CreditsWindow cw)
cw.PrintText("15 - Area 51:"@GetMissionTimeString(15));
cw.PrintText("Total:"@GetTotalTimeString());
cw.PrintLn();


fired = dxr.Player.FlagBase.GetInt('DXRStats_shotsfired');
swings = dxr.Player.FlagBase.GetInt('DXRStats_weaponswings');
jumps = dxr.Player.FlagBase.GetInt('DXRStats_jumps');
deaths = GetDataStorageStat('DXRStats_deaths');

cw.PrintHeader("Statistics");

cw.PrintText("Shots Fired: "$fired);
cw.PrintText("Weapon Swings: "$swings);
cw.PrintText("Jumps: "$jumps);
cw.PrintText("Nano Keys: "$dxr.player.KeyRing.GetKeyCount());
cw.PrintText("Skill Points Earned: "$dxr.Player.SkillPointsTotal);
cw.PrintText("Deaths: "$deaths);

cw.PrintLn();
}

defaultproperties
Expand Down
1 change: 1 addition & 0 deletions DXRando.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public DeusEx(IPlayer player, Func<CrowdControlBlock, bool> responseHandler, Act
new Effect("Give Health", "give_health",new[]{"amount100"}),
new Effect("Set On Fire", "set_fire"),
new Effect("Give one Medkit", "give_medkit"),
new Effect("Give a Fire Extinguisher", "give_fireextinguisher"), //New for third Crowd Control batch
new Effect("Full Heal", "full_heal"),
new Effect("Drunk Mode (1 minute)", "drunk_mode"),
new Effect("Drop Selected Item", "drop_selected_item"),
Expand Down
Loading

0 comments on commit 539eb69

Please sign in to comment.