Skip to content

Commit

Permalink
Add Corpse Explosion Crowd Control effect #407
Browse files Browse the repository at this point in the history
  • Loading branch information
theastropath committed Mar 11, 2024
1 parent 7439410 commit 2c03dd3
Show file tree
Hide file tree
Showing 3 changed files with 108 additions and 1 deletion.
1 change: 1 addition & 0 deletions DXRando.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ public DeusEx(UserRecord player, Func<CrowdControlBlock, bool> responseHandler,
new Effect ("Toggle the Flashlight", "toggle_flashlight"){Price = 1,Description = "Toggle the flashlight!"}, //New for fifth Crowd Control batch, v2.6
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

//Spawn Enemies/Allies
//new Effect("Spawn Enemies/Allies","spawnpawns",ItemKind.Folder), //New for fourth Crowd Control batch
Expand Down
105 changes: 105 additions & 0 deletions DXRando/DeusEx/Classes/DXRandoCrowdControlEffects.uc
Original file line number Diff line number Diff line change
Expand Up @@ -1777,6 +1777,102 @@ function bool HealAllEnemies(string viewer)
return True;
}

function bool CorpseExplosion(string viewer)
{
local DeusExCarcass carc;
local int num,i;

num=0;

for (i=0;i<5;i++){
carc = FindClosestCarcass(1000);
if (carc==None){
break;
}
DetonateCarcass(carc);
num++;
}

if (num==0){
return False;
}

PlayerMessage(viewer@"detonated "$num$" corpses!");

return True;

}

function DeusExCarcass FindClosestCarcass(float radius)
{
local DeusExCarcass carc,closest;
local float closeDist;

closest = None;
closeDist = 2 * radius;
foreach player().RadiusActors(class'DeusExCarcass',carc,radius){
if (VSize(carc.Location-player().Location) < closeDist){
closest = carc;
closeDist = VSize(carc.Location-player().Location);
}
}

return closest;
}

//Duped from MIB
function DetonateCarcass(DeusExCarcass carc)
{
local SphereEffect sphere;
local ScorchMark s;
local ExplosionLight light;
local int i;
local float explosionDamage;
local float explosionRadius;

explosionDamage = 100;
explosionRadius = 256;

// alert NPCs that I'm exploding
AISendEvent('LoudNoise', EAITYPE_Audio, , explosionRadius*16);
PlaySound(Sound'LargeExplosion1', SLOT_None,,, explosionRadius*16);

// draw a pretty explosion
light = Spawn(class'ExplosionLight',,, carc.Location);
if (light != None)
light.size = 4;

Spawn(class'ExplosionSmall',,, carc.Location + 2*VRand()*carc.CollisionRadius);
Spawn(class'ExplosionMedium',,, carc.Location + 2*VRand()*carc.CollisionRadius);
Spawn(class'ExplosionMedium',,, carc.Location + 2*VRand()*carc.CollisionRadius);
Spawn(class'ExplosionLarge',,, carc.Location + 2*VRand()*carc.CollisionRadius);

sphere = Spawn(class'SphereEffect',,, carc.Location);
if (sphere != None)
sphere.size = explosionRadius / 32.0;

// spawn a mark
s = spawn(class'ScorchMark', carc.Base,, carc.Location-vect(0,0,1)*carc.CollisionHeight, carc.Rotation+rot(16384,0,0));
if (s != None)
{
s.DrawScale = FClamp(explosionDamage/30, 0.1, 3.0);
s.ReattachDecal();
}

// spawn some rocks and flesh fragments
for (i=0; i<explosionDamage/4; i++)
{
if (FRand() < 0.2)
spawn(class'Rockchip',,,carc.Location);
else
spawn(class'FleshFragment',,,carc.Location);
}

HurtRadius(explosionDamage, explosionRadius, 'Exploded', explosionDamage*100, carc.Location);

carc.Destroy();
}

function SpawnRECam()
{
reCam=Spawn(class'CCResidentEvilCam',,,player().Location);
Expand Down Expand Up @@ -2460,6 +2556,15 @@ function int doCrowdControlEvent(string code, string param[5], string viewer, in

startNewTimer('cc_Radioactive',duration);
break;
case "corpse_explosion":
if (!InGame()) {
return TempFail;
}
if (!CorpseExplosion(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(90)) {
switch(Rand(91)) {
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 @@ -276,6 +276,7 @@ function int RandomOfflineEffects() {
case 87: return ccEffects.doCrowdControlEvent("giveenemyweapon_weaponhideagun", param, viewer, 0, 0);
case 88: return ccEffects.doCrowdControlEvent("heal_all_enemies", param, viewer, 0, 0);
case 89: return ccEffects.doCrowdControlEvent("resident_evil", param, viewer, 0, 0);
case 90: return ccEffects.doCrowdControlEvent("corpse_explosion", param, viewer, 0, 0);
}

return 0;
Expand Down

0 comments on commit 2c03dd3

Please sign in to comment.