From c205afcf4d495e0d830c67f0b9afdf62bcde3f11 Mon Sep 17 00:00:00 2001 From: reaperrr Date: Fri, 24 Jul 2015 14:29:07 +0200 Subject: [PATCH 1/3] Add descriptions and LoadedChance to Explodes trait 'Chance' only allows to control whether the actor explodes at all. 'LoadedChance' allows to control how likely the actor will explode violently using Weapon, and otherwise falls back to EmptyWeapon. --- OpenRA.Mods.Common/Traits/Explodes.cs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/OpenRA.Mods.Common/Traits/Explodes.cs b/OpenRA.Mods.Common/Traits/Explodes.cs index 3dcf1ad02c..a0a55f4544 100644 --- a/OpenRA.Mods.Common/Traits/Explodes.cs +++ b/OpenRA.Mods.Common/Traits/Explodes.cs @@ -14,14 +14,22 @@ using OpenRA.Traits; namespace OpenRA.Mods.Common.Traits { + [Desc("This actor explodes when killed.")] public class ExplodesInfo : ITraitInfo { - [WeaponReference] + [WeaponReference, Desc("Weapon to use for explosion if ammo/payload is loaded.")] public readonly string Weapon = "UnitExplode"; - [WeaponReference] + + [WeaponReference, Desc("Weapon to use for explosion if no ammo/payload is loaded.")] public readonly string EmptyWeapon = "UnitExplode"; + [Desc("Chance that the explosion will use Weapon if the actor has ammo/payload.")] + public readonly int LoadedChance = 100; + + [Desc("Chance that this actor will explode at all.")] public readonly int Chance = 100; + + [Desc("DeathType(s) to apply upon explosion.")] public readonly string[] DeathType = null; public object Create(ActorInitializer init) { return new Explodes(this); } @@ -60,7 +68,8 @@ namespace OpenRA.Mods.Common.Traits string ChooseWeaponForExplosion(Actor self) { var shouldExplode = self.TraitsImplementing().All(a => a.ShouldExplode(self)); - return shouldExplode ? info.Weapon : info.EmptyWeapon; + var useFullExplosion = self.World.SharedRandom.Next(100) <= info.LoadedChance; + return (shouldExplode && useFullExplosion) ? info.Weapon : info.EmptyWeapon; } } } From 715a89468a0d762d1488edcdd597e25d8eda5582 Mon Sep 17 00:00:00 2001 From: reaperrr Date: Fri, 24 Jul 2015 14:23:13 +0200 Subject: [PATCH 2/3] Clean up RA vehicles.yaml since UnitExplodeSmall is inherited from defaults --- mods/ra/rules/vehicles.yaml | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/mods/ra/rules/vehicles.yaml b/mods/ra/rules/vehicles.yaml index 9e55532f02..9b73e6c236 100644 --- a/mods/ra/rules/vehicles.yaml +++ b/mods/ra/rules/vehicles.yaml @@ -25,7 +25,6 @@ V2RL: AutoTarget: Explodes: Weapon: SCUD - EmptyWeapon: UnitExplodeSmall WithAttackAnimation: AimSequence: aim ReloadPrefix: empty- @@ -64,9 +63,6 @@ V2RL: WithMuzzleFlash: WithTurret: AutoTarget: - Explodes: - Weapon: UnitExplodeSmall - EmptyWeapon: UnitExplodeSmall LeavesHusk: HuskActor: 1TNK.Husk ProducibleWithLevel: @@ -104,9 +100,6 @@ V2RL: WithMuzzleFlash: WithTurret: AutoTarget: - Explodes: - Weapon: UnitExplodeSmall - EmptyWeapon: UnitExplodeSmall LeavesHusk: HuskActor: 2TNK.Husk SelectionDecorations: @@ -146,9 +139,6 @@ V2RL: WithMuzzleFlash: WithTurret: AutoTarget: - Explodes: - Weapon: UnitExplodeSmall - EmptyWeapon: UnitExplodeSmall LeavesHusk: HuskActor: 3TNK.Husk SelectionDecorations: @@ -197,9 +187,6 @@ V2RL: WithMuzzleFlash: WithTurret: AutoTarget: - Explodes: - Weapon: UnitExplodeSmall - EmptyWeapon: UnitExplodeSmall LeavesHusk: HuskActor: 4TNK.Husk SelfHealing: @@ -289,7 +276,6 @@ HARV: FullnessThreshold: 50 Explodes: Weapon: OreExplosion - EmptyWeapon: UnitExplodeSmall MCV: Inherits: ^Vehicle @@ -328,9 +314,6 @@ MCV: BaseBuilding: LeavesHusk: HuskActor: MCV.Husk - Explodes: - Weapon: UnitExplodeSmall - EmptyWeapon: UnitExplodeSmall JEEP: Inherits: ^Vehicle From a06cb8fccb00cd34b3fbbea9e583aa34ad99e91a Mon Sep 17 00:00:00 2001 From: reaperrr Date: Fri, 24 Jul 2015 14:31:35 +0200 Subject: [PATCH 3/3] Tweaked RA and TD artillery explosion Renamed RA UnitExplode to AmmoExplode, added new UnitExplode with 1/10 damage. Reduced TD UnitExplode damage to 1/10 of old value. Now artillery always explodes, but there's only a 75% chance it explodes violently and only when it has ammo. If either condition isn't met, it explodes with the (now less violent) UnitExplode. --- mods/cnc/rules/vehicles.yaml | 4 ++++ mods/cnc/weapons/explosions.yaml | 1 - mods/ra/rules/vehicles.yaml | 5 +++-- mods/ra/weapons/explosions.yaml | 19 +++++++++++++++++++ 4 files changed, 26 insertions(+), 3 deletions(-) diff --git a/mods/cnc/rules/vehicles.yaml b/mods/cnc/rules/vehicles.yaml index d768d3fb33..330d963794 100644 --- a/mods/cnc/rules/vehicles.yaml +++ b/mods/cnc/rules/vehicles.yaml @@ -153,6 +153,10 @@ ARTY: InitialStance: Defend LeavesHusk: HuskActor: ARTY.Husk + Explodes: + Weapon: ArtilleryShell + EmptyWeapon: UnitExplode + LoadedChance: 75 FTNK: Inherits: ^Tank diff --git a/mods/cnc/weapons/explosions.yaml b/mods/cnc/weapons/explosions.yaml index 0e8b0d847d..7cc61ee337 100644 --- a/mods/cnc/weapons/explosions.yaml +++ b/mods/cnc/weapons/explosions.yaml @@ -27,7 +27,6 @@ UnitExplode: Warhead@1Dam: SpreadDamage Spread: 426 Damage: 50 - Falloff: 1000, 368, 135, 50, 18, 7, 0 Versus: None: 90 Wood: 75 diff --git a/mods/ra/rules/vehicles.yaml b/mods/ra/rules/vehicles.yaml index 9b73e6c236..56ded60823 100644 --- a/mods/ra/rules/vehicles.yaml +++ b/mods/ra/rules/vehicles.yaml @@ -226,8 +226,9 @@ ARTY: AttackFrontal: WithMuzzleFlash: Explodes: - Weapon: UnitExplode - Chance: 75 + Weapon: ArtilleryExplode + EmptyWeapon: UnitExplodeSmall + LoadedChance: 75 AutoTarget: ProducibleWithLevel: Prerequisites: vehicles.upgraded diff --git a/mods/ra/weapons/explosions.yaml b/mods/ra/weapons/explosions.yaml index 750edfab47..8a8439c114 100644 --- a/mods/ra/weapons/explosions.yaml +++ b/mods/ra/weapons/explosions.yaml @@ -197,6 +197,25 @@ UnitExplodeSmall: ImpactSound: splash9.aud ValidImpactTypes: Water +ArtilleryExplode: + Warhead@1Dam: SpreadDamage + Spread: 426 + Damage: 150 + Versus: + None: 90 + Wood: 75 + Light: 60 + Heavy: 25 + DamageTypes: Prone50Percent, TriggerProne, ExplosionDeath + Warhead@2Eff: CreateEffect + Explosion: self_destruct + ImpactSound: kaboom22.aud + InvalidImpactTypes: Water + Warhead@3EffWater: CreateEffect + Explosion: large_splash + ImpactSound: splash9.aud + ValidImpactTypes: Water + BarrelExplode: Warhead@1Dam: SpreadDamage Spread: 426