mirror of
https://github.com/correl/mage.git
synced 2024-11-15 11:09:30 +00:00
Fixed cast exception for Rebound
This commit is contained in:
parent
94d7fa6ea3
commit
5a45c597bc
1 changed files with 12 additions and 9 deletions
|
@ -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<ReboundEffect> {
|
|||
@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
|
||||
|
|
Loading…
Reference in a new issue