fixed error with Sunbird's Invocation (#4022)

This commit is contained in:
Evan Kranzler 2017-09-18 14:45:56 -04:00
parent a5f71ba3f3
commit 4e194d965e

View file

@ -92,7 +92,7 @@ class SunbirdsInvocationTriggeredAbility extends SpellCastControllerTriggeredAbi
if (spell != null && spell.getFromZone() == Zone.HAND) {
if (spell.getCard() != null) {
for (Effect effect : getEffects()) {
effect.setTargetPointer(new FixedTarget(spell.getId(), spell.getZoneChangeCounter(game)));
effect.setTargetPointer(new FixedTarget(spell.getId()));
}
return true;
}
@ -125,8 +125,16 @@ class SunbirdsInvocationEffect extends OneShotEffect {
if (controller == null || sourceObject == null) {
return false;
}
Spell spell = game.getStack().getSpell(this.getTargetPointer().getFirst(game, source));
int xValue = 0;
if (spell == null) {
spell = (Spell) game.getLastKnownInformation(this.getTargetPointer().getFirst(game, source), Zone.STACK);
}
if (spell == null) {
return false;
}
xValue = spell.getConvertedManaCost();
Cards cards = new CardsImpl();
int xValue = game.getLastKnownInformation(this.getTargetPointer().getFirst(game, source), Zone.STACK).getConvertedManaCost();
cards.addAll(controller.getLibrary().getTopCards(game, xValue));
if (!cards.isEmpty()) {
controller.revealCards(sourceObject.getIdName(), cards, game);
@ -138,7 +146,7 @@ class SunbirdsInvocationEffect extends OneShotEffect {
if (controller.chooseTarget(Outcome.PlayForFree, cards, target, source, game)) {
Card card = cards.get(target.getFirstTarget(), game);
if (card != null) {
if (controller.chooseUse(outcome, "Do you wish to cast " + card.getName(), source, game)) {
if (controller.chooseUse(outcome, "Cast " + card.getLogName() + " without paying its mana cost?", source, game)) {
controller.cast(card.getSpellAbility(), game, true);
cards.remove(card);
}