* Zur's Weirding - Fixed that the player hand cards were not revealed.

This commit is contained in:
LevelX2 2015-06-21 23:50:03 +02:00
parent 87f919ecac
commit 88928772fb
6 changed files with 62 additions and 27 deletions

View file

@ -31,18 +31,20 @@ import java.util.UUID;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ContinuousEffectImpl;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardsImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Layer;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.SubLayer;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.players.Player;
import mage.players.PlayerList;
@ -56,8 +58,8 @@ public class ZursWeirding extends CardImpl {
super(ownerId, 112, "Zur's Weirding", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{3}{U}");
this.expansionSetCode = "ICE";
// Players play with their hands revealed.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new PlayerRevealHandCardsEffect()));
// If a player would draw a card, he or she reveals it instead. Then any other player may pay 2 life. If a player does, put that card into its owner's graveyard. Otherwise, that player draws a card.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ZursWeirdingReplacementEffect()));
@ -97,32 +99,32 @@ class ZursWeirdingReplacementEffect extends ReplacementEffectImpl {
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Player player = game.getPlayer(event.getTargetId());
MageObject sourceObject = game.getObject(source.getSourceId());
if (player != null) {
MageObject sourceObject = source.getSourceObject(game);
if (player != null && sourceObject != null) {
Card card = player.getLibrary().getFromTop(game);
if (card != null) {
// reveals it instead
player.revealCards(sourceObject != null ? sourceObject.getName() : null, new CardsImpl(card), game);
player.revealCards(sourceObject.getIdName() + " next draw of " + player.getName() + " (" + game.getTurnNum()+"|"+game.getPhase().getType() +")", new CardsImpl(card), game);
// Then any other player may pay 2 life. If a player does, put that card into its owner's graveyard
PlayerList playerList = game.getPlayerList().copy();
playerList.setCurrent(player.getId());
Player currentPlayer = playerList.getNext(game);
String message = new StringBuilder("Pay 2 life to put ").append(card.getName()).append(" into graveyard?").toString();
String message = new StringBuilder("Pay 2 life to put ").append(card.getLogName()).append(" into graveyard?").toString();
while (!currentPlayer.getId().equals(player.getId())) {
if (currentPlayer.canPayLifeCost() &&
currentPlayer.getLife() >= 2 &&
currentPlayer.chooseUse(Outcome.Benefit, message, game)) {
currentPlayer.loseLife(2, game);
player.moveCards(card, Zone.LIBRARY, Zone.GRAVEYARD, source, game);
game.getState().getRevealed().reset();
// game.getState().getRevealed().reset();
return true;
}
currentPlayer = playerList.getNext(game);
}
game.getState().getRevealed().reset();
// game.getState().getRevealed().reset();
}
}
return false;
@ -138,3 +140,35 @@ class ZursWeirdingReplacementEffect extends ReplacementEffectImpl {
}
}
class PlayerRevealHandCardsEffect extends ContinuousEffectImpl {
public PlayerRevealHandCardsEffect() {
super(Duration.WhileOnBattlefield, Layer.PlayerEffects, SubLayer.NA, Outcome.Detriment);
staticText = "Players play with their hands revealed";
}
public PlayerRevealHandCardsEffect(final PlayerRevealHandCardsEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
for (UUID playerID : controller.getInRange()) {
Player player = game.getPlayer(playerID);
if (player != null) {
player.revealCards(player.getName() + "'s hand cards", player.getHand(), game, false);
}
}
return true;
}
return false;
}
@Override
public PlayerRevealHandCardsEffect copy() {
return new PlayerRevealHandCardsEffect(this);
}
}

View file

@ -85,7 +85,7 @@ class PeekEffect extends OneShotEffect {
Player player = game.getPlayer(targetPointer.getFirst(game, source));
MageObject sourceObject = source.getSourceObject(game);
if (player != null && controller != null && sourceObject != null) {
controller.lookAtCards(sourceObject.getIdName(), player.getHand(), game);
controller.lookAtCards(sourceObject.getIdName() + " " + player.getName() + " (" + game.getTurnNum()+"|"+game.getPhase().getType() +")", player.getHand(), game);
}
return true;
}

View file

@ -48,7 +48,6 @@ public class Telepathy extends CardImpl {
super(ownerId, 102, "Telepathy", Rarity.UNCOMMON, new CardType[]{CardType.ENCHANTMENT}, "{U}");
this.expansionSetCode = "USG";
// Your opponents play with their hands revealed.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new OpponentsPlayWithTheTopCardRevealedEffect()));
}
@ -82,7 +81,7 @@ class OpponentsPlayWithTheTopCardRevealedEffect extends ContinuousEffectImpl {
for (UUID opponentId : game.getOpponents(controller.getId())) {
Player opponent = game.getPlayer(opponentId);
if (opponent != null) {
controller.revealCards(sourceObject.getName() + " " + opponent.getName(), opponent.getHand(), game, false);
controller.revealCards(sourceObject.getIdName() + " " + opponent.getName(), opponent.getHand(), game, false);
}
}
return true;

View file

@ -28,6 +28,7 @@
package mage.sets.zendikar;
import java.util.UUID;
import mage.MageObject;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
@ -42,7 +43,6 @@ import mage.cards.CardImpl;
import mage.cards.Cards;
import mage.cards.CardsImpl;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
/**
@ -56,7 +56,10 @@ public class ExplorersScope extends CardImpl {
this.expansionSetCode = "ZEN";
this.subtype.add("Equipment");
// Whenever equipped creature attacks, look at the top card of your library. If it's a land card, you may put it onto the battlefield tapped.
this.addAbility(new AttacksAttachedTriggeredAbility(new ExplorersScopeEffect()));
// Equip ({1}: Attach to target creature you control. Equip only as a sorcery.)
this.addAbility(new EquipAbility(Outcome.AddAbility, new GenericManaCost(1)));
}
@ -88,28 +91,24 @@ class ExplorersScopeEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null) {
Player controller = game.getPlayer(source.getControllerId());
MageObject sourceObject = source.getSourceObject(game);
if (controller == null || sourceObject == null) {
return false;
}
Card card = player.getLibrary().getFromTop(game);
Card card = controller.getLibrary().getFromTop(game);
if (card != null) {
Cards cards = new CardsImpl();
cards.add(card);
player.lookAtCards("Explorer's Scope", cards, game);
controller.lookAtCards(sourceObject.getIdName(), cards, game);
if (card.getCardType().contains(CardType.LAND)) {
String message = "Put " + card.getName() + " onto the battlefield tapped?";
if (player.chooseUse(Outcome.PutLandInPlay, message, game)) {
if (card.putOntoBattlefield(game, Zone.LIBRARY, source.getSourceId(), source.getControllerId())) {
Permanent permanent = game.getPermanent(card.getId());
if (permanent != null) {
permanent.setTapped(true);
}
}
String message = "Put " + card.getLogName() + " onto the battlefield tapped?";
if (controller.chooseUse(Outcome.PutLandInPlay, message, game)) {
card.putOntoBattlefield(game, Zone.LIBRARY, source.getSourceId(), source.getControllerId(), true);
}
}
}
return true;
}
}
}

View file

@ -29,6 +29,9 @@ package org.mage.test.cards.abilities.keywords;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import mage.game.permanent.Permanent;
import mage.game.permanent.PermanentToken;
import org.junit.Assert;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
@ -89,5 +92,5 @@ public class ProvokeTest extends CardTestPlayerBase{
assertLife(playerA, 18); // one attack from Imp
assertLife(playerB, 15); // Not blocked
}
}
}

View file

@ -99,7 +99,7 @@ public class MiracleWatcher extends Watcher {
Cards cards = new CardsImpl();
cards.add(card);
controller.lookAtCards("Miracle", cards, game);
if (controller.chooseUse(Outcome.Benefit, "Reveal " + card.getName() + " to be able to use Miracle?", game)) {
if (controller.chooseUse(Outcome.Benefit, "Reveal " + card.getLogName() + " to be able to use Miracle?", game)) {
controller.revealCards("Miracle", cards, game);
game.fireEvent(GameEvent.getEvent(GameEvent.EventType.MIRACLE_CARD_REVEALED, card.getId(), card.getId(),controller.getId()));
break;