mirror of
https://github.com/correl/mage.git
synced 2025-01-12 19:25:44 +00:00
Merge origin/master
This commit is contained in:
commit
054973f821
6 changed files with 58 additions and 15 deletions
|
@ -119,7 +119,7 @@ class WhimsOfTheFateEffect extends OneShotEffect<WhimsOfTheFateEffect> {
|
|||
}
|
||||
// if player is in range of controller he chooses 3 piles with all its permanents
|
||||
if (currentPlayer != null && controller.getInRange().contains(currentPlayer.getId())) {
|
||||
Map<Integer, Set<UUID>> playerPiles = new HashMap<Integer, Set<UUID>>();
|
||||
Map<Integer, Set<UUID>> playerPiles = new HashMap<>();
|
||||
for (int i = 1; i < 4; i++) {
|
||||
playerPiles.put(i, new LinkedHashSet<UUID>());
|
||||
}
|
||||
|
|
|
@ -151,8 +151,9 @@ class BoseijuWhoSheltersAllCantCounterEffect extends ReplacementEffectImpl<Bosei
|
|||
@Override
|
||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||
Player player = game.getPlayer(event.getPlayerId());
|
||||
if (player != null) {
|
||||
game.informPlayer(player, new StringBuilder("This spell can't be countered by spells or abilities (Boseiju, Who Shelters All)").toString());
|
||||
Spell spell = game.getStack().getSpell(event.getTargetId());
|
||||
if (player != null && spell != null) {
|
||||
game.informPlayers(new StringBuilder(spell.getName()).append(" can't be countered by spells or abilities (Boseiju, Who Shelters All) - counter ignored").toString());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -265,8 +265,7 @@ class JaceArchitectOfThoughtEffect2 extends OneShotEffect<JaceArchitectOfThought
|
|||
|
||||
Cards pile1 = new CardsImpl();
|
||||
if (opponent.choose(Outcome.Neutral, cards, target, game)) {
|
||||
List<UUID> targets = target.getTargets();
|
||||
for (UUID targetId : targets) {
|
||||
for (UUID targetId : (List<UUID>) target.getTargets()) {
|
||||
Card card = cards.get(targetId, game);
|
||||
if (card != null) {
|
||||
pile1.add(card);
|
||||
|
@ -276,11 +275,14 @@ class JaceArchitectOfThoughtEffect2 extends OneShotEffect<JaceArchitectOfThought
|
|||
}
|
||||
player.revealCards("Pile 1 (Jace, Architect of Thought)", pile1, game);
|
||||
player.revealCards("Pile 2 (Jace, Architect of Thought)", cards, game);
|
||||
|
||||
|
||||
postPileToLog("Pile 1", pile1.getCards(game), game);
|
||||
postPileToLog("Pile 2", cards.getCards(game), game);
|
||||
|
||||
Cards cardsToHand = cards;
|
||||
Cards cardsToLibrary = pile1;
|
||||
List<Card> cardPile1 = new ArrayList<Card>();
|
||||
List<Card> cardPile2 = new ArrayList<Card>();
|
||||
List<Card> cardPile1 = new ArrayList<>();
|
||||
List<Card> cardPile2 = new ArrayList<>();
|
||||
for (UUID cardId: pile1) {
|
||||
cardPile1.add(game.getCard(cardId));
|
||||
}
|
||||
|
@ -290,7 +292,6 @@ class JaceArchitectOfThoughtEffect2 extends OneShotEffect<JaceArchitectOfThought
|
|||
|
||||
boolean pileChoice = player.choosePile(Outcome.Neutral, "Choose a pile to to put into your hand.", cardPile1, cardPile2, game);
|
||||
if (pileChoice){
|
||||
|
||||
cardsToHand = pile1;
|
||||
cardsToLibrary = cards;
|
||||
}
|
||||
|
@ -299,7 +300,7 @@ class JaceArchitectOfThoughtEffect2 extends OneShotEffect<JaceArchitectOfThought
|
|||
for (UUID cardUuid : cardsToHand) {
|
||||
Card card = cardsToHand.get(cardUuid, game);
|
||||
if (card != null) {
|
||||
card.moveToZone(Zone.HAND, source.getSourceId(), game, false);
|
||||
player.moveCardToHandWithInfo(card, source.getSourceId(), game, Zone.LIBRARY);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -310,18 +311,29 @@ class JaceArchitectOfThoughtEffect2 extends OneShotEffect<JaceArchitectOfThought
|
|||
Card card = cardsToLibrary.get(targetCard.getFirstTarget(), game);
|
||||
if (card != null) {
|
||||
cardsToLibrary.remove(card);
|
||||
card.moveToZone(Zone.LIBRARY, source.getSourceId(), game, false);
|
||||
player.moveCardToLibraryWithInfo(card, source.getSourceId(), game, Zone.LIBRARY, false);
|
||||
}
|
||||
target.clearChosen();
|
||||
}
|
||||
if (cardsToLibrary.size() == 1) {
|
||||
Card card = cardsToLibrary.get(cardsToLibrary.iterator().next(), game);
|
||||
card.moveToZone(Zone.LIBRARY, source.getSourceId(), game, false);
|
||||
player.moveCardToLibraryWithInfo(card, source.getSourceId(), game, Zone.LIBRARY, false);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private void postPileToLog(String pileName, Set<Card> cards, Game game) {
|
||||
StringBuilder message = new StringBuilder(pileName).append(": ");
|
||||
for (Card card : cards) {
|
||||
message.append(card.getName()).append(" ");
|
||||
}
|
||||
if (cards.isEmpty()) {
|
||||
message.append(" (empty)");
|
||||
}
|
||||
game.informPlayers(message.toString());
|
||||
}
|
||||
}
|
||||
|
||||
class JaceArchitectOfThoughtEffect3 extends OneShotEffect<JaceArchitectOfThoughtEffect3> {
|
||||
|
|
|
@ -416,6 +416,20 @@ public interface Player extends MageItem, Copyable<Player> {
|
|||
*/
|
||||
boolean moveCardToGraveyardWithInfo(Card card, 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
|
||||
* @param toTop to the top of the library else to the bottom
|
||||
* @return
|
||||
*/
|
||||
boolean moveCardToLibraryWithInfo(Card card, UUID sourceId, Game game, Zone fromZone, boolean toTop);
|
||||
|
||||
|
||||
/**
|
||||
* Uses putOntoBattlefield and posts also a info message about in the game log
|
||||
*
|
||||
|
|
|
@ -1469,13 +1469,14 @@ public abstract class PlayerImpl<T extends PlayerImpl<T>> implements Player, Ser
|
|||
|
||||
@Override
|
||||
public void quit(Game game) {
|
||||
quit = true;
|
||||
this.concede(game);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void concede(Game game) {
|
||||
public void concede(Game game) {
|
||||
game.leave(playerId);
|
||||
lost(game);
|
||||
this.left = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -2148,6 +2149,19 @@ public abstract class PlayerImpl<T extends PlayerImpl<T>> implements Player, Ser
|
|||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean moveCardToLibraryWithInfo(Card card, UUID sourceId, Game game, Zone fromZone, boolean toTop) {
|
||||
boolean result = false;
|
||||
if (card.moveToZone(Zone.LIBRARY, sourceId, game, toTop)) {
|
||||
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("to the ").append(toTop ? "top":"bottom").append(" of his or her library").toString());
|
||||
result = true;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean moveCardToExileWithInfo(Card card, UUID exileId, String exileName, UUID sourceId, Game game, Zone fromZone) {
|
||||
boolean result = false;
|
||||
|
|
|
@ -366,7 +366,9 @@ public abstract class TargetImpl<T extends TargetImpl<T>> implements Target {
|
|||
|
||||
@Override
|
||||
public List<UUID> getTargets() {
|
||||
return new ArrayList<UUID>(targets.keySet());
|
||||
ArrayList<UUID> newList = new ArrayList<>();
|
||||
newList.addAll(targets.keySet());
|
||||
return newList;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue