congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
Player.isLifeTotalCanChange
Code IndexAdd Tabnine to your IDE (free)

How to use
isLifeTotalCanChange
method
in
mage.players.Player

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

origin: magefree/mage

public static List<Permanent> canKillOpponent(Game game, List<Permanent> attackersList, List<Permanent> blockersList,
                       Player defender) {
  List<Permanent> blockableAttackers = new ArrayList<>(blockersList);
  List<Permanent> unblockableAttackers = new ArrayList<>();
  for (Permanent attacker : attackersList) {
    if (!canBeBlocked(game, attacker, blockersList)) {
      unblockableAttackers.add(attacker);
      blockableAttackers.remove(attacker);
    }
  }
  sortByPower(blockableAttackers, true);
  // imagine that most powerful will be blocked as 1-vs-1
  List<Permanent> attackersThatWontBeBlocked = new ArrayList<>(blockableAttackers);
  for (int i = 0; (i < blockersList.size() && i < blockableAttackers.size()); i++) {
    attackersThatWontBeBlocked.remove(blockableAttackers.get(i));
  }
  attackersThatWontBeBlocked.addAll(unblockableAttackers);
  // now count if it is possible to win the game by this attack using unblockable attackers and
  // those attackers that won't be blocked for sure (as player will block other creatures)
  if (sumDamage(attackersThatWontBeBlocked, defender) >= defender.getLife() && defender.isLifeTotalCanChange()
      && defender.canLose(game) && defender.getLife() > 0) {
    blockableAttackers.addAll(unblockableAttackers);
    return blockableAttackers;
  }
  if (sumPoisonDamage(attackersThatWontBeBlocked, defender) >= 10 - defender.getCounters().getCount(CounterType.POISON)) {
    blockableAttackers.addAll(unblockableAttackers);
    return blockableAttackers;
  }
  return emptyList;
}
origin: magefree/mage

if (!player1.isLifeTotalCanChange() || !player2.isLifeTotalCanChange()) {
  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 (!player1.isLifeTotalCanChange() || !player2.isLifeTotalCanChange()) {
  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.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.playersPlayerisLifeTotalCanChange

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
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • findViewById (Activity)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • Thread (java.lang)
    A thread is a thread of execution in a program. The Java Virtual Machine allows an application to ha
  • DecimalFormat (java.text)
    A concrete subclass of NumberFormat that formats decimal numbers. It has a variety of features desig
  • HashSet (java.util)
    HashSet is an implementation of a Set. All optional operations (adding and removing) are supported.
  • DataSource (javax.sql)
    An interface for the creation of Connection objects which represent a connection to a database. This
  • JComboBox (javax.swing)
  • LogFactory (org.apache.commons.logging)
    Factory for creating Log instances, with discovery and configuration features similar to that employ
  • From CI to AI: The AI layer in your organization
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