mirror of
https://github.com/correl/mage.git
synced 2024-12-25 03:00:15 +00:00
Added some methods to write card move infos more easy to game log.
This commit is contained in:
parent
778a3ce688
commit
d07c7b490b
4 changed files with 68 additions and 5 deletions
|
@ -113,18 +113,20 @@ class PeregrinationEffect extends OneShotEffect<PeregrinationEffect> {
|
|||
target2.setRequired(true);
|
||||
player.choose(Outcome.Benefit, revealed, target2, game);
|
||||
Card card = revealed.get(target2.getFirstTarget(), game);
|
||||
card.putOntoBattlefield(game, Zone.LIBRARY, source.getId(), source.getControllerId());
|
||||
|
||||
player.putOntoBattlefieldWithInfo(card, game, Zone.LIBRARY, source.getSourceId());
|
||||
|
||||
revealed.remove(card);
|
||||
Permanent permanent = game.getPermanent(card.getId());
|
||||
if (permanent != null) {
|
||||
permanent.setTapped(true);
|
||||
}
|
||||
card = revealed.getCards(game).iterator().next();
|
||||
card.moveToZone(Zone.HAND, source.getId(), game, false);
|
||||
player.moveCardToHandWithInfo(card, source.getSourceId(), game, Zone.LIBRARY);
|
||||
}
|
||||
else if (target.getTargets().size() == 1) {
|
||||
Card card = revealed.getCards(game).iterator().next();
|
||||
card.putOntoBattlefield(game, Zone.LIBRARY, source.getId(), source.getControllerId());
|
||||
player.putOntoBattlefieldWithInfo(card, game, Zone.LIBRARY, source.getSourceId());
|
||||
Permanent permanent = game.getPermanent(card.getId());
|
||||
if (permanent != null) {
|
||||
permanent.setTapped(true);
|
||||
|
|
|
@ -72,9 +72,11 @@ public class ReturnFromGraveyardToHandTargetEffect extends OneShotEffect<ReturnF
|
|||
if (card != null && game.getState().getZone(cardId).equals(Zone.GRAVEYARD)) {
|
||||
Player player = game.getPlayer(card.getOwnerId());
|
||||
if (player != null) {
|
||||
card.moveToZone(Zone.HAND, source.getSourceId(), game, false);
|
||||
|
||||
if (informPlayers) {
|
||||
game.informPlayers(new StringBuilder(player.getName()).append(" returned ").append(card.getName()).append(" from graveyard to hand").toString());
|
||||
player.moveCardToHandWithInfo(card, source.getSourceId(), game, Zone.GRAVEYARD);
|
||||
} else {
|
||||
card.moveToZone(Zone.HAND, source.getSourceId(), game, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,6 +50,7 @@ import mage.cards.decks.Deck;
|
|||
import mage.choices.Choice;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.RangeOfInfluence;
|
||||
import mage.constants.Zone;
|
||||
import mage.counters.Counter;
|
||||
import mage.counters.Counters;
|
||||
import mage.game.Game;
|
||||
|
@ -353,4 +354,29 @@ public interface Player extends MageItem, Copyable<Player> {
|
|||
* @param card
|
||||
*/
|
||||
UUID getCommanderId();
|
||||
|
||||
/**
|
||||
* Uses card.moveToZone and posts a inform message about moving the card
|
||||
* into the game log
|
||||
*
|
||||
* @param card
|
||||
* @param sourceId
|
||||
* @param game
|
||||
* @param fromZone if null, this info isn't postet
|
||||
* @return
|
||||
*/
|
||||
boolean moveCardToHandWithInfo(Card card, UUID sourceId, Game game, Zone fromZone);
|
||||
|
||||
/**
|
||||
* Uses putOntoBattlefield and posts also a info message about in the game log
|
||||
*
|
||||
* @param card
|
||||
* @param game
|
||||
* @param fromZone
|
||||
* @param sourceId
|
||||
* @param game
|
||||
* @return
|
||||
*/
|
||||
boolean putOntoBattlefieldWithInfo(Card card, Game game, Zone fromZone, UUID sourceId);
|
||||
|
||||
}
|
||||
|
|
|
@ -35,6 +35,7 @@ import java.util.HashSet;
|
|||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Random;
|
||||
|
@ -2091,4 +2092,36 @@ public abstract class PlayerImpl<T extends PlayerImpl<T>> implements Player, Ser
|
|||
public UUID getCommanderId() {
|
||||
return this.commanderId;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean moveCardToHandWithInfo(Card card, UUID sourceId, Game game, Zone fromZone) {
|
||||
boolean result = false;
|
||||
if (card.moveToZone(Zone.HAND, sourceId, game, false)) {
|
||||
game.informPlayers(new StringBuilder(this.getName())
|
||||
.append(" puts ").append(card.getName()).append(" ")
|
||||
.append(fromZone != null ? new StringBuilder("from ").append(fromZone.toString().toLowerCase(Locale.ENGLISH)).append(" "):"")
|
||||
.append("onto his or her hand").toString());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean putOntoBattlefieldWithInfo(Card card, Game game, Zone fromZone, UUID sourceId) {
|
||||
boolean result = false;
|
||||
if (card.putOntoBattlefield(game, fromZone, sourceId, this.getId())) {
|
||||
game.informPlayers(new StringBuilder(this.getName())
|
||||
.append(" puts ").append(card.getName())
|
||||
.append("from ").append(fromZone.toString().toLowerCase(Locale.ENGLISH)).append(" ")
|
||||
.append("onto the Battlefield").toString());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue