예제 #1
0
 public boolean apply(Game game, Ability source) {
   Permanent target = game.getPermanent(source.getFirstTarget());
   if (target != null) {
     for (ObjectColor color : target.getColor(game).getColors()) {
       FilterCard filter = new FilterCard(color.getDescription());
       filter.add(new ColorPredicate(color));
       game.addEffect(
           new GainAbilityControlledEffect(
               new ProtectionAbility(filter),
               Duration.EndOfTurn,
               new FilterControlledCreaturePermanent()),
           source);
     }
     return true;
   }
   return false;
 }
예제 #2
0
  @java.lang.Override
  public boolean apply(Game game, Ability source) {
    Permanent permanent = game.getPermanent(source.getSourceId());
    Player player = game.getPlayer(source.getControllerId());
    if (permanent != null && player != null) {
      List<UUID> imprinted = permanent.getImprinted();
      if (imprinted.size() > 0) {
        Card imprintedCard = game.getCard(imprinted.get(0));
        if (imprintedCard != null) {
          Choice choice = new ChoiceImpl(true);
          choice.setMessage("Pick a mana color");
          ObjectColor color = imprintedCard.getColor(game);
          if (color.isBlack()) {
            choice.getChoices().add("Black");
          }
          if (color.isRed()) {
            choice.getChoices().add("Red");
          }
          if (color.isBlue()) {
            choice.getChoices().add("Blue");
          }
          if (color.isGreen()) {
            choice.getChoices().add("Green");
          }
          if (color.isWhite()) {
            choice.getChoices().add("White");
          }

          if (choice.getChoices().size() > 0) {
            Mana mana = new Mana();
            if (choice.getChoices().size() == 1) {
              choice.setChoice(choice.getChoices().iterator().next());
            } else {
              player.choose(outcome, choice, game);
            }
            if (choice.getChoice().equals("Black")) {
              player.getManaPool().addMana(Mana.BlackMana, game, source);
            } else if (choice.getChoice().equals("Blue")) {
              player.getManaPool().addMana(Mana.BlueMana, game, source);
            } else if (choice.getChoice().equals("Red")) {
              player.getManaPool().addMana(Mana.RedMana, game, source);
            } else if (choice.getChoice().equals("Green")) {
              player.getManaPool().addMana(Mana.GreenMana, game, source);
            } else if (choice.getChoice().equals("White")) {
              player.getManaPool().addMana(Mana.WhiteMana, game, source);
            } else if (choice.getChoice().equals("Colorless")) {
              player.getManaPool().addMana(Mana.ColorlessMana, game, source);
            }
            checkToFirePossibleEvents(mana, game, source);
            player.getManaPool().addMana(mana, game, source);
          }
        }
      }
    }
    return true;
  }
예제 #3
0
파일: Token.java 프로젝트: xdaft/mage
 public Token(
     String name,
     String description,
     ObjectColor color,
     List<String> subtype,
     int power,
     int toughness,
     Abilities abilities) {
   this(name, description);
   this.cardType.add(CardType.CREATURE);
   this.color = color.copy();
   this.subtype = subtype;
   this.power.setValue(power);
   this.toughness.setValue(toughness);
   if (abilities != null) {
     this.abilities = abilities.copy();
   }
 }
예제 #4
0
파일: Token.java 프로젝트: royk/mage
 public Token(
     String name,
     String description,
     ObjectColor color,
     List<String> subtype,
     int power,
     int toughness,
     Abilities<Ability> abilities) {
   this(name, description);
   this.cardType.add(CardType.CREATURE);
   this.color = color.copy();
   this.subtype = subtype;
   this.power.modifyBaseValue(power);
   this.toughness.modifyBaseValue(toughness);
   if (abilities != null) {
     this.abilities = abilities.copy();
   }
   this.expansionSetCodeChecked = false;
 }
예제 #5
0
 @Override
 public String toString() {
   return "Color(" + color.toString() + ')';
 }