From 4a4afc2505cdd93fec769d24d362a310f60887d9 Mon Sep 17 00:00:00 2001 From: Alvin Date: Sun, 2 Oct 2011 10:07:03 +0900 Subject: [PATCH] [MODIFY] fixed ISD cards --- .../mage/sets/innistrad/DelverOfSecrets.java | 61 ++++++++++++++++++- .../sets/innistrad/InsectileAberration.java | 36 ----------- .../mage/sets/innistrad/SkaabRuinator.java | 5 +- 3 files changed, 64 insertions(+), 38 deletions(-) diff --git a/Mage.Sets/src/mage/sets/innistrad/DelverOfSecrets.java b/Mage.Sets/src/mage/sets/innistrad/DelverOfSecrets.java index 04dbdafeb5..d56ef36229 100644 --- a/Mage.Sets/src/mage/sets/innistrad/DelverOfSecrets.java +++ b/Mage.Sets/src/mage/sets/innistrad/DelverOfSecrets.java @@ -29,13 +29,26 @@ package mage.sets.innistrad; import java.util.UUID; import mage.Constants.CardType; +import mage.Constants.Outcome; import mage.Constants.Rarity; +import mage.Constants.Zone; import mage.Constants; import mage.MageInt; +import mage.abilities.TriggeredAbilityImpl; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.costs.common.TapSourceCost; +import mage.abilities.effects.common.TapSourceEffect; +import mage.abilities.effects.common.TransformSourceEffect; import mage.abilities.keyword.TransformAbility; +import mage.cards.Card; import mage.cards.CardImpl; +import mage.cards.Cards; +import mage.cards.CardsImpl; +import mage.filter.common.FilterCreatureCard; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.players.Player; +import mage.target.TargetCard; /** * @@ -52,9 +65,13 @@ public class DelverOfSecrets extends CardImpl { this.color.setBlue(true); this.power = new MageInt(1); this.toughness = new MageInt(1); + + this.canTransform = true; + this.secondSideCard = new InsectileAberration(ownerId); // At the beginning of your upkeep, look at the top card of your library. You may reveal that card. If an instant or sorcery card is revealed this way, transform Delver of Secrets. - this.addWatcher(new InsectileAberration.InsectileAberrationWatcher()); + this.addAbility(new TransformAbility()); + this.addAbility(new DelverOfSecretsAbility()); } public DelverOfSecrets(final DelverOfSecrets card) { @@ -66,3 +83,45 @@ public class DelverOfSecrets extends CardImpl { return new DelverOfSecrets(this); } } + +class DelverOfSecretsAbility extends TriggeredAbilityImpl { + + public DelverOfSecretsAbility() { + super(Constants.Zone.BATTLEFIELD, new TransformSourceEffect(), false); + } + + public DelverOfSecretsAbility(DelverOfSecretsAbility ability) { + super(ability); + } + + @Override + public DelverOfSecretsAbility copy() { + return new DelverOfSecretsAbility(this); + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + if (event.getType() == GameEvent.EventType.UPKEEP_STEP_PRE && event.getPlayerId().equals(this.controllerId)) { + Player player = game.getPlayer(this.controllerId); + 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); + if (player.chooseUse(Outcome.DrawCard, "Do you wish to reveal the card at the top of the liberary?", game)) + { + player.revealCards("Delver of Secrets", cards, game); + if ((card.getCardType().contains(CardType.INSTANT) || card.getCardType().contains(CardType.SORCERY))) { + return true; + } + } + } + } + return false; + } + + @Override + public String getRule() { + return "At the beginning of your upkeep, look at the top card of your library. You may reveal that card. If an instant or sorcery card is revealed this way, transform Delver of Secrets"; + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/innistrad/InsectileAberration.java b/Mage.Sets/src/mage/sets/innistrad/InsectileAberration.java index 9b7fdd32cc..ade8153cc0 100644 --- a/Mage.Sets/src/mage/sets/innistrad/InsectileAberration.java +++ b/Mage.Sets/src/mage/sets/innistrad/InsectileAberration.java @@ -75,40 +75,4 @@ public class InsectileAberration extends CardImpl { public InsectileAberration copy() { return new InsectileAberration(this); } - - public static class InsectileAberrationWatcher extends WatcherImpl { - - public Map> blockedCreatures = new HashMap>(); - - public InsectileAberrationWatcher() { - super("InsectileAberrationWatcher"); - } - - public InsectileAberrationWatcher(final InsectileAberrationWatcher watcher) { - super(watcher); - } - - @Override - public InsectileAberrationWatcher copy() { - return new InsectileAberrationWatcher(this); - } - - @Override - public void watch(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.DRAW_STEP_PRE && event.getSourceId().equals(sourceId)) { - Player player = game.getPlayer(event.getPlayerId()); - if (player != null && player.getLibrary().size() > 0) { - Card card = player.getLibrary().getFromTop(game); - Cards cards = new CardsImpl(); - cards.add(card); - player.lookAtCards("Insectile Aberration", cards, game); - - if (card.getCardType().contains(CardType.INSTANT) || card.getCardType().contains(CardType.SORCERY)) { - player.revealCards("This card", cards, game); - condition = true; - } - } - } - } - } } diff --git a/Mage.Sets/src/mage/sets/innistrad/SkaabRuinator.java b/Mage.Sets/src/mage/sets/innistrad/SkaabRuinator.java index 7d5b7afa53..5b352e1430 100644 --- a/Mage.Sets/src/mage/sets/innistrad/SkaabRuinator.java +++ b/Mage.Sets/src/mage/sets/innistrad/SkaabRuinator.java @@ -33,6 +33,7 @@ import mage.Constants.CardType; import mage.Constants.Rarity; import mage.Constants.TimingRule; import mage.Constants; +import mage.Constants.Zone; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.ActivatedAbilityImpl; @@ -51,6 +52,7 @@ import mage.filter.common.FilterControlledCreaturePermanent; import mage.filter.common.FilterCreatureCard; import mage.game.Game; import mage.players.Player; +import mage.target.common.TargetAttackingOrBlockingCreature; import mage.target.common.TargetCardInYourGraveyard; import mage.target.targetpointer.FixedTarget; @@ -146,7 +148,8 @@ class SkaabRuinatorEffect extends OneShotEffect { if (target != null) { Player controller = game.getPlayer(target.getOwnerId()); if (controller != null) { - return controller.cast(target.getSpellAbility(), game, true); + //return controller.cast(target.getSpellAbility(), game, true); + return target.cast(game, Zone.GRAVEYARD, target.getSpellAbility(), controller.getId()); } } return false;