Ejemplo n.º 1
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;
 }
Ejemplo n.º 3
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;
  }
Ejemplo 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;
 }
Ejemplo n.º 5
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;
 }
Ejemplo n.º 6
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;
 }
Ejemplo n.º 7
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;
 }
Ejemplo n.º 8
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);
 }