* Soulfire Grand Master - Fixed possible Cast exception.

This commit is contained in:
LevelX2 2015-01-26 16:08:35 +01:00
parent 89a21923a8
commit 684e76e9bf

View file

@ -193,11 +193,11 @@ class SoulfireGrandMasterCastFromHandReplacementEffect extends ReplacementEffect
@Override @Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) { public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Spell sourceSpell = (Spell) game.getObject(spellId); MageObject mageObject = game.getObject(spellId);
if (sourceSpell != null && sourceSpell.isCopiedSpell()) { if (mageObject == null || !(mageObject instanceof Spell) || ((Spell)mageObject).isCopiedSpell()) {
return false; return false;
} else { } else {
Card sourceCard = (Card) game.getCard(spellId); Card sourceCard = game.getCard(spellId);
if (sourceCard != null) { if (sourceCard != null) {
Player player = game.getPlayer(sourceCard.getOwnerId()); Player player = game.getPlayer(sourceCard.getOwnerId());
if (player != null) { if (player != null) {
@ -218,7 +218,7 @@ class SoulfireGrandMasterCastFromHandReplacementEffect extends ReplacementEffect
public boolean applies(GameEvent event, Ability source, Game game) { public boolean applies(GameEvent event, Ability source, Game game) {
//Something hit the stack from the hand, see if its a spell with this ability. //Something hit the stack from the hand, see if its a spell with this ability.
ZoneChangeEvent zEvent = (ZoneChangeEvent) event; ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
if (spellId == null && if (spellId == null && // because this effect works only once, spellId has to be null here
zEvent.getFromZone() == Zone.HAND && zEvent.getFromZone() == Zone.HAND &&
zEvent.getToZone() == Zone.STACK && zEvent.getToZone() == Zone.STACK &&
event.getPlayerId().equals(source.getControllerId())) { event.getPlayerId().equals(source.getControllerId())) {