1
0
Fork 0
mirror of https://github.com/correl/mage.git synced 2025-03-28 13:00:16 -09:00

* Aven Windreader - Fixed that the reveal ability did only show the card to the controller of the ability and that the card was removed from libraray instead only shown.

This commit is contained in:
LevelX2 2015-08-30 10:12:28 +02:00
parent eb3aef7ee5
commit 826b65628e
2 changed files with 10 additions and 52 deletions
Mage.Sets/src/mage/sets/ninthedition
Mage/src/mage/abilities/effects/common

View file

@ -32,16 +32,12 @@ import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.RevealTargetPlayerLibraryEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.cards.CardsImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.game.Game;
import mage.players.Player;
import mage.target.TargetPlayer;
/**
@ -62,8 +58,9 @@ public class AvenWindreader extends CardImpl {
// Flying
this.addAbility(FlyingAbility.getInstance());
// {1}{U}: Target player reveals the top card of his or her library.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new RevealTopCardTargetPlayerEffect(), new ManaCostsImpl("{1}{U}"));
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new RevealTargetPlayerLibraryEffect(1), new ManaCostsImpl("{1}{U}"));
ability.addTarget(new TargetPlayer());
this.addAbility(ability);
}
@ -77,31 +74,3 @@ public class AvenWindreader extends CardImpl {
return new AvenWindreader(this);
}
}
class RevealTopCardTargetPlayerEffect extends OneShotEffect {
public RevealTopCardTargetPlayerEffect() {
super(Outcome.Benefit);
this.staticText = "Target player reveals the top card of his or her library.";
}
public RevealTopCardTargetPlayerEffect(final RevealTopCardTargetPlayerEffect effect) {
super(effect);
}
@Override
public RevealTopCardTargetPlayerEffect copy() {
return new RevealTopCardTargetPlayerEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getFirstTarget());
if (player != null) {
CardsImpl cards = new CardsImpl();
cards.add(player.getLibrary().removeFromTop(game));
player.revealCards("Top card of target player's library", cards, game);
}
return false;
}
}

View file

@ -27,11 +27,11 @@
*/
package mage.abilities.effects.common;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
import mage.cards.Cards;
import mage.cards.CardsImpl;
import mage.constants.Outcome;
@ -42,9 +42,8 @@ import mage.util.CardUtil;
/**
*
* @author anonymous
* @author Luna Skyrise
*/
public class RevealTargetPlayerLibraryEffect extends OneShotEffect {
private DynamicValue amountCards;
@ -73,28 +72,18 @@ public class RevealTargetPlayerLibraryEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
Player targetPlayer = game.getPlayer(source.getFirstTarget());
if (player == null || targetPlayer == null) {
MageObject sourceObject = source.getSourceObject(game);
if (player == null || targetPlayer == null || sourceObject == null) {
return false;
}
Cards cards = new CardsImpl(Zone.LIBRARY);
int count = Math.min(targetPlayer.getLibrary().size(), amountCards.calculate(game, source, this));
for (int i = 0; i < count; i++) {
Card card = targetPlayer.getLibrary().removeFromTop(game);
if (card != null) {
cards.add(card);
}
}
player.lookAtCards("Top " + amountCards.toString() + "cards of " + targetPlayer.getName() + "\'s library", cards, game);
cards.addAll(player.getLibrary().getTopCards(game, amountCards.calculate(game, source, this)));
player.revealCards(sourceObject.getIdName() + " - Top " + amountCards.toString() + "cards of " + targetPlayer.getName() + "\'s library", cards, game);
return true;
}
private String setText() {
StringBuilder sb = new StringBuilder("Reveal the top ");
sb.append(CardUtil.numberToText(amountCards.toString())).append(" cards of target player's library.");
return sb.toString();
return "Reveal the top " + CardUtil.numberToText(amountCards.toString()) + " cards of target player's library.";
}
}