public Fertilid(UUID ownerId) { super(ownerId, 154, "Fertilid", Rarity.COMMON, new CardType[] {CardType.CREATURE}, "{2}{G}"); this.expansionSetCode = "CMD"; this.subtype.add("Elemental"); this.power = new MageInt(0); this.toughness = new MageInt(0); // Fertilid enters the battlefield with two +1/+1 counters on it. this.addAbility( new EntersBattlefieldAbility( new AddCountersSourceEffect(CounterType.P1P1.createInstance(2)), "with two +1/+1 counters on it")); // {1}{G}, Remove a +1/+1 counter from Fertilid: Target player searches his or her library for a // basic land card and puts it onto the battlefield tapped. Then that player shuffles his or her // library. Ability ability = new SimpleActivatedAbility( Zone.BATTLEFIELD, new SearchLibraryPutInPlayTargetPlayerEffect( new TargetCardInLibrary(new FilterBasicLandCard()), true, true), new ManaCostsImpl("{1}{G}")); ability.addCost(new RemoveCountersSourceCost(CounterType.P1P1.createInstance(1))); ability.addTarget(new TargetPlayer()); this.addAbility(ability); }
public SpikeWeaver(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[] {CardType.CREATURE}, "{2}{G}{G}"); this.subtype.add("Spike"); this.power = new MageInt(0); this.toughness = new MageInt(0); // Spike Weaver enters the battlefield with three +1/+1 counters on it. this.addAbility( new EntersBattlefieldAbility( new AddCountersSourceEffect(CounterType.P1P1.createInstance(3)))); // {2}, Remove a +1/+1 counter from Spike Weaver: Put a +1/+1 counter on target creature. Ability ability = new SimpleActivatedAbility( Zone.BATTLEFIELD, new AddCountersTargetEffect(CounterType.P1P1.createInstance()), new GenericManaCost(2)); ability.addCost(new RemoveCountersSourceCost(CounterType.P1P1.createInstance())); ability.addTarget(new TargetCreaturePermanent()); this.addAbility(ability); // {1}, Remove a +1/+1 counter from Spike Weaver: Prevent all combat damage that would be dealt // this turn. Ability ability2 = new SimpleActivatedAbility( Zone.BATTLEFIELD, new PreventAllDamageByAllPermanentsEffect(Duration.EndOfTurn, true), new GenericManaCost(1)); ability2.addCost(new RemoveCountersSourceCost(CounterType.P1P1.createInstance())); this.addAbility(ability2); }
public MindlessAutomaton(UUID ownerId) { super( ownerId, 135, "Mindless Automaton", Rarity.RARE, new CardType[] {CardType.ARTIFACT, CardType.CREATURE}, "{4}"); this.expansionSetCode = "EXO"; this.subtype.add("Construct"); this.power = new MageInt(0); this.toughness = new MageInt(0); // Mindless Automaton enters the battlefield with two +1/+1 counters on it. this.addAbility( new EntersBattlefieldAbility( new AddCountersSourceEffect(CounterType.P1P1.createInstance(2)))); // {1}, Discard a card: Put a +1/+1 counter on Mindless Automaton. Ability ability = new SimpleActivatedAbility( Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.P1P1.createInstance()), new GenericManaCost(1)); ability.addCost(new DiscardCardCost()); this.addAbility(ability); // Remove two +1/+1 counters from Mindless Automaton: Draw a card. this.addAbility( new SimpleActivatedAbility( Zone.BATTLEFIELD, new DrawCardSourceControllerEffect(1), new RemoveCountersSourceCost(CounterType.P1P1.createInstance(2)))); }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null && source.getTargets().size() > 0) { Target multiTarget = source.getTargets().get(0); for (UUID target : multiTarget.getTargets()) { Permanent permanent = game.getPermanent(target); if (permanent != null) { permanent.addCounters( CounterType.P1P1.createInstance(multiTarget.getTargetAmount(target)), game); game.informPlayers( new StringBuilder(controller.getLogName()) .append(" puts ") .append(multiTarget.getTargetAmount(target)) .append(" ") .append(CounterType.P1P1.getName().toLowerCase()) .append(" counter on ") .append(permanent.getName()) .toString()); } } return true; } return false; }
public Rakavolver(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[] {CardType.CREATURE}, "{2}{R}"); this.subtype.add("Volver"); this.power = new MageInt(2); this.toughness = new MageInt(2); // Kicker {1}{W} and/or {U} KickerAbility kickerAbility = new KickerAbility("{1}{W}"); kickerAbility.addKickerCost("{U}"); this.addAbility(kickerAbility); // If Rakavolver was kicked with its {1}{W} kicker, it enters the battlefield with two +1/+1 // counters on it and with "Whenever Rakavolver deals damage, you gain that much life." Ability ability = new EntersBattlefieldAbility( new AddCountersSourceEffect(CounterType.P1P1.createInstance(2)), new KickedCostCondition("{1}{W}"), "If {this} was kicked with its {1}{W} kicker, it enters the battlefield with two +1/+1 counters on it and with \"Whenever {this} deals damage, you gain that much life.\"", ""); ability.addEffect( new GainAbilitySourceEffect( new DealsDamageGainLifeSourceTriggeredAbility(), Duration.WhileOnBattlefield)); this.addAbility(ability); // If Rakavolver was kicked with its {U} kicker, it enters the battlefield with a +1/+1 counter // on it and with flying. ability = new EntersBattlefieldAbility( new AddCountersSourceEffect(CounterType.P1P1.createInstance(1)), new KickedCostCondition("{U}"), "If {this} was kicked with its {U} kicker, it enters the battlefield with a +1/+1 counter on it and with flying.", ""); ability.addEffect( new GainAbilitySourceEffect(FlyingAbility.getInstance(), Duration.WhileOnBattlefield)); this.addAbility(ability); }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); // If no controller, exit out here and do not vote. if (controller == null) return false; this.vote("feather", "quill", controller, game, source); Permanent permanent = game.getPermanent(source.getSourceId()); // Feathers Votes // If feathers received zero votes or the permanent is no longer on the battlefield, do not // attempt to put P1P1 counter on it. if (voteOneCount > 0 && permanent != null) permanent.addCounters(CounterType.P1P1.createInstance(voteOneCount), game); // Quill Votes // Only let the controller loot the appropriate amount of cards if it was voted for. if (voteTwoCount > 0) { Effect lootCardsEffect = new DrawDiscardControllerEffect(voteTwoCount, voteTwoCount); lootCardsEffect.apply(game, source); } return true; }
@Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { boolean retValue = false; GameEvent preventEvent = new GameEvent( GameEvent.EventType.PREVENT_DAMAGE, source.getFirstTarget(), source.getId(), source.getControllerId(), event.getAmount(), false); int damage = event.getAmount(); if (!game.replaceEvent(preventEvent)) { event.setAmount(0); game.fireEvent( GameEvent.getEvent( GameEvent.EventType.PREVENTED_DAMAGE, source.getFirstTarget(), source.getId(), source.getControllerId(), damage)); retValue = true; } Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null) { permanent.removeCounters(CounterType.P1P1.createInstance(damage), game); } return retValue; }
@Override public boolean apply(Game game, Ability source) { Player you = game.getPlayer(source.getControllerId()); if (you == null) { return false; } Permanent arsenalThresher = game.getPermanent(source.getSourceId()); FilterArtifactCard filter = new FilterArtifactCard(); filter.add(new AnotherPredicate()); if (you.chooseUse( Outcome.Benefit, "Do you want to reveal other artifacts in your hand?", game)) { Cards cards = new CardsImpl(); if (you.getHand().count(filter, game) > 0) { TargetCardInHand target = new TargetCardInHand(0, Integer.MAX_VALUE, filter); if (you.choose(Outcome.Benefit, target, source.getSourceId(), game)) { for (UUID uuid : target.getTargets()) { cards.add(you.getHand().get(uuid, game)); } you.revealCards("Revealed cards", cards, game); if (arsenalThresher != null) { arsenalThresher.addCounters(CounterType.P1P1.createInstance(cards.size()), game); return true; } } } } return false; }
public PrimeSpeakerZegana(UUID ownerId) { super( ownerId, 188, "Prime Speaker Zegana", Rarity.MYTHIC, new CardType[] {CardType.CREATURE}, "{2}{G}{G}{U}{U}"); this.expansionSetCode = "GTC"; this.subtype.add("Merfolk"); this.subtype.add("Wizard"); this.supertype.add("Legendary"); this.color.setGreen(true); this.color.setBlue(true); this.power = new MageInt(1); this.toughness = new MageInt(1); // Prime Speaker Zegana enters the battlefield with X +1/+1 counters on it, where X is the // greatest power among other creatures you control. this.addAbility( new EntersBattlefieldAbility( new AddCountersSourceEffect( CounterType.P1P1.createInstance(0), new greatestPowerCount(), true), "where X is the greatest power among other creatures you control")); // When Prime Speaker Zegana enters the battlefield, draw cards equal to its power. this.addAbility( new EntersBattlefieldTriggeredAbility( new DrawCardSourceControllerEffect(new SourcePermanentPowerCount()))); }
public MistcutterHydra(UUID ownerId) { super( ownerId, 162, "Mistcutter Hydra", Rarity.RARE, new CardType[] {CardType.CREATURE}, "{X}{G}"); this.expansionSetCode = "THS"; this.subtype.add("Hydra"); this.power = new MageInt(0); this.toughness = new MageInt(0); // Mistcutter Hydra can't be countered. this.addAbility(new CantBeCounteredAbility()); // Haste this.addAbility(HasteAbility.getInstance()); // protection from blue this.addAbility(new ProtectionAbility(filter)); // Mistcutter Hydra enters the battlefield with X +1/+1 counters on it. this.addAbility( new EntersBattlefieldAbility( new EntersBattlefieldWithXCountersEffect(CounterType.P1P1.createInstance()))); }
@Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { preventDamageAction(event, source, game); Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null) { boolean removeCounter = true; // check if in the same combat damage step already a counter was removed if (game.getTurn().getPhase().getStep().getType().equals(PhaseStep.COMBAT_DAMAGE)) { if (game.getTurnNum() == turn && game.getTurn().getStep().equals(combatPhaseStep)) { removeCounter = false; } else { turn = game.getTurnNum(); combatPhaseStep = game.getTurn().getStep(); } } if (removeCounter && permanent.getCounters().getCount(CounterType.P1P1) > 0) { StringBuilder sb = new StringBuilder(permanent.getName()).append(": "); permanent.removeCounters(CounterType.P1P1.createInstance(), game); sb.append("Removed a +1/+1 counter "); game.informPlayers(sb.toString()); } } return false; }
public CitadelSiege(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[] {CardType.ENCHANTMENT}, "{2}{W}{W}"); // As Citadel Siege enters the battlefield, choose Khans or Dragons. this.addAbility( new EntersBattlefieldAbility( new ChooseModeEffect("Khans or Dragons?", "Khans", "Dragons"), null, "As {this} enters the battlefield, choose Khans or Dragons.", "")); // * Khans - At the beginning of combat on your turn, put two +1/+1 counters on target creature // you control. Ability ability = new ConditionalTriggeredAbility( new BeginningOfCombatTriggeredAbility( new AddCountersTargetEffect(CounterType.P1P1.createInstance(2)), TargetController.YOU, false), new ModeChoiceSourceCondition("Khans"), ruleTrigger1); ability.addTarget(new TargetControlledCreaturePermanent()); this.addAbility(ability); // * Dragons - At the beginning of combat on each opponent's turn, tap target creature that // player controls. ability = new ConditionalTriggeredAbility( new BeginningOfCombatTriggeredAbility( new TapTargetEffect(), TargetController.OPPONENT, false), new ModeChoiceSourceCondition("Dragons"), ruleTrigger2); ability.addTarget(new TargetCreaturePermanent()); this.addAbility(ability); }
public AjaniGoldmane(UUID ownerId) { super( ownerId, 1, "Ajani Goldmane", Rarity.MYTHIC, new CardType[] {CardType.PLANESWALKER}, "{2}{W}{W}"); this.expansionSetCode = "M10"; this.subtype.add("Ajani"); this.color.setWhite(true); this.addAbility( new EntersBattlefieldAbility( new AddCountersSourceEffect(CounterType.LOYALTY.createInstance(4)), false)); this.addAbility(new LoyaltyAbility(new GainLifeEffect(2), 1)); Effects effects1 = new Effects(); effects1.add( new AddCountersAllEffect( CounterType.P1P1.createInstance(), new FilterControlledCreaturePermanent())); effects1.add( new GainAbilityControlledEffect( VigilanceAbility.getInstance(), Duration.EndOfTurn, new FilterCreaturePermanent())); this.addAbility(new LoyaltyAbility(effects1, -1)); this.addAbility(new LoyaltyAbility(new CreateTokenEffect(new AvatarToken()), -6)); }
public GuardianShieldBearer(UUID ownerId) { super( ownerId, 189, "Guardian Shield-Bearer", Rarity.COMMON, new CardType[] {CardType.CREATURE}, "{1}{G}"); this.expansionSetCode = "DTK"; this.subtype.add("Human"); this.subtype.add("Soldier"); this.power = new MageInt(2); this.toughness = new MageInt(1); // Megamorph {3}{G} this.addAbility(new MorphAbility(this, new ManaCostsImpl("{3}{G}"), true)); // When Guardian Shield-Bearer is turned face up, put a +1/+1 counter on another target creature // you control. Ability ability = new TurnedFaceUpSourceTriggeredAbility( new AddCountersTargetEffect(CounterType.P1P1.createInstance()), false); ability.addTarget(new TargetControlledCreaturePermanent(filter)); this.addAbility(ability); }
public RepentantVampire(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[] {CardType.CREATURE}, "{3}{B}{B}"); this.subtype.add("Vampire"); this.power = new MageInt(3); this.toughness = new MageInt(3); // Flying this.addAbility(FlyingAbility.getInstance()); // Whenever a creature dealt damage by Repentant Vampire this turn dies, put a +1/+1 counter on // Repentant Vampire. this.addAbility( new DiesAndDealtDamageThisTurnTriggeredAbility( new AddCountersSourceEffect(CounterType.P1P1.createInstance()), false)); // Threshold - As long as seven or more cards are in your graveyard, Repentant Vampire is white // and has "{tap}: Destroy target black creature." Ability ability = new SimpleStaticAbility( Zone.BATTLEFIELD, new ConditionalContinuousEffect( new BecomesColorSourceEffect(ObjectColor.WHITE, Duration.WhileOnBattlefield), new CardsInControllerGraveCondition(7), "As long as seven or more cards are in your graveyard, {this} is white")); Ability gainedAbility = new SimpleActivatedAbility( Zone.BATTLEFIELD, new DestroyTargetEffect(), new TapSourceCost()); gainedAbility.addTarget(new TargetCreaturePermanent(filter)); ability.addEffect( new ConditionalContinuousEffect( new GainAbilitySourceEffect(gainedAbility, Duration.WhileOnBattlefield), new CardsInControllerGraveCondition(7), "and has \"{T}: Destroy target black creature.\"")); ability.setAbilityWord(AbilityWord.THRESHOLD); this.addAbility(ability); }
public AdvocateOfTheBeast(UUID ownerId) { super( ownerId, 164, "Advocate of the Beast", Rarity.COMMON, new CardType[] {CardType.CREATURE}, "{2}{G}"); this.expansionSetCode = "M14"; this.subtype.add("Elf"); this.subtype.add("Shaman"); this.power = new MageInt(2); this.toughness = new MageInt(3); // At the beginning of your end step, put a +1/+1 counter on target Beast creature you control. Ability ability = new BeginningOfEndStepTriggeredAbility( new AddCountersTargetEffect(CounterType.P1P1.createInstance()), TargetController.YOU, false); Target target = new TargetCreaturePermanent(filter); ability.addTarget(target); this.addAbility(ability); }
public SekkiSeasonsGuide(UUID ownerId) { super( ownerId, 148, "Sekki, Seasons' Guide", Rarity.RARE, new CardType[] {CardType.CREATURE}, "{5}{G}{G}{G}"); this.expansionSetCode = "SOK"; this.supertype.add("Legendary"); this.subtype.add("Spirit"); this.power = new MageInt(0); this.toughness = new MageInt(0); // Sekki, Seasons' Guide enters the battlefield with eight +1/+1 counters on it. this.addAbility( new EntersBattlefieldAbility( new AddCountersSourceEffect(CounterType.P1P1.createInstance(8)), "with eight +1/+1 counters on it")); // If damage would be dealt to Sekki, prevent that damage, remove that many +1/+1 counters from // Sekki, and put that many 1/1 colorless Spirit creature tokens onto the battlefield. this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new SekkiSeasonsGuideEffect())); // Sacrifice eight Spirits: Return Sekki from your graveyard to the battlefield. this.addAbility( new SimpleActivatedAbility( Zone.GRAVEYARD, new ReturnSourceFromGraveyardToBattlefieldEffect(), new SacrificeTargetCost(new TargetControlledPermanent(8, 8, filter, true)))); }
public WoodlandWanderer(UUID ownerId) { super( ownerId, 198, "Woodland Wanderer", Rarity.RARE, new CardType[] {CardType.CREATURE}, "{3}{G}"); this.expansionSetCode = "BFZ"; this.subtype.add("Elemental"); this.power = new MageInt(2); this.toughness = new MageInt(2); // Vigilance this.addAbility(VigilanceAbility.getInstance()); // Trample this.addAbility(TrampleAbility.getInstance()); // <i>Converge</i> - Woodland Wanderer enters the battlefield with a +1/+1 counter on it for // each color of mana spent to cast it. this.addAbility( new EntersBattlefieldAbility( new AddCountersSourceEffect( CounterType.P1P1.createInstance(), ColorsOfManaSpentToCastCount.getInstance(), true), null, true, "<i>Converge</i> — {this} enters the battlefield with a +1/+1 counter on it for each color of mana spent to cast it.", null)); }
@Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { int damage = event.getAmount(); preventDamageAction(event, source, game); Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null) { permanent.removeCounters(CounterType.P1P1.createInstance(damage), game); } new CreateTokenEffect(new SpiritToken(), damage).apply(game, source); return true; }
public EarthenArms(UUID ownerId) { super(ownerId, 172, "Earthen Arms", Rarity.COMMON, new CardType[] {CardType.SORCERY}, "{1}{G}"); this.expansionSetCode = "BFZ"; // Put two +1/+1 counters on target permanent. this.getSpellAbility() .addEffect(new AddCountersTargetEffect(CounterType.P1P1.createInstance(2))); this.getSpellAbility().addTarget(new TargetPermanent()); // Awaken 4 - {6}{G} this.addAbility(new AwakenAbility(this, 4, "{6}{G}")); }
public SupportEffect(Card card, int amount, boolean otherPermanent) { super(CounterType.P1P1.createInstance(0), new StaticValue(1)); this.amountSupportTargets = new StaticValue(amount); this.otherPermanent = otherPermanent; if (card.getCardType().contains(CardType.INSTANT) || card.getCardType().contains(CardType.SORCERY)) { card.getSpellAbility() .addTarget( new TargetCreaturePermanent( 0, amount, new FilterCreaturePermanent("target creatures"), false)); } staticText = setText(); }
@Override public boolean apply(Game game, Ability source) { Permanent sourcePermanent = game.getPermanent(source.getSourceId()); if (sourcePermanent != null && sourcePermanent.getCounters().getCount(CounterType.P1P1) > 0) { Permanent targetPermanent = game.getPermanent(targetPointer.getFirst(game, source)); if (targetPermanent != null) { sourcePermanent.getCounters().removeCounter(CounterType.P1P1, 1); targetPermanent.addCounters(CounterType.P1P1.createInstance(), game); return true; } } return false; }
@Override public boolean apply(Game game, Ability source) { Permanent target = game.getPermanent(source.getFirstTarget()); if (target == null) { return false; } Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { int amount = controller.getCounters().getCount(CounterType.EXPERIENCE); target.addCounters(CounterType.P1P1.createInstance(amount), game); } return false; }
@Override public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null && player != null) { int amount = game.getBattlefield().countAll(filter1, source.getControllerId(), game) - 1; amount += player.getGraveyard().count(filter2, game); if (amount > 0) { permanent.addCounters(CounterType.P1P1.createInstance(amount), game); } return true; } return false; }
public UmaraRaptor(UUID ownerId) { super(ownerId, 75, "Umara Raptor", Rarity.COMMON, new CardType[] {CardType.CREATURE}, "{2}{U}"); this.expansionSetCode = "ZEN"; this.subtype.add("Bird"); this.subtype.add("Ally"); this.color.setBlue(true); this.power = new MageInt(1); this.toughness = new MageInt(1); this.addAbility(FlyingAbility.getInstance()); this.addAbility( new AllyEntersBattlefieldTriggeredAbility( new AddCountersSourceEffect(CounterType.P1P1.createInstance()), true)); }
public StromkirkNoble(UUID ownerId) { super(ownerId, 164, "Stromkirk Noble", Rarity.RARE, new CardType[] {CardType.CREATURE}, "{R}"); this.expansionSetCode = "ISD"; this.subtype.add("Vampire"); this.color.setRed(true); this.power = new MageInt(1); this.toughness = new MageInt(1); // Stromkirk Noble can't be blocked by Humans. this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new StromkirkEffect())); // Whenever Stromkirk Noble deals combat damage to a player, put a +1/+1 counter on it. this.addAbility( new DealsCombatDamageToAPlayerTriggeredAbility( new AddCountersSourceEffect(CounterType.P1P1.createInstance()), false)); }
@Override public boolean apply(Game game, Ability source) { Permanent triggeringCreature = game.getPermanentOrLKIBattlefield(getTargetPointer().getFirst(game, source)); if (triggeringCreature != null) { Permanent sourceCreature = game.getPermanent(source.getSourceId()); if (sourceCreature != null && EvolveAbility.isPowerOrThoughnessGreater(sourceCreature, triggeringCreature)) { game.getState().setValue("EvolveAddCounterActive", Boolean.TRUE); sourceCreature.addCounters(CounterType.P1P1.createInstance(), game); game.getState().setValue("EvolveAddCounterActive", Boolean.FALSE); } return true; } return false; }
public SawtoothThresher(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[] {CardType.ARTIFACT, CardType.CREATURE}, "{6}"); this.subtype.add("Construct"); this.power = new MageInt(1); this.toughness = new MageInt(1); // Sunburst this.addAbility(new SunburstAbility(this)); // Remove two +1/+1 counters from Sawtooth Thresher: Sawtooth Thresher gets +4/+4 until end of // turn. this.addAbility( new SimpleActivatedAbility( Zone.BATTLEFIELD, new BoostSourceEffect(4, 4, Duration.EndOfTurn), new RemoveCountersSourceCost(CounterType.P1P1.createInstance(2)))); }
public TitaniasBoon(UUID ownerId) { super( ownerId, 276, "Titania's Boon", Rarity.UNCOMMON, new CardType[] {CardType.SORCERY}, "{3}{G}"); this.expansionSetCode = "USG"; // Put a +1/+1 counter on each creature you control. this.getSpellAbility() .addEffect( new AddCountersAllEffect( CounterType.P1P1.createInstance(), new FilterControlledCreaturePermanent("creature you control"))); }
@Override public boolean apply(Game game, Ability source) { Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null) { Object obj = getValue(mage.abilities.effects.EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY); if (obj != null && obj instanceof SpellAbility) { // delete to prevent using it again if put into battlefield from other effect setValue(mage.abilities.effects.EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY, null); int amount = ((SpellAbility) obj).getManaCostsToPay().getX(); if (amount > 0) { permanent.addCounters(CounterType.P1P1.createInstance(amount), game); } } } return true; }