Skip to content

Commit

Permalink
New Crowd Control effect to drop a bunch of marbles on the ground #407
Browse files Browse the repository at this point in the history
  • Loading branch information
theastropath committed Apr 4, 2024
1 parent e5f68d9 commit 2c4de06
Show file tree
Hide file tree
Showing 6 changed files with 112 additions and 5 deletions.
8 changes: 5 additions & 3 deletions DXRModules/DeusEx/Classes/DXREventsBase.uc
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ simulated function bool ClassInLevel(class<Actor> 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;
Expand All @@ -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++;
}
Expand Down
1 change: 1 addition & 0 deletions DXRando.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ public DeusEx(UserRecord player, Func<CrowdControlBlock, bool> 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
Expand Down
12 changes: 12 additions & 0 deletions DXRando/DeusEx/Classes/DXRMarble.uc
Original file line number Diff line number Diff line change
@@ -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'
}
37 changes: 37 additions & 0 deletions DXRando/DeusEx/Classes/DXRandoCrowdControlEffects.uc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
Expand Down
3 changes: 2 additions & 1 deletion DXRando/DeusEx/Classes/DXRandoCrowdControlLink.uc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down
56 changes: 55 additions & 1 deletion DXRando/DeusEx/Classes/Poolball.uc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class DXRPoolball injects #var(prefix)Poolball;
class #var(injectsprefix)Poolball injects #var(prefix)Poolball;


function Bump(actor Other)
Expand All @@ -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();
}

0 comments on commit 2c4de06

Please sign in to comment.