From eb96b728784abb99a1a799b5e58e2af337e6e5e6 Mon Sep 17 00:00:00 2001 From: reaperrr Date: Fri, 11 Jul 2014 21:35:04 +0200 Subject: [PATCH] Add MaxSpread to Warhead to allow setting a specific area of effect. --- OpenRA.Game/GameRules/WeaponInfo.cs | 2 ++ OpenRA.Mods.RA/Combat.cs | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/OpenRA.Game/GameRules/WeaponInfo.cs b/OpenRA.Game/GameRules/WeaponInfo.cs index a35d0dcf2c..ea77199b37 100644 --- a/OpenRA.Game/GameRules/WeaponInfo.cs +++ b/OpenRA.Game/GameRules/WeaponInfo.cs @@ -19,6 +19,8 @@ namespace OpenRA.GameRules { [Desc("Distance from the explosion center at which damage is 1/2.")] public readonly WRange Spread = new WRange(43); + [Desc("Maximum Spread. If a value >= Spread is set, this sets a fixed maximum area of damage.")] + public readonly WRange MaxSpread = new WRange(0); [FieldLoader.LoadUsing("LoadVersus")] [Desc("Damage vs each armortype. 0% = can't target.")] public readonly Dictionary Versus; diff --git a/OpenRA.Mods.RA/Combat.cs b/OpenRA.Mods.RA/Combat.cs index bc481652b1..53b376497e 100644 --- a/OpenRA.Mods.RA/Combat.cs +++ b/OpenRA.Mods.RA/Combat.cs @@ -122,7 +122,10 @@ namespace OpenRA.Mods.RA { case DamageModel.Normal: { - var maxSpread = new WRange((int)(warhead.Spread.Range * (float)Math.Log(Math.Abs(warhead.Damage), 2))); + var spreadMax = warhead.MaxSpread.Range; + var maxSpreadCalculation = spreadMax >= warhead.Spread.Range ? spreadMax : (warhead.Spread.Range * (float)Math.Log(Math.Abs(warhead.Damage), 2)); + + var maxSpread = new WRange((int)(maxSpreadCalculation)); var hitActors = world.FindActorsInCircle(pos, maxSpread); foreach (var victim in hitActors)