congrats Icon
New! Announcing our next generation AI code completions
Read here
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

  • Start an intent from android
  • onRequestPermissionsResult (Fragment)
  • findViewById (Activity)
  • compareTo (BigDecimal)
  • File (java.io)
    An "abstract" representation of a file system entity identified by a pathname. The pathname may be a
  • NoSuchElementException (java.util)
    Thrown when trying to retrieve an element past the end of an Enumeration or Iterator.
  • ResourceBundle (java.util)
    ResourceBundle is an abstract class which is the superclass of classes which provide Locale-specifi
  • SortedMap (java.util)
    A map that has its keys ordered. The sorting is according to either the natural ordering of its keys
  • JarFile (java.util.jar)
    JarFile is used to read jar entries and their associated data from jar files.
  • SSLHandshakeException (javax.net.ssl)
    The exception that is thrown when a handshake could not be completed successfully.
  • 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