diff --git a/OpenRA.Game/Actor.cs b/OpenRA.Game/Actor.cs index a356a4198f..5e3a65c928 100755 --- a/OpenRA.Game/Actor.cs +++ b/OpenRA.Game/Actor.cs @@ -228,6 +228,11 @@ namespace OpenRA return (health.Value == null) ? false : health.Value.IsDead; } + public bool IsDisguised() + { + return effectiveOwner.Value != null && effectiveOwner.Value.Disguised; + } + public void Kill(Actor attacker) { if (health.Value == null) diff --git a/OpenRA.Mods.RA/ActorExts.cs b/OpenRA.Mods.RA/ActorExts.cs index 31ec3dc988..e1b3c59d49 100644 --- a/OpenRA.Mods.RA/ActorExts.cs +++ b/OpenRA.Mods.RA/ActorExts.cs @@ -21,7 +21,7 @@ namespace OpenRA.Mods.RA if (stance == Stance.Ally) return true; - if (self.EffectiveOwner != null && self.EffectiveOwner.Disguised && !toActor.HasTrait()) + if (self.IsDisguised() && !toActor.HasTrait()) return toActor.Owner.Stances[self.EffectiveOwner.Owner] == Stance.Ally; return stance == Stance.Ally; @@ -33,7 +33,7 @@ namespace OpenRA.Mods.RA if (stance == Stance.Ally) return false; /* otherwise, we'll hate friendly disguised spies */ - if (self.EffectiveOwner != null && self.EffectiveOwner.Disguised && !toActor.HasTrait()) + if (self.IsDisguised() && !toActor.HasTrait()) return toActor.Owner.Stances[self.EffectiveOwner.Owner] == Stance.Enemy; return stance == Stance.Enemy;