/// <summary>
/// Handles the Hero's pickpocketing ability; call this method in the Game's update
/// cycle (AFTER calling KeyboardManager.update())
/// </summary>
/// <param name="hero">The main character</param>
/// <param name="targets">List of characters in the scene; one that is in range is chosen randomly</param>
public static void handlePickpocketing(Hero hero, List<Character> targets)
{
nullCheck();
if (KeyboardManager.isKeyPressed(keyTypes[(int)KeyInputType.Pickpocket]))
{
if (hero.isPickpocketing())
{
Item item = hero.stopPickpocket();
System.Diagnostics.Debug.WriteLine("Stole " + Enum.GetName(typeof(Item), item));
}
else if (!hero.isPickpocketing())
{
//naive search through a list of characters
// We should probably do this on a per-room basis later, for efficiency.
// And/or use some sort of "expanding circle" search.
for(int i = 0; i < targets.Count; i++)
{
if (hero.inRangeAction(targets[i]))
{
hero.startPickpocket(targets[i]);
break;
}
}
}
}
}