コード例 #1
0
ファイル: TransformAbility.java プロジェクト: joshhazel/mage
  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());
  }
コード例 #2
0
ファイル: Duplicant.java プロジェクト: TumbleMagnet/mage
  @Override
  public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
    Permanent permanent = game.getPermanent(source.getSourceId());
    if (permanent != null) {
      if (permanent.getImprinted().size() > 0) {
        Card card = game.getCard(permanent.getImprinted().get(0));
        if (card != null && card.getCardType().contains(CardType.CREATURE)) {
          switch (layer) {
            case TypeChangingEffects_4:
              if (sublayer == SubLayer.NA) {
                permanent.getSubtype().addAll(card.getSubtype());
              }

              break;
            case PTChangingEffects_7:
              if (sublayer == SubLayer.SetPT_7b) {
                permanent.getPower().setValue(card.getPower().getValue());
                permanent.getToughness().setValue(card.getToughness().getValue());
              }
          }
          return true;
        }
      }
    }
    return false;
  }
コード例 #3
0
ファイル: DimirDoppelganger.java プロジェクト: nigelzor/mage
  @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;
  }
コード例 #4
0
ファイル: Spell.java プロジェクト: quercitron/mage
 @Override
 public MageInt getToughness() {
   return card.getToughness();
 }