From f43b3d1ee21c0af6e3340875f591e5aa45f2dded Mon Sep 17 00:00:00 2001 From: Plopman Date: Wed, 3 Jul 2013 21:24:47 +0200 Subject: [PATCH] Added "tapped" option for putOntoBattlefield. Fixed amulet of vigor --- .../ReturnFromGraveyardToBattlefieldTargetEffect.java | 9 ++------- .../ReturnSourceFromGraveyardToBattlefieldEffect.java | 8 ++------ .../common/search/SearchLibraryPutInPlayEffect.java | 8 +------- Mage/src/mage/cards/Card.java | 1 + Mage/src/mage/cards/CardImpl.java | 7 +++++++ Mage/src/mage/game/stack/Spell.java | 7 +++++++ 6 files changed, 20 insertions(+), 20 deletions(-) diff --git a/Mage/src/mage/abilities/effects/common/ReturnFromGraveyardToBattlefieldTargetEffect.java b/Mage/src/mage/abilities/effects/common/ReturnFromGraveyardToBattlefieldTargetEffect.java index 5b91a1c54fe..f911b854a22 100644 --- a/Mage/src/mage/abilities/effects/common/ReturnFromGraveyardToBattlefieldTargetEffect.java +++ b/Mage/src/mage/abilities/effects/common/ReturnFromGraveyardToBattlefieldTargetEffect.java @@ -75,13 +75,8 @@ public class ReturnFromGraveyardToBattlefieldTargetEffect extends OneShotEffect< if (card != null) { Player player = game.getPlayer(card.getOwnerId()); if (player != null) { - if (card.putOntoBattlefield(game, Zone.GRAVEYARD, source.getSourceId(), source.getControllerId())) { - if (tapped) { - Permanent permanent = game.getPermanent(card.getId()); - if (permanent != null) { - permanent.setTapped(true); - } - } + if(card.putOntoBattlefield(game, Zone.GRAVEYARD, source.getSourceId(), source.getControllerId(), true)){ + return true; } } } diff --git a/Mage/src/mage/abilities/effects/common/ReturnSourceFromGraveyardToBattlefieldEffect.java b/Mage/src/mage/abilities/effects/common/ReturnSourceFromGraveyardToBattlefieldEffect.java index 34e52f029c1..3df272b6a7d 100644 --- a/Mage/src/mage/abilities/effects/common/ReturnSourceFromGraveyardToBattlefieldEffect.java +++ b/Mage/src/mage/abilities/effects/common/ReturnSourceFromGraveyardToBattlefieldEffect.java @@ -70,12 +70,8 @@ public class ReturnSourceFromGraveyardToBattlefieldEffect extends OneShotEffect< Player player = game.getPlayer(source.getControllerId()); Card card = player.getGraveyard().get(source.getSourceId(), game); if (card != null) { - if (card.putOntoBattlefield(game, Zone.GRAVEYARD, source.getId(), source.getControllerId())) { - if (tapped) { - Permanent permanent = game.getPermanent(card.getId()); - if (permanent != null) - permanent.setTapped(true); - } + if(card.putOntoBattlefield(game, Zone.GRAVEYARD, source.getId(), source.getControllerId(), true)) + { return true; } } diff --git a/Mage/src/mage/abilities/effects/common/search/SearchLibraryPutInPlayEffect.java b/Mage/src/mage/abilities/effects/common/search/SearchLibraryPutInPlayEffect.java index da036572e3b..3a6558e9087 100644 --- a/Mage/src/mage/abilities/effects/common/search/SearchLibraryPutInPlayEffect.java +++ b/Mage/src/mage/abilities/effects/common/search/SearchLibraryPutInPlayEffect.java @@ -94,13 +94,7 @@ public class SearchLibraryPutInPlayEffect extends SearchEffect)target.getTargets()) { Card card = player.getLibrary().getCard(cardId, game); if (card != null) { - if (card.putOntoBattlefield(game, Zone.LIBRARY, source.getId(), source.getControllerId())) { - if (tapped) { - Permanent permanent = game.getPermanent(card.getId()); - if (permanent != null) - permanent.setTapped(true); - } - } + card.putOntoBattlefield(game, Zone.LIBRARY, source.getId(), source.getControllerId(), tapped); } } } diff --git a/Mage/src/mage/cards/Card.java b/Mage/src/mage/cards/Card.java index be654617d27..3366acc4e59 100644 --- a/Mage/src/mage/cards/Card.java +++ b/Mage/src/mage/cards/Card.java @@ -108,6 +108,7 @@ public interface Card extends MageObject { boolean cast(Game game, Zone fromZone, SpellAbility ability, UUID controllerId); boolean putOntoBattlefield(Game game, Zone fromZone, UUID sourceId, UUID controllerId); + boolean putOntoBattlefield(Game game, Zone fromZone, UUID sourceId, UUID controllerId, boolean tapped); List getMana(); void build(); diff --git a/Mage/src/mage/cards/CardImpl.java b/Mage/src/mage/cards/CardImpl.java index 6f788edbb9b..44331f555a0 100644 --- a/Mage/src/mage/cards/CardImpl.java +++ b/Mage/src/mage/cards/CardImpl.java @@ -426,6 +426,12 @@ public abstract class CardImpl> extends MageObjectImpl @Override public boolean putOntoBattlefield(Game game, Zone fromZone, UUID sourceId, UUID controllerId) { + return putOntoBattlefield(game, fromZone, sourceId, controllerId, false); + } + + + @Override + public boolean putOntoBattlefield(Game game, Zone fromZone, UUID sourceId, UUID controllerId, boolean tapped){ ZoneChangeEvent event = new ZoneChangeEvent(this.objectId, sourceId, controllerId, fromZone, Zone.BATTLEFIELD); if (!game.replaceEvent(event)) { if (fromZone != null) { @@ -462,6 +468,7 @@ public abstract class CardImpl> extends MageObjectImpl game.setZone(objectId, Zone.BATTLEFIELD); game.setScopeRelevant(true); game.applyEffects(); // magenoxx: this causes bugs - LevelX2: but it's neccessary for casting e.g. Kird Ape which must trigger evolve + permanent.setTapped(tapped); permanent.entersBattlefield(sourceId, game, event.getFromZone(), true); game.setScopeRelevant(false); game.applyEffects(); diff --git a/Mage/src/mage/game/stack/Spell.java b/Mage/src/mage/game/stack/Spell.java index fab094b1409..fdae09d4cb9 100644 --- a/Mage/src/mage/game/stack/Spell.java +++ b/Mage/src/mage/game/stack/Spell.java @@ -508,6 +508,12 @@ public class Spell> implements StackObject, Card { return false; } + + @Override + public boolean putOntoBattlefield(Game game, Zone fromZone, UUID sourceId, UUID controllerId, boolean tapped) { + throw new UnsupportedOperationException("Not supported yet."); + } + @Override public boolean putOntoBattlefield(Game game, Zone fromZone, UUID sourceId, UUID controllerId) { throw new UnsupportedOperationException("Unsupported operation"); @@ -614,4 +620,5 @@ public class Spell> implements StackObject, Card { public Card getCard() { return card; } + }