Пример #1
0
 @Override
 public boolean apply(Game game, Ability source) {
   Player controller = game.getPlayer(source.getControllerId());
   if (controller != null && source.getTargets().size() > 0) {
     Target multiTarget = source.getTargets().get(0);
     for (UUID target : multiTarget.getTargets()) {
       Permanent permanent = game.getPermanent(target);
       if (permanent != null) {
         permanent.addCounters(
             CounterType.P1P1.createInstance(multiTarget.getTargetAmount(target)), game);
         game.informPlayers(
             new StringBuilder(controller.getLogName())
                 .append(" puts ")
                 .append(multiTarget.getTargetAmount(target))
                 .append(" ")
                 .append(CounterType.P1P1.getName().toLowerCase())
                 .append(" counter on ")
                 .append(permanent.getName())
                 .toString());
       }
     }
     return true;
   }
   return false;
 }
Пример #2
0
 @Override
 public boolean apply(Game game, Ability source) {
   if (source.getTargets().size() > 0) {
     Target multiTarget = source.getTargets().get(0);
     for (UUID target : multiTarget.getTargets()) {
       Permanent permanent = game.getPermanent(target);
       if (permanent != null) {
         permanent.damage(
             multiTarget.getTargetAmount(target), source.getSourceId(), game, true, false);
       } else {
         Player player = game.getPlayer(target);
         if (player != null) {
           player.damage(
               multiTarget.getTargetAmount(target), source.getSourceId(), game, false, true);
         }
       }
     }
   }
   return true;
 }