예제 #1
0
  @Override
  public boolean apply(Game game, Ability source) {
    Player player1 = game.getPlayer(source.getFirstTarget());
    Player player2 = game.getPlayer(source.getTargets().get(1).getFirstTarget());
    if (player1 != null && player2 != null) {
      int lifePlayer1 = player1.getLife();
      int lifePlayer2 = player2.getLife();

      if (lifePlayer1 == lifePlayer2) return false;

      if (!player1.isLifeTotalCanChange() || !player2.isLifeTotalCanChange()) return false;

      // 20110930 - 118.7, 118.8
      if (lifePlayer1 < lifePlayer2 && (!player1.isCanGainLife() || !player2.isCanLoseLife()))
        return false;

      if (lifePlayer1 > lifePlayer2 && (!player1.isCanLoseLife() || !player2.isCanGainLife()))
        return false;

      player1.setLife(lifePlayer2, game);
      player2.setLife(lifePlayer1, game);
      return true;
    }
    return false;
  }
예제 #2
0
 @Override
 public boolean apply(Game game, Ability source) {
   Player player = game.getPlayer(targetPointer.getFirst(game, source));
   if (player != null) {
     player.setLife(amount.calculate(game, source, this), game);
     return true;
   }
   return false;
 }
예제 #3
0
 @Override
 public boolean apply(Game game, Ability source) {
   FilterControlledPermanent filter = new FilterControlledPermanent();
   Player player = game.getPlayer(source.getControllerId());
   int permanentsInPlay = game.getBattlefield().countAll(filter, source.getControllerId(), game);
   if (player != null) {
     player.setLife(permanentsInPlay, game);
     return true;
   }
   return false;
 }
예제 #4
0
 @Override
 public boolean apply(Game game, Ability source) {
   int lowestLife = game.getPlayer(source.getControllerId()).getLife();
   for (Player playerid : game.getPlayers().values()) {
     if (playerid != null) {
       if (lowestLife > playerid.getLife()) {
         lowestLife = playerid.getLife();
       }
     }
   }
   for (Player playerId : game.getPlayers().values()) {
     if (playerId != null) {
       playerId.setLife(lowestLife, game);
     }
   }
   return true;
 }