From 2c4de065595e8d2d443b2855b845895e66e1beaa Mon Sep 17 00:00:00 2001 From: "theastropath@gmail.com" Date: Wed, 3 Apr 2024 23:55:06 -0400 Subject: [PATCH] New Crowd Control effect to drop a bunch of marbles on the ground #407 --- DXRModules/DeusEx/Classes/DXREventsBase.uc | 8 ++- DXRando.cs | 1 + DXRando/DeusEx/Classes/DXRMarble.uc | 12 ++++ .../Classes/DXRandoCrowdControlEffects.uc | 37 ++++++++++++ .../DeusEx/Classes/DXRandoCrowdControlLink.uc | 3 +- DXRando/DeusEx/Classes/Poolball.uc | 56 ++++++++++++++++++- 6 files changed, 112 insertions(+), 5 deletions(-) create mode 100644 DXRando/DeusEx/Classes/DXRMarble.uc diff --git a/DXRModules/DeusEx/Classes/DXREventsBase.uc b/DXRModules/DeusEx/Classes/DXREventsBase.uc index 167dafac4..d952720f7 100644 --- a/DXRModules/DeusEx/Classes/DXREventsBase.uc +++ b/DXRModules/DeusEx/Classes/DXREventsBase.uc @@ -202,7 +202,7 @@ simulated function bool ClassInLevel(class className) simulated function int PoolBallsSunk() { - local #var(prefix)Poolball cue,ball; + local #var(injectsprefix)Poolball cue,ball; local int ballsSunk,tablesSunk,freshSink,radius; radius=99999; @@ -217,10 +217,12 @@ simulated function int PoolBallsSunk() } tablesSunk=0; - foreach AllActors(class'#var(prefix)Poolball',cue){ + foreach AllActors(class'#var(injectsprefix)Poolball',cue){ + if (cue.Class!=class'#var(injectsprefix)Poolball') continue; if (cue.SkinColor==SC_Cue){ ballsSunk=0; - foreach cue.RadiusActors(class'#var(prefix)Poolball',ball,radius){ + foreach cue.RadiusActors(class'#var(injectsprefix)Poolball',ball,radius){ + if (ball.Class!=class'#var(injectsprefix)Poolball') continue; if (ball.Location.Z <= PoolBallHeight){ ballsSunk++; } diff --git a/DXRando.cs b/DXRando.cs index 5140abe25..17cef5c4c 100644 --- a/DXRando.cs +++ b/DXRando.cs @@ -66,6 +66,7 @@ public DeusEx(UserRecord player, Func responseHandler, new Effect ("Heal all Enemies", "heal_all_enemies"){Price = 10,Description = "Fully heal all enemies in the current level!"}, //New for fifth Crowd Control batch, v2.6 new Effect ("Make Player Radioactive", "radioactive"){Price = 10,Description = "The player becomes radioactive and starts hurting nearby people!",Duration=60}, //New for fifth Crowd Control batch, v2.6 new Effect ("Corpse Explosion", "corpse_explosion"){Price = 10,Description = "Fill up to 5 nearby corpses with energy, causing them to explode violently!"}, //New for fifth Crowd Control batch, v2.6 + new Effect ("Lose your Marbles", "drop_marbles"){Price = 3,Description = "Oops, JC dropped all the marbles!"}, //New for sixth Crowd Control batch //Spawn Enemies/Allies //new Effect("Spawn Enemies/Allies","spawnpawns",ItemKind.Folder), //New for fourth Crowd Control batch diff --git a/DXRando/DeusEx/Classes/DXRMarble.uc b/DXRando/DeusEx/Classes/DXRMarble.uc new file mode 100644 index 000000000..a3893f786 --- /dev/null +++ b/DXRando/DeusEx/Classes/DXRMarble.uc @@ -0,0 +1,12 @@ +class DXRMarble extends #var(injectsprefix)Poolball; + +//Reduce drawscale to look more like marbles, but leave +//the collision the same for more slipperiness +defaultproperties +{ + bInvincible=False + ItemName="Marble" + DrawScale=0.5 + HitPoints=5 + FragType=Class'DeusEx.GlassFragment' +} diff --git a/DXRando/DeusEx/Classes/DXRandoCrowdControlEffects.uc b/DXRando/DeusEx/Classes/DXRandoCrowdControlEffects.uc index d4d83416e..3c350d4e4 100644 --- a/DXRando/DeusEx/Classes/DXRandoCrowdControlEffects.uc +++ b/DXRando/DeusEx/Classes/DXRandoCrowdControlEffects.uc @@ -2018,6 +2018,34 @@ function PlayerRadiates() } +function bool DropMarbles(string viewer) +{ + local DXRMarble ball; + local int num,i; + + num=0; + + for (i=0;i<10;i++){ + ball = Spawn(class'DXRMarble',,,player().Location+vect(0,0,80),player().Rotation); + if (ball!=None){ + ball.Velocity = vector(ball.Rotation) * 300 + vect(0,0,220) + VRand()*320; + ball.Velocity.Z = abs(ball.Velocity.Z); + ball.SetSkin(Rand(16)); + num++; + } + } + + if (num==0){ + return False; + } + + PlayerMessage(viewer@"made you drop your marbles!"); + + return True; +} + + + function SplitString(string src, string divider, out string parts[8]) { local int i, c; @@ -2908,6 +2936,15 @@ function int doCrowdControlEvent(string code, string param[5], string viewer, in } break; + case "drop_marbles": + if (!InGame()) { + return TempFail; + } + if (!DropMarbles(viewer)){ + return TempFail; + } + break; + default: return doCrowdControlEventWithPrefix(code, param, viewer, type, duration); } diff --git a/DXRando/DeusEx/Classes/DXRandoCrowdControlLink.uc b/DXRando/DeusEx/Classes/DXRandoCrowdControlLink.uc index 159247083..be0febc56 100644 --- a/DXRando/DeusEx/Classes/DXRandoCrowdControlLink.uc +++ b/DXRando/DeusEx/Classes/DXRandoCrowdControlLink.uc @@ -135,7 +135,7 @@ function int RandomOfflineEffects() { viewer = "Simulated Crowd Control"; param[0] = "1"; - switch(Rand(91)) { + switch(Rand(94)) { case 0: if(Rand(2)==0){ return 0; } else { return ccEffects.doCrowdControlEvent("poison", param, viewer, 0, 0); } case 1: return ccEffects.doCrowdControlEvent("glass_legs", param, viewer, 0, 0); case 2: param[0] = string(Rand(20)); return ccEffects.doCrowdControlEvent("give_health", param, viewer, 0, 0); @@ -281,6 +281,7 @@ function int RandomOfflineEffects() { case 91: return ccEffects.doCrowdControlEvent("doom_mode", param, viewer, 0, 0); #endif case 92: return ccEffects.doCrowdControlEvent("raise_dead", param, viewer, 0, 0); + case 93: return ccEffects.doCrowdControlEvent("drop_marbles", param, viewer, 0, 0); } return 0; diff --git a/DXRando/DeusEx/Classes/Poolball.uc b/DXRando/DeusEx/Classes/Poolball.uc index 45d5fe5f8..22b836cd3 100644 --- a/DXRando/DeusEx/Classes/Poolball.uc +++ b/DXRando/DeusEx/Classes/Poolball.uc @@ -1,4 +1,4 @@ -class DXRPoolball injects #var(prefix)Poolball; +class #var(injectsprefix)Poolball injects #var(prefix)Poolball; function Bump(actor Other) @@ -16,3 +16,57 @@ function Bump(actor Other) Velocity.Z = 0; } } + +function SetSkin(int skinNum){ + switch(skinNum){ + case 0: + SkinColor=SC_1; + break; + case 1: + SkinColor=SC_2; + break; + case 2: + SkinColor=SC_3; + break; + case 3: + SkinColor=SC_4; + break; + case 4: + SkinColor=SC_5; + break; + case 5: + SkinColor=SC_6; + break; + case 6: + SkinColor=SC_7; + break; + case 7: + SkinColor=SC_8; + break; + case 8: + SkinColor=SC_9; + break; + case 9: + SkinColor=SC_10; + break; + case 10: + SkinColor=SC_11; + break; + case 11: + SkinColor=SC_12; + break; + case 12: + SkinColor=SC_13; + break; + case 13: + SkinColor=SC_14; + break; + case 14: + SkinColor=SC_15; + break; + case 15: + SkinColor=SC_Cue; + break; + } + BeginPlay(); +}