congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
Player.discard
Code IndexAdd Tabnine to your IDE (free)

How to use
discard
method
in
mage.players.Player

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

origin: magefree/mage

@Override
public boolean apply(Game game, Ability source) {
  for (UUID targetPlayerId : targetPointer.getTargets(game, source)) {
    Player player = game.getPlayer(targetPlayerId);
    if (player != null) {
      player.discard(amount.calculate(game, source, this), randomDiscard, source, game);
    }
  }
  return true;
}
origin: magefree/mage

@Override
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) {
  Player player = game.getPlayer(controllerId);
  if (player != null) {
    for (Card card : player.getHand().getCards(game)) {
      player.discard(card, ability, game);
    }
    paid = true;
  }
  return paid;
}
origin: magefree/mage

  @Override
  public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    if (controller != null) {
      controller.drawCards(2, game);
      controller.discard(1, false, source, game);
      return true;
    }
    return false;
  }
}
origin: magefree/mage

@Override
public boolean apply(Game game, Ability source) {
  Player targetPlayer = game.getPlayer(targetPointer.getFirst(game, source));
  if (targetPlayer != null) {
    targetPlayer.drawCards(1, game);
    targetPlayer.discard(1, false, source, game);
    return true;
  }
  return false;
}

origin: magefree/mage

@Override
public boolean apply(Game game, Ability source) {
  Player player = game.getPlayer(source.getControllerId());
  if (player != null) {
    int amount = player.getHand().getCards(game).size();
    player.discard(amount, false, source, game);
    player.drawCards(amount, game);
    return true;
  }
  return false;
}
origin: magefree/mage

  @Override
  public boolean apply(Game game, Ability source) {
    Player player = game.getPlayer(source.getControllerId());
    if (player != null && player.chooseUse(Outcome.DrawCard, "Do you wish to draw a card? If you do, discard a card.", source, game)) {
      if (player.drawCards(1, game) > 0) {
        player.discard(1, source, game);
      }
      return true;
    }
    return false;
  }
}
origin: magefree/mage

  @Override
  public boolean apply(Game game, Ability source) {
    Player player = game.getPlayer(source.getControllerId());
    if (player != null) {
      for (Card card : player.getHand().getCards(game)) {
        player.discard(card, source, game);
      }
      return true;
    }
    return false;
  }
}
origin: magefree/mage

  @Override
  public boolean apply(Game game, Ability source) {
    Player player = game.getPlayer(source.getControllerId());
    if (player != null && player.chooseUse(Outcome.DrawCard, "Do you wish to draw a card? If you do, discard a card.", source, game)) {
      if (player.drawCards(1, game) > 0) {
        player.discard(1, source, game);
      }
      return true;
    }
    return false;
  }
}
origin: magefree/mage

  @Override
  public boolean apply(Game game, Ability source) {
    Player player = game.getPlayer(source.getControllerId());
    if (player != null) {
      for (Card card : player.getHand().getCards(game)) {
        player.discard(card, source, game);
      }
      return true;
    }
    return false;
  }
}
origin: magefree/mage

@Override
public boolean apply(Game game, Ability source) {
  Player player = game.getPlayer(targetPointer.getFirst(game, source));
  if (player != null) {
    int value = player.getCounters().getCount(CounterType.POISON);
    if (value > 0) {
      player.discard(value, source, game);
      return true;
    }
  }
  return false;
}
origin: magefree/mage

@Override
public boolean apply(Game game, Ability source) {
  Player player = game.getPlayer(getTargetPointer().getFirst(game, source));
  if (player != null) {
    player.drawCards(cardsToDraw, game);
    player.discard(cardsToDiscard, source, game);
    return true;
  }
  return false;
}
origin: magefree/mage

@Override
public boolean apply(Game game, Ability source) {
  Player player = game.getPlayer(source.getControllerId());
  if (player != null) {
    if (!optional || player.chooseUse(outcome, "Use draw, then discard effect?", source, game)) {
      player.drawCards(cardsToDraw, game);
      player.discard(cardsToDiscard, false, source, game);
    }
    return true;
  }
  return false;
}
origin: magefree/mage

  @Override
  public boolean apply(Game game, Ability source) {
    Player player = game.getPlayer(source.getFirstTarget());
    if (player != null) {
      Set<Card> cards = player.getHand().getCards(game);
      for (Card card : cards) {
        player.discard(card, source, game);
      }
      return true;
    }
    return false;
  }
}
origin: magefree/mage

  @Override
  public boolean apply(Game game, Ability source) {
    Permanent permanent = (Permanent) game.getLastKnownInformation(source.getFirstTarget(), Zone.BATTLEFIELD);
    if (permanent != null) {
      Player player = game.getPlayer(permanent.getControllerId());
      if (player != null) {
        player.discard(1, false, source, game);
        return true;
      }
    }
    return false;
  }
}
origin: magefree/mage

  @Override
  public boolean apply(Game game, Ability source) {
    Player player = game.getPlayer(source.getControllerId());
    if (player != null) {
      for (Card card : player.getHand().getCards(game)) {
        player.discard(card, source, game);
      }
      return true;
    }
    return false;
  }
}
origin: magefree/mage

@Override
public boolean apply(Game game, Ability source) {
  Player targetPlayer = game.getPlayer(targetPointer.getFirst(game, source));
  if (targetPlayer != null) {
    int damage = (Integer)getValue("damage");
    targetPlayer.discard(damage, false, source, game);
    game.informPlayers(targetPlayer.getLogName() + "discards " + damage + " card(s)");
    return true;
  }
  return false;
}
origin: magefree/mage

@Override
public boolean apply(Game game, Ability source) {
  Player you = game.getPlayer(source.getControllerId());
  Player damagedPlayer = game.getPlayer(targetPointer.getFirst(game, source));
  if (damagedPlayer != null) {
    damagedPlayer.discard(1, source, game);
  }
  if (you != null) {
    you.drawCards(1, game);
  }
  return true;
}
origin: magefree/mage

@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
  Permanent permanent = ((EntersTheBattlefieldEvent) event).getTarget();
  if (permanent != null) {
    Player you = game.getPlayer(source.getControllerId());
    if (you != null) {
      you.discard(permanent.getToughness().getValue(), false, source, game);
    }
  }
  return false;
}
origin: magefree/mage

  @Override
  public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    if (controller != null) {
      int cardsInHand = controller.getHand().size();
      controller.discard(cardsInHand, false, source, game);
      controller.drawCards(cardsInHand, game);
      return true;
    }
    return false;
  }
}
origin: magefree/mage

  @Override
  public boolean apply(Game game, Ability source) {
    Player player = game.getPlayer(source.getFirstTarget());
    if(player != null) {
      int handCount = player.getHand().count(new FilterCard(), game);
      player.drawCards(handCount, game);
      player.discard(handCount, false, source, game);
    }
    return false;
  }
}
mage.playersPlayerdiscard

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

  • Running tasks concurrently on multiple threads
  • getSupportFragmentManager (FragmentActivity)
  • notifyDataSetChanged (ArrayAdapter)
  • setContentView (Activity)
  • FileNotFoundException (java.io)
    Thrown when a file specified by a program cannot be found.
  • ServerSocket (java.net)
    This class represents a server-side socket that waits for incoming client connections. A ServerSocke
  • ByteBuffer (java.nio)
    A buffer for bytes. A byte buffer can be created in either one of the following ways: * #allocate
  • Connection (java.sql)
    A connection represents a link from a Java application to a database. All SQL statements and results
  • PriorityQueue (java.util)
    A PriorityQueue holds elements on a priority heap, which orders the elements according to their natu
  • JarFile (java.util.jar)
    JarFile is used to read jar entries and their associated data from jar files.
  • Top 25 Plugins for Webstorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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