diff --git a/DXRando.cs b/DXRando.cs index 16e1a9a9a..bb6502c0f 100644 --- a/DXRando.cs +++ b/DXRando.cs @@ -68,6 +68,8 @@ public DeusEx(UserRecord player, Func responseHandler, new Effect ("Quick Save", "quick_save"){Price = 10,Description = "Stir up some real trouble..."}, //New for fourth Crowd Control batch new Effect ("Quick Load", "quick_load"){Price = 20,Description = "Hope that last quick save wasn't too far back, or in too much danger!"}, //New for fourth Crowd Control batch new Effect ("Drop a piano on the player", "drop_piano"){Price = 10,Description = "Spawn a piano above the player to drop it on them, just like in the cartoons!"}, //New for fifth Crowd Control batch, v2.6 + 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 //Spawn Enemies/Allies //new Effect("Spawn Enemies/Allies","spawnpawns",ItemKind.Folder), //New for fourth Crowd Control batch @@ -176,6 +178,8 @@ public DeusEx(UserRecord player, Func responseHandler, new Effect("Give Gas Grenade", "give_weapongasgrenade") { Category = "Give Weapon",Price = 2,Description = "Give the player a gas grenade" }, //New for second Crowd Control batch new Effect("Give Scrambler Grenade", "give_weaponnanovirusgrenade") { Category = "Give Weapon",Price = 5,Description = "Give the player a scrambler grenade" }, //New for second Crowd Control batch new Effect("Give PS40","give_weaponhideagun") { Category = "Give Weapon",Price = 10,Description = "Give the player a PS40" }, + new Effect("Give all enemies a LAW", "giveenemyweapon_weaponlaw") { Category = "Give Weapon",Price = 40,Description = "Give all enemies a LAW" }, //New for fifth Crowd Control batch, v2.6 + new Effect("Give all enemies a PS40", "giveenemyweapon_weaponhideagun") { Category = "Give Weapon",Price = 30,Description = "Give all enemies a PS40" }, //New for fifth Crowd Control batch, v2.6 //Ammo //new Effect("Give Ammo","giveammo",ItemKind.Folder), diff --git a/DXRando/DeusEx/Classes/DXRandoCrowdControlEffects.uc b/DXRando/DeusEx/Classes/DXRandoCrowdControlEffects.uc index 64d4dc5f6..a3081dadf 100644 --- a/DXRando/DeusEx/Classes/DXRandoCrowdControlEffects.uc +++ b/DXRando/DeusEx/Classes/DXRandoCrowdControlEffects.uc @@ -798,6 +798,10 @@ function class getScriptedPawnClass(string type) { return class(ccLink.ccModule.GetClassFromString(type, class'ScriptedPawn')); } +function class<#var(DeusExPrefix)Weapon> getWeaponClass(string type) { + return class<#var(DeusExPrefix)Weapon>(ccLink.ccModule.GetClassFromString(type, class'#var(DeusExPrefix)Weapon')); +} + //"Why not just use "GivePlayerAugmentation", you ask. //While it works well to give the player an aug they don't @@ -1221,15 +1225,15 @@ function int GiveItem(string viewer, string type, optional int amount) { outMsg = viewer@"gave you"; if( amount > 1 && DeusExAmmo(item) != None ) { - outMsg = outMsg @amount@"cases of"@item.Default.ItemName; + outMsg = outMsg @amount@"cases of"@item.ItemName; } else if( DeusExAmmo(item) != None ) { - outMsg = outMsg @"a case of"@item.Default.ItemName; + outMsg = outMsg @"a case of"@item.ItemName; } else if( amount > 1 ) { - outMsg = outMsg @ amount @ item.Default.ItemName $ "s"; + outMsg = outMsg @ amount @ item.ItemName $ "s"; } else { - outMsg = outMsg @ item.Default.ItemArticle @ item.Default.ItemName; + outMsg = outMsg @ item.ItemArticle @ item.ItemName; } PlayerMessage(outMsg $ shouldSave); @@ -1608,6 +1612,99 @@ function bool SwapAllItems(string viewer) return true; } +function bool ToggleFlashlight(string viewer) +{ + local Augmentation aug; + + aug = player().AugmentationSystem.FindAugmentation(class'#var(prefix)AugLight'); + + if (aug==None) return False; + + if (aug.IsActive()){ + aug.Deactivate(); + } else { + aug.Activate(); + } + + PlayerMessage(viewer@"toggled your flashlight!"); + + return true; + +} + +function int GiveAllEnemiesWeapon(class<#var(DeusExPrefix)Weapon> w,string viewer) +{ + local int numEnemies; + local inventory inv; + local ScriptedPawn a; + + numEnemies=0; + + foreach AllActors(class'ScriptedPawn', a ) + { + if( a.bHidden || a.bStatic ) continue; + if( #var(prefix)Animal(a)!=None ) continue; + if( #var(prefix)Robot(a) != None ) continue; + if( !ccLink.ccModule.IsInitialEnemy(a) ) continue; + numEnemies++; + inv = ccLink.ccModule.GiveItem(a,w,1); + } + + if (numEnemies==0){ + return TempFail; + } + + PlayerMessage(viewer@"gave "$numEnemies$" enemies a "$inv.ItemName$"!"); + + return Success; +} + +function bool HealAllEnemies(string viewer) +{ + local int numEnemies; + local ScriptedPawn a; + + numEnemies=0; + + foreach AllActors(class'ScriptedPawn', a ) + { + if( a.bHidden || a.bStatic ) continue; + if( #var(prefix)Animal(a)!=None ) continue; + if( #var(prefix)Robot(a) != None ) continue; + if( !ccLink.ccModule.IsInitialEnemy(a) ) continue; + if ( a.IsInState('Dying') ) continue; //It's too late for this guy... + if ( a.bInvincible ) continue; + if ( a.Health >= a.Default.Health ) continue; //Nothing to heal + + numEnemies++; + a.Health = a.Default.Health; + a.HealthArmLeft = a.Default.HealthArmLeft; + a.HealthArmRight = a.Default.HealthArmRight; + a.HealthLegLeft = a.Default.HealthLegLeft; + a.HealthLegRight = a.Default.HealthLegRight; + a.HealthHead = a.Default.HealthHead; + a.HealthTorso = a.Default.HealthTorso; + + if (a.bOnFire){ + a.ExtinguishFire(); + } + + //Get back in the fight, soldier! + if (a.IsInState('Fleeing') || a.IsInState('Burning') || a.IsInState('RubbingEyes')){ + a.FearLevel=0; + a.FollowOrders(); + } + } + + if (numEnemies==0){ + return False; + } + + PlayerMessage(viewer@"healed "$numEnemies$" enemies to full health!"); + + return True; +} + function SplitString(string src, string divider, out string parts[8]) { local int i, c; @@ -2207,6 +2304,24 @@ function int doCrowdControlEvent(string code, string param[5], string viewer, in return DropPiano(viewer); break; + case "toggle_flashlight": + if (!InGame()) { + return TempFail; + } + if (!ToggleFlashlight(viewer)){ + return TempFail; + } + break; + + case "heal_all_enemies": + if (!InGame()) { + return TempFail; + } + if (!HealAllEnemies(viewer)){ + return TempFail; + } + break; + default: return doCrowdControlEventWithPrefix(code, param, viewer, type, duration); } @@ -2232,6 +2347,8 @@ function int doCrowdControlEventWithPrefix(string code, string param[5], string return SpawnPawnNearPlayer(player(),getScriptedPawnClass(words[1]),True,viewer); case "spawnenemy": return SpawnPawnNearPlayer(player(),getScriptedPawnClass(words[1]),False,viewer); + case "giveenemyweapon": + return GiveAllEnemiesWeapon(getWeaponClass(words[1]),viewer); default: err("Unknown effect: "$code); return NotAvail; diff --git a/DXRando/DeusEx/Classes/DXRandoCrowdControlLink.uc b/DXRando/DeusEx/Classes/DXRandoCrowdControlLink.uc index fde5aaf5a..a7cea3c48 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(85)) { + switch(Rand(89)) { 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); @@ -271,6 +271,10 @@ function int RandomOfflineEffects() { case 82: return ccEffects.doCrowdControlEvent("drop_piano", param, viewer, 0, 0); case 83: return ccEffects.doCrowdControlEvent("swap_enemies", param, viewer, 0, 0); case 84: return ccEffects.doCrowdControlEvent("swap_items", param, viewer, 0, 0); + case 85: return ccEffects.doCrowdControlEvent("toggle_flashlight", param, viewer, 0, 0); + case 86: return ccEffects.doCrowdControlEvent("giveenemyweapon_weaponlaw", param, viewer, 0, 0); + case 87: return ccEffects.doCrowdControlEvent("giveenemyweapon_weaponhideagun", param, viewer, 0, 0); + case 88: return ccEffects.doCrowdControlEvent("heal_all_enemies", param, viewer, 0, 0); } return 0;