mirror of
https://github.com/correl/mage.git
synced 2024-12-25 03:00:15 +00:00
* Jeskai Infiltrator - Fixed that Jeskai Infiltrator stayed wrongly on it's battlefield position after returning from exile.
This commit is contained in:
parent
d4624853be
commit
df1382010d
4 changed files with 18 additions and 37 deletions
|
@ -108,19 +108,9 @@ class GhastlyConscriptionEffect extends OneShotEffect {
|
||||||
Collections.shuffle(cardsToManifest);
|
Collections.shuffle(cardsToManifest);
|
||||||
game.informPlayers(controller.getName() + " shuffles the face-down pile");
|
game.informPlayers(controller.getName() + " shuffles the face-down pile");
|
||||||
for (Card card: cardsToManifest) {
|
for (Card card: cardsToManifest) {
|
||||||
//Manual zone change to keep the cards face-down.
|
if (card.moveToZone(Zone.BATTLEFIELD, source.getSourceId(), game, false)) {
|
||||||
ZoneChangeEvent event = new ZoneChangeEvent(card.getId(), source.getSourceId(), source.getControllerId(), Zone.EXILED, Zone.BATTLEFIELD);
|
game.informPlayers(new StringBuilder(controller.getName())
|
||||||
if (!game.replaceEvent(event)) {
|
.append(" puts facedown card from exile onto the battlefield").toString());
|
||||||
game.getExile().removeCard(card, game);
|
|
||||||
game.rememberLKI(card.getId(), event.getFromZone(), card);
|
|
||||||
PermanentCard permanent = new PermanentCard(card, event.getPlayerId());
|
|
||||||
game.addPermanent(permanent);
|
|
||||||
game.setZone(card.getId(), Zone.BATTLEFIELD);
|
|
||||||
game.setScopeRelevant(true);
|
|
||||||
permanent.entersBattlefield(source.getSourceId(), game, event.getFromZone(), true);
|
|
||||||
game.setScopeRelevant(false);
|
|
||||||
game.applyEffects();
|
|
||||||
game.fireEvent(new ZoneChangeEvent(permanent, event.getPlayerId(), Zone.EXILED, Zone.BATTLEFIELD));
|
|
||||||
ManaCosts<ManaCost> manaCosts = null;
|
ManaCosts<ManaCost> manaCosts = null;
|
||||||
if (card.getCardType().contains(CardType.CREATURE)) {
|
if (card.getCardType().contains(CardType.CREATURE)) {
|
||||||
manaCosts = card.getSpellAbility().getManaCosts();
|
manaCosts = card.getSpellAbility().getManaCosts();
|
||||||
|
@ -131,7 +121,6 @@ class GhastlyConscriptionEffect extends OneShotEffect {
|
||||||
ContinuousEffect effect = new BecomesFaceDownCreatureEffect(manaCosts, true, Duration.Custom, FaceDownType.MANIFESTED);
|
ContinuousEffect effect = new BecomesFaceDownCreatureEffect(manaCosts, true, Duration.Custom, FaceDownType.MANIFESTED);
|
||||||
effect.setTargetPointer(new FixedTarget(card.getId()));
|
effect.setTargetPointer(new FixedTarget(card.getId()));
|
||||||
game.addEffect(effect, source);
|
game.addEffect(effect, source);
|
||||||
game.informPlayers(controller.getName() + " puts facedown card from exile onto the battlefield");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -54,9 +54,7 @@ import mage.constants.Outcome;
|
||||||
import mage.constants.Rarity;
|
import mage.constants.Rarity;
|
||||||
import mage.constants.Zone;
|
import mage.constants.Zone;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.events.ZoneChangeEvent;
|
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
import mage.game.permanent.PermanentCard;
|
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
import mage.target.targetpointer.FixedTarget;
|
import mage.target.targetpointer.FixedTarget;
|
||||||
|
|
||||||
|
@ -117,31 +115,22 @@ class JeskaiInfiltratorEffect extends OneShotEffect {
|
||||||
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
|
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
|
||||||
Card sourceCard = game.getCard(source.getSourceId());
|
Card sourceCard = game.getCard(source.getSourceId());
|
||||||
if (sourcePermanent != null && sourceCard != null) {
|
if (sourcePermanent != null && sourceCard != null) {
|
||||||
|
player.moveCardToExileWithInfo(sourcePermanent, sourcePermanent.getId(), sourcePermanent.getName(), source.getSourceId(), game, Zone.BATTLEFIELD);
|
||||||
sourceCard.setFaceDown(true);
|
sourceCard.setFaceDown(true);
|
||||||
player.moveCardToExileWithInfo(sourcePermanent, null, "", source.getSourceId(), game, Zone.BATTLEFIELD);
|
|
||||||
cardsToManifest.add(sourceCard);
|
cardsToManifest.add(sourceCard);
|
||||||
}
|
}
|
||||||
if (player.getLibrary().size() > 0) {
|
if (player.getLibrary().size() > 0) {
|
||||||
Card cardFromLibrary = player.getLibrary().removeFromTop(game);
|
Card cardFromLibrary = player.getLibrary().removeFromTop(game);
|
||||||
cardFromLibrary.setFaceDown(true);
|
cardFromLibrary.setFaceDown(true);
|
||||||
player.moveCardToExileWithInfo(cardFromLibrary, null, "", source.getSourceId(), game, Zone.LIBRARY);
|
player.moveCardToExileWithInfo(cardFromLibrary, sourcePermanent.getId(), sourcePermanent.getName(), source.getSourceId(), game, Zone.LIBRARY);
|
||||||
cardsToManifest.add(cardFromLibrary);
|
cardsToManifest.add(cardFromLibrary);
|
||||||
}
|
}
|
||||||
Collections.shuffle(cardsToManifest);
|
Collections.shuffle(cardsToManifest);
|
||||||
|
game.fireUpdatePlayersEvent(); // removes Jeskai from Battlefield, so he returns as a fresh permanent to the battlefield with new position
|
||||||
for (Card card : cardsToManifest) {
|
for (Card card : cardsToManifest) {
|
||||||
//Manual zone change to keep the cards face-down.
|
if (card.moveToZone(Zone.BATTLEFIELD, source.getSourceId(), game, false)) {
|
||||||
ZoneChangeEvent event = new ZoneChangeEvent(card.getId(), source.getSourceId(), source.getControllerId(), Zone.EXILED, Zone.BATTLEFIELD);
|
game.informPlayers(new StringBuilder(player.getName())
|
||||||
if (!game.replaceEvent(event)) {
|
.append(" puts facedown card from exile onto the battlefield").toString());
|
||||||
game.getExile().removeCard(card, game);
|
|
||||||
game.rememberLKI(card.getId(), event.getFromZone(), card);
|
|
||||||
PermanentCard permanent = new PermanentCard(card, event.getPlayerId());
|
|
||||||
game.addPermanent(permanent);
|
|
||||||
game.setZone(card.getId(), Zone.BATTLEFIELD);
|
|
||||||
game.setScopeRelevant(true);
|
|
||||||
permanent.entersBattlefield(source.getSourceId(), game, event.getFromZone(), true);
|
|
||||||
game.setScopeRelevant(false);
|
|
||||||
game.applyEffects();
|
|
||||||
game.fireEvent(new ZoneChangeEvent(permanent, event.getPlayerId(), Zone.EXILED, Zone.BATTLEFIELD));
|
|
||||||
ManaCosts<ManaCost> manaCosts = null;
|
ManaCosts<ManaCost> manaCosts = null;
|
||||||
if (card.getCardType().contains(CardType.CREATURE)) {
|
if (card.getCardType().contains(CardType.CREATURE)) {
|
||||||
manaCosts = card.getSpellAbility().getManaCosts();
|
manaCosts = card.getSpellAbility().getManaCosts();
|
||||||
|
@ -149,11 +138,15 @@ class JeskaiInfiltratorEffect extends OneShotEffect {
|
||||||
manaCosts = new ManaCostsImpl<>("{0}");
|
manaCosts = new ManaCostsImpl<>("{0}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ContinuousEffect effect = new BecomesFaceDownCreatureEffect(manaCosts, true, Duration.Custom, FaceDownType.MANIFESTED);
|
ContinuousEffect effect = new BecomesFaceDownCreatureEffect(
|
||||||
|
manaCosts,
|
||||||
|
true,
|
||||||
|
Duration.Custom,
|
||||||
|
FaceDownType.MANIFESTED
|
||||||
|
);
|
||||||
effect.setTargetPointer(new FixedTarget(card.getId()));
|
effect.setTargetPointer(new FixedTarget(card.getId()));
|
||||||
game.addEffect(effect, source);
|
game.addEffect(effect, source);
|
||||||
game.informPlayers(new StringBuilder(player.getName())
|
|
||||||
.append(" puts facedown card from exile onto the battlefield").toString());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -149,7 +149,6 @@ public class BecomesFaceDownCreatureEffect extends ContinuousEffectImpl implemen
|
||||||
permanent.getCardType().clear();
|
permanent.getCardType().clear();
|
||||||
permanent.getCardType().add(CardType.CREATURE);
|
permanent.getCardType().add(CardType.CREATURE);
|
||||||
permanent.getSubtype().clear();
|
permanent.getSubtype().clear();
|
||||||
permanent.getManaCost().clear();
|
|
||||||
break;
|
break;
|
||||||
case ColorChangingEffects_5:
|
case ColorChangingEffects_5:
|
||||||
permanent.getColor().setColor(new ObjectColor());
|
permanent.getColor().setColor(new ObjectColor());
|
||||||
|
|
|
@ -264,7 +264,7 @@ public class PermanentCard extends PermanentImpl {
|
||||||
public ManaCosts<ManaCost> getManaCost() {
|
public ManaCosts<ManaCost> getManaCost() {
|
||||||
if (isFaceDown()) { // face down permanent has always {0} mana costs
|
if (isFaceDown()) { // face down permanent has always {0} mana costs
|
||||||
manaCost.clear();
|
manaCost.clear();
|
||||||
manaCost.add(new GenericManaCost(0));
|
return manaCost;
|
||||||
}
|
}
|
||||||
return super.getManaCost();
|
return super.getManaCost();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue