From 70c61817d9b061034740821349aa1a90fe8b73a0 Mon Sep 17 00:00:00 2001 From: Taryn Hill Date: Fri, 22 May 2015 09:57:21 -0500 Subject: [PATCH] =?UTF-8?q?Fix=20oversight=20where=20disguising=20SpyA=20a?= =?UTF-8?q?s=20a=20disguised=20SpyB=20uses=20the=20image=20and=20tooltip?= =?UTF-8?q?=20for=20SpyB=20instead=20of=20SpyB=E2=80=99s=20disguise.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- OpenRA.Mods.RA/Traits/Disguise.cs | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/OpenRA.Mods.RA/Traits/Disguise.cs b/OpenRA.Mods.RA/Traits/Disguise.cs index fcd2b9c1ab..0a4f9f6bd4 100644 --- a/OpenRA.Mods.RA/Traits/Disguise.cs +++ b/OpenRA.Mods.RA/Traits/Disguise.cs @@ -112,10 +112,22 @@ namespace OpenRA.Mods.RA.Traits if (target != null) { - var tooltip = target.TraitsImplementing().FirstOrDefault(); - AsTooltipInfo = tooltip.TooltipInfo; - AsPlayer = tooltip.Owner; - AsSprite = target.Trait().GetImage(target); + // Take the image of the target's disguise, if it exist. + // E.g., SpyA is disguised as a dog. SpyB then targets SpyA. We should use the dog image. + var targetDisguise = target.TraitOrDefault(); + if (targetDisguise != null && targetDisguise.Disguised) + { + AsSprite = targetDisguise.AsSprite; + AsPlayer = targetDisguise.AsPlayer; + AsTooltipInfo = targetDisguise.AsTooltipInfo; + } + else + { + AsSprite = target.Trait().GetImage(target); + var tooltip = target.TraitsImplementing().FirstOrDefault(); + AsPlayer = tooltip.Owner; + AsTooltipInfo = tooltip.TooltipInfo; + } } else {