#156, #151 fixed: splash damage against invalid targets is now ignored

This commit is contained in:
Chris Forbes
2010-04-16 20:50:48 +12:00
parent b5b943fee8
commit a4e2407d8e

View File

@@ -125,6 +125,9 @@ namespace OpenRA
static float GetDamageToInflict(Actor target, ProjectileArgs args, WarheadInfo warhead, float modifier)
{
// don't hit air units with splash from ground explosions, etc
if (!WeaponValidForTarget(args.weapon, target)) return 0f;
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);