@Override public DoIfCostPaid copy() { return new DoIfCostPaid(this); } }
public CreepingChillAbility() { super( Zone.LIBRARY, Zone.GRAVEYARD, new DoIfCostPaid( new DamagePlayersEffect(3, TargetController.OPPONENT), new ExileSourceFromGraveCost() ).addEffect(new GainLifeEffect(3)), "", true ); }
@Override public boolean apply(Game game, Ability source) { UrzasMiterWatcher watcher = game.getState().getWatcher(UrzasMiterWatcher.class); if(watcher != null && !watcher.cards.contains(source.getFirstTarget())) { return super.apply(game, source); } return false; }
public Hypothesizzle(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{3}{U}{R}"); // Draw two cards. Then you may discard a nonland card. When you do, Hypothesizzle deals 4 damage to target creature. this.getSpellAbility().addEffect(new DrawCardSourceControllerEffect(2)); this.getSpellAbility().addEffect(new DoIfCostPaid( new HypothesizzleCreateReflexiveTriggerEffect(), new DiscardCardCost(StaticFilters.FILTER_CARD_A_NON_LAND), "Discard a nonland card to deal 4 damage?" ).setText("Then you may discard a nonland card. " + "When you do, {this} deals 4 damage to target creature.")); }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { CreateTokenEffect createTokenEffect = new CreateTokenEffect(new ElementalShamanToken("LRW")); DoIfCostPaid doIfCostPaid = new DoIfCostPaid(createTokenEffect, new ManaCostsImpl("{1}")); doIfCostPaid.apply(game, source); Permanent token = game.getPermanent(createTokenEffect.getLastAddedTokenId()); if (token != null && (boolean) (this.getValue("clash"))) { ContinuousEffect continuousEffect = new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.EndOfTurn); continuousEffect.setTargetPointer(new FixedTarget(createTokenEffect.getLastAddedTokenId())); game.addEffect(continuousEffect, source); } return true; } return false; } }
@Override public boolean apply(Game game, Ability source) { Player player = getPayingPlayer(game, source); MageObject mageObject = game.getObject(source.getSourceId()); if (player != null && mageObject != null) { effectText = effectText.substring(0, effectText.length() - 1); message = getCostText() + " and " + effectText + '?'; message = Character.toUpperCase(message.charAt(0)) + message.substring(1); CardUtil.replaceSourceName(message, mageObject.getName());
@Override public String getText(Mode mode) { if (!staticText.isEmpty()) { return staticText; } return (optional ? "you may " : "") + getCostText() + ". If you do, " + executingEffects.getText(mode) + (!otherwiseEffects.isEmpty() ? " If you don't, " + otherwiseEffects.getText(mode) : ""); }
@Override public int calculate(Game game, Ability sourceAbility, Effect effect) { for (Effect sourceEffect : sourceAbility.getEffects()) { if (sourceEffect instanceof DoIfCostPaid) { Cost doCosts = ((DoIfCostPaid) sourceEffect).getCost(); if (doCosts instanceof Costs) { Costs costs = (Costs) doCosts; for (Object cost : costs) { if (cost instanceof DiscardCardCost) { DiscardCardCost discardCost = (DiscardCardCost) cost; int cmc = 0; for (Card card : discardCost.getCards()) { cmc += card.getConvertedManaCost(); } return cmc; } } } } } return 0; }
@Override public boolean checkTrigger(GameEvent event, Game game) { if (event.getPlayerId().equals(this.getControllerId())) { Spell spell = game.getStack().getSpell(event.getTargetId()); if (isControlledInstantOrSorcery(spell)) { for (Effect effect : getEffects()) { if (effect instanceof DoIfCostPaid) { for (Effect execEffect : ((DoIfCostPaid) effect).getExecutingEffects()) { execEffect.setTargetPointer(new FixedTarget(spell.getId())); } } } return true; } } return false; }
public Necrite(UUID ownerId, CardSetInfo setInfo) { super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{B}{B}"); this.subtype.add(SubType.THRULL); this.power = new MageInt(2); this.toughness = new MageInt(2); // Whenever Necrite attacks and isn't blocked, you may sacrifice it. If you do, destroy target creature defending player controls. It can't be regenerated. DoIfCostPaid effect = new DoIfCostPaid(new DestroyTargetEffect(true), new SacrificeSourceCost(), "Sacrifice {this} to destroy target creature defending player controls?"); effect.setText("you may sacrifice it. If you do, destroy target creature defending player controls. It can't be regenerated."); Ability ability = new NecriteTriggeredAbility(effect); this.addAbility(ability); }
public SigilOfTheNewDawn(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{3}{W}"); // Whenever a creature is put into your graveyard from the battlefield, you may pay {1}{W}. If you do, return that card to your hand. Effect effect = new ReturnFromGraveyardToHandTargetEffect(); effect.setText("return that card to your hand"); this.addAbility(new PutIntoGraveFromBattlefieldAllTriggeredAbility( new DoIfCostPaid(effect, new ManaCostsImpl("{1}{W}")), false, StaticFilters.FILTER_PERMANENT_A_CREATURE, true, true )); }
public CircleOfAfflictionTriggeredAbility() { super(Zone.BATTLEFIELD, new DoIfCostPaid(new LoseLifeTargetEffect(1), new GenericManaCost(1)), false); ((DoIfCostPaid) getEffects().get(0)).addEffect(new GainLifeEffect(1)); }
public ThunderbladeCharge(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{1}{R}{R}"); // Thunderblade Charge deals 3 damage to any target. this.getSpellAbility().addEffect(new DamageTargetEffect(3)); this.getSpellAbility().addTarget(new TargetAnyTarget()); // Whenever one or more creatures you control deal combat damage to a player, if Thunderblade Charge is in your graveyard, you may pay {2}{R}{R}{R}. If you do, you may cast it without paying its mana cost. this.addAbility(new ControlledCreaturesDealCombatDamagePlayerTriggeredAbility(Zone.GRAVEYARD, new DoIfCostPaid(new ThunderbladeChargeCastEffect(), new ManaCostsImpl("{2}{R}{R}{R}")) .setText("if {this} is in your graveyard, you may pay {2}{R}{R}{R}. If you do, you may cast it without paying its mana cost"))); }
public SeersSundial(UUID ownerId, CardSetInfo setInfo) { super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{4}"); // Landfall - Whenever a land enters the battlefield under your control, you may pay {2}. If you do, draw a card. this.addAbility(new LandfallAbility(new DoIfCostPaid(new DrawCardSourceControllerEffect(1), new ManaCostsImpl("{2}")), false)); // optional = false because DoIfCost is already optonal }
public FaithOfTheDevoted(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{B}"); // Whenever you cycle or discard a card, you may pay {1}. If you do, each opponent loses 2 life and you gain 2 life. Effect subEffect = new GainLifeEffect(2); subEffect.setText("and you gain 2 life"); DoIfCostPaid effect = new DoIfCostPaid( new LoseLifeOpponentsEffect(2), new GenericManaCost(1)); effect.addEffect(subEffect); this.addAbility(new CycleOrDiscardControllerTriggeredAbility(effect)); }
public SpittingSlug(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{G}{G}"); this.subtype.add(SubType.SLUG); this.power = new MageInt(2); this.toughness = new MageInt(4); // Whenever Spitting Slug blocks or becomes blocked, you may pay {1}{G}. If you do, Spitting Slug gains first strike until end of turn. Otherwise, each creature blocking or blocked by Spitting Slug gains first strike until end of turn. this.addAbility(new BlocksOrBecomesBlockedTriggeredAbility( new DoIfCostPaid(new GainAbilitySourceEffect(FirstStrikeAbility.getInstance(), Duration.EndOfTurn), new SpittingSlugEffect(), new ManaCostsImpl("{1}{G}")).setText("you may pay {1}{G}. If you do, {this} gains first strike until end of turn. Otherwise, each creature blocking or blocked by {this} gains first strike until end of turn"), false)); }
MirariTriggeredAbility() { super(Zone.BATTLEFIELD, new DoIfCostPaid( new CopyTargetSpellEffect(true), new GenericManaCost(3)), false); }
public QuietContemplation(UUID ownerId, CardSetInfo setInfo) { super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{2}{U}"); // Whenever you cast a noncreature spell, you may pay {1}. If you do, tap target creature an opponent controls and it doesn't untap during its controller's next untap step. DoIfCostPaid doIfCostPaid = new DoIfCostPaid(new TapTargetEffect(), new GenericManaCost(1),"Tap creature?"); Effect effect = new DontUntapInControllersNextUntapStepTargetEffect(); effect.setText("and it doesn't untap during its controller's next untap step"); doIfCostPaid.addEffect(effect); Ability ability = new SpellCastControllerTriggeredAbility(doIfCostPaid, filterNonCreature, false); ability.addTarget(new TargetCreaturePermanent(filter)); this.addAbility(ability); }
public SparktongueDragon(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{R}{R}"); this.subtype.add(SubType.DRAGON); this.power = new MageInt(3); this.toughness = new MageInt(3); // Flying this.addAbility(FlyingAbility.getInstance()); // When Sparktongue Dragon enters the battlefield, you may pay {2}{R}. When you do, it deals 3 damage to any target. this.addAbility(new EntersBattlefieldTriggeredAbility( new DoIfCostPaid( new SparktongueDragonCreateReflexiveTriggerEffect(), new ManaCostsImpl("{2}{R}"), "Pay {2}{R} to deal 3 damage?" ).setText("you may pay {2}{R}. When you do, it deals 3 damage to any target") )); }
public EyesOfTheWatcher(UUID ownerId, CardSetInfo setInfo) { super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{2}{U}"); // Whenever you cast an instant or sorcery spell, you may pay {1}. If you do, scry 2. this.addAbility(new SpellCastControllerTriggeredAbility(new DoIfCostPaid(new ScryEffect(2), new ManaCostsImpl("{1}")), filter, true)); }