Ejemplo n.º 1
0
 @Override
 public boolean apply(Game game, Ability source) {
   boolean result = false;
   Player graveyardPlayer = null;
   for (UUID cardInGraveyard : targetPointer.getTargets(game, source)) {
     Card card = game.getCard(cardInGraveyard);
     if (card != null) {
       for (Player player : game.getPlayers().values()) {
         if (player.getGraveyard().contains(card.getId())) {
           graveyardPlayer = player;
           player.getGraveyard().remove(card);
           result |= card.moveToZone(Zone.LIBRARY, source.getSourceId(), game, true);
         }
       }
     }
   }
   Card card = game.getCard(source.getSourceId());
   result |= card.moveToZone(Zone.LIBRARY, source.getSourceId(), game, false);
   Player player = game.getPlayer(card.getOwnerId());
   if (player != null) {
     player.shuffleLibrary(game);
   }
   if (graveyardPlayer != null && !graveyardPlayer.equals(player)) {
     graveyardPlayer.shuffleLibrary(game);
   }
   return result;
 }
Ejemplo n.º 2
0
 @Override
 public boolean apply(Game game, Ability source) {
   Player controller = game.getPlayer(source.getControllerId());
   Player newController = game.getPlayer(this.getTargetPointer().getFirst(game, source));
   if (newController != null && controller != null && !controller.equals(newController)) {
     ContinuousEffect effect =
         new GainControlTargetEffect(Duration.Custom, newController.getId());
     effect.setTargetPointer(new FixedTarget(source.getSourceId()));
     game.addEffect(effect, source);
     return true;
   }
   return false;
 }
Ejemplo n.º 3
0
 @Override
 public boolean apply(Game game, Ability source) {
   Player controller = game.getPlayer(source.getControllerId());
   if (controller != null) {
     switch (targetController) {
       case YOU:
         controller.setCanGainLife(false);
         break;
       case NOT_YOU:
         for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
           Player player = game.getPlayer(playerId);
           if (player != null && !player.equals(controller)) {
             player.setCanGainLife(false);
           }
         }
         break;
       case OPPONENT:
         for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
           if (controller.hasOpponent(playerId, game)) {
             Player player = game.getPlayer(playerId);
             if (player != null) {
               player.setCanGainLife(false);
             }
           }
         }
         break;
       case ANY:
         for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
           Player player = game.getPlayer(playerId);
           if (player != null) {
             player.setCanGainLife(false);
           }
         }
         break;
     }
     return true;
   }
   return false;
 }