move Selectable.Radius into Health

This commit is contained in:
Bob
2010-11-06 14:35:26 +13:00
parent 155e7320cb
commit 9a2cdcde11
3 changed files with 5 additions and 4 deletions

View File

@@ -151,9 +151,10 @@ namespace OpenRA.Mods.RA
// 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 = (int)Math.Max(0, (target.CenterLocation - args.dest).Length - radius);
var health = target.Info.Traits.GetOrDefault<HealthInfo>();
if( health == null ) return 0f;
var distance = (int)Math.Max(0, (target.CenterLocation - args.dest).Length - health.Radius);
var falloff = (float)GetDamageFalloff(distance / warhead.Spread);
var rawDamage = (float)(warhead.Damage * modifier * falloff);
var multiplier = (float)warhead.EffectivenessAgainst(target);