Ejemplo n.º 1
0
  public CrosissCharm(UUID ownerId) {
    super(
        ownerId,
        181,
        "Crosis's Charm",
        Rarity.UNCOMMON,
        new CardType[] {CardType.INSTANT},
        "{U}{B}{R}");
    this.expansionSetCode = "C13";

    // Choose one - Return target permanent to its owner's hand;
    this.getSpellAbility().addEffect(new ReturnToHandTargetEffect());
    this.getSpellAbility().addTarget(new TargetPermanent());
    // or destroy target nonblack creature, and it can't be regenerated;
    Mode mode = new Mode();
    mode.getEffects().add(new DestroyTargetEffect(true));
    mode.getTargets().add(new TargetCreaturePermanent(filter));
    this.getSpellAbility().addMode(mode);
    // or destroy target artifact.
    mode = new Mode();
    mode.getEffects().add(new DestroyTargetEffect(true));
    Target target = new TargetArtifactPermanent();
    mode.getTargets().add(target);
    this.getSpellAbility().addMode(mode);
  }
Ejemplo n.º 2
0
 @Override
 public String getText(Mode mode) {
   if (staticText != null && !staticText.isEmpty()) {
     return staticText;
   }
   StringBuilder sb = new StringBuilder();
   if (mode.getTargets().size() > 0) {
     sb.append("Target ").append(mode.getTargets().get(0).getTargetName());
   } else {
     sb.append("that player");
   }
   if (optional) {
     sb.append(" may draw ");
   } else {
     sb.append(" draws ");
   }
   if (upTo) {
     sb.append("up to ");
   }
   sb.append(CardUtil.numberToText(amount.toString())).append(" card");
   try {
     if (Integer.parseInt(amount.toString()) > 1) {
       sb.append("s");
     }
   } catch (Exception e) {
     sb.append("s");
   }
   String message = amount.getMessage();
   if (message.length() > 0) {
     sb.append(" for each ");
   }
   sb.append(message);
   return sb.toString();
 }
 @Override
 public String getText(Mode mode) {
   if (mode.getTargets().isEmpty()) {
     return "Exile it";
   } else {
     return "Exile target " + mode.getTargets().get(0).getTargetName();
   }
 }
Ejemplo n.º 4
0
 @Override
 public String getText(Mode mode) {
   return "Gain control of target "
       + mode.getTargets().get(0).getTargetName()
       + " "
       + duration.toString();
 }
 @Override
 public String getText(Mode mode) {
   if (staticText != null && !staticText.isEmpty()) {
     return staticText;
   }
   StringBuilder sb = new StringBuilder();
   if (mode.getTargets().size() > 0) {
     sb.append("target ");
     sb.append(mode.getTargets().get(0).getMessage());
     sb.append(" becomes the color or colors of your choice");
     if (duration.toString().length() > 0) {
       sb.append(" ").append(duration.toString());
     }
   }
   return sb.toString();
 }
Ejemplo n.º 6
0
  public TrevasCharm(UUID ownerId) {
    super(
        ownerId,
        129,
        "Treva's Charm",
        Rarity.UNCOMMON,
        new CardType[] {CardType.INSTANT},
        "{G}{W}{U}");
    this.expansionSetCode = "PLS";

    // Choose one - Destroy target enchantment;
    this.getSpellAbility().addEffect(new DestroyTargetEffect());
    this.getSpellAbility().addTarget(new TargetEnchantmentPermanent());

    // or exile target attacking creature;
    Mode mode = new Mode();
    mode.getEffects().add(new ExileTargetEffect());
    mode.getTargets().add(new TargetAttackingCreature());
    this.getSpellAbility().addMode(mode);

    // or draw a card, then discard a card.
    mode = new Mode();
    mode.getEffects().add(new DrawDiscardControllerEffect());
    this.getSpellAbility().addMode(mode);
  }
Ejemplo n.º 7
0
 @Override
 public String getText(Mode mode) {
   StringBuilder sb = new StringBuilder();
   sb.append("{source} deals ").append(amount.toString());
   sb.append(" damage divided as you choose among any number of target ")
       .append(mode.getTargets().get(0).getTargetName());
   return sb.toString();
 }
Ejemplo n.º 8
0
  public DawnCharm(UUID ownerId, CardSetInfo setInfo) {
    super(ownerId, setInfo, new CardType[] {CardType.INSTANT}, "{1}{W}");

    // Choose one - Prevent all combat damage that would be dealt this turn
    this.getSpellAbility()
        .addEffect(new PreventAllDamageByAllPermanentsEffect(Duration.EndOfTurn, true));
    // or regenerate target creature;
    Mode mode = new Mode();
    mode.getEffects().add(new RegenerateTargetEffect());
    mode.getTargets().add(new TargetCreaturePermanent());
    this.getSpellAbility().addMode(mode);
    // or counter target spell that targets you.
    mode = new Mode();
    mode.getEffects().add(new CounterTargetEffect());
    mode.getTargets().add(new TargetSpell(filter));
    this.getSpellAbility().addMode(mode);
  }
Ejemplo n.º 9
0
  private void updateTargets(Game game, StackAbility ability) {
    List<String> names = new ArrayList<>();
    for (Mode mode : ability.getModes().getSelectedModes()) {
      if (mode.getTargets().size() > 0) {
        setTargets(mode.getTargets());
      } else {
        List<UUID> targetList = new ArrayList<>();
        for (Effect effect : mode.getEffects()) {
          TargetPointer targetPointer = effect.getTargetPointer();
          if (targetPointer instanceof FixedTarget) {
            targetList.add(((FixedTarget) targetPointer).getTarget());
          }
        }
        if (targetList.size() > 0) {
          overrideTargets(targetList);

          for (UUID uuid : targetList) {
            MageObject mageObject = game.getObject(uuid);
            if (mageObject != null) {
              if ((mageObject instanceof Card) && ((Card) mageObject).isFaceDown(game)) {
                continue;
              }
              names.add(GameLog.getColoredObjectIdNameForTooltip(mageObject));
            }
          }
        }
      }
    }
    if (!names.isEmpty()) {
      getRules().add("<i>Related objects: " + names.toString() + "</i>");
    }
    // show for modal ability, which mode was choosen
    if (ability.isModal()) {
      Modes modes = ability.getModes();
      for (Mode mode : modes.getSelectedModes()) {
        this.rules.add(
            "<span color='green'><i>Chosen mode: "
                + mode.getEffects().getText(mode)
                + "</i></span>");
      }
    }
  }
Ejemplo n.º 10
0
 @Override
 public String getText(Mode mode) {
   if (staticText != null && !staticText.isEmpty()) {
     return staticText;
   }
   StringBuilder sb = new StringBuilder();
   sb.append("copy target ")
       .append(mode.getTargets().get(0).getTargetName())
       .append(". You may choose new targets for the copy");
   return sb.toString();
 }
Ejemplo n.º 11
0
  public SteelSabotage(UUID ownerId, CardSetInfo setInfo) {
    super(ownerId, setInfo, new CardType[] {CardType.INSTANT}, "{U}");

    // Choose one - Counter target artifact spell; or return target artifact to its owner's hand.
    this.getSpellAbility().addEffect(new CounterTargetEffect());
    this.getSpellAbility().addTarget(new TargetSpell(new FilterArtifactSpell()));
    Mode mode = new Mode();
    mode.getEffects().add(new ReturnToHandTargetEffect());
    mode.getTargets().add(new TargetArtifactPermanent());
    this.getSpellAbility().addMode(mode);
  }
Ejemplo n.º 12
0
  public FeastOrFamine(UUID ownerId, CardSetInfo setInfo) {
    super(ownerId, setInfo, new CardType[] {CardType.INSTANT}, "{3}{B}");

    // Choose one - Create a 2/2 black Zombie creature token;
    this.getSpellAbility().addEffect(new CreateTokenEffect(new ZombieToken()));

    // or destroy target nonartifact, nonblack creature and it can't be regenerated.
    Mode mode = new Mode();
    mode.getEffects().add(new DestroyTargetEffect(true));
    mode.getTargets().add(new TargetCreaturePermanent(filter));
    this.getSpellAbility().addMode(mode);
  }
Ejemplo n.º 13
0
  @Override
  public String getText(Mode mode) {
    if (this.staticText != null && !this.staticText.isEmpty()) {
      return staticText;
    }
    StringBuilder sb = new StringBuilder();
    Target target = mode.getTargets().get(0);
    sb.append("Put ");
    if (target.getMaxNumberOfTargets() == 0) {
      sb.append("any number of ");
    } else {
      if (target.getMaxNumberOfTargets() != 1 || target.getNumberOfTargets() != 1) {
        if (target.getMaxNumberOfTargets() > target.getNumberOfTargets()) {
          sb.append("up to ");
        }
        sb.append(CardUtil.numberToText(target.getMaxNumberOfTargets())).append(" ");
      }
    }
    sb.append("target ").append(mode.getTargets().get(0).getTargetName()).append(" on ");
    sb.append(onTop ? "top" : "the bottom").append(" of its owner's library");

    return sb.toString();
  }
Ejemplo n.º 14
0
  public Vandalize(UUID ownerId, CardSetInfo setInfo) {
    super(ownerId, setInfo, new CardType[] {CardType.SORCERY}, "{4}{R}");

    // Choose one or both - Destroy target artifact; or Destroy target land.
    this.getSpellAbility().getModes().setMinModes(1);
    this.getSpellAbility().getModes().setMaxModes(2);

    this.getSpellAbility().addTarget(new TargetArtifactPermanent());
    this.getSpellAbility().addEffect(new DestroyTargetEffect());

    Mode mode1 = new Mode();
    mode1.getTargets().add(new TargetLandPermanent());
    mode1.getEffects().add(new DestroyTargetEffect());
    this.getSpellAbility().addMode(mode1);
  }
Ejemplo n.º 15
0
 @Override
 public boolean applies(Ability abilityToModify, Ability source, Game game) {
   if (abilityToModify instanceof SpellAbility) {
     if (source.getControllerId().equals(abilityToModify.getControllerId())) {
       for (UUID modeId : abilityToModify.getModes().getSelectedModes()) {
         Mode mode = abilityToModify.getModes().get(modeId);
         for (Target target : mode.getTargets()) {
           for (UUID targetUUID : target.getTargets()) {
             Permanent enchantment = game.getPermanent(source.getSourceId());
             UUID attachedTo = enchantment.getAttachedTo();
             if (targetUUID.equals(attachedTo)) {
               return true;
             }
           }
         }
       }
     }
   }
   return false;
 }
Ejemplo n.º 16
0
  public RainOfRust(UUID ownerId) {
    super(
        ownerId, 76, "Rain of Rust", Rarity.COMMON, new CardType[] {CardType.INSTANT}, "{3}{R}{R}");
    this.expansionSetCode = "5DN";

    this.color.setRed(true);

    // Choose one -
    this.getSpellAbility().getModes().setMinModes(1);
    this.getSpellAbility().getModes().setMaxModes(1);
    // Destroy target artifact;
    this.getSpellAbility().addEffect(new DestroyTargetEffect());
    this.getSpellAbility().addTarget(new TargetArtifactPermanent());
    // or destroy target land.
    Mode mode = new Mode();
    mode.getEffects().add(new DestroyTargetEffect());
    mode.getTargets().add(new TargetLandPermanent());
    this.getSpellAbility().getModes().addMode(mode);
    // Entwine {3}{R}
    this.addAbility(new EntwineAbility("{3}{R}"));
  }
Ejemplo n.º 17
0
  public String getValue(boolean useHidden, Game game) {
    StringBuilder sb = new StringBuilder(1024);

    sb.append(turnNum)
        .append(turn.getPhaseType())
        .append(turn.getStepType())
        .append(activePlayerId)
        .append(priorityPlayerId);

    for (Player player : players.values()) {
      sb.append("player").append(player.isPassed()).append(player.getLife()).append("hand");
      if (useHidden) {
        sb.append(player.getHand());
      } else {
        sb.append(player.getHand().size());
      }
      sb.append("library").append(player.getLibrary().size());
      sb.append("graveyard");
      for (Card card : player.getGraveyard().getCards(game)) {
        sb.append(card.getName());
      }
    }

    sb.append("permanents");
    List<String> perms = new ArrayList<String>();
    for (Permanent permanent : battlefield.getAllPermanents()) {
      perms.add(permanent.getValue());
    }
    Collections.sort(perms);
    sb.append(perms);

    sb.append("spells");
    for (StackObject spell : stack) {
      sb.append(spell.getControllerId()).append(spell.getName());
      sb.append(spell.getStackAbility().toString());
      for (Mode mode : spell.getStackAbility().getModes().values()) {
        if (!mode.getTargets().isEmpty()) {
          sb.append("targets");
          for (Target target : mode.getTargets()) {
            sb.append(target.getTargets());
          }
        }
        if (!mode.getChoices().isEmpty()) {
          sb.append("choices");
          for (Choice choice : mode.getChoices()) {
            sb.append(choice.getChoice());
          }
        }
      }
    }

    for (ExileZone zone : exile.getExileZones()) {
      sb.append("exile").append(zone.getName()).append(zone);
    }

    sb.append("combat");
    for (CombatGroup group : combat.getGroups()) {
      sb.append(group.getDefenderId()).append(group.getAttackers()).append(group.getBlockers());
    }

    return sb.toString();
  }