@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { int cardsToDiscard; if (ClashEffect.getInstance().apply(game, source)) { cardsToDiscard = 2; } else { cardsToDiscard = 1; } DiscardTargetEffect effect = new DiscardTargetEffect(cardsToDiscard); effect.apply(game, source); return true; } return false; } }
@Override public ClashEffect copy() { return new ClashEffect(this); }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { do { controller.loseLife(2, game, false); controller.drawCards(2, game); } while (controller.canRespond() && ClashEffect.getInstance().apply(game, source)); return true; } return false; } }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { if (ClashEffect.getInstance().apply(game, source)) { Card spellCard = game.getStack().getSpell(source.getSourceId()).getCard(); if (spellCard != null) { controller.moveCards(spellCard, Zone.HAND, source, game); } } return true; } return false; }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); Permanent creature = game.getPermanent(getTargetPointer().getFirst(game, source)); if (controller != null && creature != null) { creature.destroy(source.getSourceId(), game, false); if (ClashEffect.getInstance().apply(game, source)) { controller.gainLife(creature.getToughness().getValue(), game, source); } return true; } return false; } }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); Permanent creature = game.getPermanent(getTargetPointer().getFirst(game, source)); if (controller != null) { boolean topOfLibrary = false; if (ClashEffect.getInstance().apply(game, source)) { topOfLibrary = controller.chooseUse(outcome, "Put " + creature.getLogName() + " to top of libraray instead?", source, game); } if (topOfLibrary) { controller.moveCardToLibraryWithInfo(creature, source.getSourceId(), game, Zone.BATTLEFIELD, true, true); } else { controller.moveCards(creature, Zone.HAND, source, game); } return true; } return false; } }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); Permanent creature = game.getPermanent(getTargetPointer().getFirst(game, source)); if (controller != null && creature != null) { creature.damage(3, source.getSourceId(), game, false, true); if (ClashEffect.getInstance().apply(game, source)) { Player creaturesController = game.getPlayer(creature.getControllerId()); if (creaturesController != null) { creaturesController.damage(3, source.getSourceId(), game, false, true); } } return true; } return false; } }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { CreateTokenEffect effect = new CreateTokenEffect(new ElfToken(), 2); effect.apply(game, source); if (ClashEffect.getInstance().apply(game, source)) { for (UUID tokenId : effect.getLastAddedTokenIds()) { Permanent token = game.getPermanent(tokenId); if (token != null) { ContinuousEffect continuousEffect = new GainAbilityTargetEffect(DeathtouchAbility.getInstance(), Duration.EndOfTurn); continuousEffect.setTargetPointer(new FixedTarget(tokenId)); game.addEffect(continuousEffect, source); } } } return true; } return false; } }
@Override public boolean apply(Game game, Ability source) { Spell spell = (Spell) game.getStack().getStackObject(getTargetPointer().getFirst(game, source)); Player controller = game.getPlayer(source.getControllerId()); if (controller != null && spell != null) { game.getStack().counter(spell.getId(), source.getSourceId(), game); if (ClashEffect.getInstance().apply(game, source)) { Effect effect = new AddManaToManaPoolSourceControllerEffect(new Mana(0, 0, 0, 0, 0, 0, 0, spell.getConvertedManaCost())); AtTheBeginOfMainPhaseDelayedTriggeredAbility delayedAbility = new AtTheBeginOfMainPhaseDelayedTriggeredAbility(effect, true, TargetController.YOU, AtTheBeginOfMainPhaseDelayedTriggeredAbility.PhaseSelection.NEXT_MAIN); game.addDelayedTriggeredAbility(delayedAbility, source); } return true; } return false; } }
if (ClashEffect.getInstance().apply(game, source)) { if (setTargetPointerToClashedOpponent) { Object opponent = getValue("clashOpponent");
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); Permanent creature = game.getPermanent(getTargetPointer().getFirst(game, source)); if (controller != null && creature != null) { ContinuousEffect effect = new BoostTargetEffect(2,2,Duration.EndOfTurn); effect.setTargetPointer(new FixedTarget(creature.getId())); game.addEffect(effect, source); if (ClashEffect.getInstance().apply(game, source)) { game.addEffect(effect.copy(), source); effect = new GainAbilityTargetEffect(TrampleAbility.getInstance(), Duration.EndOfTurn); effect.setTargetPointer(new FixedTarget(creature.getId())); game.addEffect(effect.copy(), source); } return true; } return false; } }
@Override public boolean apply(Game game, Ability source) { final boolean clashResult; Player controller = game.getPlayer(source.getControllerId()); Permanent captivatingGlance = game.getPermanent(source.getSourceId()); if (controller != null && captivatingGlance != null) { Permanent enchantedCreature = game.getPermanent(captivatingGlance.getAttachedTo()); clashResult = ClashEffect.getInstance().apply(game, source); if (enchantedCreature != null) { if (clashResult) { ContinuousEffect effect = new GainControlTargetEffect(Duration.Custom, false, controller.getId()); effect.setTargetPointer(new FixedTarget(enchantedCreature.getId())); game.addEffect(effect, source); } else { Player opponentWhomControllerClashedWith = game.getPlayer(targetPointer.getFirst(game, source)); if (opponentWhomControllerClashedWith != null) { ContinuousEffect effect = new GainControlTargetEffect(Duration.Custom, false, opponentWhomControllerClashedWith.getId()); effect.setTargetPointer(new FixedTarget(enchantedCreature.getId())); game.addEffect(effect, source); } } return true; } } return false; } }
@Override public boolean apply(Game game, Ability source) { Spell spell = (Spell) game.getStack().getStackObject(getTargetPointer().getFirst(game, source)); Player controller = game.getPlayer(spell.getControllerId()); if (controller != null) { Cost costToPay; if (cost != null) { costToPay = cost.copy(); } else { costToPay = new GenericManaCost(genericMana.calculate(game, source, this)); } String message; if (costToPay instanceof ManaCost) { message = "Would you like to pay " + costToPay.getText() + " to prevent counter effect?"; } else { message = costToPay.getText() + " to prevent counter effect?"; } costToPay.clearPaid(); if (!(controller.chooseUse(Outcome.Benefit, message, source, game) && costToPay.pay(source, game, spell.getSourceId(), spell.getControllerId(), false, null))) { game.getStack().counter(spell.getId(), source.getSourceId(), game); } if (ClashEffect.getInstance().apply(game, source)) { controller.moveCards(controller.getLibrary().getTopCards(game, 4), Zone.GRAVEYARD, source, game); } return true; } return false; } }