[MODIFY] fixed ISD cards

This commit is contained in:
Alvin 2011-10-02 10:07:03 +09:00
parent 4b2201d567
commit 4a4afc2505
3 changed files with 64 additions and 38 deletions

View file

@ -29,13 +29,26 @@ package mage.sets.innistrad;
import java.util.UUID; import java.util.UUID;
import mage.Constants.CardType; import mage.Constants.CardType;
import mage.Constants.Outcome;
import mage.Constants.Rarity; import mage.Constants.Rarity;
import mage.Constants.Zone;
import mage.Constants; import mage.Constants;
import mage.MageInt; import mage.MageInt;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.TapSourceCost; 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.abilities.keyword.TransformAbility;
import mage.cards.Card;
import mage.cards.CardImpl; 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;
/** /**
* *
@ -53,8 +66,12 @@ public class DelverOfSecrets extends CardImpl<DelverOfSecrets> {
this.power = new MageInt(1); this.power = new MageInt(1);
this.toughness = 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. // 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) { public DelverOfSecrets(final DelverOfSecrets card) {
@ -66,3 +83,45 @@ public class DelverOfSecrets extends CardImpl<DelverOfSecrets> {
return new DelverOfSecrets(this); return new DelverOfSecrets(this);
} }
} }
class DelverOfSecretsAbility extends TriggeredAbilityImpl<DelverOfSecretsAbility> {
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";
}
}

View file

@ -75,40 +75,4 @@ public class InsectileAberration extends CardImpl<InsectileAberration> {
public InsectileAberration copy() { public InsectileAberration copy() {
return new InsectileAberration(this); return new InsectileAberration(this);
} }
public static class InsectileAberrationWatcher extends WatcherImpl<InsectileAberrationWatcher> {
public Map<UUID, Set<UUID>> blockedCreatures = new HashMap<UUID, Set<UUID>>();
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;
}
}
}
}
}
} }

View file

@ -33,6 +33,7 @@ import mage.Constants.CardType;
import mage.Constants.Rarity; import mage.Constants.Rarity;
import mage.Constants.TimingRule; import mage.Constants.TimingRule;
import mage.Constants; import mage.Constants;
import mage.Constants.Zone;
import mage.MageInt; import mage.MageInt;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.ActivatedAbilityImpl; import mage.abilities.ActivatedAbilityImpl;
@ -51,6 +52,7 @@ import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.common.FilterCreatureCard; import mage.filter.common.FilterCreatureCard;
import mage.game.Game; import mage.game.Game;
import mage.players.Player; import mage.players.Player;
import mage.target.common.TargetAttackingOrBlockingCreature;
import mage.target.common.TargetCardInYourGraveyard; import mage.target.common.TargetCardInYourGraveyard;
import mage.target.targetpointer.FixedTarget; import mage.target.targetpointer.FixedTarget;
@ -146,7 +148,8 @@ class SkaabRuinatorEffect extends OneShotEffect<SkaabRuinatorEffect> {
if (target != null) { if (target != null) {
Player controller = game.getPlayer(target.getOwnerId()); Player controller = game.getPlayer(target.getOwnerId());
if (controller != null) { 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; return false;