From 5a45c597bc55bd51f8b58da2219c1e5b05c953c2 Mon Sep 17 00:00:00 2001 From: North Date: Sat, 7 Jul 2012 20:27:17 +0300 Subject: [PATCH] Fixed cast exception for Rebound --- .../abilities/keyword/ReboundAbility.java | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/Mage/src/mage/abilities/keyword/ReboundAbility.java b/Mage/src/mage/abilities/keyword/ReboundAbility.java index 5c0966ac41..d89d1c2819 100644 --- a/Mage/src/mage/abilities/keyword/ReboundAbility.java +++ b/Mage/src/mage/abilities/keyword/ReboundAbility.java @@ -31,6 +31,7 @@ package mage.abilities.keyword; import mage.Constants.Duration; import mage.Constants.Outcome; import mage.Constants.Zone; +import mage.MageObject; import mage.abilities.Ability; import mage.abilities.DelayedTriggeredAbility; import mage.abilities.SpellAbility; @@ -143,17 +144,19 @@ class ReboundEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { Spell sourceSpell = (Spell) game.getObject(source.getId()); - if (sourceSpell != null && sourceSpell.isCopiedSpell()) { - return false; - } else { - StackObject sourceCard = (StackObject) game.getObject(source.getSourceId()); - ReboundEffectCastFromExileDelayedTrigger trigger = new ReboundEffectCastFromExileDelayedTrigger(sourceCard.getSourceId(), sourceCard.getSourceId()); - trigger.setControllerId(source.getControllerId()); - game.addDelayedTriggeredAbility(trigger); + if (sourceSpell == null || !sourceSpell.isCopiedSpell()) { + MageObject mageObject = game.getObject(source.getSourceId()); + if (mageObject instanceof StackObject) { + StackObject sourceCard = (StackObject) mageObject; + ReboundEffectCastFromExileDelayedTrigger trigger = new ReboundEffectCastFromExileDelayedTrigger(sourceCard.getSourceId(), sourceCard.getSourceId()); + trigger.setControllerId(source.getControllerId()); + game.addDelayedTriggeredAbility(trigger); - game.getContinuousEffects().addEffect(new ReboundCastFromHandReplacementEffect(source.getSourceId()), source); - return true; + game.getContinuousEffects().addEffect(new ReboundCastFromHandReplacementEffect(source.getSourceId()), source); + return true; + } } + return false; } @Override