add radius to Selectable, used to adjust distance for damage calculation
This commit is contained in:
@@ -116,7 +116,9 @@ namespace OpenRA
|
||||
|
||||
static float GetDamageToInflict(Actor target, ProjectileArgs args, WarheadInfo warhead, float modifier)
|
||||
{
|
||||
var distance = (target.CenterLocation - args.dest).Length;
|
||||
var selectable = target.Info.Traits.GetOrDefault<SelectableInfo>();
|
||||
var radius = selectable != null ? selectable.Radius : 0;
|
||||
var distance = Math.Max(0, (target.CenterLocation - args.dest).Length - radius);
|
||||
var rawDamage = warhead.Damage * modifier * (float)Math.Exp(-distance / warhead.Spread);
|
||||
var multiplier = warhead.EffectivenessAgainst(target.Info.Traits.Get<OwnedActorInfo>().Armor);
|
||||
return rawDamage * multiplier;
|
||||
|
||||
@@ -25,6 +25,7 @@ namespace OpenRA.Traits
|
||||
public readonly int Priority = 10;
|
||||
public readonly int[] Bounds = null;
|
||||
public readonly string Voice = "GenericVoice";
|
||||
public readonly float Radius = 10;
|
||||
}
|
||||
|
||||
public class Selectable {}
|
||||
|
||||
Reference in New Issue
Block a user