- Dev Mode: added a new function "Remove Card from Game", which allows to completely remove a card from the game in case it was added previously by mistake.

This commit is contained in:
Agetian
2017-08-21 16:09:20 +00:00
parent 96f97e41e1
commit 46ecbc9c42
6 changed files with 73 additions and 3 deletions

View File

@@ -42,6 +42,8 @@ public interface IDevModeCheats {
*/
void exileCardsFromBattlefield();
void removeCardsFromGame();
void addCardToBattlefield();
void riggedPlanarRoll();
@@ -113,6 +115,9 @@ public interface IDevModeCheats {
@Override
public void addCardToExile() {
}
@Override
public void removeCardsFromGame() {
}
};
}

View File

@@ -2199,6 +2199,42 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
}
}
/*
* (non-Javadoc)
*
* @see forge.player.IDevModeCheats#exileCardsFromBattlefield()
*/
@Override
public void removeCardsFromGame() {
final Player p = game.getPlayer(getGui().oneOrNone("Remove card(s) belonging to which player?",
PlayerView.getCollection(game.getPlayers())));
if (p == null) {
return;
}
final String zone = getGui().one("Remove card(s) from which zone?",
Arrays.asList("Hand", "Battlefield", "Library", "Graveyard", "Exile"));
final CardCollection selection;
CardCollectionView cards = p.getCardsIn(ZoneType.smartValueOf(zone));
selection = game.getCardList(getGui().many("Choose cards to remove from game", "Removed", 0, -1,
CardView.getCollection(cards), null));
if (selection != null && selection.size() > 0) {
for (Card c : selection) {
if (c == null) {
continue;
}
c.ceaseToExist();
StringBuilder sb = new StringBuilder();
sb.append(p).append(" removes ").append(c).append(" from game due to Dev Cheats.");
game.getGameLog().add(GameLogEntryType.ZONE_CHANGE, sb.toString());
}
}
}
/*
* (non-Javadoc)
*