mirror of
https://github.com/correl/mage.git
synced 2024-11-15 19:19:33 +00:00
* Ad Nauseam - Fixed log output of revealed and moved cards.
This commit is contained in:
parent
85572a2372
commit
7e6c1ede2a
2 changed files with 15 additions and 19 deletions
|
@ -28,16 +28,15 @@
|
|||
package mage.sets.shardsofalara;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.Cards;
|
||||
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;
|
||||
|
||||
|
@ -87,23 +86,19 @@ class AdNauseamEffect extends OneShotEffect<AdNauseamEffect> {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
String message = "Reveal the top card of your library and put that card into your hand? You lose life equal to its converted mana cost.";
|
||||
Card sourceCard = game.getCard(source.getSourceId());
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player == null || sourceCard == null) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller == null || sourceCard == null) {
|
||||
return false;
|
||||
}
|
||||
Cards cards = new CardsImpl();
|
||||
while (player.chooseUse(outcome, message, game) && player.getLibrary().size() > 0) {
|
||||
Card card = player.getLibrary().removeFromTop(game);
|
||||
while (controller.chooseUse(outcome, message, game) && controller.getLibrary().size() > 0) {
|
||||
Card card = controller.getLibrary().removeFromTop(game);
|
||||
if (card != null) {
|
||||
card.moveToZone(Zone.HAND, source.getSourceId(), game, true);
|
||||
|
||||
controller.moveCardToHandWithInfo(card, source.getSourceId(), game, Zone.LIBRARY);
|
||||
int cmc = card.getManaCost().convertedManaCost();
|
||||
if (cmc > 0) {
|
||||
player.loseLife(cmc, game);
|
||||
controller.loseLife(cmc, game);
|
||||
}
|
||||
cards.add(card);
|
||||
player.revealCards("card(s) from top of library put into hand by " + sourceCard.getName(), cards, game);
|
||||
game.informPlayers(sourceCard.getName() + ": "+ player.getName() + " revealed " +card.getName() + " and lost " + cmc + " live");
|
||||
controller.revealCards(new StringBuilder(sourceCard.getName()).append(" put into hand").toString(), new CardsImpl(card), game);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -56,10 +56,11 @@ public class Revealed extends HashMap<String, Cards> implements Serializable, Co
|
|||
}
|
||||
|
||||
public void add(String name, Cards cards) {
|
||||
if (!this.containsKey(name)) {
|
||||
createRevealed(name);
|
||||
if (this.containsKey(name)) {
|
||||
this.get(name).addAll(cards);
|
||||
} else {
|
||||
this.put(name, cards.copy());
|
||||
}
|
||||
this.put(name, cards.copy());
|
||||
}
|
||||
|
||||
public Cards createRevealed(String name) {
|
||||
|
|
Loading…
Reference in a new issue