Tabnine Logo
ReturnToHandTargetEffect
Code IndexAdd Tabnine to your IDE (free)

How to use
ReturnToHandTargetEffect
in
mage.abilities.effects.common

Best Java code snippets using mage.abilities.effects.common.ReturnToHandTargetEffect (Showing top 20 results out of 315)

origin: magefree/mage

public DreamEaterReflexiveTriggeredAbility() {
  super(new ReturnToHandTargetEffect());
  this.addTarget(new TargetPermanent(filter));
  this.optional = true;
}
origin: magefree/mage

@Override
public boolean apply(Game game, Ability source) {
  Player controller = game.getPlayer(source.getControllerId());
  Permanent permanent = game.getPermanent(targetPointer.getFirst(game, source));
  if (permanent != null && controller != null) {
    if (permanent.isAttacking()) {
      if (controller.chooseUse(Outcome.Neutral, "Put " + permanent.getIdName() + " on top of its owner's library (otherwise return to hand)?", source, game)) {
        new PutOnLibraryTargetEffect(true).apply(game, source);
      } else {
        new ReturnToHandTargetEffect().apply(game, source);
      }
    } else {
      new ReturnToHandTargetEffect().apply(game, source);
    }
    return true;
  }
  return false;
}
origin: magefree/mage

public PitchstoneWallTriggeredAbility() {
  super(Zone.BATTLEFIELD, new DoIfCostPaid(new ReturnToHandTargetEffect().setText("return the discarded card from your graveyard to your hand"), new SacrificeSourceCost()), false);
}
origin: magefree/mage

  @Override
  public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    if (controller != null) {
      UUID targetId = getTargetPointer().getFirst(game, source);
      Card card = game.getCard(targetId);
      if (card != null) {
        controller.moveCards(card, Zone.BATTLEFIELD, source, game);
        Permanent creature = game.getPermanent(card.getId());
        if (creature != null) {
          ContinuousEffect hasteEffect = new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.Custom);
          hasteEffect.setTargetPointer(new FixedTarget(creature, game));
          game.addEffect(hasteEffect, source);

          ReturnToHandTargetEffect returnToHandEffect = new ReturnToHandTargetEffect();
          returnToHandEffect.setText("return that creature to your hand");
          returnToHandEffect.setTargetPointer(new FixedTarget(creature, game));
          DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(returnToHandEffect);
          game.addDelayedTriggeredAbility(delayedAbility, source);
        }
      }
      return true;
    }
    return false;
  }
}
origin: magefree/mage

  @Override
  public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    if (controller != null) {
      if (controller.chooseUse(Outcome.PutCreatureInPlay, choiceText, source, game)) {
        TargetCardInHand target = new TargetCardInHand(filter);
        if (controller.choose(Outcome.PutCreatureInPlay, target, source.getSourceId(), game)) {
          Card card = game.getCard(target.getFirstTarget());
          if (card != null) {
            if (controller.moveCards(card, Zone.BATTLEFIELD, source, game)) {
              Permanent permanent = game.getPermanent(card.getId());
              if (permanent != null) {
                ReturnToHandTargetEffect effect = new ReturnToHandTargetEffect();
                effect.setTargetPointer(new FixedTarget(permanent, game));
                DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(effect);
                game.addDelayedTriggeredAbility(delayedAbility, source);
                return true;
              }
            }
          }
          return false;
        }
      }
      return true;
    }
    return false;
  }
}
origin: magefree/mage

public HallowedGround(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{W}");
  // {W}{W}: Return target nonsnow land you control to its owner's hand.
  Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ReturnToHandTargetEffect(), new ManaCostsImpl("{W}{W}"));
  ability.addTarget(new TargetControlledPermanent(filter));
  this.addAbility(ability);
}
origin: magefree/mage

public SelectiveSnare(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{X}{U}");
  // Return X target creatures of the creature type of your choice to their owner's hand.
  this.getSpellAbility().addEffect(
      new ReturnToHandTargetEffect(true)
          .setText("Return X target creatures of "
              + "the creature type of your choice "
              + "to their owner's hand")
  );
  this.getSpellAbility().setTargetAdjuster(SelectiveSnareAdjuster.instance);
}
origin: magefree/mage

  @Override
  public boolean apply(Game game, Ability source) {
    Permanent creature = game.getPermanent(source.getFirstTarget());
    if (creature == null || creature.getPower().getValue()
        > new PermanentsOnBattlefieldCount(filter).calculate(game, source, this)) {
      return false;
    }
    return new ReturnToHandTargetEffect().apply(game, source);
  }
}
origin: magefree/mage

public SealOfRemoval(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{U}");
  // Sacrifice Seal of Removal: Return target creature to its owner's hand.
  Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ReturnToHandTargetEffect(), new SacrificeSourceCost());
  ability.addTarget(new TargetCreaturePermanent());
  this.addAbility(ability);
}
origin: magefree/mage

public ReapingTheGraves(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{2}{B}");
  // Return target creature card from your graveyard to your hand.
  this.getSpellAbility().addTarget(new TargetCardInYourGraveyard(StaticFilters.FILTER_CARD_CREATURE_YOUR_GRAVEYARD));
  this.getSpellAbility().addEffect(new ReturnToHandTargetEffect().setText("Return target creature card from your graveyard to your hand."));
  // Storm
  this.addAbility(new StormAbility());
}
origin: magefree/mage

new ReturnToHandTargetEffect().apply(game, source);
origin: magefree/mage

public SurrakarBanisher(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{4}{U}");
  this.subtype.add(SubType.SURRAKAR);
  this.power = new MageInt(3);
  this.toughness = new MageInt(3);
  Ability ability = new EntersBattlefieldTriggeredAbility(new ReturnToHandTargetEffect(), true);
  ability.addTarget(new TargetCreaturePermanent(filter));
  this.addAbility(ability);
}
origin: magefree/mage

public TragicPoet(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{W}");
  this.subtype.add(SubType.HUMAN);
  this.power = new MageInt(1);
  this.toughness = new MageInt(1);
  // {tap}, Sacrifice Tragic Poet: Return target enchantment card from your graveyard to your hand.
  Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ReturnToHandTargetEffect()
      .setText("Return target enchantment card from your graveyard to your hand"), new TapSourceCost());
  ability.addCost(new SacrificeSourceCost());
  ability.addTarget(new TargetCardInYourGraveyard(filter));
  this.addAbility(ability);
}
origin: magefree/mage

public ManOWar(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{U}");
  this.subtype.add(SubType.JELLYFISH);
  this.power = new MageInt(2);
  this.toughness = new MageInt(2);
  // When Man-o'-War enters the battlefield, return target creature to its owner's hand.
  Ability ability = new EntersBattlefieldTriggeredAbility(new ReturnToHandTargetEffect());
  ability.addTarget(new TargetCreaturePermanent());
  this.addAbility(ability);
}
origin: magefree/mage

public Reap(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{G}");
  // Return up to X target cards from your graveyard to your hand, where X is the number of black permanents target opponent controls as you cast Reap.
  this.getSpellAbility().addEffect(new ReturnToHandTargetEffect().setText("Return up to X target cards from your graveyard to your hand, where X is the number of black permanents target opponent controls as you cast Reap."));
  this.getSpellAbility().addTarget(new TargetOpponent());
  this.getSpellAbility().addTarget(new TargetCardInYourGraveyard(0, 0));
  this.getSpellAbility().setTargetAdjuster(ReapAdjuster.instance);
}
origin: magefree/mage

public Groffskithur(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{5}{G}");
  this.subtype.add(SubType.BEAST);
  this.power = new MageInt(3);
  this.toughness = new MageInt(3);
  // Whenever Groffskithur becomes blocked, you may return target card named Groffskithur from your graveyard to your hand.
  Ability ability = new BecomesBlockedTriggeredAbility(new ReturnToHandTargetEffect(), true);
  ability.addTarget(new TargetCardInYourGraveyard(filter));
  this.addAbility(ability);
}
origin: magefree/mage

public CommandOfUnsummoning(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{2}{U}");
  // Cast Command of Unsummoning only during the declare attackers step and only if you've been attacked this step.
  Ability ability = new CastOnlyDuringPhaseStepSourceAbility(
      TurnPhase.COMBAT, PhaseStep.DECLARE_ATTACKERS, AttackedThisStepCondition.instance,
      "Cast this spell only during the declare attackers step and only if you've been attacked this step."
  );
  ability.addWatcher(new PlayerAttackedStepWatcher());
  this.addAbility(ability);
  // Return one or two target attacking creatures to their owner's hand.
  this.getSpellAbility().addEffect(new ReturnToHandTargetEffect().setText("Return one or two target attacking creatures to their owner's hand."));
  this.getSpellAbility().addTarget(new TargetAttackingCreature(1, 2, new FilterAttackingCreature(), false));
}
origin: magefree/mage

public DeadeyeRigHauler(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{U}");
  this.subtype.add(SubType.HUMAN);
  this.subtype.add(SubType.PIRATE);
  this.power = new MageInt(3);
  this.toughness = new MageInt(2);
  // <i>Raid</i>— When Deadeye Rig-Hauler enters the battlefield, if you attacked with a creature this turn, you may return target creature to its owner's hand.
  Ability ability = new ConditionalInterveningIfTriggeredAbility(new EntersBattlefieldTriggeredAbility(new ReturnToHandTargetEffect(), true), RaidCondition.instance,
      "<i>Raid</i> &mdash; When {this} enters the battlefield, if you attacked with a creature this turn, you may return target creature to its owner's hand.");
  ability.addTarget(new TargetCreaturePermanent());
  this.addAbility(ability, new PlayerAttackedWatcher());
}
origin: magefree/mage

public MemorialToFolly(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId, setInfo, new CardType[]{CardType.LAND}, "");
  // Memorial to Folly enters the battlefield tapped.
  this.addAbility(new EntersBattlefieldTappedAbility());
  this.addAbility(new BlackManaAbility());
  // {2}{B}, {T}, Sacrifice Memorial to Folly: Return target creature card from your graveyard to your hand.
  Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ReturnToHandTargetEffect()
      .setText("Return target creature card from your graveyard to your hand"),
      new ManaCostsImpl("{2}{B}"));
  ability.addCost(new TapSourceCost());
  ability.addCost(new SacrificeSourceCost());
  ability.addTarget(new TargetCardInYourGraveyard(new FilterCreatureCard("creature card from your graveyard")));
  this.addAbility(ability);
}
origin: magefree/mage

public SalvagerOfSecrets(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{U}{U}");
  this.subtype.add(SubType.MERFOLK);
  this.subtype.add(SubType.WIZARD);
  this.power = new MageInt(2);
  this.toughness = new MageInt(2);
  // When Salvager of Secrets enters the battlefield, return target instant or sorcery card from your graveyard to your hand.
  EntersBattlefieldTriggeredAbility ability = new EntersBattlefieldTriggeredAbility(new ReturnToHandTargetEffect(), false);
  Target target = new TargetCardInYourGraveyard(filter);
  ability.addTarget(target);
  this.addAbility(ability);
}
mage.abilities.effects.commonReturnToHandTargetEffect

Most used methods

  • <init>
  • apply
  • setTargetPointer
  • setText

Popular in Java

  • Finding current android device location
  • setRequestProperty (URLConnection)
  • putExtra (Intent)
  • setScale (BigDecimal)
  • Calendar (java.util)
    Calendar is an abstract base class for converting between a Date object and a set of integer fields
  • LinkedList (java.util)
    Doubly-linked list implementation of the List and Dequeinterfaces. Implements all optional list oper
  • UUID (java.util)
    UUID is an immutable representation of a 128-bit universally unique identifier (UUID). There are mul
  • Notification (javax.management)
  • IOUtils (org.apache.commons.io)
    General IO stream manipulation utilities. This class provides static utility methods for input/outpu
  • Loader (org.hibernate.loader)
    Abstract superclass of object loading (and querying) strategies. This class implements useful common
  • CodeWhisperer alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now