mirror of
https://github.com/magefree/mage.git
synced 2025-12-22 11:32:00 -08:00
* Intet, the Dreamer - Improved handling to look at face down cards exiled with Intet. Works now also if Intet has left the battlefield.
This commit is contained in:
parent
618033c947
commit
9df993bd3a
11 changed files with 276 additions and 208 deletions
|
|
@ -629,10 +629,11 @@ public class HumanPlayer extends PlayerImpl {
|
||||||
if (object != null) {
|
if (object != null) {
|
||||||
Zone zone = game.getState().getZone(object.getId());
|
Zone zone = game.getState().getZone(object.getId());
|
||||||
if (zone != null) {
|
if (zone != null) {
|
||||||
if (object instanceof Card && ((Card) object).isFaceDown(game)) {
|
if (object instanceof Card
|
||||||
revealFaceDownCard((Card) object, game);
|
&& ((Card) object).isFaceDown(game)
|
||||||
|
&& lookAtFaceDownCard((Card) object, game)) {
|
||||||
result = true;
|
result = true;
|
||||||
}
|
} else {
|
||||||
Player actingPlayer = null;
|
Player actingPlayer = null;
|
||||||
if (game.getPriorityPlayerId().equals(playerId)) {
|
if (game.getPriorityPlayerId().equals(playerId)) {
|
||||||
actingPlayer = this;
|
actingPlayer = this;
|
||||||
|
|
@ -648,6 +649,7 @@ public class HumanPlayer extends PlayerImpl {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
} else if (response.getManaType() != null) {
|
} else if (response.getManaType() != null) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
|
|
@ -30,12 +30,6 @@ package mage.sets.gatecrash;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.constants.AsThoughEffectType;
|
|
||||||
import mage.constants.CardType;
|
|
||||||
import mage.constants.Duration;
|
|
||||||
import mage.constants.Outcome;
|
|
||||||
import mage.constants.Rarity;
|
|
||||||
import mage.constants.Zone;
|
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.MageObject;
|
import mage.MageObject;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
|
|
@ -48,8 +42,12 @@ import mage.abilities.effects.OneShotEffect;
|
||||||
import mage.abilities.effects.common.ReturnToHandTargetEffect;
|
import mage.abilities.effects.common.ReturnToHandTargetEffect;
|
||||||
import mage.cards.Card;
|
import mage.cards.Card;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.cards.Cards;
|
import mage.constants.AsThoughEffectType;
|
||||||
import mage.cards.CardsImpl;
|
import mage.constants.CardType;
|
||||||
|
import mage.constants.Duration;
|
||||||
|
import mage.constants.Outcome;
|
||||||
|
import mage.constants.Rarity;
|
||||||
|
import mage.constants.Zone;
|
||||||
import mage.filter.FilterCard;
|
import mage.filter.FilterCard;
|
||||||
import mage.game.ExileZone;
|
import mage.game.ExileZone;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
|
|
@ -62,29 +60,31 @@ import mage.util.CardUtil;
|
||||||
/**
|
/**
|
||||||
* Gatecrash FAQ (01.2013)
|
* Gatecrash FAQ (01.2013)
|
||||||
*
|
*
|
||||||
* If Bane Alley Broker's first ability resolves when you have no cards in your hand,
|
* If Bane Alley Broker's first ability resolves when you have no cards in your
|
||||||
* you'll draw a card and then exile it. You won't have the opportunity to cast that
|
* hand, you'll draw a card and then exile it. You won't have the opportunity to
|
||||||
* card (or do anything else with it) before exiling it.
|
* cast that card (or do anything else with it) before exiling it.
|
||||||
*
|
*
|
||||||
* Due to a recent rules change, once you are allowed to look at a face-down card in
|
* Due to a recent rules change, once you are allowed to look at a face-down
|
||||||
* exile, you are allowed to look at that card as long as it's exiled. If you no longer
|
* card in exile, you are allowed to look at that card as long as it's exiled.
|
||||||
* control Bane Alley Broker when its last ability resolves, you can continue to look
|
* If you no longer control Bane Alley Broker when its last ability resolves,
|
||||||
* at the relevant cards in exile to choose one to return.
|
* you can continue to look at the relevant cards in exile to choose one to
|
||||||
|
* return.
|
||||||
*
|
*
|
||||||
* Bane Alley Broker's second and third abilities apply to cards exiled with that
|
* Bane Alley Broker's second and third abilities apply to cards exiled with
|
||||||
* specific Bane Alley Broker, not any other creature named Bane Alley Broker.
|
* that specific Bane Alley Broker, not any other creature named Bane Alley
|
||||||
* You should keep cards exiled by different Bane Alley Brokers separate.
|
* Broker. You should keep cards exiled by different Bane Alley Brokers
|
||||||
|
* separate.
|
||||||
*
|
*
|
||||||
* If Bane Alley Broker leaves the battlefield, the cards exiled with it will be
|
* If Bane Alley Broker leaves the battlefield, the cards exiled with it will be
|
||||||
* exiled indefinitely. If it later returns to the battlefield, it will be a new
|
* exiled indefinitely. If it later returns to the battlefield, it will be a new
|
||||||
* object with no connection to the cards exiled with it in its previous existence.
|
* object with no connection to the cards exiled with it in its previous
|
||||||
* You won't be able to use the "new" Bane Alley Broker to return cards exiled with
|
* existence. You won't be able to use the "new" Bane Alley Broker to return
|
||||||
* the "old" one.
|
* cards exiled with the "old" one.
|
||||||
*
|
*
|
||||||
* Even if not all players can look at the exiled cards, each card's owner is still
|
* Even if not all players can look at the exiled cards, each card's owner is
|
||||||
* known. It is advisable to keep cards owned by different players in distinct piles
|
* still known. It is advisable to keep cards owned by different players in
|
||||||
* in case another player gains control of Bane Alley Broker and exiles one or more
|
* distinct piles in case another player gains control of Bane Alley Broker and
|
||||||
* cards with it.
|
* exiles one or more cards with it.
|
||||||
*
|
*
|
||||||
* @author LevelX2
|
* @author LevelX2
|
||||||
*/
|
*/
|
||||||
|
|
@ -223,7 +223,7 @@ class TargetCardInBaneAlleyBrokerExile extends TargetCard {
|
||||||
class BaneAlleyBrokerLookAtCardEffect extends AsThoughEffectImpl {
|
class BaneAlleyBrokerLookAtCardEffect extends AsThoughEffectImpl {
|
||||||
|
|
||||||
public BaneAlleyBrokerLookAtCardEffect() {
|
public BaneAlleyBrokerLookAtCardEffect() {
|
||||||
super(AsThoughEffectType.REVEAL_FACE_DOWN, Duration.EndOfGame, Outcome.Benefit);
|
super(AsThoughEffectType.LOOK_AT_FACE_DOWN, Duration.EndOfGame, Outcome.Benefit);
|
||||||
staticText = "You may look at cards exiled with {this}";
|
staticText = "You may look at cards exiled with {this}";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -252,13 +252,7 @@ class BaneAlleyBrokerLookAtCardEffect extends AsThoughEffectImpl {
|
||||||
}
|
}
|
||||||
UUID exileId = CardUtil.getCardExileZoneId(game, source);
|
UUID exileId = CardUtil.getCardExileZoneId(game, source);
|
||||||
ExileZone exile = game.getExile().getExileZone(exileId);
|
ExileZone exile = game.getExile().getExileZone(exileId);
|
||||||
if (exile != null && exile.contains(objectId)) {
|
return exile != null && exile.contains(objectId);
|
||||||
Cards cards = new CardsImpl(card);
|
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
|
||||||
if (controller != null) {
|
|
||||||
controller.lookAtCards("Exiled with " + sourceObject.getName(), cards, game);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
|
|
@ -34,8 +34,6 @@ import mage.abilities.effects.AsThoughEffectImpl;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
import mage.cards.Card;
|
import mage.cards.Card;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.cards.Cards;
|
|
||||||
import mage.cards.CardsImpl;
|
|
||||||
import mage.constants.AsThoughEffectType;
|
import mage.constants.AsThoughEffectType;
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
import mage.constants.Duration;
|
import mage.constants.Duration;
|
||||||
|
|
@ -167,7 +165,7 @@ class PraetorsGraspRevealEffect extends AsThoughEffectImpl {
|
||||||
private final UUID cardId;
|
private final UUID cardId;
|
||||||
|
|
||||||
public PraetorsGraspRevealEffect(UUID cardId) {
|
public PraetorsGraspRevealEffect(UUID cardId) {
|
||||||
super(AsThoughEffectType.REVEAL_FACE_DOWN, Duration.EndOfGame, Outcome.Benefit);
|
super(AsThoughEffectType.LOOK_AT_FACE_DOWN, Duration.EndOfGame, Outcome.Benefit);
|
||||||
this.cardId = cardId;
|
this.cardId = cardId;
|
||||||
staticText = "You may look at and play that card for as long as it remains exiled";
|
staticText = "You may look at and play that card for as long as it remains exiled";
|
||||||
}
|
}
|
||||||
|
|
@ -198,10 +196,7 @@ class PraetorsGraspRevealEffect extends AsThoughEffectImpl {
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
Card card = game.getCard(cardId);
|
Card card = game.getCard(cardId);
|
||||||
if (controller != null && card != null && game.getState().getZone(cardId) == Zone.EXILED) {
|
if (controller != null && card != null && game.getState().getZone(cardId) == Zone.EXILED) {
|
||||||
if (controller.chooseUse(outcome, "Reveal exiled card?", source, game)) {
|
return true;
|
||||||
Cards cards = new CardsImpl(card);
|
|
||||||
controller.lookAtCards("Exiled with " + sourceObject.getIdName(), cards, game);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
discard();
|
discard();
|
||||||
|
|
|
||||||
|
|
@ -27,21 +27,21 @@
|
||||||
*/
|
*/
|
||||||
package mage.sets.planarchaos;
|
package mage.sets.planarchaos;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.MageObject;
|
import mage.MageObject;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility;
|
import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility;
|
||||||
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||||
import mage.abilities.effects.AsThoughEffectImpl;
|
import mage.abilities.effects.AsThoughEffectImpl;
|
||||||
import mage.abilities.common.SimpleStaticAbility;
|
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
import mage.abilities.effects.common.DoIfCostPaid;
|
import mage.abilities.effects.common.DoIfCostPaid;
|
||||||
import mage.abilities.keyword.FlyingAbility;
|
import mage.abilities.keyword.FlyingAbility;
|
||||||
import mage.cards.Card;
|
import mage.cards.Card;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.cards.Cards;
|
|
||||||
import mage.cards.CardsImpl;
|
|
||||||
import mage.constants.AsThoughEffectType;
|
import mage.constants.AsThoughEffectType;
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
import mage.constants.Duration;
|
import mage.constants.Duration;
|
||||||
|
|
@ -59,6 +59,8 @@ import mage.util.CardUtil;
|
||||||
*/
|
*/
|
||||||
public class IntetTheDreamer extends CardImpl {
|
public class IntetTheDreamer extends CardImpl {
|
||||||
|
|
||||||
|
protected static final String VALUE_PREFIX = "ExileZones";
|
||||||
|
|
||||||
public IntetTheDreamer(UUID ownerId) {
|
public IntetTheDreamer(UUID ownerId) {
|
||||||
super(ownerId, 158, "Intet, the Dreamer", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{3}{U}{R}{G}");
|
super(ownerId, 158, "Intet, the Dreamer", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{3}{U}{R}{G}");
|
||||||
this.expansionSetCode = "PLC";
|
this.expansionSetCode = "PLC";
|
||||||
|
|
@ -72,9 +74,12 @@ public class IntetTheDreamer extends CardImpl {
|
||||||
// Whenever Intet, the Dreamer deals combat damage to a player, you may pay {2}{U}. If you do, exile the top card of your library face down.
|
// Whenever Intet, the Dreamer deals combat damage to a player, you may pay {2}{U}. If you do, exile the top card of your library face down.
|
||||||
this.addAbility(new DealsCombatDamageToAPlayerTriggeredAbility(
|
this.addAbility(new DealsCombatDamageToAPlayerTriggeredAbility(
|
||||||
new DoIfCostPaid(new IntetTheDreamerExileEffect(), new ManaCostsImpl("{2}{U}")), false, true));
|
new DoIfCostPaid(new IntetTheDreamerExileEffect(), new ManaCostsImpl("{2}{U}")), false, true));
|
||||||
// You may look at that card for as long as it remains exiled. You may play that card without paying its mana cost for as long as Intet remains on the battlefield.
|
// You may look at that card for as long as it remains exiled.
|
||||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new IntetTheDreamerEffect()));
|
this.addAbility(new SimpleStaticAbility(Zone.ALL, new IntetTheDreamerLookEffect()));
|
||||||
|
// You may play that card without paying its mana cost for as long as Intet remains on the battlefield.
|
||||||
|
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new IntetTheDreamerCastEffect()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public IntetTheDreamer(final IntetTheDreamer card) {
|
public IntetTheDreamer(final IntetTheDreamer card) {
|
||||||
super(card);
|
super(card);
|
||||||
}
|
}
|
||||||
|
|
@ -98,14 +103,21 @@ class IntetTheDreamerExileEffect extends OneShotEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Player player = game.getPlayer(source.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
if (player != null) {
|
if (controller != null) {
|
||||||
Card card = player.getLibrary().getFromTop(game);
|
Card card = controller.getLibrary().getFromTop(game);
|
||||||
MageObject sourceObject = source.getSourceObject(game);
|
MageObject sourceObject = source.getSourceObject(game);
|
||||||
if (card != null && sourceObject != null) {
|
if (card != null && sourceObject != null) {
|
||||||
UUID exileZoneId = CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter());
|
UUID exileZoneId = CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter());
|
||||||
player.moveCardToExileWithInfo(card, exileZoneId, sourceObject.getIdName(), source.getSourceId(), game, Zone.LIBRARY, false);
|
|
||||||
card.setFaceDown(true, game);
|
card.setFaceDown(true, game);
|
||||||
|
controller.moveCardsToExile(card, source, game, false, exileZoneId, sourceObject.getIdName());
|
||||||
|
card.setFaceDown(true, game);
|
||||||
|
Set<UUID> exileZones = (Set<UUID>) game.getState().getValue(IntetTheDreamer.VALUE_PREFIX + source.getSourceId().toString());
|
||||||
|
if (exileZones == null) {
|
||||||
|
exileZones = new HashSet<>();
|
||||||
|
game.getState().setValue(IntetTheDreamer.VALUE_PREFIX + source.getSourceId().toString(), exileZones);
|
||||||
|
}
|
||||||
|
exileZones.add(exileZoneId);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -118,14 +130,14 @@ class IntetTheDreamerExileEffect extends OneShotEffect {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class IntetTheDreamerEffect extends AsThoughEffectImpl {
|
class IntetTheDreamerCastEffect extends AsThoughEffectImpl {
|
||||||
|
|
||||||
public IntetTheDreamerEffect() {
|
public IntetTheDreamerCastEffect() {
|
||||||
super(AsThoughEffectType.PLAY_FROM_NOT_OWN_HAND_ZONE, Duration.WhileOnBattlefield, Outcome.Benefit);
|
super(AsThoughEffectType.PLAY_FROM_NOT_OWN_HAND_ZONE, Duration.WhileOnBattlefield, Outcome.Benefit);
|
||||||
staticText = "You may play the card from exile without paying its mana cost for as long as {this} remains on the battlefield";
|
staticText = "You may play the card from exile without paying its mana cost for as long as {this} remains on the battlefield";
|
||||||
}
|
}
|
||||||
|
|
||||||
public IntetTheDreamerEffect(final IntetTheDreamerEffect effect) {
|
public IntetTheDreamerCastEffect(final IntetTheDreamerCastEffect effect) {
|
||||||
super(effect);
|
super(effect);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -135,30 +147,80 @@ class IntetTheDreamerEffect extends AsThoughEffectImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IntetTheDreamerEffect copy() {
|
public IntetTheDreamerCastEffect copy() {
|
||||||
return new IntetTheDreamerEffect(this);
|
return new IntetTheDreamerCastEffect(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) {
|
public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) {
|
||||||
|
if (affectedControllerId.equals(source.getControllerId()) && game.getState().getZone(objectId).equals(Zone.EXILED)) {
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
MageObject sourceObject = source.getSourceObject(game);
|
MageObject sourceObject = source.getSourceObject(game);
|
||||||
if (controller != null && sourceObject != null) {
|
if (controller != null && sourceObject != null) {
|
||||||
Card card = game.getCard(objectId);
|
Card card = game.getCard(objectId);
|
||||||
if (affectedControllerId.equals(source.getControllerId()) && card != null && game.getState().getZone(card.getId()) == Zone.EXILED) {
|
if (card != null && card.isFaceDown(game)) {
|
||||||
ExileZone zone = game.getExile().getExileZone(CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter()));
|
ExileZone zone = game.getExile().getExileZone(CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter()));
|
||||||
if (zone != null && zone.contains(card.getId())) {
|
if (zone != null && zone.contains(card.getId())/* && CardUtil.cardCanBePlayedNow(card, controller.getId(), game)*/) {
|
||||||
if (controller.chooseUse(outcome, "Look at the card?", source, game)) {
|
if (card.getCardType().contains(CardType.LAND)) {
|
||||||
Cards cards = new CardsImpl();
|
if (game.canPlaySorcery(controller.getId()) && game.getPlayer(controller.getId()).canPlayLand()) {
|
||||||
cards.add(card);
|
return controller.chooseUse(outcome, "Play " + card.getName() + "?", source, game);
|
||||||
controller.lookAtCards(sourceObject.getName(), cards, game);
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
controller.setCastSourceIdWithAlternateMana(objectId, null);
|
controller.setCastSourceIdWithAlternateMana(objectId, null);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class IntetTheDreamerLookEffect extends AsThoughEffectImpl {
|
||||||
|
|
||||||
|
public IntetTheDreamerLookEffect() {
|
||||||
|
super(AsThoughEffectType.LOOK_AT_FACE_DOWN, Duration.EndOfGame, Outcome.Benefit);
|
||||||
|
staticText = "You may look at that card for as long as it remains exiled";
|
||||||
|
}
|
||||||
|
|
||||||
|
public IntetTheDreamerLookEffect(final IntetTheDreamerLookEffect effect) {
|
||||||
|
super(effect);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean apply(Game game, Ability source) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IntetTheDreamerLookEffect copy() {
|
||||||
|
return new IntetTheDreamerLookEffect(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) {
|
||||||
|
if (affectedControllerId.equals(source.getControllerId()) && game.getState().getZone(objectId).equals(Zone.EXILED)) {
|
||||||
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
|
MageObject sourceObject = source.getSourceObject(game);
|
||||||
|
if (controller != null && sourceObject != null) {
|
||||||
|
Card card = game.getCard(objectId);
|
||||||
|
if (card != null && card.isFaceDown(game)) {
|
||||||
|
Set<UUID> exileZones = (Set<UUID>) game.getState().getValue(IntetTheDreamer.VALUE_PREFIX + source.getSourceId().toString());
|
||||||
|
if (exileZones != null) {
|
||||||
|
for (ExileZone exileZone : game.getExile().getExileZones()) {
|
||||||
|
if (exileZone.contains(objectId)) {
|
||||||
|
if (!exileZones.contains(exileZone.getId())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1613,8 +1613,8 @@ public class TestPlayer implements Player {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void revealFaceDownCard(Card card, Game game) {
|
public boolean lookAtFaceDownCard(Card card, Game game) {
|
||||||
computerPlayer.revealFaceDownCard(card, game);
|
return computerPlayer.lookAtFaceDownCard(card, game);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -53,6 +53,7 @@ public class DoIfCostPaid extends OneShotEffect {
|
||||||
effectText = effectText.substring(0, effectText.length() - 1);
|
effectText = effectText.substring(0, effectText.length() - 1);
|
||||||
}
|
}
|
||||||
message = getCostText() + " and " + effectText + "?";
|
message = getCostText() + " and " + effectText + "?";
|
||||||
|
message = Character.toUpperCase(message.charAt(0)) + message.substring(1);
|
||||||
} else {
|
} else {
|
||||||
message = chooseUseText;
|
message = chooseUseText;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -139,7 +139,7 @@ class HideawayExileEffect extends OneShotEffect {
|
||||||
class HideawayLookAtFaceDownCardEffect extends AsThoughEffectImpl {
|
class HideawayLookAtFaceDownCardEffect extends AsThoughEffectImpl {
|
||||||
|
|
||||||
public HideawayLookAtFaceDownCardEffect() {
|
public HideawayLookAtFaceDownCardEffect() {
|
||||||
super(AsThoughEffectType.REVEAL_FACE_DOWN, Duration.EndOfGame, Outcome.Benefit);
|
super(AsThoughEffectType.LOOK_AT_FACE_DOWN, Duration.EndOfGame, Outcome.Benefit);
|
||||||
staticText = "You may look at cards exiled with {this}";
|
staticText = "You may look at cards exiled with {this}";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ public enum AsThoughEffectType {
|
||||||
DAMAGE,
|
DAMAGE,
|
||||||
HEXPROOF,
|
HEXPROOF,
|
||||||
PAY,
|
PAY,
|
||||||
REVEAL_FACE_DOWN,
|
LOOK_AT_FACE_DOWN,
|
||||||
SPEND_ANY_MANA,
|
SPEND_ANY_MANA,
|
||||||
TARGET
|
TARGET
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -566,8 +566,9 @@ public interface Player extends MageItem, Copyable<Player> {
|
||||||
*
|
*
|
||||||
* @param card
|
* @param card
|
||||||
* @param game
|
* @param game
|
||||||
|
* @return player looked at the card
|
||||||
*/
|
*/
|
||||||
void revealFaceDownCard(Card card, Game game);
|
boolean lookAtFaceDownCard(Card card, Game game);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set seconds left to play the game.
|
* Set seconds left to play the game.
|
||||||
|
|
|
||||||
|
|
@ -2830,12 +2830,16 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void revealFaceDownCard(Card card, Game game) {
|
public boolean lookAtFaceDownCard(Card card, Game game) {
|
||||||
if (game.getContinuousEffects().asThough(card.getId(), AsThoughEffectType.REVEAL_FACE_DOWN, this.getId(), game)) {
|
if (game.getContinuousEffects().asThough(card.getId(), AsThoughEffectType.LOOK_AT_FACE_DOWN, this.getId(), game)) {
|
||||||
|
if (chooseUse(Outcome.Benefit, "Look at that card?", null, game)) {
|
||||||
Cards cards = new CardsImpl(card);
|
Cards cards = new CardsImpl(card);
|
||||||
this.revealCards(getName(), cards, game);
|
this.lookAtCards(getName(), cards, game);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setPriorityTimeLeft(int timeLeft) {
|
public void setPriorityTimeLeft(int timeLeft) {
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,6 @@
|
||||||
* authors and should not be interpreted as representing official policies, either expressed
|
* authors and should not be interpreted as representing official policies, either expressed
|
||||||
* or implied, of BetaSteward_at_googlemail.com.
|
* or implied, of BetaSteward_at_googlemail.com.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package mage.util;
|
package mage.util;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
@ -58,7 +57,6 @@ import mage.game.permanent.token.Token;
|
||||||
import mage.game.stack.Spell;
|
import mage.game.stack.Spell;
|
||||||
import mage.util.functions.CopyTokenFunction;
|
import mage.util.functions.CopyTokenFunction;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author nantuko
|
* @author nantuko
|
||||||
*/
|
*/
|
||||||
|
|
@ -72,10 +70,10 @@ public class CardUtil {
|
||||||
|
|
||||||
private static final String SOURCE_EXILE_ZONE_TEXT = "SourceExileZone";
|
private static final String SOURCE_EXILE_ZONE_TEXT = "SourceExileZone";
|
||||||
|
|
||||||
static String numberStrings[] = { "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine",
|
static String numberStrings[] = {"zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine",
|
||||||
"ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "ninteen", "twenty"};
|
"ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "ninteen", "twenty"};
|
||||||
|
|
||||||
public static final String[] NON_CHANGELING_SUBTYPES_VALUES = new String[] { "Mountain", "Forest", "Plains", "Swamp", "Island",
|
public static final String[] NON_CHANGELING_SUBTYPES_VALUES = new String[]{"Mountain", "Forest", "Plains", "Swamp", "Island",
|
||||||
"Aura", "Curse", "Shrine",
|
"Aura", "Curse", "Shrine",
|
||||||
"Equipment", "Fortification", "Contraption",
|
"Equipment", "Fortification", "Contraption",
|
||||||
"Trap", "Arcane"};
|
"Trap", "Arcane"};
|
||||||
|
|
@ -102,6 +100,7 @@ public class CardUtil {
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks whether two cards share card subtypes.
|
* Checks whether two cards share card subtypes.
|
||||||
*
|
*
|
||||||
|
|
@ -116,10 +115,10 @@ public class CardUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (card1.getCardType().contains(CardType.CREATURE) && card2.getCardType().contains(CardType.CREATURE)) {
|
if (card1.getCardType().contains(CardType.CREATURE) && card2.getCardType().contains(CardType.CREATURE)) {
|
||||||
if (card1.getAbilities().contains(ChangelingAbility.getInstance()) ||
|
if (card1.getAbilities().contains(ChangelingAbility.getInstance())
|
||||||
card1.getSubtype().contains(ChangelingAbility.ALL_CREATURE_TYPE) ||
|
|| card1.getSubtype().contains(ChangelingAbility.ALL_CREATURE_TYPE)
|
||||||
card2.getAbilities().contains(ChangelingAbility.getInstance()) ||
|
|| card2.getAbilities().contains(ChangelingAbility.getInstance())
|
||||||
card2.getSubtype().contains(ChangelingAbility.ALL_CREATURE_TYPE)) {
|
|| card2.getSubtype().contains(ChangelingAbility.ALL_CREATURE_TYPE)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -207,8 +206,6 @@ public class CardUtil {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adjusts ability cost to be paid.
|
* Adjusts ability cost to be paid.
|
||||||
*
|
*
|
||||||
|
|
@ -251,7 +248,7 @@ public class CardUtil {
|
||||||
|
|
||||||
public static ManaCosts<ManaCost> removeVariableManaCost(ManaCosts<ManaCost> manaCosts) {
|
public static ManaCosts<ManaCost> removeVariableManaCost(ManaCosts<ManaCost> manaCosts) {
|
||||||
ManaCosts<ManaCost> adjustedCost = new ManaCostsImpl<>();
|
ManaCosts<ManaCost> adjustedCost = new ManaCostsImpl<>();
|
||||||
for (ManaCost manaCost: manaCosts) {
|
for (ManaCost manaCost : manaCosts) {
|
||||||
if (!(manaCost instanceof VariableManaCost)) {
|
if (!(manaCost instanceof VariableManaCost)) {
|
||||||
adjustedCost.add(manaCost);
|
adjustedCost.add(manaCost);
|
||||||
}
|
}
|
||||||
|
|
@ -279,19 +276,19 @@ public class CardUtil {
|
||||||
*
|
*
|
||||||
* @param spellAbility
|
* @param spellAbility
|
||||||
* @param manaCostsToReduce costs to reduce
|
* @param manaCostsToReduce costs to reduce
|
||||||
* @param convertToGeneric colored mana does reduce generic mana if no appropriate colored mana is in the costs included
|
* @param convertToGeneric colored mana does reduce generic mana if no
|
||||||
|
* appropriate colored mana is in the costs included
|
||||||
*/
|
*/
|
||||||
public static void adjustCost(SpellAbility spellAbility, ManaCosts<ManaCost> manaCostsToReduce, boolean convertToGeneric) {
|
public static void adjustCost(SpellAbility spellAbility, ManaCosts<ManaCost> manaCostsToReduce, boolean convertToGeneric) {
|
||||||
ManaCosts<ManaCost> previousCost = spellAbility.getManaCostsToPay();
|
ManaCosts<ManaCost> previousCost = spellAbility.getManaCostsToPay();
|
||||||
ManaCosts<ManaCost> adjustedCost = new ManaCostsImpl<>();
|
ManaCosts<ManaCost> adjustedCost = new ManaCostsImpl<>();
|
||||||
// save X value (e.g. convoke ability)
|
// save X value (e.g. convoke ability)
|
||||||
for (VariableCost vCost: previousCost.getVariableCosts()) {
|
for (VariableCost vCost : previousCost.getVariableCosts()) {
|
||||||
if (vCost instanceof VariableManaCost) {
|
if (vCost instanceof VariableManaCost) {
|
||||||
adjustedCost.add((VariableManaCost) vCost);
|
adjustedCost.add((VariableManaCost) vCost);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Mana reduceMana = new Mana();
|
Mana reduceMana = new Mana();
|
||||||
for (ManaCost manaCost : manaCostsToReduce) {
|
for (ManaCost manaCost : manaCostsToReduce) {
|
||||||
reduceMana.add(manaCost.getMana());
|
reduceMana.add(manaCost.getMana());
|
||||||
|
|
@ -304,46 +301,46 @@ public class CardUtil {
|
||||||
}
|
}
|
||||||
if (mana.getBlack() > 0 && reduceMana.getBlack() > 0) {
|
if (mana.getBlack() > 0 && reduceMana.getBlack() > 0) {
|
||||||
if (reduceMana.getBlack() > mana.getBlack()) {
|
if (reduceMana.getBlack() > mana.getBlack()) {
|
||||||
reduceMana.setBlack(reduceMana.getBlack()-mana.getBlack());
|
reduceMana.setBlack(reduceMana.getBlack() - mana.getBlack());
|
||||||
mana.setBlack(0);
|
mana.setBlack(0);
|
||||||
} else {
|
} else {
|
||||||
mana.setBlack(mana.getBlack()-reduceMana.getBlack());
|
mana.setBlack(mana.getBlack() - reduceMana.getBlack());
|
||||||
reduceMana.setBlack(0);
|
reduceMana.setBlack(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (mana.getRed() > 0 && reduceMana.getRed() > 0) {
|
if (mana.getRed() > 0 && reduceMana.getRed() > 0) {
|
||||||
if (reduceMana.getRed() > mana.getRed()) {
|
if (reduceMana.getRed() > mana.getRed()) {
|
||||||
reduceMana.setRed(reduceMana.getRed()-mana.getRed());
|
reduceMana.setRed(reduceMana.getRed() - mana.getRed());
|
||||||
mana.setRed(0);
|
mana.setRed(0);
|
||||||
} else {
|
} else {
|
||||||
mana.setRed(mana.getRed()-reduceMana.getRed());
|
mana.setRed(mana.getRed() - reduceMana.getRed());
|
||||||
reduceMana.setRed(0);
|
reduceMana.setRed(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (mana.getBlue() > 0 && reduceMana.getBlue() > 0) {
|
if (mana.getBlue() > 0 && reduceMana.getBlue() > 0) {
|
||||||
if (reduceMana.getBlue() > mana.getBlue()) {
|
if (reduceMana.getBlue() > mana.getBlue()) {
|
||||||
reduceMana.setBlue(reduceMana.getBlue()-mana.getBlue());
|
reduceMana.setBlue(reduceMana.getBlue() - mana.getBlue());
|
||||||
mana.setBlue(0);
|
mana.setBlue(0);
|
||||||
} else {
|
} else {
|
||||||
mana.setBlue(mana.getBlue()-reduceMana.getBlue());
|
mana.setBlue(mana.getBlue() - reduceMana.getBlue());
|
||||||
reduceMana.setBlue(0);
|
reduceMana.setBlue(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (mana.getGreen() > 0 && reduceMana.getGreen() > 0) {
|
if (mana.getGreen() > 0 && reduceMana.getGreen() > 0) {
|
||||||
if (reduceMana.getGreen() > mana.getGreen()) {
|
if (reduceMana.getGreen() > mana.getGreen()) {
|
||||||
reduceMana.setGreen(reduceMana.getGreen()-mana.getGreen());
|
reduceMana.setGreen(reduceMana.getGreen() - mana.getGreen());
|
||||||
mana.setGreen(0);
|
mana.setGreen(0);
|
||||||
} else {
|
} else {
|
||||||
mana.setGreen(mana.getGreen()-reduceMana.getGreen());
|
mana.setGreen(mana.getGreen() - reduceMana.getGreen());
|
||||||
reduceMana.setGreen(0);
|
reduceMana.setGreen(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (mana.getWhite() > 0 && reduceMana.getWhite() > 0) {
|
if (mana.getWhite() > 0 && reduceMana.getWhite() > 0) {
|
||||||
if (reduceMana.getWhite() > mana.getWhite()) {
|
if (reduceMana.getWhite() > mana.getWhite()) {
|
||||||
reduceMana.setWhite(reduceMana.getWhite()-mana.getWhite());
|
reduceMana.setWhite(reduceMana.getWhite() - mana.getWhite());
|
||||||
mana.setWhite(0);
|
mana.setWhite(0);
|
||||||
} else {
|
} else {
|
||||||
mana.setWhite(mana.getWhite()-reduceMana.getWhite());
|
mana.setWhite(mana.getWhite() - reduceMana.getWhite());
|
||||||
reduceMana.setWhite(0);
|
reduceMana.setWhite(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -385,9 +382,9 @@ public class CardUtil {
|
||||||
spellAbility.getManaCostsToPay().addAll(adjustedCost);
|
spellAbility.getManaCostsToPay().addAll(adjustedCost);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns function that copies params\abilities from one card to {@link Token}.
|
* Returns function that copies params\abilities from one card to
|
||||||
|
* {@link Token}.
|
||||||
*
|
*
|
||||||
* @param target
|
* @param target
|
||||||
* @return
|
* @return
|
||||||
|
|
@ -396,7 +393,7 @@ public class CardUtil {
|
||||||
return new CopyTokenFunction(target);
|
return new CopyTokenFunction(target);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isPermanentCard ( Card card ) {
|
public static boolean isPermanentCard(Card card) {
|
||||||
boolean permanent = false;
|
boolean permanent = false;
|
||||||
|
|
||||||
permanent |= card.getCardType().contains(CardType.ARTIFACT);
|
permanent |= card.getCardType().contains(CardType.ARTIFACT);
|
||||||
|
|
@ -409,8 +406,8 @@ public class CardUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts an integer number to string
|
* Converts an integer number to string Numbers > 20 will be returned as
|
||||||
* Numbers > 20 will be returned as digits
|
* digits
|
||||||
*
|
*
|
||||||
* @param number
|
* @param number
|
||||||
* @return
|
* @return
|
||||||
|
|
@ -424,7 +421,8 @@ public class CardUtil {
|
||||||
* Numbers > 20 will be returned as digits
|
* Numbers > 20 will be returned as digits
|
||||||
*
|
*
|
||||||
* @param number number to convert to text
|
* @param number number to convert to text
|
||||||
* @param forOne if the number is 1, this string will be returnedinstead of "one".
|
* @param forOne if the number is 1, this string will be returnedinstead of
|
||||||
|
* "one".
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static String numberToText(int number, String forOne) {
|
public static String numberToText(int number, String forOne) {
|
||||||
|
|
@ -458,8 +456,8 @@ public class CardUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean checkNumeric(String s) {
|
public static boolean checkNumeric(String s) {
|
||||||
for(int i = 0; i < s.length(); i++) {
|
for (int i = 0; i < s.length(); i++) {
|
||||||
if(!Character.isDigit(s.charAt(i))) {
|
if (!Character.isDigit(s.charAt(i))) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -499,11 +497,11 @@ public class CardUtil {
|
||||||
if (zoneChangeCounter > 0 && previous) {
|
if (zoneChangeCounter > 0 && previous) {
|
||||||
zoneChangeCounter--;
|
zoneChangeCounter--;
|
||||||
}
|
}
|
||||||
return getExileZoneId(getObjectZoneString(SOURCE_EXILE_ZONE_TEXT,mageObject.getId(), game, zoneChangeCounter, false), game);
|
return getExileZoneId(getObjectZoneString(SOURCE_EXILE_ZONE_TEXT, mageObject.getId(), game, zoneChangeCounter, false), game);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static UUID getExileZoneId(Game game, UUID objectId, int zoneChangeCounter) {
|
public static UUID getExileZoneId(Game game, UUID objectId, int zoneChangeCounter) {
|
||||||
return getExileZoneId(getObjectZoneString(SOURCE_EXILE_ZONE_TEXT,objectId, game, zoneChangeCounter, false), game);
|
return getExileZoneId(getObjectZoneString(SOURCE_EXILE_ZONE_TEXT, objectId, game, zoneChangeCounter, false), game);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static UUID getExileZoneId(String key, Game game) {
|
public static UUID getExileZoneId(String key, Game game) {
|
||||||
|
|
@ -516,9 +514,10 @@ public class CardUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a string from text + cardId and the zoneChangeCounter of the card (from cardId).
|
* Creates a string from text + cardId and the zoneChangeCounter of the card
|
||||||
* This string can be used to save and get values that must be specific to a permanent instance.
|
* (from cardId). This string can be used to save and get values that must
|
||||||
* So they won't match, if a permanent was e.g. exiled and came back immediately.
|
* be specific to a permanent instance. So they won't match, if a permanent
|
||||||
|
* was e.g. exiled and came back immediately.
|
||||||
*
|
*
|
||||||
* @param text short value to describe the value
|
* @param text short value to describe the value
|
||||||
* @param cardId id of the card
|
* @param cardId id of the card
|
||||||
|
|
@ -530,12 +529,12 @@ public class CardUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getCardZoneString(String text, UUID cardId, Game game, boolean previous) {
|
public static String getCardZoneString(String text, UUID cardId, Game game, boolean previous) {
|
||||||
int zoneChangeCounter= 0;
|
int zoneChangeCounter = 0;
|
||||||
Card card = game.getCard(cardId); // if called for a token, the id is enough
|
Card card = game.getCard(cardId); // if called for a token, the id is enough
|
||||||
if (card != null) {
|
if (card != null) {
|
||||||
zoneChangeCounter = card.getZoneChangeCounter(game);
|
zoneChangeCounter = card.getZoneChangeCounter(game);
|
||||||
}
|
}
|
||||||
return getObjectZoneString(text,cardId, game, zoneChangeCounter, previous);
|
return getObjectZoneString(text, cardId, game, zoneChangeCounter, previous);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getObjectZoneString(String text, MageObject mageObject, Game game) {
|
public static String getObjectZoneString(String text, MageObject mageObject, Game game) {
|
||||||
|
|
@ -554,13 +553,14 @@ public class CardUtil {
|
||||||
uniqueString.append(text);
|
uniqueString.append(text);
|
||||||
}
|
}
|
||||||
uniqueString.append(objectId);
|
uniqueString.append(objectId);
|
||||||
uniqueString.append(previous ? zoneChangeCounter - 1: zoneChangeCounter);
|
uniqueString.append(previous ? zoneChangeCounter - 1 : zoneChangeCounter);
|
||||||
return uniqueString.toString();
|
return uniqueString.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns if the ability is used to check which cards
|
* Returns if the ability is used to check which cards are playable on hand.
|
||||||
* are playable on hand. (Issue #457)
|
* (Issue #457)
|
||||||
|
*
|
||||||
* @param ability - ability to check
|
* @param ability - ability to check
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
@ -572,8 +572,8 @@ public class CardUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds tags to mark the additional info of a card
|
* Adds tags to mark the additional info of a card (e.g. blue font color)
|
||||||
* (e.g. blue font color)
|
*
|
||||||
* @param text text body
|
* @param text text body
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
@ -584,7 +584,7 @@ public class CardUtil {
|
||||||
public static boolean convertedManaCostsIsEqual(MageObject object1, MageObject object2) {
|
public static boolean convertedManaCostsIsEqual(MageObject object1, MageObject object2) {
|
||||||
Set<Integer> cmcObject1 = getCMC(object1);
|
Set<Integer> cmcObject1 = getCMC(object1);
|
||||||
Set<Integer> cmcObject2 = getCMC(object2);
|
Set<Integer> cmcObject2 = getCMC(object2);
|
||||||
for (Integer integer :cmcObject1) {
|
for (Integer integer : cmcObject1) {
|
||||||
if (cmcObject2.contains(integer)) {
|
if (cmcObject2.contains(integer)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -595,7 +595,7 @@ public class CardUtil {
|
||||||
public static Set<Integer> getCMC(MageObject object) {
|
public static Set<Integer> getCMC(MageObject object) {
|
||||||
Set<Integer> cmcObject = new HashSet<>();
|
Set<Integer> cmcObject = new HashSet<>();
|
||||||
if (object instanceof Spell) {
|
if (object instanceof Spell) {
|
||||||
cmcObject.add(((Spell)object).getConvertedManaCost());
|
cmcObject.add(((Spell) object).getConvertedManaCost());
|
||||||
} else if (object instanceof Card) {
|
} else if (object instanceof Card) {
|
||||||
Card card = (Card) object;
|
Card card = (Card) object;
|
||||||
if (card instanceof SplitCard) {
|
if (card instanceof SplitCard) {
|
||||||
|
|
@ -648,4 +648,13 @@ public class CardUtil {
|
||||||
public static boolean isNonCreatureSubtype(String subtype) {
|
public static boolean isNonCreatureSubtype(String subtype) {
|
||||||
return NON_CREATURE_SUBTYPES.contains(subtype);
|
return NON_CREATURE_SUBTYPES.contains(subtype);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean cardCanBePlayedNow(Card card, UUID playerId, Game game) {
|
||||||
|
if (card.getCardType().contains(CardType.LAND)) {
|
||||||
|
return game.canPlaySorcery(playerId) && game.getPlayer(playerId).canPlayLand();
|
||||||
|
} else {
|
||||||
|
return card.getSpellAbility() != null && card.getSpellAbility().spellCanBeActivatedRegularlyNow(playerId, game);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue