mirror of
https://github.com/correl/mage.git
synced 2024-12-26 11:09:27 +00:00
* Mind's Desire - improved exile windows;
This commit is contained in:
parent
ba1c6de2cd
commit
08616b6ec9
4 changed files with 46 additions and 25 deletions
|
@ -1,7 +1,5 @@
|
||||||
|
|
||||||
package mage.cards.m;
|
package mage.cards.m;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.effects.AsThoughEffectImpl;
|
import mage.abilities.effects.AsThoughEffectImpl;
|
||||||
import mage.abilities.effects.ContinuousEffect;
|
import mage.abilities.effects.ContinuousEffect;
|
||||||
|
@ -19,8 +17,9 @@ import mage.players.Player;
|
||||||
import mage.target.targetpointer.FixedTargets;
|
import mage.target.targetpointer.FixedTargets;
|
||||||
import mage.util.CardUtil;
|
import mage.util.CardUtil;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author emerald000
|
* @author emerald000
|
||||||
*/
|
*/
|
||||||
public final class MindsDesire extends CardImpl {
|
public final class MindsDesire extends CardImpl {
|
||||||
|
@ -68,12 +67,15 @@ class MindsDesireEffect extends OneShotEffect {
|
||||||
controller.shuffleLibrary(source, game);
|
controller.shuffleLibrary(source, game);
|
||||||
Card card = controller.getLibrary().getFromTop(game);
|
Card card = controller.getLibrary().getFromTop(game);
|
||||||
if (card != null) {
|
if (card != null) {
|
||||||
UUID exileId = UUID.randomUUID();
|
UUID exileId = CardUtil.getExileZoneId(controller.getId().toString() + "-" + game.getState().getTurnNum() + "-" + MindsDesire.class.toString(), game);
|
||||||
controller.moveCardsToExile(card, source, game, true, exileId, CardUtil.createObjectRealtedWindowTitle(source, game, null));
|
String exileName = "Mind's Desire free cast on " + game.getState().getTurnNum() + " turn for " + controller.getName();
|
||||||
|
game.getExile().createZone(exileId, exileName).setCleanupOnEndTurn(true);
|
||||||
|
if (controller.moveCardsToExile(card, source, game, true, exileId, exileName)) {
|
||||||
ContinuousEffect effect = new MindsDesireCastFromExileEffect();
|
ContinuousEffect effect = new MindsDesireCastFromExileEffect();
|
||||||
effect.setTargetPointer(new FixedTargets(game.getExile().getExileZone(exileId).getCards(game), game));
|
effect.setTargetPointer(new FixedTargets(game.getExile().getExileZone(exileId).getCards(game), game));
|
||||||
game.addEffect(effect, source);
|
game.addEffect(effect, source);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -1,22 +1,15 @@
|
||||||
|
|
||||||
package mage.game;
|
package mage.game;
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Map.Entry;
|
|
||||||
import java.util.UUID;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import mage.cards.Card;
|
import mage.cards.Card;
|
||||||
import mage.filter.FilterCard;
|
import mage.filter.FilterCard;
|
||||||
import mage.util.Copyable;
|
import mage.util.Copyable;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author BetaSteward_at_googlemail.com
|
* @author BetaSteward_at_googlemail.com
|
||||||
*/
|
*/
|
||||||
public class Exile implements Serializable, Copyable<Exile> {
|
public class Exile implements Serializable, Copyable<Exile> {
|
||||||
|
@ -114,4 +107,17 @@ public class Exile implements Serializable, Copyable<Exile> {
|
||||||
exile.clear();
|
exile.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void cleanupEndOfTurnZones(Game game) {
|
||||||
|
// moves cards from outdated zone to main exile zone
|
||||||
|
ExileZone mainZone = getExileZone(PERMANENT);
|
||||||
|
for (ExileZone zone : exileZones.values()) {
|
||||||
|
if (zone.isCleanupOnEndTurn()) {
|
||||||
|
for (Card card : zone.getCards(game)) {
|
||||||
|
mainZone.add(card);
|
||||||
|
zone.remove(card);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,10 @@
|
||||||
|
|
||||||
|
|
||||||
package mage.game;
|
package mage.game;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
import mage.cards.CardsImpl;
|
import mage.cards.CardsImpl;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author BetaSteward_at_googlemail.com
|
* @author BetaSteward_at_googlemail.com
|
||||||
*/
|
*/
|
||||||
public class ExileZone extends CardsImpl {
|
public class ExileZone extends CardsImpl {
|
||||||
|
@ -15,16 +12,22 @@ public class ExileZone extends CardsImpl {
|
||||||
private UUID id;
|
private UUID id;
|
||||||
private String name;
|
private String name;
|
||||||
private boolean hidden;
|
private boolean hidden;
|
||||||
|
private boolean cleanupOnEndTurn = false; // moved cards from that zone to default on end of turn (to cleanup exile windows)
|
||||||
|
|
||||||
public ExileZone(UUID id, String name) {
|
public ExileZone(UUID id, String name) {
|
||||||
this(id, name, false);
|
this(id, name, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ExileZone(UUID id, String name, boolean hidden) {
|
public ExileZone(UUID id, String name, boolean hidden) {
|
||||||
|
this(id, name, false, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ExileZone(UUID id, String name, boolean hidden, boolean cleanupOnEndTurn) {
|
||||||
super();
|
super();
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.hidden = hidden;
|
this.hidden = hidden;
|
||||||
|
this.cleanupOnEndTurn = cleanupOnEndTurn;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ExileZone(final ExileZone zone) {
|
public ExileZone(final ExileZone zone) {
|
||||||
|
@ -32,6 +35,7 @@ public class ExileZone extends CardsImpl {
|
||||||
this.id = zone.id;
|
this.id = zone.id;
|
||||||
this.name = zone.name;
|
this.name = zone.name;
|
||||||
this.hidden = zone.hidden;
|
this.hidden = zone.hidden;
|
||||||
|
this.cleanupOnEndTurn = zone.cleanupOnEndTurn;
|
||||||
}
|
}
|
||||||
|
|
||||||
public UUID getId() {
|
public UUID getId() {
|
||||||
|
@ -46,6 +50,14 @@ public class ExileZone extends CardsImpl {
|
||||||
return hidden;
|
return hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isCleanupOnEndTurn() {
|
||||||
|
return cleanupOnEndTurn;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCleanupOnEndTurn(boolean cleanupOnEndTurn) {
|
||||||
|
this.cleanupOnEndTurn = cleanupOnEndTurn;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ExileZone copy() {
|
public ExileZone copy() {
|
||||||
return new ExileZone(this);
|
return new ExileZone(this);
|
||||||
|
|
|
@ -579,6 +579,7 @@ public class GameState implements Serializable, Copyable<GameState> {
|
||||||
public void removeEotEffects(Game game) {
|
public void removeEotEffects(Game game) {
|
||||||
effects.removeEndOfTurnEffects();
|
effects.removeEndOfTurnEffects();
|
||||||
delayed.removeEndOfTurnAbilities();
|
delayed.removeEndOfTurnAbilities();
|
||||||
|
exile.cleanupEndOfTurnZones(game);
|
||||||
game.applyEffects();
|
game.applyEffects();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue