Esempio n. 1
0
  public static void transform(Permanent permanent, Card sourceCard, Game game) {

    if (sourceCard == null) {
      return;
    }

    permanent.setName(sourceCard.getName());
    permanent.getColor().setColor(sourceCard.getColor());
    permanent.getManaCost().clear();
    permanent.getManaCost().add(sourceCard.getManaCost());
    permanent.getCardType().clear();
    for (CardType type : sourceCard.getCardType()) {
      permanent.getCardType().add(type);
    }
    permanent.getSubtype().clear();
    for (String type : sourceCard.getSubtype()) {
      permanent.getSubtype().add(type);
    }
    permanent.getSupertype().clear();
    for (String type : sourceCard.getSupertype()) {
      permanent.getSupertype().add(type);
    }
    permanent.setExpansionSetCode(sourceCard.getExpansionSetCode());
    permanent.getAbilities().clear();
    for (Ability ability : sourceCard.getAbilities()) {
      permanent.addAbility(ability, game);
    }
    permanent.getPower().setValue(sourceCard.getPower().getValue());
    permanent.getToughness().setValue(sourceCard.getToughness().getValue());
  }
Esempio n. 2
0
  @Override
  public boolean apply(Game game, Ability source) {
    Card card = game.getCard(source.getFirstTarget());
    Permanent permanent = game.getPermanent(source.getSourceId());
    if (card == null || permanent == null) {
      return false;
    }
    card.moveToExile(null, "Dimir Doppelganger", source.getSourceId(), game);
    Card cardToCopy = card.copy();
    cardToCopy.assignNewId();
    permanent.setName(cardToCopy.getName());
    permanent.getPower().setValue(cardToCopy.getPower().getValue());
    permanent.getToughness().setValue(cardToCopy.getToughness().getValue());
    permanent.getColor(game).setColor(cardToCopy.getColor(game));
    permanent.getManaCost().clear();
    permanent.getManaCost().add(cardToCopy.getManaCost());
    permanent.getCardType().clear();
    for (CardType type : cardToCopy.getCardType()) {
      if (!permanent.getCardType().contains(type)) {
        permanent.getCardType().add(type);
      }
    }
    permanent.getSubtype(game).clear();
    for (String type : cardToCopy.getSubtype(game)) {
      if (!permanent.getSubtype(game).contains(type)) {
        permanent.getSubtype(game).add(type);
      }
    }
    permanent.getSupertype().clear();
    for (String type : cardToCopy.getSupertype()) {
      if (!permanent.getSupertype().contains(type)) {
        permanent.getSupertype().add(type);
      }
    }
    permanent.removeAllAbilities(source.getSourceId(), game);
    // gains ability of Dimir Doppelganger
    Ability dimirDoppelgangerAbility =
        new SimpleActivatedAbility(
            Zone.BATTLEFIELD, new DimirDoppelgangerEffect(), new ManaCostsImpl("{1}{U}{B}"));
    dimirDoppelgangerAbility.addTarget(
        new TargetCardInGraveyard(new FilterCreatureCard("creature card in a graveyard")));
    permanent.addAbility(dimirDoppelgangerAbility, source.getSourceId(), game);

    for (Ability ability : cardToCopy.getAbilities()) {
      if (!permanent.getAbilities().contains(ability)) {
        permanent.addAbility(ability, source.getSourceId(), game);
      }
    }
    return true;
  }
Esempio n. 3
0
 @Override
 public boolean apply(Game game, Ability source) {
   Permanent permanent =
       (Permanent) game.getLastKnownInformation(source.getFirstTarget(), Zone.BATTLEFIELD);
   if (permanent != null && !permanent.getSupertype().contains("Basic")) {
     Player player = game.getPlayer(permanent.getControllerId());
     if (player != null) {
       player.damage(2, source.getSourceId(), game, false, true);
       return true;
     }
   }
   return false;
 }