mirror of
https://github.com/magefree/mage.git
synced 2026-01-10 21:02:08 -08:00
moved faceDown property from Card to CardState
This commit is contained in:
parent
d7b9a4a979
commit
9ad8530dee
61 changed files with 378 additions and 224 deletions
|
|
@ -94,7 +94,7 @@ class LifebloodHydraComesIntoPlayEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (permanent != null && !permanent.isFaceDown()) {
|
||||
if (permanent != null && !permanent.isFaceDown(game)) {
|
||||
Object obj = getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY);
|
||||
if (obj != null && obj instanceof SpellAbility) {
|
||||
int amount = ((SpellAbility) obj).getManaCostsToPay().getX();
|
||||
|
|
|
|||
|
|
@ -107,8 +107,7 @@ class ShorecrasherElementalEffect extends OneShotEffect {
|
|||
if (shorecrasherElemental.moveToExile(source.getSourceId(), "Shorecrasher Elemental", source.getSourceId(), game)) {
|
||||
Card card = game.getExile().getCard(source.getSourceId(), game);
|
||||
if (card != null) {
|
||||
card.setFaceDown(true);
|
||||
return card.moveToZone(Zone.BATTLEFIELD, source.getSourceId(), game, false);
|
||||
return card.putOntoBattlefield(game, Zone.EXILED, source.getSourceId(), card.getOwnerId(), false, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -99,14 +99,12 @@ class GhastlyConscriptionEffect extends OneShotEffect {
|
|||
for(Card card: targetPlayer.getGraveyard().getCards(new FilterCreatureCard(), game)) {
|
||||
cardsToManifest.add(card);
|
||||
controller.moveCardToExileWithInfo(card, null, "", source.getSourceId(), game, Zone.GRAVEYARD);
|
||||
card.setFaceDown(true);
|
||||
}
|
||||
Collections.shuffle(cardsToManifest);
|
||||
game.informPlayers(controller.getName() + " shuffles the face-down pile");
|
||||
Ability newSource = source.copy();
|
||||
newSource.setWorksFaceDown(true);
|
||||
for (Card card: cardsToManifest) {
|
||||
card.setFaceDown(true);
|
||||
ManaCosts manaCosts = null;
|
||||
if (card.getCardType().contains(CardType.CREATURE)) {
|
||||
manaCosts = card.getSpellAbility().getManaCosts();
|
||||
|
|
@ -116,7 +114,7 @@ class GhastlyConscriptionEffect extends OneShotEffect {
|
|||
}
|
||||
MageObjectReference objectReference= new MageObjectReference(card.getId(), card.getZoneChangeCounter() +1, game);
|
||||
game.addEffect(new BecomesFaceDownCreatureEffect(manaCosts, objectReference, Duration.Custom, FaceDownType.MANIFESTED), newSource);
|
||||
if (controller.putOntoBattlefieldWithInfo(card, game, Zone.EXILED, source.getSourceId())) {
|
||||
if (controller.putOntoBattlefieldWithInfo(card, game, Zone.EXILED, source.getSourceId(), false, true)) {
|
||||
game.informPlayers(new StringBuilder(controller.getName())
|
||||
.append(" puts facedown card from exile onto the battlefield").toString());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -114,12 +114,10 @@ class JeskaiInfiltratorEffect extends OneShotEffect {
|
|||
Card sourceCard = game.getCard(source.getSourceId());
|
||||
if (sourcePermanent != null && sourceCard != null) {
|
||||
player.moveCardToExileWithInfo(sourcePermanent, sourcePermanent.getId(), sourcePermanent.getName(), source.getSourceId(), game, Zone.BATTLEFIELD);
|
||||
sourceCard.setFaceDown(true);
|
||||
cardsToManifest.add(sourceCard);
|
||||
}
|
||||
if (sourcePermanent!= null && player.getLibrary().size() > 0) {
|
||||
Card cardFromLibrary = player.getLibrary().removeFromTop(game);
|
||||
cardFromLibrary.setFaceDown(true);
|
||||
player.moveCardToExileWithInfo(cardFromLibrary, sourcePermanent.getId(), sourcePermanent.getName(), source.getSourceId(), game, Zone.LIBRARY);
|
||||
cardsToManifest.add(cardFromLibrary);
|
||||
}
|
||||
|
|
@ -128,7 +126,6 @@ class JeskaiInfiltratorEffect extends OneShotEffect {
|
|||
Ability newSource = source.copy();
|
||||
newSource.setWorksFaceDown(true);
|
||||
for (Card card : cardsToManifest) {
|
||||
card.setFaceDown(true);
|
||||
ManaCosts manaCosts = null;
|
||||
if (card.getCardType().contains(CardType.CREATURE)) {
|
||||
manaCosts = card.getSpellAbility().getManaCosts();
|
||||
|
|
@ -138,7 +135,7 @@ class JeskaiInfiltratorEffect extends OneShotEffect {
|
|||
}
|
||||
MageObjectReference objectReference= new MageObjectReference(card.getId(), card.getZoneChangeCounter() +1, game);
|
||||
game.addEffect(new BecomesFaceDownCreatureEffect(manaCosts, objectReference, Duration.Custom, FaceDownType.MANIFESTED), newSource);
|
||||
if (card.moveToZone(Zone.BATTLEFIELD, newSource.getSourceId(), game, false)) {
|
||||
if (player.putOntoBattlefieldWithInfo(card, game, Zone.EXILED, source.getSourceId(), false, true)) {
|
||||
game.informPlayers(new StringBuilder(player.getName())
|
||||
.append(" puts facedown card from exile onto the battlefield").toString());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -97,8 +97,8 @@ class SummonersEggImprintEffect extends OneShotEffect {
|
|||
&& controller.choose(Outcome.Benefit, controller.getHand(), target, game)) {
|
||||
Card card = controller.getHand().get(target.getFirstTarget(), game);
|
||||
if (card != null) {
|
||||
card.setFaceDown(true);
|
||||
controller.moveCardToExileWithInfo(card, source.getSourceId(), sourcePermanent.getLogName() +" (Imprint)", source.getSourceId(), game, Zone.HAND);
|
||||
card.setFaceDown(true, game);
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (permanent != null) {
|
||||
permanent.imprint(card.getId(), game);
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ class PrimalPlasmaReplacementEffect extends ReplacementEffectImpl {
|
|||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
if (event.getTargetId().equals(source.getSourceId())) {
|
||||
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
|
||||
if (sourcePermanent != null && !sourcePermanent.isFaceDown()) {
|
||||
if (sourcePermanent != null && !sourcePermanent.isFaceDown(game)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -146,8 +146,10 @@ class BaneAlleyBrokerDrawExileEffect extends OneShotEffect {
|
|||
Card card = game.getCard(target.getFirstTarget());
|
||||
MageObject sourceObject = game.getObject(source.getSourceId());
|
||||
if (card != null && sourceObject != null) {
|
||||
card.setFaceDown(true);
|
||||
return card.moveToExile(CardUtil.getCardExileZoneId(game, source), new StringBuilder(sourceObject.getLogName()).toString(), source.getSourceId(), game);
|
||||
if (card.moveToExile(CardUtil.getCardExileZoneId(game, source), new StringBuilder(sourceObject.getLogName()).toString(), source.getSourceId(), game)) {
|
||||
card.setFaceDown(true, game);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -136,8 +136,8 @@ class NecropotenceEffect extends OneShotEffect {
|
|||
if (controller != null) {
|
||||
if (controller.getLibrary().size() > 0) {
|
||||
Card card = controller.getLibrary().removeFromTop(game);
|
||||
card.setFaceDown(true);
|
||||
if (controller.moveCardToExileWithInfo(card, null, "", source.getSourceId(), game, Zone.LIBRARY)) {
|
||||
card.setFaceDown(true, game);
|
||||
Effect returnToHandeffect = new ReturnToHandTargetEffect();
|
||||
returnToHandeffect.setText("put that face down card into your hand");
|
||||
returnToHandeffect.setTargetPointer(new FixedTarget(card.getId()));
|
||||
|
|
|
|||
|
|
@ -112,8 +112,7 @@ class AshcloudPhoenixEffect extends OneShotEffect {
|
|||
if (card != null) {
|
||||
Player owner = game.getPlayer(card.getOwnerId());
|
||||
if (owner != null && owner.getGraveyard().contains(card.getId())) {
|
||||
card.setFaceDown(true);
|
||||
player.putOntoBattlefieldWithInfo(card, game, Zone.GRAVEYARD, source.getSourceId());
|
||||
player.putOntoBattlefieldWithInfo(card, game, Zone.GRAVEYARD, source.getSourceId(), false, true);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ class EfreetWeaponmasterAbility extends TriggeredAbilityImpl {
|
|||
}
|
||||
if (event.getType() == EventType.ENTERS_THE_BATTLEFIELD && event.getTargetId().equals(this.getSourceId()) ) {
|
||||
Permanent sourcePermanent = game.getPermanent(getSourceId());
|
||||
if (sourcePermanent != null && !sourcePermanent.isFaceDown()) {
|
||||
if (sourcePermanent != null && !sourcePermanent.isFaceDown(game)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ class HoodedHydraEffect1 extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (permanent != null && !permanent.isFaceDown()) {
|
||||
if (permanent != null && !permanent.isFaceDown(game)) {
|
||||
Object obj = getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY);
|
||||
if (obj != null && obj instanceof SpellAbility) {
|
||||
int amount = ((SpellAbility) obj).getManaCostsToPay().getX();
|
||||
|
|
|
|||
|
|
@ -184,7 +184,7 @@ class LensOfClarityLookFaceDownEffect extends OneShotEffect {
|
|||
Permanent faceDownCreature = game.getPermanent(getTargetPointer().getFirst(game, source));
|
||||
if (faceDownCreature != null) {
|
||||
Permanent copyFaceDown = faceDownCreature.copy();
|
||||
copyFaceDown.setFaceDown(false);
|
||||
copyFaceDown.setFaceDown(false, game);
|
||||
Cards cards = new CardsImpl();
|
||||
cards.add(copyFaceDown);
|
||||
Player player = game.getPlayer(faceDownCreature.getControllerId());
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ class PonybackBrigadeAbility extends TriggeredAbilityImpl {
|
|||
}
|
||||
if (event.getType() == EventType.ENTERS_THE_BATTLEFIELD && event.getTargetId().equals(this.getSourceId()) ) {
|
||||
Permanent sourcePermanent = game.getPermanent(getSourceId());
|
||||
if (sourcePermanent != null && !sourcePermanent.isFaceDown()) {
|
||||
if (sourcePermanent != null && !sourcePermanent.isFaceDown(game)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ class SmokeTellerLookFaceDownEffect extends OneShotEffect {
|
|||
Permanent faceDownCreature = game.getPermanent(getTargetPointer().getFirst(game, source));
|
||||
if (faceDownCreature != null) {
|
||||
Permanent copyFaceDown = faceDownCreature.copy();
|
||||
copyFaceDown.setFaceDown(false);
|
||||
copyFaceDown.setFaceDown(false, game);
|
||||
Cards cards = new CardsImpl();
|
||||
cards.add(copyFaceDown);
|
||||
player.lookAtCards("face down card - " + mageObject.getLogName(), cards, game);
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@ class FaceUpPredicate implements Predicate<Card> {
|
|||
|
||||
@Override
|
||||
public boolean apply(Card input, Game game) {
|
||||
return !input.isFaceDown();
|
||||
return !input.isFaceDown(game);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -105,9 +105,9 @@ class PraetorsGraspEffect extends OneShotEffect {
|
|||
Card card = opponent.getLibrary().getCard(targetId, game);
|
||||
UUID exileId = CardUtil.getObjectExileZoneId(game, sourceObject);
|
||||
if (card != null && exileId != null) {
|
||||
card.setFaceDown(true);
|
||||
game.informPlayers(controller.getName() + " moves the searched card face down to exile");
|
||||
card.moveToExile(exileId, sourceObject.getName(), source.getSourceId(), game);
|
||||
card.setFaceDown(true, game);
|
||||
game.addEffect(new PraetorsGraspPlayEffect(card.getId()), source);
|
||||
game.addEffect(new PraetorsGraspRevealEffect(card.getId()), source);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ class PrimalPlasmaReplacementEffect extends ReplacementEffectImpl {
|
|||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
if (event.getTargetId().equals(source.getSourceId())) {
|
||||
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
|
||||
if (sourcePermanent != null && !sourcePermanent.isFaceDown()) {
|
||||
if (sourcePermanent != null && !sourcePermanent.isFaceDown(game)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -101,8 +101,8 @@ class BottledCloisterExileEffect extends OneShotEffect {
|
|||
if (numberOfCards > 0) {
|
||||
UUID exileId = CardUtil.getCardExileZoneId(game, source);
|
||||
for (Card card: controller.getHand().getCards(game)) {
|
||||
card.setFaceDown(true);
|
||||
card.moveToExile(exileId, sourcePermanent.getName(), source.getSourceId(), game);
|
||||
card.setFaceDown(true, game);
|
||||
}
|
||||
game.informPlayers(sourcePermanent.getName() + ": " + controller.getName() + " exiles his or her hand face down (" + numberOfCards + "card" + (numberOfCards > 1 ?"s":"") +")");
|
||||
}
|
||||
|
|
@ -140,8 +140,8 @@ class BottledCloisterReturnEffect extends OneShotEffect {
|
|||
for (Card card: exileZone.getCards(game)) {
|
||||
if (card.getOwnerId().equals(controller.getId())) {
|
||||
numberOfCards++;
|
||||
card.setFaceDown(false);
|
||||
card.moveToZone(Zone.HAND, source.getSourceId(), game, true);
|
||||
card.setFaceDown(false, game);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -113,8 +113,8 @@ class CloneShellEffect extends OneShotEffect {
|
|||
Card card = cards.get(target1.getFirstTarget(), game);
|
||||
if (card != null) {
|
||||
cards.remove(card);
|
||||
card.setFaceDown(true);
|
||||
card.moveToExile(getId(), "Clone Shell (Imprint)", source.getSourceId(), game);
|
||||
card.setFaceDown(true, game);
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (permanent != null) {
|
||||
permanent.imprint(card.getId(), game);
|
||||
|
|
@ -166,7 +166,7 @@ class CloneShellDiesEffect extends OneShotEffect {
|
|||
List<UUID> imprinted = permanent.getImprinted();
|
||||
if (imprinted.size() > 0) {
|
||||
Card imprintedCard = game.getCard(imprinted.get(0));
|
||||
imprintedCard.setFaceDown(false);
|
||||
imprintedCard.setFaceDown(false, game);
|
||||
if (imprintedCard.getCardType().contains(CardType.CREATURE)) {
|
||||
imprintedCard.putOntoBattlefield(game, Zone.EXILED, source.getSourceId(), source.getControllerId());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@ class AquamorphEntityReplacementEffect extends ReplacementEffectImpl {
|
|||
if (event.getType() == EventType.ENTERS_THE_BATTLEFIELD) {
|
||||
if (event.getTargetId().equals(source.getSourceId())) {
|
||||
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
|
||||
if (sourcePermanent != null && !sourcePermanent.isFaceDown()) {
|
||||
if (sourcePermanent != null && !sourcePermanent.isFaceDown(game)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -101,8 +101,8 @@ class ScrollRackEffect extends OneShotEffect {
|
|||
for (UUID targetId : targets) {
|
||||
Card card = game.getCard(targetId);
|
||||
if (card != null) {
|
||||
card.setFaceDown(true);
|
||||
if (card.moveToExile(source.getSourceId(), sourceObject.getLogName(), source.getSourceId(), game)) {
|
||||
card.setFaceDown(true, game);
|
||||
amountExiled++;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -122,10 +122,10 @@ class PyxisOfPandemoniumExileEffect extends OneShotEffect {
|
|||
exileId = UUID.randomUUID();
|
||||
exileIds.put(exileKey, exileId);
|
||||
}
|
||||
card.setFaceDown(true);
|
||||
player.moveCardToExileWithInfo(card, exileId,
|
||||
new StringBuilder(sourceObject.getLogName() +" (").append(player.getName()).append(")").toString(),
|
||||
source.getSourceId(), game, Zone.LIBRARY);
|
||||
card.setFaceDown(true, game);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -173,7 +173,7 @@ class PyxisOfPandemoniumPutOntoBattlefieldEffect extends OneShotEffect {
|
|||
ExileZone exileZone = game.getState().getExile().getExileZone(exileId);
|
||||
if (exileZone != null) {
|
||||
for(Card card: exileZone.getCards(game)) {
|
||||
card.setFaceDown(false);
|
||||
// card.setFaceDown(false, game);
|
||||
if (CardUtil.isPermanentCard(card)) {
|
||||
player.putOntoBattlefieldWithInfo(card, game, Zone.EXILED, source.getSourceId());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -248,7 +248,7 @@ class RescueFromTheUnderworldReturnEffect extends OneShotEffect {
|
|||
if (source.getTargets().get(1) != null) {
|
||||
for (UUID targetId: ((Target) source.getTargets().get(1)).getTargets()) {
|
||||
Card card = game.getCard(targetId);
|
||||
if (card != null && !card.isFaceDown()) {
|
||||
if (card != null && !card.isFaceDown(game)) {
|
||||
Player player = game.getPlayer(card.getOwnerId());
|
||||
if (player != null) {
|
||||
Zone currentZone = game.getState().getZone(card.getId());
|
||||
|
|
|
|||
|
|
@ -107,8 +107,8 @@ class MemoryJarEffect extends OneShotEffect {
|
|||
Card card = hand.get(hand.iterator().next(), game);
|
||||
if(card != null)
|
||||
{
|
||||
card.setFaceDown(true);
|
||||
card.moveToExile(getId(), "Memory Jar", source.getSourceId(), game);
|
||||
card.setFaceDown(true, game);
|
||||
cards.add(card);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue