Some changes/fixes to Praetors's Grasp and Bane Alley Broker, to handle face down cards.

This commit is contained in:
LevelX2 2013-04-06 00:05:10 +02:00
parent 48f1560cb8
commit 1df4946135
2 changed files with 53 additions and 11 deletions

View file

@ -104,7 +104,7 @@ public class BaneAlleyBroker extends CardImpl<BaneAlleyBroker> {
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new BaneAlleyBrokerDrawExileEffect(), new TapSourceCost())); this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new BaneAlleyBrokerDrawExileEffect(), new TapSourceCost()));
// You may look at cards exiled with Bane Alley Broker. // You may look at cards exiled with Bane Alley Broker.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BaneAlleyBrokerLookAtCardEffect(this.getId()))); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BaneAlleyBrokerLookAtCardEffect()));
// {U}{B}, {tap}: Return a card exiled with Bane Alley Broker to its owner's hand. // {U}{B}, {tap}: Return a card exiled with Bane Alley Broker to its owner's hand.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ReturnToHandTargetEffect(), new ManaCostsImpl("{U}{B}")); Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ReturnToHandTargetEffect(), new ManaCostsImpl("{U}{B}"));
@ -227,17 +227,13 @@ class TargetCardInBaneAlleyBrokerExile extends TargetCard<TargetCardInBaneAlleyB
class BaneAlleyBrokerLookAtCardEffect extends AsThoughEffectImpl<BaneAlleyBrokerLookAtCardEffect> { class BaneAlleyBrokerLookAtCardEffect extends AsThoughEffectImpl<BaneAlleyBrokerLookAtCardEffect> {
private UUID cardId; public BaneAlleyBrokerLookAtCardEffect() {
super(AsThoughEffectType.REVEAL_FACE_DOWN, Duration.EndOfGame, Outcome.Benefit);
public BaneAlleyBrokerLookAtCardEffect(UUID cardId) {
super(AsThoughEffectType.CAST, Duration.EndOfGame, Outcome.Benefit);
this.cardId = cardId;
staticText = "You may look at cards exiled with {this}"; staticText = "You may look at cards exiled with {this}";
} }
public BaneAlleyBrokerLookAtCardEffect(final BaneAlleyBrokerLookAtCardEffect effect) { public BaneAlleyBrokerLookAtCardEffect(final BaneAlleyBrokerLookAtCardEffect effect) {
super(effect); super(effect);
this.cardId = effect.cardId;
} }
@Override @Override

View file

@ -103,11 +103,11 @@ class PraetorsGraspEffect extends OneShotEffect<PraetorsGraspEffect> {
card.setControllerId(player.getId()); card.setControllerId(player.getId());
card.moveToExile(getId(), "Praetor's Grasp", source.getSourceId(), game); card.moveToExile(getId(), "Praetor's Grasp", source.getSourceId(), game);
game.addEffect(new PraetorsGraspPlayEffect(card.getId()), source); game.addEffect(new PraetorsGraspPlayEffect(card.getId()), source);
game.addEffect(new PraetorsGraspRevealEffect(card.getId()), source);
} }
} }
}
opponent.shuffleLibrary(game); opponent.shuffleLibrary(game);
}
return true; return true;
} }
} }
@ -141,10 +141,56 @@ class PraetorsGraspPlayEffect extends AsThoughEffectImpl<PraetorsGraspPlayEffect
public boolean applies(UUID sourceId, Ability source, Game game) { public boolean applies(UUID sourceId, Ability source, Game game) {
if (sourceId.equals(cardId)) { if (sourceId.equals(cardId)) {
Card card = game.getCard(cardId); Card card = game.getCard(cardId);
if (card != null && game.getState().getZone(cardId) == Zone.EXILED) { Player controller = game.getPlayer(source.getControllerId());
if (controller != null && card != null && game.getState().getZone(cardId) == Zone.EXILED) {
if (card.getCardType().contains(CardType.INSTANT) || game.canPlaySorcery(source.getControllerId())) {
return true; return true;
} }
} }
}
return false;
}
}
class PraetorsGraspRevealEffect extends AsThoughEffectImpl<PraetorsGraspRevealEffect> {
private UUID cardId;
public PraetorsGraspRevealEffect(UUID cardId) {
super(AsThoughEffectType.REVEAL_FACE_DOWN, Duration.EndOfGame, Outcome.Benefit);
this.cardId = cardId;
staticText = "You may look at and play that card for as long as it remains exiled";
}
public PraetorsGraspRevealEffect(final PraetorsGraspRevealEffect effect) {
super(effect);
this.cardId = effect.cardId;
}
@Override
public boolean apply(Game game, Ability source) {
return true;
}
@Override
public PraetorsGraspRevealEffect copy() {
return new PraetorsGraspRevealEffect(this);
}
@Override
public boolean applies(UUID sourceId, Ability source, Game game) {
if (sourceId.equals(cardId)) {
Card card = game.getCard(cardId);
Card sourceCard = game.getCard(source.getSourceId());
Player controller = game.getPlayer(source.getControllerId());
if (controller != null && card != null && game.getState().getZone(cardId) == Zone.EXILED) {
if (controller.chooseUse(outcome, "Reveal exiled card?", game)) {
Cards cards = new CardsImpl(card);
controller.lookAtCards("Exiled with " + sourceCard.getName(), cards, game);
}
}
}
return false; return false;
} }