Esempio n. 1
0
  static {
    filter.add(new ColorPredicate(ObjectColor.BLUE));
    filter.add(new ControllerPredicate(TargetController.YOU));

    filter2.add(new ColorPredicate(ObjectColor.RED));
    filter2.add(new ControllerPredicate(TargetController.YOU));
  }
Esempio n. 2
0
 @Override
 public boolean apply(Game game, Ability source) {
   Player player = game.getPlayer(source.getControllerId());
   MageObject sourceObject = game.getObject(source.getSourceId());
   if (player != null) {
     Choice typeChoice = new ChoiceImpl(true);
     typeChoice.setMessage("Choose a creature type:");
     typeChoice.setChoices(CardRepository.instance.getCreatureTypes());
     while (!player.choose(outcome, typeChoice, game)) {
       if (!player.canRespond()) {
         return false;
       }
     }
     if (typeChoice.getChoice() != null) {
       game.informPlayers(sourceObject.getLogName() + " chosen type: " + typeChoice.getChoice());
     }
     FilterCreaturePermanent filterCreaturePermanent = new FilterCreaturePermanent();
     filterCreaturePermanent.add(new SubtypePredicate(typeChoice.getChoice()));
     for (Permanent creature :
         game.getBattlefield()
             .getActivePermanents(filterCreaturePermanent, source.getSourceId(), game)) {
       creature.untap(game);
     }
     return true;
   }
   return false;
 }
Esempio n. 3
0
 @Override
 public void adjustTargets(Ability ability, Game game) {
   if (this.getAbilities().contains(ability) && ability.getRule().startsWith("&bull Dragons")) {
     FilterCreaturePermanent filter = new FilterCreaturePermanent("creature that player controls");
     filter.add(new ControllerIdPredicate(game.getCombat().getAttackerId()));
     ability.getTargets().clear();
     ability.addTarget(new TargetCreaturePermanent(filter));
   }
 }
Esempio n. 4
0
 @Override
 public void adjustTargets(Ability ability, Game game) {
   if (ability.getAbilityType().equals(AbilityType.TRIGGERED)) {
     ability.getTargets().clear();
     FilterCreaturePermanent filter =
         new FilterCreaturePermanent("creature defending player controls");
     UUID defenderId = game.getCombat().getDefenderId(ability.getSourceId());
     filter.add(new ControllerIdPredicate(defenderId));
     TargetCreaturePermanent target = new TargetCreaturePermanent(filter);
     ability.addTarget(target);
   }
 }
Esempio n. 5
0
 public SupportAbility(Card card, int amount) {
   super(new SupportEffect(card, amount, true));
   if (!card.getCardType().contains(CardType.INSTANT)
       && !card.getCardType().contains(CardType.SORCERY)) {
     FilterCreaturePermanent filter = new FilterCreaturePermanent("creatures");
     if (card.getCardType().contains(CardType.CREATURE)) {
       filter.add(new AnotherPredicate());
       filter.setMessage("other target creatures");
     }
     addTarget(new TargetCreaturePermanent(0, amount, filter, false));
   }
 }
 public CantBeBlockedByCreaturesAllEffect(
     FilterCreaturePermanent filterCreatures,
     FilterCreaturePermanent filterBlockedBy,
     Duration duration) {
   super(Duration.WhileOnBattlefield);
   this.filterCreatures = filterCreatures;
   this.filterBlockedBy = filterBlockedBy;
   staticText =
       new StringBuilder(filterCreatures.getMessage())
           .append(" can't be blocked ")
           .append(filterBlockedBy.getMessage().startsWith("except by") ? "" : "by ")
           .append(filterBlockedBy.getMessage())
           .toString();
 }
Esempio n. 7
0
  @Override
  public boolean activate(Game game, boolean noMana) {
    UUID defenderId = game.getCombat().getDefenderId(sourceId);
    if (defenderId != null) {
      FilterCreaturePermanent filter = filterTemplate.copy();
      filter.add(new ControllerIdPredicate(defenderId));

      this.getTargets().clear();
      TargetCreaturePermanent target = new TargetCreaturePermanent(filter);
      target.setRequired(true);
      this.addTarget(target);
      return super.activate(game, noMana);
    }
    return false;
  }
Esempio n. 8
0
 @Override
 public void adjustTargets(Ability ability, Game game) {
   if (ability instanceof SpellAbility) {
     for (UUID opponentId : game.getOpponents(ability.getControllerId())) {
       Player opponent = game.getPlayer(opponentId);
       if (opponent != null) {
         ability.getTargets().clear();
         FilterCreaturePermanent filter =
             new FilterCreaturePermanent("creature from opponent " + opponent.getLogName());
         filter.add(new ControllerIdPredicate(opponentId));
         TargetCreaturePermanent target = new TargetCreaturePermanent(0, 1, filter, false);
         ability.addTarget(target);
       }
     }
   }
 }
 @Override
 public void adjustTargets(Ability ability, Game game) {
   if (ability.getOriginalId().equals(originalId)) {
     for (Effect effect : ability.getEffects()) {
       UUID opponentId = effect.getTargetPointer().getFirst(game, ability);
       Player opponent = game.getPlayer(opponentId);
       if (opponent != null) {
         effect.setTargetPointer(new FirstTargetPointer());
         FilterCreaturePermanent filter =
             new FilterCreaturePermanent("a creature from the active opponent");
         filter.add(new ControllerIdPredicate(opponentId));
         Target target = new TargetCreaturePermanent(filter);
         ability.addTarget(target);
       }
     }
   }
 }
Esempio n. 10
0
 static {
   filter.add(new ControllerPredicate(TargetController.YOU));
   filterCard.add(
       Predicates.or(
           new SubtypePredicate("Aura"),
           new CardTypePredicate(CardType.CREATURE),
           new CardTypePredicate(CardType.PLANESWALKER)));
 }
Esempio n. 11
0
 @Override
 public String getText(Mode mode) {
   StringBuilder sb = new StringBuilder();
   sb.append(filter.getMessage()).append(" can't block");
   if (Duration.EndOfTurn.equals(this.duration)) {
     sb.append(" this turn");
   }
   return sb.toString();
 }
Esempio n. 12
0
  public SerpentineSpike(UUID ownerId) {
    super(
        ownerId,
        133,
        "Serpentine Spike",
        Rarity.RARE,
        new CardType[] {CardType.SORCERY},
        "{5}{R}{R}");
    this.expansionSetCode = "BFZ";

    // Devoid
    Ability ability = new DevoidAbility(this.color);
    ability.setRuleAtTheTop(true);
    this.addAbility(ability);
    // Serpentine Spike deals 2 damage to target creature, 3 damage to another target creature, and
    // 4 damage to a third target creature. If a creature dealt damage this way would die this turn,
    // exile it instead.
    this.getSpellAbility().addEffect(new SerpentineSpikeEffect());

    TargetCreaturePermanent target =
        new TargetCreaturePermanent(new FilterCreaturePermanent("creature (2 damage)"));
    target.setTargetTag(1);
    this.getSpellAbility().addTarget(target);

    FilterCreaturePermanent filter =
        new FilterCreaturePermanent("another target creature (3 damage)");
    filter.add(new AnotherTargetPredicate(2));
    target = new TargetCreaturePermanent(filter);
    target.setTargetTag(2);
    this.getSpellAbility().addTarget(target);

    filter = new FilterCreaturePermanent("another target creature (4 damage)");
    filter.add(new AnotherTargetPredicate(3));
    target = new TargetCreaturePermanent(filter);
    target.setTargetTag(3);
    this.getSpellAbility().addTarget(target);

    Effect effect = new DealtDamageToCreatureBySourceDies(this, Duration.EndOfTurn);
    effect.setText("If a creature dealt damage this way would die this turn, exile it instead");
    this.getSpellAbility().addEffect(effect);
    this.getSpellAbility().addWatcher(new DamagedByWatcher());
  }
Esempio n. 13
0
  public SistersOfStoneDeath(UUID ownerId) {
    super(
        ownerId,
        231,
        "Sisters of Stone Death",
        Rarity.RARE,
        new CardType[] {CardType.CREATURE},
        "{4}{B}{B}{G}{G}");
    this.expansionSetCode = "RAV";
    this.supertype.add("Legendary");
    this.subtype.add("Gorgon");

    this.power = new MageInt(7);
    this.toughness = new MageInt(5);

    // {G}: Target creature blocks Sisters of Stone Death this turn if able.
    Ability ability =
        new SimpleActivatedAbility(
            Zone.BATTLEFIELD, new MustBeBlockedByTargetSourceEffect(), new ManaCostsImpl("{G}"));
    ability.addTarget(new TargetCreaturePermanent());
    this.addAbility(ability);

    // {B}{G}: Exile target creature blocking or blocked by Sisters of Stone Death.
    Ability ability2 =
        new SimpleActivatedAbility(
            Zone.BATTLEFIELD,
            new ExileTargetEffect(exileId, this.getIdName()),
            new ManaCostsImpl("{B}{G}"));
    FilterCreaturePermanent filter =
        new FilterCreaturePermanent("creature blocking or blocked by Sisters of Stone Death");
    filter.add(
        Predicates.or(
            new BlockedByIdPredicate(this.getId()), new BlockingAttackerIdPredicate(this.getId())));
    ability2.addTarget(new TargetCreaturePermanent(filter));
    this.addAbility(ability2);

    // {2}{B}: Put a creature card exiled with Sisters of Stone Death onto the battlefield under
    // your control.
    this.addAbility(
        new SimpleActivatedAbility(
            Zone.BATTLEFIELD, new SistersOfStoneDeathEffect(exileId), new ManaCostsImpl("{2}{B}")));
  }
Esempio n. 14
0
 @Override
 public boolean checkTrigger(GameEvent event, Game game) {
   if (event.getTargetId().equals(this.getSourceId())) {
     Permanent blocker = game.getPermanent(event.getSourceId());
     if (filter.match(blocker, game)) {
       for (Effect effect : this.getEffects()) {
         effect.setTargetPointer(new FixedTarget(event.getSourceId()));
       }
       return true;
     }
   }
   return false;
 }
Esempio n. 15
0
 @Override
 public boolean apply(Game game, Ability source) {
   Player player = game.getPlayer(targetPointer.getFirst(game, source));
   if (player != null) {
     int amount = (Integer) getValue("damage");
     if (amount > 0) {
       FilterCreaturePermanent filter =
           new FilterCreaturePermanent("creature " + player.getLogName() + " controls");
       filter.add(new ControllerIdPredicate(player.getId()));
       TargetCreaturePermanent target = new TargetCreaturePermanent(filter);
       if (target.canChoose(source.getControllerId(), game)
           && target.choose(
               Outcome.Damage, source.getControllerId(), source.getSourceId(), game)) {
         UUID creature = target.getFirstTarget();
         if (creature != null) {
           game.getPermanent(creature).damage(amount, source.getSourceId(), game, false, true);
           return true;
         }
       }
     }
   }
   return false;
 }
Esempio n. 16
0
 @Override
 public boolean applies(GameEvent event, Ability source, Game game) {
   if (super.applies(event, source, game)) {
     if (event.getTargetId().equals(source.getControllerId())) {
       Permanent sourcePermanent = game.getPermanent(source.getSourceId());
       if (sourcePermanent != null && !sourcePermanent.isTapped()) {
         Permanent damageSource = game.getPermanent(event.getSourceId());
         if (damageSource != null && filter.match(damageSource, game)) {
           return true;
         }
       }
     }
   }
   return false;
 }
Esempio n. 17
0
  public FateTransfer(UUID ownerId) {
    super(
        ownerId,
        161,
        "Fate Transfer",
        Rarity.COMMON,
        new CardType[] {CardType.INSTANT},
        "{1}{U/B}");
    this.expansionSetCode = "SHM";

    // Move all counters from target creature onto another target creature.
    this.getSpellAbility().addEffect(new FateTransferEffect());

    TargetCreaturePermanent fromTarget = new TargetCreaturePermanent(filter);
    fromTarget.setTargetTag(1);
    this.getSpellAbility().addTarget(fromTarget);

    TargetCreaturePermanent toTarget = new TargetCreaturePermanent(filter2);
    filter2.add(new AnotherTargetPredicate(2));
    toTarget.setTargetTag(2);
    this.getSpellAbility().addTarget(toTarget);
  }
Esempio n. 18
0
 static {
   filter3orLess.add(new ConvertedManaCostPredicate(Filter.ComparisonType.LessThan, 4));
   filter4orMore.add(new ConvertedManaCostPredicate(Filter.ComparisonType.GreaterThan, 3));
 }
Esempio n. 19
0
 static {
   filter1.add(new SubtypePredicate("Zombie"));
   filter2.add(new SubtypePredicate("Zombie"));
 }
Esempio n. 20
0
 static {
   filter.add(new FaceDownPredicate());
   filter.add(new ControllerPredicate(TargetController.NOT_YOU));
 }
Esempio n. 21
0
 static {
   filter.add(new AbilityPredicate(HorsemanshipAbility.class));
 }
Esempio n. 22
0
 static {
   filter.add(new ColorPredicate(ObjectColor.WHITE));
 }
Esempio n. 23
0
 static {
   filter.add(new SubtypePredicate("Angel"));
 }
Esempio n. 24
0
 static {
   filter1.add(new SubtypePredicate("Vampire"));
   filter2.add(new SubtypePredicate("Vampire"));
   filter2.add(Predicates.not(new TappedPredicate()));
 }
Esempio n. 25
0
 static {
   filterAnotherCreature.add(new AnotherPredicate());
 }
Esempio n. 26
0
 static {
   filter.add(Predicates.not(new AbilityPredicate(FlyingAbility.class)));
 }
Esempio n. 27
0
 static {
   filter.add(new SubtypePredicate("Faerie"));
   filter.add(new ControllerPredicate(TargetController.YOU));
 }
Esempio n. 28
0
 static {
   filter.add(Predicates.not(new CardTypePredicate(CardType.ARTIFACT)));
 }
Esempio n. 29
0
 static {
   filter.add(new ColorPredicate(ObjectColor.BLACK));
 }
Esempio n. 30
0
 static {
   filter.add(new AttackingPredicate());
 }