Add try/catch to hiddenOriginCanPlayAi

If a SpellAbility's origin is something like "Graveyard,Library",
ZoneType.smartValueOf throws an IllegalArgumentException.  Catch
this exception and return false.  This prevents the crash, but
means that the AI still can't play cards like Doomsday.

Fixes bug 745
This commit is contained in:
dripton
2013-10-10 14:29:53 +00:00
parent a098b56339
commit c54ed09d38

View File

@@ -167,7 +167,13 @@ public class ChangeZoneAi extends SpellAbilityAi {
final Player opponent = ai.getOpponent();
if (sa.hasParam("Origin")) {
origin = ZoneType.smartValueOf(sa.getParam("Origin"));
try {
origin = ZoneType.smartValueOf(sa.getParam("Origin"));
} catch (IllegalArgumentException ex) {
// This happens when Origin is something like
// "Graveyard,Library" (Doomsday)
return false;
}
}
final String destination = sa.getParam("Destination");