This commit is contained in:
BetaSteward 2012-02-28 22:54:40 -05:00
parent 6f7050f9eb
commit cab80c5a68
8 changed files with 586 additions and 10 deletions

View file

@ -0,0 +1,122 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.darkascension;
import java.util.List;
import java.util.UUID;
import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.Constants.Zone;
import mage.abilities.Ability;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.SearchEffect;
import mage.abilities.keyword.FlashbackAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.filter.FilterCard;
import mage.game.Game;
import mage.game.stack.Spell;
import mage.players.Player;
import mage.target.common.TargetCardInLibrary;
/**
*
* @author BetaSteward
*/
public class IncreasingAmbition extends CardImpl<IncreasingAmbition> {
public IncreasingAmbition(UUID ownerId) {
super(ownerId, 69, "Increasing Ambition", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{4}{B}");
this.expansionSetCode = "DKA";
this.color.setBlack(true);
// Search your library for a card and put that card into your hand. If Increasing Ambition was cast from a graveyard, instead search your library for two cards and put those cards into your hand. Then shuffle your library.
this.getSpellAbility().addEffect(new IncreasingAmbitionEffect());
// Flashback {7}{B}
this.addAbility(new FlashbackAbility(new ManaCostsImpl("{7}{B}"), Constants.TimingRule.SORCERY));
}
public IncreasingAmbition(final IncreasingAmbition card) {
super(card);
}
@Override
public IncreasingAmbition copy() {
return new IncreasingAmbition(this);
}
}
class IncreasingAmbitionEffect extends SearchEffect<IncreasingAmbitionEffect> {
public IncreasingAmbitionEffect() {
super(new TargetCardInLibrary(), Constants.Outcome.DrawCard);
staticText = "Search your library for a card and put that card into your hand. If Increasing Ambition was cast from a graveyard, instead search your library for two cards and put those cards into your hand. Then shuffle your library";
}
public IncreasingAmbitionEffect(final IncreasingAmbitionEffect effect) {
super(effect);
}
@Override
public IncreasingAmbitionEffect copy() {
return new IncreasingAmbitionEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player != null) {
Spell spell = (Spell) game.getStack().getStackObject(source.getSourceId());
if (spell != null) {
if (spell.getFromZone() == Zone.GRAVEYARD) {
target = new TargetCardInLibrary(2, new FilterCard());
}
else {
target = new TargetCardInLibrary();
}
player.searchLibrary(target, game);
if (target.getTargets().size() > 0) {
for (UUID cardId: (List<UUID>)target.getTargets()) {
Card card = player.getLibrary().remove(cardId, game);
if (card != null){
card.moveToZone(Constants.Zone.HAND, source.getId(), game, false);
}
}
}
// shuffle anyway
player.shuffleLibrary(game);
return true;
}
}
return false;
}
}

View file

@ -0,0 +1,116 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.darkascension;
import java.util.UUID;
import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.abilities.Ability;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.keyword.FlashbackAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.game.Game;
import mage.game.stack.Spell;
import mage.players.Player;
import mage.target.TargetPlayer;
/**
*
* @author BetaSteward
*/
public class IncreasingConfusion extends CardImpl<IncreasingConfusion> {
public IncreasingConfusion(UUID ownerId) {
super(ownerId, 41, "Increasing Confusion", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{X}{U}");
this.expansionSetCode = "DKA";
this.color.setBlue(true);
// Target player puts the top X cards of his or her library into his or her graveyard. If Increasing Confusion was cast from a graveyard, that player puts twice that many cards into his or her graveyard instead.
this.getSpellAbility().addEffect(new IncreasingConfusionEffect());
this.getSpellAbility().addTarget(new TargetPlayer());
// Flashback {X}{U}
this.addAbility(new FlashbackAbility(new ManaCostsImpl("{X}{U}"), Constants.TimingRule.SORCERY));
}
public IncreasingConfusion(final IncreasingConfusion card) {
super(card);
}
@Override
public IncreasingConfusion copy() {
return new IncreasingConfusion(this);
}
}
class IncreasingConfusionEffect extends OneShotEffect<IncreasingConfusionEffect> {
public IncreasingConfusionEffect() {
super(Constants.Outcome.Detriment);
staticText = "Target player puts the top X cards of his or her library into his or her graveyard. If Increasing Confusion was cast from a graveyard, that player puts twice that many cards into his or her graveyard instead";
}
public IncreasingConfusionEffect(final IncreasingConfusionEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getFirstTarget());
if (player != null) {
int amount = source.getManaCostsToPay().getX();
Spell spell = (Spell) game.getStack().getStackObject(source.getSourceId());
if (spell != null) {
if (spell.getFromZone() == Constants.Zone.GRAVEYARD) {
amount *= 2;
}
Card card;
for (int i = 0; i < amount; i++) {
card = player.getLibrary().removeFromTop(game);
if (card != null) {
card.moveToZone(Constants.Zone.GRAVEYARD, source.getId(), game, false);
} else {
break;
}
}
return true;
}
}
return false;
}
@Override
public IncreasingConfusionEffect copy() {
return new IncreasingConfusionEffect(this);
}
}

View file

@ -0,0 +1,107 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.darkascension;
import java.util.UUID;
import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.keyword.FlashbackAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.game.Game;
import mage.game.permanent.token.Token;
import mage.game.stack.Spell;
import mage.players.Player;
/**
*
* @author BetaSteward
*/
public class IncreasingDevotion extends CardImpl<IncreasingDevotion> {
public IncreasingDevotion(UUID ownerId) {
super(ownerId, 11, "Increasing Devotion", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{3}{W}{W}");
this.expansionSetCode = "DKA";
this.color.setWhite(true);
// Put five 1/1 white Human creature tokens onto the battlefield. If Increasing Devotion was cast from a graveyard, put ten of those tokens onto the battlefield instead.
this.getSpellAbility().addEffect(new IncreasingDevotionEffect());
// Flashback {7}{W}{W}
this.addAbility(new FlashbackAbility(new ManaCostsImpl("{7}{W}{W}"), Constants.TimingRule.SORCERY));
}
public IncreasingDevotion(final IncreasingDevotion card) {
super(card);
}
@Override
public IncreasingDevotion copy() {
return new IncreasingDevotion(this);
}
}
class IncreasingDevotionEffect extends OneShotEffect<IncreasingDevotionEffect> {
private static HumanToken token = new HumanToken();
public IncreasingDevotionEffect() {
super(Constants.Outcome.PutCreatureInPlay);
staticText = "Put five 1/1 white Human creature tokens onto the battlefield. If Increasing Devotion was cast from a graveyard, put ten of those tokens onto the battlefield instead";
}
public IncreasingDevotionEffect(final IncreasingDevotionEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
int amount = 5;
Spell spell = (Spell) game.getStack().getStackObject(source.getSourceId());
if (spell != null) {
if (spell.getFromZone() == Constants.Zone.GRAVEYARD) {
amount = 10;
}
token.putOntoBattlefield(amount, game, source.getSourceId(), source.getControllerId());
return true;
}
return false;
}
@Override
public IncreasingDevotionEffect copy() {
return new IncreasingDevotionEffect(this);
}
}

View file

@ -0,0 +1,109 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.darkascension;
import java.util.UUID;
import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.abilities.Ability;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.keyword.FlashbackAbility;
import mage.cards.CardImpl;
import mage.counters.Counter;
import mage.counters.CounterType;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.game.stack.Spell;
import mage.target.common.TargetCreaturePermanent;
/**
*
* @author BetaSteward
*/
public class IncreasingSavagery extends CardImpl<IncreasingSavagery> {
public IncreasingSavagery(UUID ownerId) {
super(ownerId, 120, "Increasing Savagery", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{2}{G}{G}");
this.expansionSetCode = "DKA";
this.color.setGreen(true);
// Put five +1/+1 counters on target creature. If Increasing Savagery was cast from a graveyard, put ten +1/+1 counters on that creature instead.
this.getSpellAbility().addEffect(new IncreasingSavageryEffect());
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
// Flashback {5}{G}{G}
this.addAbility(new FlashbackAbility(new ManaCostsImpl("{5}{G}{G}"), Constants.TimingRule.SORCERY));
}
public IncreasingSavagery(final IncreasingSavagery card) {
super(card);
}
@Override
public IncreasingSavagery copy() {
return new IncreasingSavagery(this);
}
}
class IncreasingSavageryEffect extends OneShotEffect<IncreasingSavageryEffect> {
public IncreasingSavageryEffect() {
super(Constants.Outcome.BoostCreature);
staticText = "Put five +1/+1 counters on target creature. If Increasing Savagery was cast from a graveyard, put ten +1/+1 counters on that creature instead";
}
public IncreasingSavageryEffect(final IncreasingSavageryEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
int amount = 5;
Spell spell = (Spell) game.getStack().getStackObject(source.getSourceId());
if (spell != null) {
if (spell.getFromZone() == Constants.Zone.GRAVEYARD) {
amount = 10;
}
Permanent permanent = game.getPermanent(targetPointer.getFirst(source));
if (permanent != null) {
permanent.addCounters(CounterType.P1P1.createInstance(amount), game);
}
return true;
}
return false;
}
@Override
public IncreasingSavageryEffect copy() {
return new IncreasingSavageryEffect(this);
}
}

View file

@ -0,0 +1,97 @@
package org.mage.test.cards;
import junit.framework.Assert;
import mage.Constants;
import mage.filter.Filter;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
*
* also tests flashback
*
* @author BetaSteward
*/
public class TestIncreasingCards extends CardTestPlayerBase {
@Test
public void testIncreasingAmbition() {
removeAllCardsFromHand(playerA);
removeAllCardsFromLibrary(playerA);
addCard(Constants.Zone.BATTLEFIELD, playerA, "Swamp", 8);
addCard(Constants.Zone.HAND, playerA, "Increasing Ambition");
addCard(Constants.Zone.LIBRARY, playerA, "Swamp", 4);
castSpell(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Increasing Ambition");
activateAbility(3, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Flashback {7}{B}");
setStopAt(3, Constants.PhaseStep.BEGIN_COMBAT);
execute();
assertLife(playerA, 20);
assertLife(playerB, 20);
assertGraveyardCount(playerA, 0);
assertHandCount(playerA, 4);
assertExileCount("Increasing Ambition", 1);
}
@Test
public void testIncreasingConfusion() {
addCard(Constants.Zone.BATTLEFIELD, playerA, "Island", 4);
addCard(Constants.Zone.HAND, playerA, "Increasing Confusion");
castSpell(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Increasing Confusion");
activateAbility(3, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Flashback {X}{U}");
setStopAt(3, Constants.PhaseStep.BEGIN_COMBAT);
execute();
assertLife(playerA, 20);
assertLife(playerB, 20);
assertGraveyardCount(playerA, 0);
assertExileCount("Increasing Confusion", 1);
assertGraveyardCount(playerB, 9);
}
@Test
public void testIncreasingDevotion() {
addCard(Constants.Zone.BATTLEFIELD, playerA, "Plains", 9);
addCard(Constants.Zone.HAND, playerA, "Increasing Devotion");
castSpell(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Increasing Devotion");
activateAbility(3, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Flashback {7}{W}{W}");
setStopAt(3, Constants.PhaseStep.BEGIN_COMBAT);
execute();
assertLife(playerA, 20);
assertLife(playerB, 20);
assertGraveyardCount(playerA, 0);
assertPermanentCount(playerA, "Human", 15);
assertExileCount("Increasing Devotion", 1);
}
@Test
public void testIncreasingSavagery() {
addCard(Constants.Zone.BATTLEFIELD, playerA, "Forest", 7);
addCard(Constants.Zone.HAND, playerA, "Increasing Savagery");
addCard(Constants.Zone.BATTLEFIELD, playerA, "Ornithopter");
castSpell(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Increasing Savagery");
activateAbility(3, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Flashback {5}{G}{G}");
setStopAt(3, Constants.PhaseStep.BEGIN_COMBAT);
execute();
assertLife(playerA, 20);
assertLife(playerB, 20);
assertGraveyardCount(playerA, 0);
assertPowerToughness(playerA, "Ornithopter", 15, 17, Filter.ComparisonScope.Any);
assertExileCount("Increasing Savagery", 1);
}
}

View file

@ -17,6 +17,7 @@ import java.util.UUID;
import mage.Constants.PhaseStep; import mage.Constants.PhaseStep;
import mage.counters.Counter; import mage.counters.Counter;
import mage.counters.CounterType; import mage.counters.CounterType;
import mage.game.ExileZone;
import org.mage.test.player.TestPlayer; import org.mage.test.player.TestPlayer;
/** /**
@ -429,6 +430,25 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
Assert.assertEquals("(Graveyard) Card counts are not equal ", count, actual); Assert.assertEquals("(Graveyard) Card counts are not equal ", count, actual);
} }
/**
* Assert card count in exile.
*
* @param cardName Name of the cards that should be counted.
* @param count Expected count.
*/
public void assertExileCount(String cardName, int count) throws AssertionError {
int actualCount = 0;
for (ExileZone exile: currentGame.getExile().getExileZones()) {
for (Card card : exile.getCards(currentGame)) {
if (card.getName().equals(cardName)) {
actualCount++;
}
}
}
Assert.assertEquals("(Exile) Card counts are not equal (" + cardName + ")", count, actualCount);
}
/** /**
* Assert card count in player's graveyard. * Assert card count in player's graveyard.
* *

View file

@ -250,7 +250,7 @@ public abstract class CardImpl<T extends CardImpl<T>> extends MageObjectImpl<T>
game.getPlayer(ownerId).getHand().add(this); game.getPlayer(ownerId).getHand().add(this);
break; break;
case STACK: case STACK:
game.getStack().push(new Spell(this, this.getSpellAbility().copy(), ownerId)); game.getStack().push(new Spell(this, this.getSpellAbility().copy(), ownerId, event.getFromZone()));
break; break;
case EXILED: case EXILED:
game.getExile().getPermanentExile().add(this); game.getExile().getPermanentExile().add(this);
@ -304,7 +304,7 @@ public abstract class CardImpl<T extends CardImpl<T>> extends MageObjectImpl<T>
} }
game.rememberLKI(objectId, event.getFromZone(), this); game.rememberLKI(objectId, event.getFromZone(), this);
} }
game.getStack().push(new Spell(this, ability.copy(), controllerId)); game.getStack().push(new Spell(this, ability.copy(), controllerId, event.getFromZone()));
game.setZone(objectId, event.getToZone()); game.setZone(objectId, event.getToZone());
game.fireEvent(event); game.fireEvent(event);
return game.getState().getZone(objectId) == Zone.STACK; return game.getState().getZone(objectId) == Zone.STACK;

View file

@ -28,6 +28,8 @@
package mage.game.stack; package mage.game.stack;
import java.util.List;
import java.util.UUID;
import mage.Constants.CardType; import mage.Constants.CardType;
import mage.Constants.Rarity; import mage.Constants.Rarity;
import mage.Constants.Zone; import mage.Constants.Zone;
@ -46,13 +48,9 @@ import mage.abilities.effects.PostResolveEffect;
import mage.abilities.keyword.KickerAbility; import mage.abilities.keyword.KickerAbility;
import mage.cards.Card; import mage.cards.Card;
import mage.game.Game; import mage.game.Game;
import mage.game.events.GameEvent; import mage.game.events.ZoneChangeEvent;
import mage.players.Player; import mage.players.Player;
import mage.target.Target; import mage.target.Target;
import java.util.List;
import java.util.UUID;
import mage.game.events.ZoneChangeEvent;
import mage.watchers.Watcher; import mage.watchers.Watcher;
/** /**
@ -65,23 +63,26 @@ public class Spell<T extends Spell<T>> implements StackObject, Card {
private SpellAbility ability; private SpellAbility ability;
private UUID controllerId; private UUID controllerId;
private boolean copiedSpell; private boolean copiedSpell;
private Zone fromZone;
public Spell(Card card, SpellAbility ability, UUID controllerId) { public Spell(Card card, SpellAbility ability, UUID controllerId, Zone fromZone) {
this.card = card; this.card = card;
this.ability = ability; this.ability = ability;
this.ability.setControllerId(controllerId); this.ability.setControllerId(controllerId);
this.controllerId = controllerId; this.controllerId = controllerId;
this.fromZone = fromZone;
} }
public Spell(final Spell<T> spell) { public Spell(final Spell<T> spell) {
this.card = spell.card.copy(); this.card = spell.card.copy();
this.ability = spell.ability.copy(); this.ability = spell.ability.copy();
this.controllerId = spell.controllerId; this.controllerId = spell.controllerId;
this.fromZone = spell.fromZone;
} }
@Override @Override
public boolean resolve(Game game) { public boolean resolve(Game game) {
boolean result = false; boolean result;
if (card.getCardType().contains(CardType.INSTANT) || card.getCardType().contains(CardType.SORCERY)) { if (card.getCardType().contains(CardType.INSTANT) || card.getCardType().contains(CardType.SORCERY)) {
if (ability.getTargets().stillLegal(ability, game)) { if (ability.getTargets().stillLegal(ability, game)) {
updateOptionalCosts(); updateOptionalCosts();
@ -359,7 +360,7 @@ public class Spell<T extends Spell<T>> implements StackObject, Card {
} }
public Spell copySpell() { public Spell copySpell() {
return new Spell(this.card.copy(), this.ability.copySpell(), this.controllerId); return new Spell(this.card.copy(), this.ability.copySpell(), this.controllerId, this.fromZone);
} }
@Override @Override
@ -432,5 +433,9 @@ public class Spell<T extends Spell<T>> implements StackObject, Card {
public boolean isCopiedSpell ( ) { public boolean isCopiedSpell ( ) {
return this.copiedSpell; return this.copiedSpell;
} }
public Zone getFromZone() {
return this.fromZone;
}
} }