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;
|
package mage.sets.shardsofalara;
|
||||||
|
|
||||||
import java.util.UUID;
|
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.Ability;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
import mage.cards.Card;
|
import mage.cards.Card;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.cards.Cards;
|
|
||||||
import mage.cards.CardsImpl;
|
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.game.Game;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
|
|
||||||
|
@ -87,23 +86,19 @@ class AdNauseamEffect extends OneShotEffect<AdNauseamEffect> {
|
||||||
public boolean apply(Game game, Ability source) {
|
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.";
|
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());
|
Card sourceCard = game.getCard(source.getSourceId());
|
||||||
Player player = game.getPlayer(source.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
if (player == null || sourceCard == null) {
|
if (controller == null || sourceCard == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Cards cards = new CardsImpl();
|
while (controller.chooseUse(outcome, message, game) && controller.getLibrary().size() > 0) {
|
||||||
while (player.chooseUse(outcome, message, game) && player.getLibrary().size() > 0) {
|
Card card = controller.getLibrary().removeFromTop(game);
|
||||||
Card card = player.getLibrary().removeFromTop(game);
|
|
||||||
if (card != null) {
|
if (card != null) {
|
||||||
card.moveToZone(Zone.HAND, source.getSourceId(), game, true);
|
controller.moveCardToHandWithInfo(card, source.getSourceId(), game, Zone.LIBRARY);
|
||||||
|
|
||||||
int cmc = card.getManaCost().convertedManaCost();
|
int cmc = card.getManaCost().convertedManaCost();
|
||||||
if (cmc > 0) {
|
if (cmc > 0) {
|
||||||
player.loseLife(cmc, game);
|
controller.loseLife(cmc, game);
|
||||||
}
|
}
|
||||||
cards.add(card);
|
controller.revealCards(new StringBuilder(sourceCard.getName()).append(" put into hand").toString(), new CardsImpl(card), game);
|
||||||
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");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -56,10 +56,11 @@ public class Revealed extends HashMap<String, Cards> implements Serializable, Co
|
||||||
}
|
}
|
||||||
|
|
||||||
public void add(String name, Cards cards) {
|
public void add(String name, Cards cards) {
|
||||||
if (!this.containsKey(name)) {
|
if (this.containsKey(name)) {
|
||||||
createRevealed(name);
|
this.get(name).addAll(cards);
|
||||||
|
} else {
|
||||||
|
this.put(name, cards.copy());
|
||||||
}
|
}
|
||||||
this.put(name, cards.copy());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Cards createRevealed(String name) {
|
public Cards createRevealed(String name) {
|
||||||
|
|
Loading…
Reference in a new issue