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

How to use
choose
method
in
mage.players.Player

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

origin: magefree/mage

@Override
public boolean choose(Outcome outcome, UUID playerId, UUID sourceId, Game game) {
  Player player = game.getPlayer(playerId);
  while (!isChosen() && !doneChosing()) {
    chosen = targets.size() >= getNumberOfTargets();
    if (!player.choose(outcome, this, sourceId, game)) {
      return chosen;
    }
    chosen = targets.size() >= getNumberOfTargets();
  }
  return chosen = true;
}
origin: magefree/mage

public boolean choose(Game game, Ability source) {
  if (this.size() > 0) {
    Player player = game.getPlayer(source.getControllerId());
    while (!isChosen()) {
      Choice choice = this.getUnchosen().get(0);
      if (!player.choose(outcome, choice, game)) {
        return false;
      }
    }
  }
  return true;
}
origin: magefree/mage

  private void chooseCardForColor(ObjectColor color, Set<Card> chosenCards, Player player, Game game, Ability source) {
    FilterCard filter = new FilterCard();
    filter.add(new ColorPredicate(color));
    TargetCardInHand target = new TargetCardInHand(filter);
    if (player.choose(Outcome.Benefit, target, source.getSourceId(), game)) {
      Card card = game.getCard(target.getFirstTarget());
      if (card != null) {
        chosenCards.add(card);
      }
    }
  }
}
origin: magefree/mage

@Override
public Mana produceMana(boolean netMana, Game game, Ability source) {
  Player controller = game.getPlayer(source.getControllerId());
  if (controller != null) {
    ChoiceColor choice = new ChoiceColor();
    choice.setMessage("Choose a color for devotion of Nykthos");
    if (controller.choose(outcome, choice, game)) {
      return computeMana(choice.getChoice(), game, source);
    }
  }
  return null;
}
origin: magefree/mage

@Override
public Mana produceMana(boolean netMana, Game game, Ability source) {
  Player controller = game.getPlayer(source.getControllerId());
  ChoiceColor choiceColor = new ChoiceColor(true);
  if (controller != null && controller.choose(Outcome.Benefit, choiceColor, game)) {
    Mana condMana = manaBuilder.setMana(choiceColor.getMana(amount), source, game).build();
    return condMana;
  }
  return null;
}
origin: magefree/mage

  @Override
  public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    if (controller != null) {
      ChoiceColor choice = new ChoiceColor();
      if (controller.choose(Outcome.PreventDamage, choice, game)) {
        game.addEffect(new AvacynGuardianAngelPreventToCreaturePreventionEffect(choice.getColor()), source);
        return true;
      }
    }
    return false;
  }
}
origin: magefree/mage

  @Override
  public boolean apply(Game game, Ability source) {
    Player player = game.getPlayer(source.getControllerId());
    Choice choice = new ChoiceBasicLandType();
    if (player != null && player.choose(Outcome.Neutral, choice, game)) {
      game.getState().setValue(source.getSourceId().toString() + "_ElsewhereFlask", choice.getChoice());
      game.addEffect(new ElsewhereFlaskContinuousEffect(), 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) {
      ChoiceColor choice = new ChoiceColor();
      if (controller.choose(Outcome.PreventDamage, choice, game)) {
        game.addEffect(new AvacynGuardianAngelPreventToPlayerPreventionEffect(choice.getColor()), 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) {
      SeasonsPastTarget target = new SeasonsPastTarget();
      controller.choose(outcome, target, source.getSourceId(), game);
      controller.moveCards(new CardsImpl(target.getTargets()), Zone.HAND, source, game);
      return true;
    }
    return false;
  }
}
origin: magefree/mage

@Override
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) {
  Player controller = game.getPlayer(controllerId);
  TargetCardInHand targetCardInHand = new TargetCardInHand();
  targetCardInHand.setRequired(false);
  Card card;
  if (targetCardInHand.canChoose(controllerId, game)
      && controller.choose(Outcome.PreventDamage, targetCardInHand, sourceId, game)) {
    card = game.getCard(targetCardInHand.getFirstTarget());
    paid = card != null && controller.moveCardToLibraryWithInfo(card, sourceId, game, Zone.HAND, true, true);
  }
  return paid;
}
origin: magefree/mage

  @Override
  public boolean apply(Game game, Ability source) {
    Player targetedPlayer = game.getPlayer(source.getFirstTarget());
    if (targetedPlayer != null) {
      TargetCardInHand target = new TargetCardInHand();
      if (targetedPlayer.choose(Outcome.Detriment, targetedPlayer.getHand(), target, game)) {
        Card card = game.getCard(target.getFirstTarget());
        return card != null && targetedPlayer.putCardOnTopXOfLibrary(card, game, source, 0);
      }
    }
    return false;
  }
}
origin: magefree/mage

@Override
public Mana produceMana(boolean netMana, Game game, Ability source) {
  if (netMana) {
    return null;
  }
  UUID playerId = (UUID) game.getState().getValue(source.getSourceId() + "_player");
  Player player = game.getPlayer(playerId);
  ChoiceColor choice = new ChoiceColor();
  if (player != null && player.choose(outcome, choice, game)) {
    return choice.getMana(1);
  }
  return new Mana();
}
origin: magefree/mage

@Override
public void init(Ability source, Game game) {
  super.init(source, game); //To change body of generated methods, choose Tools | Templates.
  MageObject sourceObject = game.getObject(source.getSourceId());
  Player controller = game.getPlayer(source.getControllerId());
  if (sourceObject != null && controller != null) {
    if (controller.choose(Outcome.Protect, choice, game)) {
      game.informPlayers(sourceObject.getLogName() + ": " + controller.getLogName() + " has chosen protection from " + choice.getChoice());
      return;
    }
  }
  discard();
}
origin: magefree/mage

@Override
public void init(Ability source, Game game) {
  super.init(source, game);
  MageObject sourceObject = game.getObject(source.getSourceId());
  Player controller = game.getPlayer(source.getControllerId());
  if (sourceObject != null && controller != null) {
    if (!controller.choose(Outcome.Protect, choice, game)) {
      discard();
      return;
    }
    game.informPlayers(sourceObject.getLogName() + ": " + controller.getLogName() + " has chosen protection from " + choice.getChoice());
  }
}
origin: magefree/mage

  private void chooseCardInHandAndPutOnTopOfLibrary(Game game, Ability source, Player you, Player targetPlayer) {
    if (!targetPlayer.getHand().isEmpty()) {
      TargetCard target = new TargetCard(Zone.HAND, new FilterCard("card to put on the top of library (last chosen will be on top)"));
      if (you.choose(Outcome.Benefit, targetPlayer.getHand(), target, game)) {
        Card card = targetPlayer.getHand().get(target.getFirstTarget(), game);
        if (card != null) {
          targetPlayer.moveCardToLibraryWithInfo(card, source.getSourceId(), game, Zone.HAND, true, false);
        }
      }
    }
  }
}
origin: magefree/mage

  @Override
  public void adjustTargets(Ability ability, Game game) {
    Player controller = game.getPlayer(ability.getControllerId());
    Choice typeChoice = new ChoiceCreatureType(game.getObject(ability.getSourceId()));
    if (controller != null && controller.choose(Outcome.PutCreatureInPlay, typeChoice, game)) {
      String chosenType = typeChoice.getChoice();
      FilterCreatureCard filter = new FilterCreatureCard(chosenType + " cards");
      filter.add(new SubtypePredicate(SubType.byDescription(chosenType)));
      ability.addTarget(new TargetCardInYourGraveyard(0, 3, filter));
    }
  }
}
origin: magefree/mage

  @Override
  public boolean apply(Game game, Ability source) {
    Player player = game.getPlayer(source.getControllerId());
    Choice typeChoice = new ChoiceCreatureType(game.getObject(source.getSourceId()));
    if (player != null && player.choose(Outcome.BoostCreature, typeChoice, game)) {
      FilterControlledPermanent filter = new FilterControlledPermanent();
      filter.add(new SubtypePredicate(SubType.byDescription(typeChoice.getChoice())));
      return new GainLifeEffect(new PermanentsOnBattlefieldCount(filter, 2)).apply(game, source);
    }
    return false;
  }
}
origin: magefree/mage

  @Override
  public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    Choice typeChoice = new ChoiceCreatureType(game.getObject(source.getSourceId()));
    if (controller != null && controller.choose(Outcome.BoostCreature, typeChoice, game)) {
      FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent();
      filter.add(new SubtypePredicate(SubType.byDescription(typeChoice.getChoice())));
      return new DrawCardSourceControllerEffect(new PermanentsOnBattlefieldCount(filter)).apply(game, source);
    }
    return false;
  }
}
origin: magefree/mage

@Override
public boolean apply(Game game, Ability source) {
  Player controller = game.getPlayer(source.getControllerId());
  MageObject mageObject = game.getObject(source.getSourceId());
  Choice typeChoice = new ChoiceCreatureType(mageObject);
  if (controller != null && mageObject != null && controller.choose(outcome, typeChoice, game)) {
    if (!game.isSimulation()) {
      game.informPlayers(mageObject.getName() + ": " + controller.getLogName() + " has chosen " + typeChoice.getChoice());
    }
    game.getState().setValue(mageObject.getId() + "_type", SubType.byDescription(typeChoice.getChoice()));
    return true;
  }
  return false;
}
origin: magefree/mage

  @Override
  public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    Choice typeChoice = new ChoiceCreatureType(game.getObject(source.getSourceId()));
    if (controller != null && controller.choose(outcome, typeChoice, game)) {
      game.informPlayers(controller.getLogName() + " has chosen " + typeChoice.getChoice());
      FilterCreaturePermanent filter = new FilterCreaturePermanent("All creatures not of the chosen type");
      filter.add(Predicates.not(new SubtypePredicate(SubType.byDescription(typeChoice.getChoice()))));
      return new DestroyAllEffect(filter).apply(game, source);
    }
    return false;
  }
}
mage.playersPlayerchoose

Javadoc

Choose the order in which blockers get damage assigned to

Popular methods of Player

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

Popular in Java

  • Reading from database using SQL prepared statement
  • addToBackStack (FragmentTransaction)
  • getApplicationContext (Context)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • UnknownHostException (java.net)
    Thrown when a hostname can not be resolved.
  • Collection (java.util)
    Collection is the root of the collection hierarchy. It defines operations on data collections and t
  • AtomicInteger (java.util.concurrent.atomic)
    An int value that may be updated atomically. See the java.util.concurrent.atomic package specificati
  • Stream (java.util.stream)
    A sequence of elements supporting sequential and parallel aggregate operations. The following exampl
  • HttpServletRequest (javax.servlet.http)
    Extends the javax.servlet.ServletRequest interface to provide request information for HTTP servlets.
  • JTextField (javax.swing)
  • Best plugins for Eclipse
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