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

How to use
isCanGainLife
method
in
mage.players.Player

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

origin: magefree/mage

@Override
public boolean apply(ObjectSourcePlayer<Player> input, Game game) {
  Player player = input.getObject();
  if(player != null) {
    return player.isCanGainLife();
  }
  return false;
}
origin: magefree/mage

@Override
public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) {
  Player controller = game.getPlayer(controllerId);
  if (controller != null) {
    for (UUID opponentId : game.getOpponents(controllerId)) {
      Player player = game.getPlayer(opponentId);
      if (player != null && player.isCanGainLife()) {
        // at least one opponent must be able to gain life
        return true;
      }
    }
  }
  return true;
}
origin: magefree/mage

@Override
public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) {
  Player controller = game.getPlayer(controllerId);
  if (controller != null) {
    for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
      if (!playerId.equals(controllerId)) {
        Player player = game.getPlayer(playerId);
        if (player != null && !player.isCanGainLife()) {
          // if only one other player can't gain life, the cost can't be paid
          return false;
        }
      }
    }
  }
  return true;
}
origin: magefree/mage

if (lifePlayer1 < lifePlayer2 && (!sourcePlayer.isCanGainLife() || !targetPlayer.isCanLoseLife())) {
  return false;
if (lifePlayer1 > lifePlayer2 && (!sourcePlayer.isCanLoseLife() || !targetPlayer.isCanGainLife())) {
  return false;
origin: magefree/mage

if (lifePlayer1 < lifePlayer2 && (!player1.isCanGainLife() || !player2.isCanLoseLife())) {
  return false;
if (lifePlayer1 > lifePlayer2 && (!player1.isCanLoseLife() || !player2.isCanGainLife())) {
  return false;
origin: magefree/mage

@Override
public boolean apply(Game game, Ability source) {
  Player controller = game.getPlayer(source.getControllerId());
  Player player = game.getPlayer(source.getFirstTarget());
  if (controller != null && player != null) {
    int lifeController = controller.getLife();
    int lifePlayer = player.getLife();
    if (lifeController == lifePlayer) {
      return false;
    }
    if (!controller.isLifeTotalCanChange() || !player.isLifeTotalCanChange()) {
      return false;
    }
    if (lifeController < lifePlayer && (!controller.isCanGainLife() || !player.isCanLoseLife())) {
      return false;
    }
    if (lifeController > lifePlayer && (!controller.isCanLoseLife() || !player.isCanGainLife())) {
      return false;
    }
    controller.setLife(lifePlayer, game, source);
    player.setLife(lifeController, game, source);
    return true;
  }
  return false;
}
origin: magefree/mage

if (lifePlayer1 < lifePlayer2 && (!player1.isCanGainLife() || !player2.isCanLoseLife())) {
  return false;
if (lifePlayer1 > lifePlayer2 && (!player1.isCanLoseLife() || !player2.isCanGainLife())) {
  return false;
origin: magefree/mage

this.canGainLife = player.isCanGainLife();
this.canLoseLife = player.isCanLoseLife();
this.attachments.clear();
origin: magefree/mage

@Override
public boolean apply(Game game, Ability source) {
  Player player = game.getPlayer(source.getControllerId());
  if (player != null && player.isLifeTotalCanChange()) {
    Permanent perm = game.getPermanent(source.getSourceId());
    if (perm != null) {
      int amount = perm.getPower().getValue();
      int life = player.getLife();
      if (life == amount) {
        return false;
      }
      if (life < amount && !player.isCanGainLife()) {
        return false;
      }
      if (life > amount && !player.isCanLoseLife()) {
        return false;
      }
      player.setLife(amount, game, source);
      game.addEffect(new SetPowerToughnessSourceEffect(life, Integer.MIN_VALUE, Duration.Custom, SubLayer.SetPT_7b), source);
      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.isLifeTotalCanChange()) {
    Permanent perm = game.getPermanent(source.getSourceId());
    if (perm != null) {
      int amount = perm.getToughness().getValue();
      int life = player.getLife();
      if (life == amount) {
        return false;
      }
      if (life < amount && !player.isCanGainLife()) {
        return false;
      }
      if (life > amount && !player.isCanLoseLife()) {
        return false;
      }
      player.setLife(amount, game, source);
      game.addEffect(new SetPowerToughnessSourceEffect(Integer.MIN_VALUE, life, Duration.Custom, SubLayer.SetPT_7b), source);
      return true;
    }
  }
  return false;
}
origin: magefree/mage

@Override
public boolean apply(Game game, Ability source) {
  Player opponent = game.getPlayer(source.getFirstTarget());
  if (opponent != null && opponent.isLifeTotalCanChange()) {
    Permanent perm = game.getPermanent(source.getSourceId());
    if (perm != null) {
      int amount = perm.getToughness().getValue();
      int life = opponent.getLife();
      if (life == amount) {
        return false;
      }
      if (life < amount && !opponent.isCanGainLife()) {
        return false;
      }
      if (life > amount && !opponent.isCanLoseLife()) {
        return false;
      }
      opponent.setLife(amount, game, source);
      perm.getToughness().modifyBaseValue(life);
      // game.addEffect(new SetPowerToughnessSourceEffect(Integer.MIN_VALUE, life, Duration.Custom, SubLayer.SetPT_7b), source);
      return true;
    }
  }
  return false;
}
mage.playersPlayerisCanGainLife

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

  • Reactive rest calls using spring rest template
  • runOnUiThread (Activity)
  • onRequestPermissionsResult (Fragment)
  • setContentView (Activity)
  • Pointer (com.sun.jna)
    An abstraction for a native pointer data type. A Pointer instance represents, on the Java side, a na
  • Graphics2D (java.awt)
    This Graphics2D class extends the Graphics class to provide more sophisticated control overgraphics
  • Point (java.awt)
    A point representing a location in (x,y) coordinate space, specified in integer precision.
  • Deque (java.util)
    A linear collection that supports element insertion and removal at both ends. The name deque is shor
  • CountDownLatch (java.util.concurrent)
    A synchronization aid that allows one or more threads to wait until a set of operations being perfor
  • JFileChooser (javax.swing)
  • Top PhpStorm 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