diff --git a/Mage.Sets/src/mage/sets/magic2010/DjinnOfWishes.java b/Mage.Sets/src/mage/sets/magic2010/DjinnOfWishes.java index f708dca534f..3b4556e2f86 100644 --- a/Mage.Sets/src/mage/sets/magic2010/DjinnOfWishes.java +++ b/Mage.Sets/src/mage/sets/magic2010/DjinnOfWishes.java @@ -113,7 +113,7 @@ class DjinnOfWishesEffect extends OneShotEffect { if (player.chooseUse(Outcome.PlayForFree, "Play " + card.getName() + " without paying its mana cost?", game)) { if (card.getCardType().contains(CardType.LAND)) { // If the revealed card is a land, you can play it only if it's your turn and you haven't yet played a land this turn. - if (game.getActivePlayerId().equals(player.getId()) && player.getLandsPlayed() < player.getLandsPerTurn()) { + if (game.getActivePlayerId().equals(player.getId()) && player.canPlayLand()) { used = true; player.playLand(card, game); } diff --git a/Mage.Sets/src/mage/sets/mirrodinbesieged/Galvanoth.java b/Mage.Sets/src/mage/sets/mirrodinbesieged/Galvanoth.java index 6abbda56d2c..52526216292 100644 --- a/Mage.Sets/src/mage/sets/mirrodinbesieged/Galvanoth.java +++ b/Mage.Sets/src/mage/sets/mirrodinbesieged/Galvanoth.java @@ -58,6 +58,7 @@ public class Galvanoth extends CardImpl { this.power = new MageInt(3); this.toughness = new MageInt(3); + // At the beginning of your upkeep, you may look at the top card of your library. If it's an instant or sorcery card, you may cast it without paying its mana cost. this.addAbility(new BeginningOfUpkeepTriggeredAbility(new GalvanothEffect(), TargetController.YOU, true)); } @@ -84,21 +85,19 @@ class GalvanothEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - Player player = game.getPlayer(source.getControllerId()); - if (player != null && player.getLibrary().size() > 0) { - Card card = player.getLibrary().getFromTop(game); - Cards cards = new CardsImpl(); - cards.add(card); - player.lookAtCards("Galvanoth", cards, game); + Player controller = game.getPlayer(source.getControllerId()); + if (controller != null && controller.getLibrary().size() > 0) { + Card card = controller.getLibrary().getFromTop(game); + Cards cards = new CardsImpl(card); + controller.lookAtCards("Galvanoth", cards, game); if (card.getCardType().contains(CardType.INSTANT) || card.getCardType().contains(CardType.SORCERY)) { - String message = "Cast " + card.getName() + " without paying its mana cost?"; - if (player.chooseUse(Outcome.PlayForFree, message, game)) { - player.getLibrary().removeFromTop(game); - player.cast(card.getSpellAbility(), game, true); + StringBuilder message = new StringBuilder("Cast ").append(card.getName()).append(" without paying its mana cost?"); + if (controller.chooseUse(Outcome.PlayForFree, message.toString(), game)) { + controller.getLibrary().removeFromTop(game); + controller.cast(card.getSpellAbility(), game, true); } } - return true; } return false; diff --git a/Mage.Sets/src/mage/sets/worldwake/QuestForUlasTemple.java b/Mage.Sets/src/mage/sets/worldwake/QuestForUlasTemple.java index b8694a5f638..b77ce1374f9 100644 --- a/Mage.Sets/src/mage/sets/worldwake/QuestForUlasTemple.java +++ b/Mage.Sets/src/mage/sets/worldwake/QuestForUlasTemple.java @@ -95,15 +95,15 @@ class QuestForUlasTempleEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - Player player = game.getPlayer(source.getControllerId()); - if (player != null && player.getLibrary().size() > 0) { - Card card = player.getLibrary().getFromTop(game); - Cards cards = new CardsImpl(); - cards.add(card); - player.lookAtCards("This card", cards, game); + Player controller = game.getPlayer(source.getControllerId()); + Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId()); + if (sourcePermanent != null && controller != null && controller.getLibrary().size() > 0) { + Card card = controller.getLibrary().getFromTop(game); + Cards cards = new CardsImpl(card); + controller.lookAtCards(sourcePermanent.getName(), cards, game); if (card.getCardType().contains(CardType.CREATURE)) { - if (player.chooseUse(Outcome.DrawCard, "Do you wish to reveal the creature card at the top of the library?", game)) { - player.revealCards("Quest for Ula's Temple", cards, game); + if (controller.chooseUse(Outcome.DrawCard, "Do you wish to reveal the creature card at the top of the library?", game)) { + controller.revealCards(sourcePermanent.getName(), cards, game); Permanent questForUlasTemple = game.getPermanent(source.getSourceId()); if (questForUlasTemple != null) { questForUlasTemple.addCounters(CounterType.QUEST.createInstance(), game); @@ -133,11 +133,9 @@ class QuestForUlasTempleTriggeredAbility extends TriggeredAbilityImpl= 3) { - return true; + if (event.getType().equals(GameEvent.EventType.END_TURN_STEP_PRE)) { + Permanent quest = game.getPermanent(super.getSourceId()); + return quest != null && quest.getCounters().getCount(CounterType.QUEST) >= 3; } return false; } @@ -171,17 +169,19 @@ class QuestForUlasTempleEffect2 extends OneShotEffect @Override public boolean apply(Game game, Ability source) { - Player player = game.getPlayer(source.getControllerId()); - if (player == null || !player.chooseUse(Outcome.PutCreatureInPlay, query, game)) { - return false; - } - TargetCardInHand target = new TargetCardInHand(filter); - if (player.choose(Outcome.PutCreatureInPlay, target, source.getSourceId(), game)) { - Card card = game.getCard(target.getFirstTarget()); - if (card != null) { - card.putOntoBattlefield(game, Zone.HAND, source.getId(), source.getControllerId()); - return true; + Player controller = game.getPlayer(source.getControllerId()); + if (controller != null) { + TargetCardInHand target = new TargetCardInHand(filter); + if (target.canChoose(source.getSourceId(), controller.getId(), game) + &&controller.chooseUse(Outcome.PutCreatureInPlay, query, game)) { + if (controller.choose(Outcome.PutCreatureInPlay, target, source.getSourceId(), game)) { + Card card = game.getCard(target.getFirstTarget()); + if (card != null) { + controller.putOntoBattlefieldWithInfo(card, game, Zone.HAND, source.getSourceId()); + } + } } + return true; } return false; } diff --git a/Mage/src/mage/game/permanent/token/WolfToken.java b/Mage/src/mage/game/permanent/token/WolfToken.java index 870ecb8b27a..31ad4a73879 100644 --- a/Mage/src/mage/game/permanent/token/WolfToken.java +++ b/Mage/src/mage/game/permanent/token/WolfToken.java @@ -39,14 +39,20 @@ import mage.ObjectColor; public class WolfToken extends Token { public WolfToken() { + this("ISD"); + } + + public WolfToken(String setCode) { super("Wolf", "2/2 green Wolf creature token"); + this.setOriginalExpansionSetCode(setCode); + if (setCode.equals("ISD")) { + setTokenType(Type.SECOND.code); + } cardType.add(CardType.CREATURE); color = ObjectColor.GREEN; subtype.add("Wolf"); power = new MageInt(2); toughness = new MageInt(2); - setTokenType(Type.SECOND.code); - this.setOriginalExpansionSetCode("ISD"); } public WolfToken(Token.Type type) {