Tabnine Logo
Player.addAttachment
Code IndexAdd Tabnine to your IDE (free)

How to use
addAttachment
method
in
mage.players.Player

Best Java code snippets using mage.players.Player.addAttachment (Showing top 5 results out of 315)

origin: magefree/mage

@Override
public boolean apply(Game game, Ability source) {
  Player controller = game.getPlayer(source.getControllerId());
  Player targetPlayer = game.getPlayer(source.getFirstTarget());
  if (controller != null && targetPlayer != null) {
    TargetCardInLibrary targetCard = new TargetCardInLibrary(filter);
    if (controller.searchLibrary(targetCard, game)) {
      Card card = game.getCard(targetCard.getFirstTarget());
      if (card != null) {
        game.getState().setValue("attachTo:" + card.getId(), targetPlayer.getId());
        if (controller.moveCards(card, Zone.BATTLEFIELD, source, game)) {
          targetPlayer.addAttachment(card.getId(), game);
        }
      }
    }
    controller.shuffleLibrary(source, game);
    return true;
  }
  return false;
}
origin: magefree/mage

@Override
public boolean apply(Game game, Ability source) {
  Permanent sourcePermanent = game.getPermanent(source.getSourceId());
  if (sourcePermanent != null) {
    int zcc = game.getState().getZoneChangeCounter(sourcePermanent.getId());
    if (zcc == source.getSourceObjectZoneChangeCounter()
        || zcc == source.getSourceObjectZoneChangeCounter() + 1
        || zcc == source.getSourceObjectZoneChangeCounter() + 2) {
      Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source));
      if (permanent != null) {
        return permanent.addAttachment(source.getSourceId(), game);
      } else {
        Player player = game.getPlayer(getTargetPointer().getFirst(game, source));
        if (player != null) {
          return player.addAttachment(source.getSourceId(), game);
        }
        if (!source.getTargets().isEmpty() && source.getTargets().get(0) instanceof TargetCard) { // e.g. Spellweaver Volute
          Card card = game.getCard(getTargetPointer().getFirst(game, source));
          if (card != null) {
            return card.addAttachment(source.getSourceId(), game);
          }
        }
      }
    }
  }
  return false;
}
origin: magefree/mage

game.getState().setValue("attachTo:" + card.getId(), targetPlayer.getId());
if (controller.moveCards(card, Zone.BATTLEFIELD, source, game)) {
  targetPlayer.addAttachment(card.getId(), game);
origin: magefree/mage

  targetPermanent.addAttachment(sourcePermanent.getId(), game);
} else if (targetPlayer != null) {
  targetPlayer.addAttachment(sourcePermanent.getId(), game);
} else {
  return false;
origin: magefree/mage

  targetPermanent.addAttachment(permanent.getId(), game);
} else if (targetPlayer != null) {
  targetPlayer.addAttachment(permanent.getId(), game);
mage.playersPlayeraddAttachment

Popular methods of Player

  • getId
  • getHand
  • getName
  • getLife
  • getLibrary
  • hasLeft
  • hasWon
  • getCounters
  • hasLost
  • copy
  • damage
  • declareAttacker
  • damage,
  • declareAttacker,
  • getGraveyard,
  • getPlayersUnderYourControl,
  • activateAbility,
  • canLose,
  • choose,
  • declareBlocker,
  • gainLife,
  • getAttachments

Popular in Java

  • Making http requests using okhttp
  • getSharedPreferences (Context)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • onRequestPermissionsResult (Fragment)
  • BufferedWriter (java.io)
    Wraps an existing Writer and buffers the output. Expensive interaction with the underlying reader is
  • FileNotFoundException (java.io)
    Thrown when a file specified by a program cannot be found.
  • ByteBuffer (java.nio)
    A buffer for bytes. A byte buffer can be created in either one of the following ways: * #allocate
  • Options (org.apache.commons.cli)
    Main entry-point into the library. Options represents a collection of Option objects, which describ
  • Logger (org.apache.log4j)
    This is the central class in the log4j package. Most logging operations, except configuration, are d
  • Reflections (org.reflections)
    Reflections one-stop-shop objectReflections scans your classpath, indexes the metadata, allows you t
  • Best IntelliJ plugins
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