move Selectable.Radius into Health
This commit is contained in:
@@ -22,6 +22,7 @@ namespace OpenRA.Traits
|
||||
public class HealthInfo : ITraitInfo
|
||||
{
|
||||
public readonly int HP = 0;
|
||||
public readonly float Radius = 10;
|
||||
public virtual object Create(ActorInitializer init) { return new Health(init, this); }
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,6 @@ namespace OpenRA.Traits
|
||||
public readonly int[] Bounds = null;
|
||||
[VoiceReference]
|
||||
public readonly string Voice = null;
|
||||
public readonly float Radius = 10;
|
||||
}
|
||||
|
||||
public class Selectable : IPostRenderSelection
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user