Added/changed some move methods for cards of player.

This commit is contained in:
LevelX2 2014-02-19 17:27:46 +01:00
parent a0ef96e975
commit c36045b1b6
2 changed files with 44 additions and 2 deletions

View file

@ -374,6 +374,7 @@ public interface Player extends MageItem, Copyable<Player> {
* @return
*/
boolean moveCardToHandWithInfo(Card card, UUID sourceId, Game game, Zone fromZone);
/**
* Uses card.moveToExile and posts a inform message about moving the card to exile
* into the game log
@ -388,6 +389,18 @@ public interface Player extends MageItem, Copyable<Player> {
*/
boolean moveCardToExileWithInfo(Card card, UUID exileId, String exileName, UUID sourceId, Game game, Zone fromZone);
/**
* Uses card.moveToZone and posts a inform message about moving the card to graveyard
* into the game log
*
* @param card
* @param sourceId
* @param game
* @param fromZone if null, this info isn't postet
* @return
*/
boolean moveCardToGraveyardWithInfo(Card card, UUID sourceId, Game game, Zone fromZone);
/**
* Uses putOntoBattlefield and posts also a info message about in the game log
*
@ -398,7 +411,19 @@ public interface Player extends MageItem, Copyable<Player> {
* @return
*/
boolean putOntoBattlefieldWithInfo(Card card, Game game, Zone fromZone, UUID sourceId);
/**
* Uses putOntoBattlefield and posts also a info message about in the game log
*
* @param card
* @param game
* @param fromZone
* @param sourceId
* @param tapped the card enters the battlefield tapped
* @return
*/
boolean putOntoBattlefieldWithInfo(Card card, Game game, Zone fromZone, UUID sourceId, boolean tapped);
/**
* Checks if the playerToCheckId is from an opponent in range
*

View file

@ -2112,6 +2112,18 @@ public abstract class PlayerImpl<T extends PlayerImpl<T>> implements Player, Ser
return result;
}
@Override
public boolean moveCardToGraveyardWithInfo(Card card, UUID sourceId, Game game, Zone fromZone) {
boolean result = false;
if (card.moveToZone(Zone.GRAVEYARD, sourceId, game, fromZone != null ? fromZone.equals(Zone.BATTLEFIELD) : 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("into his or her graveyard").toString());
}
return result;
}
@Override
public boolean moveCardToExileWithInfo(Card card, UUID exileId, String exileName, UUID sourceId, Game game, Zone fromZone) {
boolean result = false;
@ -2126,8 +2138,13 @@ public abstract class PlayerImpl<T extends PlayerImpl<T>> implements Player, Ser
@Override
public boolean putOntoBattlefieldWithInfo(Card card, Game game, Zone fromZone, UUID sourceId) {
return this.putOntoBattlefieldWithInfo(card, game, fromZone, sourceId, false);
}
@Override
public boolean putOntoBattlefieldWithInfo(Card card, Game game, Zone fromZone, UUID sourceId, boolean tapped) {
boolean result = false;
if (card.putOntoBattlefield(game, fromZone, sourceId, this.getId())) {
if (card.putOntoBattlefield(game, fromZone, sourceId, this.getId(), tapped)) {
game.informPlayers(new StringBuilder(this.getName())
.append(" puts ").append(card.getName())
.append(" from ").append(fromZone.toString().toLowerCase(Locale.ENGLISH)).append(" ")