Пример #1
0
 @Override
 protected void init(UUID choosingPlayerId) {
   Ability ability = new SimpleStaticAbility(Zone.COMMAND, new InfoEffect("Commander effects"));
   // Move commander to command zone
   for (UUID playerId : state.getPlayerList(startingPlayerId)) {
     Player player = getPlayer(playerId);
     if (player != null) {
       if (player.getSideboard().size() > 0) {
         Card commander = getCard((UUID) player.getSideboard().toArray()[0]);
         if (commander != null) {
           player.setCommanderId(commander.getId());
           commander.moveToZone(Zone.COMMAND, null, this, true);
           commander.getAbilities().setControllerId(player.getId());
           ability.addEffect(
               new CommanderReplacementEffect(commander.getId(), alsoHand, alsoLibrary));
           ability.addEffect(new CommanderCostModification(commander.getId()));
           ability.addEffect(
               new CommanderManaReplacementEffect(
                   player.getId(), CardUtil.getColorIdentity(commander)));
           getState().setValue(commander.getId() + "_castCount", 0);
           CommanderInfoWatcher watcher =
               new CommanderInfoWatcher(commander.getId(), CHECK_COMMANDER_DAMAGE);
           getState().getWatchers().add(watcher);
           watcher.addCardInfoToCommander(this);
         }
       }
     }
   }
   this.getState().addAbility(ability, null);
   super.init(choosingPlayerId);
   if (startingPlayerSkipsDraw) {
     state.getTurnMods().add(new TurnMod(startingPlayerId, PhaseStep.DRAW));
   }
 }
Пример #2
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());
  }
Пример #3
0
 @Override
 public int calculate(Game game, Ability source, Effect effect) {
   int count = 0;
   Card card = game.getCard(source.getSourceId());
   if (card != null) {
     for (Ability ability : card.getAbilities()) {
       if (ability instanceof KickerAbility) {
         count += ((KickerAbility) ability).getXManaValue();
       }
     }
   }
   return count;
 }
Пример #4
0
 @Override
 public boolean apply(Game game, Ability source) {
   Card card = game.getCard(source.getSourceId());
   if (card != null) {
     for (Ability ability : card.getAbilities()) {
       if (ability instanceof KickerAbility) {
         if (((KickerAbility) ability).isKicked(game)) {
           return true;
         }
       }
     }
   }
   return false;
 }
Пример #5
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;
  }
Пример #6
0
 public void addCard(Card card) {
   setZone(card.getId(), Zone.OUTSIDE);
   for (Watcher watcher : card.getWatchers()) {
     watcher.setControllerId(card.getOwnerId());
     watcher.setSourceId(card.getId());
     watchers.add(watcher);
   }
   for (Ability ability : card.getAbilities()) {
     addAbility(ability, card);
   }
   if (card.isSplitCard()) {
     addCard(((SplitCard) card).getLeftHalfCard());
     addCard(((SplitCard) card).getRightHalfCard());
   }
 }
Пример #7
0
 @Override
 public Abilities<Ability> getAbilities() {
   return card.getAbilities();
 }