Add MaxSpread to Warhead to allow setting a specific area of effect.

This commit is contained in:
reaperrr
2014-07-11 21:35:04 +02:00
parent a03d607878
commit eb96b72878
2 changed files with 6 additions and 1 deletions

View File

@@ -19,6 +19,8 @@ namespace OpenRA.GameRules
{ {
[Desc("Distance from the explosion center at which damage is 1/2.")] [Desc("Distance from the explosion center at which damage is 1/2.")]
public readonly WRange Spread = new WRange(43); 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")] [FieldLoader.LoadUsing("LoadVersus")]
[Desc("Damage vs each armortype. 0% = can't target.")] [Desc("Damage vs each armortype. 0% = can't target.")]
public readonly Dictionary<string, float> Versus; public readonly Dictionary<string, float> Versus;

View File

@@ -122,7 +122,10 @@ namespace OpenRA.Mods.RA
{ {
case DamageModel.Normal: 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); var hitActors = world.FindActorsInCircle(pos, maxSpread);
foreach (var victim in hitActors) foreach (var victim in hitActors)