Exemplo n.º 1
0
 @Override
 public boolean checkTrigger(GameEvent event, Game game) {
   if (event.getType() == GameEvent.EventType.DAMAGED_PLAYER) {
     if (((DamagedEvent) event).isCombatDamage()) {
       Permanent creature = game.getPermanent(event.getSourceId());
       if (creature != null
           && creature.getControllerId().equals(controllerId)
           && !damagedPlayerIds.contains(event.getTargetId())) {
         damagedPlayerIds.add(event.getTargetId());
         return true;
       }
     }
   }
   if (event.getType().equals(GameEvent.EventType.END_COMBAT_STEP_POST)) {
     damagedPlayerIds.clear();
   }
   if (event.getType().equals(GameEvent.EventType.ZONE_CHANGE)
       && event.getTargetId().equals(getSourceId())) {
     ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
     if (zEvent.getFromZone().equals(Zone.GRAVEYARD)) {
       damagedPlayerIds.clear();
     }
   }
   return false;
 }
Exemplo n.º 2
0
 @Override
 public boolean checkTrigger(GameEvent event, Game game) {
   if (event.getTargetId().equals(target)) {
     ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
     if (zEvent.getFromZone() == Zone.BATTLEFIELD && zEvent.getToZone() == Zone.GRAVEYARD) {
       return true;
     }
   }
   return false;
 }
 @Override
 public boolean checkTrigger(GameEvent event, Game game) {
   if (event.getType() == EventType.ZONE_CHANGE
       && event.getTargetId().equals(this.getSourceId())) {
     ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
     if ((fromZone == null || zEvent.getFromZone() == fromZone)
         && (toZone == null || zEvent.getToZone() == toZone)) {
       return true;
     }
   }
   return false;
 }
Exemplo n.º 4
0
 @Override
 public boolean applies(GameEvent event, Ability source, Game game) {
   if (event.getTargetId().equals(source.getSourceId())) {
     ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
     if (zEvent.getFromZone() == Zone.BATTLEFIELD && zEvent.getToZone() != Zone.EXILED) {
       // started in graveyard goint to battlefield so current zone change counter has to be +1
       return source.getSourceObjectZoneChangeCounter() + 1
           == game.getState().getZoneChangeCounter(source.getSourceId());
     }
   }
   return false;
 }
Exemplo n.º 5
0
 @Override
 public boolean checkTrigger(GameEvent event, Game game) {
   ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
   if (zEvent.getFromZone().equals(Zone.GRAVEYARD)) {
     Card card = game.getCard(zEvent.getTargetId());
     Player controller = game.getPlayer(getControllerId());
     return card != null
         && card.getCardType().contains(CardType.CREATURE)
         && controller != null
         && controller.hasOpponent(card.getOwnerId(), game);
   }
   return false;
 }
Exemplo n.º 6
0
 @Override
 public boolean checkTrigger(GameEvent event, Game game) {
   if (event.getType() == GameEvent.EventType.ZONE_CHANGE
       && event.getSourceId() != null
       && event.getSourceId().equals(getSourceId())) {
     ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
     if (zEvent.getFromZone() == Zone.BATTLEFIELD && zEvent.getToZone() == Zone.EXILED) {
       if (zEvent.getTarget() != null && zEvent.getTarget().getSubtype().contains("Faerie")) {
         return true;
       }
     }
   }
   return false;
 }
Exemplo n.º 7
0
 @Override
 public boolean applies(GameEvent event, Ability source, Game game) {
   ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
   if (zEvent.getToZone().equals(Zone.GRAVEYARD)) {
     Card card = game.getCard(event.getTargetId());
     if (card != null) {
       Permanent enchantment = game.getPermanent(source.getSourceId());
       if (enchantment != null
           && enchantment.getAttachedTo() != null
           && card.getOwnerId().equals(enchantment.getAttachedTo())) {
         return true;
       }
     }
   }
   return false;
 }
Exemplo n.º 8
0
 @Override
 public boolean checkTrigger(GameEvent event, Game game) {
   if (event.getType() == GameEvent.EventType.ZONE_CHANGE) {
     ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
     if (zEvent.getFromZone() == Zone.BATTLEFIELD && zEvent.getToZone() == Zone.GRAVEYARD) {
       Permanent permanent =
           (Permanent) game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD);
       if (permanent != null) {
         if (permanent.getId().equals(this.getSourceId())) {
           return true;
         } else {
           if (permanent.getCardType().contains(CardType.CREATURE)) {
             return true;
           }
         }
       }
     }
   }
   return false;
 }
Exemplo n.º 9
0
  @Override
  public boolean moveToExile(
      UUID exileId, String name, UUID sourceId, Game game, ArrayList<UUID> appliedEffects) {
    ZoneChangeEvent event =
        new ZoneChangeEvent(
            this.getId(), sourceId, this.getOwnerId(), Zone.STACK, Zone.EXILED, appliedEffects);
    if (!game.replaceEvent(event)) {
      game.getStack().remove(this);
      game.rememberLKI(this.getId(), event.getFromZone(), this);

      if (exileId == null) {
        game.getExile().getPermanentExile().add(this.card);
      } else {
        game.getExile().createZone(exileId, name).add(this.card);
      }
      game.setZone(this.card.getId(), event.getToZone());
      game.fireEvent(event);
      return event.getToZone() == Zone.EXILED;
    }
    return false;
  }
Exemplo n.º 10
0
 @Override
 public boolean applies(GameEvent event, Ability source, Game game) {
   ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
   return zEvent.getToZone() == Zone.GRAVEYARD
       && ((ZoneChangeEvent) event).getTargetId().equals(cardid);
 }