public BecomesFaceDownCreatureEffect(Costs<Cost> turnFaceUpCosts, MageObjectReference objectReference, Duration duration, FaceDownType faceDownType) { super(duration, Outcome.BecomeCreature); this.objectReference = objectReference; this.zoneChangeCounter = Integer.MIN_VALUE; if (turnFaceUpCosts != null) { this.turnFaceUpAbility = new TurnFaceUpAbility(turnFaceUpCosts, faceDownType == FaceDownType.MEGAMORPHED); } staticText = "{this} becomes a 2/2 face-down creature, with no text, no name, no subtypes, and no mana cost"; foundPermanent = false; this.faceDownType = faceDownType; }
public TurnFaceUpAbility(Costs<Cost> costs, boolean megamorph) { super(Zone.BATTLEFIELD); this.addEffect(new TurnFaceUpEffect(megamorph)); for (Cost cost : costs) { if (cost instanceof ManaCost) { this.addManaCost((ManaCost) cost); } else { this.addCost(cost); } } this.usesStack = false; this.abilityType = AbilityType.SPECIAL_ACTION; this.setRuleVisible(false); // will be made visible only to controller in CardView }
@Override public TurnFaceUpAbility copy() { return new TurnFaceUpAbility(this); } }
@Override public void init(Ability source, Game game) { super.init(source, game); for (Permanent perm: game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) { if (!perm.isFaceDown(game) && !perm.isTransformable()) { affectedObjectList.add(new MageObjectReference(perm, game)); perm.setFaceDown(true, game); // check for Morph Card card = game.getCard(perm.getId()); if (card != null) { for (Ability ability: card.getAbilities()) { if (ability instanceof MorphAbility) { this.turnFaceUpAbilityMap.put(card.getId(), new TurnFaceUpAbility(((MorphAbility)ability).getMorphCosts())); } } } } } }