Exemplo n.º 1
0
 @Override
 public boolean apply(Game game, Ability source) {
   StackObject spell = game.getStack().getStackObject(targetPointer.getFirst(game, source));
   if (spell != null) {
     Player player = game.getPlayer(spell.getControllerId());
     if (player != null) {
       GenericManaCost cost = new GenericManaCost(spell.getConvertedManaCost());
       if (!cost.pay(source, game, source.getSourceId(), player.getId(), false)) {
         game.getStack().counter(spell.getId(), source.getSourceId(), game);
       }
       return true;
     }
   }
   return false;
 }
Exemplo n.º 2
0
 @Override
 public boolean apply(Game game, Ability source) {
   StackObject spell = game.getStack().getStackObject(targetPointer.getFirst(game, source));
   MageObject sourceObject = game.getObject(source.getSourceId());
   if (sourceObject != null && spell != null) {
     Player player = game.getPlayer(spell.getControllerId());
     Player controller = game.getPlayer(source.getControllerId());
     if (player != null && controller != null) {
       int amount =
           game.getBattlefield()
               .countAll(new FilterArtifactPermanent(), source.getControllerId(), game);
       if (amount > 0) {
         GenericManaCost cost = new GenericManaCost(amount);
         if (!cost.pay(source, game, spell.getControllerId(), spell.getControllerId(), false)) {
           game.informPlayers(
               sourceObject.getLogName() + ": cost wasn't payed - countering target spell.");
           return game.getStack().counter(source.getFirstTarget(), source.getSourceId(), game);
         }
       }
       return true;
     }
   }
   return false;
 }