public BoseijuWhoSheltersAll(UUID ownerId) {
    super(
        ownerId, 273, "Boseiju, Who Shelters All", Rarity.RARE, new CardType[] {CardType.LAND}, "");
    this.expansionSetCode = "CHK";
    this.supertype.add("Legendary");

    // Boseiju, Who Shelters All enters the battlefield tapped.
    this.addAbility(new EntersBattlefieldTappedAbility());

    // {tap}, Pay 2 life: Add {C} to your mana pool. If that mana is spent on an instant or sorcery
    // spell, that spell can't be countered by spells or abilities.
    Mana mana = new Mana(0, 0, 0, 0, 0, 0, 0, 1);
    mana.setFlag(true); // used to indicate this mana ability
    SimpleManaAbility ability = new SimpleManaAbility(Zone.BATTLEFIELD, mana, new TapSourceCost());
    ability.addCost(new PayLifeCost(2));
    ability
        .getEffects()
        .get(0)
        .setText(
            "Add {C} to your mana pool. If that mana is spent on an instant or sorcery spell, that spell can't be countered by spells or abilities");
    this.addAbility(ability);

    this.addAbility(
        new SimpleStaticAbility(Zone.BATTLEFIELD, new BoseijuWhoSheltersAllCantCounterEffect()),
        new BoseijuWhoSheltersAllWatcher());
  }
 @Override
 public boolean apply(Game game, Ability source, Ability abilityToModify) {
   if (manaCostsToReduce != null) {
     CardUtil.adjustCost((SpellAbility) abilityToModify, manaCostsToReduce, false);
   } else {
     if (upTo) {
       Mana mana = abilityToModify.getManaCostsToPay().getMana();
       int reduceMax = mana.getColorless();
       if (reduceMax > 2) {
         reduceMax = 2;
       }
       if (reduceMax > 0) {
         Player controller = game.getPlayer(abilityToModify.getControllerId());
         if (controller == null) {
           return false;
         }
         ChoiceImpl choice = new ChoiceImpl(true);
         Set<String> set = new LinkedHashSet<>();
         for (int i = 0; i <= reduceMax; i++) {
           set.add(String.valueOf(i));
         }
         choice.setChoices(set);
         choice.setMessage("Reduce cost of " + filter);
         if (controller.choose(Outcome.Benefit, choice, game)) {
           int reduce = Integer.parseInt(choice.getChoice());
           CardUtil.reduceCost(abilityToModify, reduce);
         }
       }
     } else {
       CardUtil.reduceCost(abilityToModify, this.amount);
     }
   }
   return true;
 }
 public MonoHybridManaCost(ColoredManaSymbol mana) {
   this.mana = mana;
   this.cost = new Mana(mana);
   this.cost.add(Mana.ColorlessMana(2));
   addColoredOption(mana);
   options.add(Mana.ColorlessMana(2));
 }
示例#4
0
 public List<Mana> getNetMana(Game game, Ability source) {
   List<Mana> netManas = new ArrayList<>();
   Mana types = getManaTypes(game, source);
   if (types.getAny() > 0) {
     netManas.add(new Mana(0, 0, 0, 0, 0, 0, 1, 0));
     return netManas;
   }
   if (types.getBlack() > 0) {
     netManas.add(new Mana(ColoredManaSymbol.B));
   }
   if (types.getRed() > 0) {
     netManas.add(new Mana(ColoredManaSymbol.R));
   }
   if (types.getBlue() > 0) {
     netManas.add(new Mana(ColoredManaSymbol.U));
   }
   if (types.getGreen() > 0) {
     netManas.add(new Mana(ColoredManaSymbol.G));
   }
   if (types.getWhite() > 0) {
     netManas.add(new Mana(ColoredManaSymbol.W));
   }
   if (types.getColorless() > 0) {
     netManas.add(Mana.ColorlessMana(1));
   }
   return netManas;
 }
 @Override
 public List<Mana> getManaOptions() {
   List<Mana> manaList = new ArrayList<>();
   manaList.add(new Mana(mana));
   manaList.add(Mana.ColorlessMana(2));
   return manaList;
 }
示例#6
0
  public Valleymaker(UUID ownerId, CardSetInfo setInfo) {
    super(ownerId, setInfo, new CardType[] {CardType.CREATURE}, "{5}{R/G}");
    this.subtype.add("Giant");
    this.subtype.add("Shaman");
    this.power = new MageInt(5);
    this.toughness = new MageInt(5);

    // {tap}, Sacrifice a Mountain: Valleymaker deals 3 damage to target creature.
    Ability ability =
        new SimpleActivatedAbility(
            Zone.BATTLEFIELD, new DamageTargetEffect(3), new TapSourceCost());
    ability.addCost(new SacrificeTargetCost(new TargetControlledPermanent(filter)));
    ability.addTarget(new TargetCreaturePermanent());
    this.addAbility(ability);

    // {tap}, Sacrifice a Forest: Choose a player. That player adds {G}{G}{G} to his or her mana
    // pool.
    Ability ability2 =
        new SimpleManaAbility(
            Zone.BATTLEFIELD,
            new AddManaToManaPoolTargetControllerEffect(Mana.GreenMana(3), "chosen player"),
            new TapSourceCost());
    ability2.addCost(new SacrificeTargetCost(new TargetControlledPermanent(filter2)));
    ability2.addTarget(new TargetPlayer(1, 1, true));
    this.addAbility(ability2);
  }
示例#7
0
 @Override
 public boolean apply(Game game, Ability source, Ability abilityToModify) {
   SpellAbility spellAbility = (SpellAbility) abilityToModify;
   Mana mana = spellAbility.getManaCostsToPay().getMana();
   if (mana.getColorless() > 0) {
     int count = new DevotionCount(ColoredManaSymbol.B).calculate(game, source);
     int newCount = mana.getColorless() - count;
     if (newCount < 0) {
       newCount = 0;
     }
     mana.setColorless(newCount);
     spellAbility.getManaCostsToPay().load(mana.toString());
     return true;
   }
   return false;
 }
 private Mana getManaTypes(Game game, Ability source) {
   List<Permanent> lands =
       game.getBattlefield().getActivePermanents(filter, source.getControllerId(), game);
   Mana types = new Mana();
   for (Permanent land : lands) {
     Abilities<ManaAbility> mana = land.getAbilities().getManaAbilities(Zone.BATTLEFIELD);
     for (ManaAbility ability : mana) {
       if (!ability.equals(source) && ability.definesMana()) {
         for (Mana netMana : ability.getNetMana(game)) {
           types.add(netMana);
         }
       }
     }
   }
   return types;
 }
示例#9
0
  @Override
  public boolean apply(Game game, Ability source) {
    Player player = game.getPlayer(source.getControllerId());
    if (player != null) {
      int x =
          game.getBattlefield().count(filter, source.getSourceId(), source.getControllerId(), game);

      Mana mana = new Mana();
      for (int i = 0; i < x; i++) {
        ChoiceColor choiceColor = new ChoiceColor();
        while (!player.choose(Outcome.Benefit, choiceColor, game)) {
          if (!player.isInGame()) {
            return false;
          }
        }

        if (choiceColor.getColor().isBlack()) {
          mana.addBlack();
        } else if (choiceColor.getColor().isBlue()) {
          mana.addBlue();
        } else if (choiceColor.getColor().isRed()) {
          mana.addRed();
        } else if (choiceColor.getColor().isGreen()) {
          mana.addGreen();
        } else if (choiceColor.getColor().isWhite()) {
          mana.addWhite();
        }
      }

      player.getManaPool().addMana(mana, game, source);
      return true;
    }
    return false;
  }
示例#10
0
 @Override
 public boolean testPay(Mana testMana) {
   switch (mana) {
     case B:
       if (testMana.getBlack() > 0) {
         return true;
       }
     case U:
       if (testMana.getBlue() > 0) {
         return true;
       }
     case R:
       if (testMana.getRed() > 0) {
         return true;
       }
     case W:
       if (testMana.getWhite() > 0) {
         return true;
       }
     case G:
       if (testMana.getGreen() > 0) {
         return true;
       }
   }
   return testMana.count() > 0;
 }
示例#11
0
  public ApprenticeWizard(UUID ownerId, CardSetInfo setInfo) {
    super(ownerId, setInfo, new CardType[] {CardType.CREATURE}, "{1}{U}{U}");
    this.subtype.add("Human");
    this.subtype.add("Wizard");
    this.power = new MageInt(0);
    this.toughness = new MageInt(1);

    // {U}, {tap}: Add {C}{C}{C} to your mana pool.
    Ability ability =
        new SimpleManaAbility(Zone.BATTLEFIELD, Mana.ColorlessMana(3), new ManaCostsImpl("{U}"));
    ability.addCost(new TapSourceCost());
    this.addAbility(ability);
  }
示例#12
0
  public SunkenRuins(UUID ownerId) {
    super(ownerId, 280, "Sunken Ruins", Rarity.RARE, new CardType[] {CardType.LAND}, "");
    this.expansionSetCode = "SHM";

    // {tap}: Add {C} to your mana pool.
    this.addAbility(new ColorlessManaAbility());
    // {UB}, {tap}: Add {U}{U}, {U}{B}, or {B}{B} to your mana pool.
    SimpleManaAbility ability =
        new SimpleManaAbility(Zone.BATTLEFIELD, Mana.BlueMana(2), new ManaCostsImpl("{U/B}"));
    ability.addCost(new TapSourceCost());
    this.addAbility(ability);

    ability =
        new SimpleManaAbility(
            Zone.BATTLEFIELD, new Mana(0, 0, 1, 0, 1, 0, 0), new ManaCostsImpl("{U/B}"));
    ability.addCost(new TapSourceCost());
    this.addAbility(ability);

    ability =
        new SimpleManaAbility(Zone.BATTLEFIELD, Mana.BlackMana(2), new ManaCostsImpl("{U/B}"));
    ability.addCost(new TapSourceCost());
    this.addAbility(ability);
  }
示例#13
0
  public UrzasPowerPlant(UUID ownerId, CardSetInfo setInfo) {
    super(ownerId, setInfo, new CardType[] {CardType.LAND}, "");
    this.subtype.add("Urza's");
    this.subtype.add("Power-Plant");

    // {T}: Add {C} to your mana pool. If you control an Urza's Mine and an Urza's Tower, add {C}{C}
    // to your mana pool instead.
    Ability urzaManaAbility =
        new DynamicManaAbility(
            Mana.ColorlessMana(1),
            new UrzaTerrainValue(2),
            "Add {C} to your mana pool. If you control an Urza's Mine and an Urza's Tower, add {C}{C} to your mana pool instead");
    this.addAbility(urzaManaAbility);
  }
示例#14
0
 @Override
 public boolean checkTrigger(GameEvent event, Game game) {
   if (((DamagedEvent) event).isCombatDamage()) {
     if (event.getSourceId().equals(getSourceId())) {
       this.getEffects().clear();
       Effect effect =
           new AddManaToManaPoolTargetControllerEffect(
               Mana.GreenMana(event.getAmount()), "that player", true);
       effect.setTargetPointer(new FixedTarget(getControllerId()));
       effect.setText(
           "add that much {G} to your mana pool. Until end of turn, this mana doesn't empty from your mana pool as steps and phases end");
       this.addEffect(effect);
       return true;
     }
   }
   return false;
 }
示例#15
0
 @Override
 public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
   for (Permanent land :
       game.getState()
           .getBattlefield()
           .getAllActivePermanents(new FilterLandPermanent(), source.getControllerId(), game)) {
     if (land != null) {
       switch (layer) {
         case AbilityAddingRemovingEffects_6:
           Mana mana = new Mana();
           for (Ability ability : land.getAbilities()) {
             if (ability instanceof BasicManaAbility) {
               for (Mana netMana : ((BasicManaAbility) ability).getNetMana(game)) {
                 mana.add(netMana);
               }
             }
           }
           if (mana.getGreen() == 0 && landTypes.contains("Forest")) {
             land.addAbility(new GreenManaAbility(), source.getSourceId(), game);
           }
           if (mana.getRed() == 0 && landTypes.contains("Mountain")) {
             land.addAbility(new RedManaAbility(), source.getSourceId(), game);
           }
           if (mana.getBlue() == 0 && landTypes.contains("Island")) {
             land.addAbility(new BlueManaAbility(), source.getSourceId(), game);
           }
           if (mana.getWhite() == 0 && landTypes.contains("Plains")) {
             land.addAbility(new WhiteManaAbility(), source.getSourceId(), game);
           }
           if (mana.getBlack() == 0 && landTypes.contains("Swamp")) {
             land.addAbility(new BlackManaAbility(), source.getSourceId(), game);
           }
           break;
         case TypeChangingEffects_4:
           for (String subtype : landTypes) {
             if (!land.getSubtype().contains(subtype)) {
               land.getSubtype().add(subtype);
             }
           }
           break;
       }
     }
   }
   return true;
 }
示例#16
0
  public RemoteFarm(UUID ownerId) {
    super(ownerId, 323, "Remote Farm", Rarity.COMMON, new CardType[] {CardType.LAND}, "");
    this.expansionSetCode = "MMQ";

    // Remote Farm enters the battlefield tapped with two depletion counters on it.
    this.addAbility(new EntersBattlefieldTappedAbility());
    this.addAbility(
        new EntersBattlefieldAbility(
            new AddCountersSourceEffect(CounterType.DEPLETION.createInstance(2))));
    // {tap}, Remove a depletion counter from Remote Farm: Add {W}{W} to your mana pool. If there
    // are no depletion counters on Remote Farm, sacrifice it.
    Ability ability =
        new SimpleManaAbility(Zone.BATTLEFIELD, Mana.WhiteMana(2), new TapSourceCost());
    ability.addCost(new RemoveCountersSourceCost(CounterType.DEPLETION.createInstance(1)));
    ability.addEffect(
        new ConditionalOneShotEffect(
            new SacrificeSourceEffect(),
            new SourceHasCounterCondition(CounterType.DEPLETION, 0, 0),
            "If there are no depletion counters on {this}, sacrifice it"));
    this.addAbility(ability);
  }
示例#17
0
 public PhyrexianManaCost(ColoredManaSymbol mana) {
   super(mana);
   options.add(Mana.ColorlessMana(0));
 }
示例#18
0
 public SolRingAbility() {
   super(new BasicManaEffect(Mana.ColorlessMana(2)));
   this.netMana.add(new Mana(0, 0, 0, 0, 0, 0, 0, 2));
 }
示例#19
0
 public MyrConditionalMana() {
   super(Mana.ColorlessMana(2));
   staticText = "Spend this mana only to cast Myr spells or activate abilities of Myr";
   addCondition(new MyrManaCondition());
 }
示例#20
0
  @Override
  public boolean activate(Game game, boolean noMana) {
    Player controller = game.getPlayer(this.getControllerId());
    if (controller == null) {
      return false;
    }
    game.applyEffects();

    /* 20130201 - 601.2b
     * If the spell is modal the player announces the mode choice (see rule 700.2).
     */
    if (!getModes().choose(game, this)) {
      return false;
    }
    if (controller.isTestMode()) {
      if (!controller.addTargets(this, game)) {
        return false;
      }
    }

    getSourceObject(game);

    /* 20130201 - 601.2b
     * If the player wishes to splice any cards onto the spell (see rule 702.45), he
     * or she reveals those cards in his or her hand.
     */
    if (this.abilityType.equals(AbilityType.SPELL)) {
      game.getContinuousEffects().applySpliceEffects(this, game);
    }

    // if ability can be cast for no mana, clear the mana costs now, because additional mana costs
    // must be paid.
    // For Flashback ability can be set X before, so the X costs have to be restored for the
    // flashbacked ability
    if (noMana) {
      if (this.getManaCostsToPay().getVariableCosts().size() > 0) {
        int xValue = this.getManaCostsToPay().getX();
        this.getManaCostsToPay().clear();
        VariableManaCost xCosts = new VariableManaCost();
        xCosts.setAmount(xValue);
        this.getManaCostsToPay().add(xCosts);
      } else {
        this.getManaCostsToPay().clear();
      }
    }
    // 20130201 - 601.2b
    // If the spell has alternative or additional costs that will be paid as it's being cast such
    // as buyback, kicker, or convoke costs (see rules 117.8 and 117.9), the player announces his
    // or her intentions to pay any or all of those costs (see rule 601.2e).
    // A player can't apply two alternative methods of casting or two alternative costs to a single
    // spell.
    if (!activateAlternateOrAdditionalCosts(sourceObject, noMana, controller, game)) {
      if (getAbilityType().equals(AbilityType.SPELL)
          && ((SpellAbility) this)
              .getSpellAbilityType()
              .equals(SpellAbilityType.FACE_DOWN_CREATURE)) {
        return false;
      }
    }

    // 20121001 - 601.2b
    // If the spell has a variable cost that will be paid as it's being cast (such as an {X} in
    // its mana cost; see rule 107.3), the player announces the value of that variable.
    VariableManaCost variableManaCost = handleManaXCosts(game, noMana, controller);
    String announceString = handleOtherXCosts(game, controller);
    // For effects from cards like Void Winnower x costs have to be set
    if (this.getAbilityType().equals(AbilityType.SPELL)
        && game.replaceEvent(
            GameEvent.getEvent(
                GameEvent.EventType.CAST_SPELL_LATE, getId(), getSourceId(), getControllerId()),
            this)) {
      return false;
    }
    for (Mode mode : this.getModes().getSelectedModes()) {
      this.getModes().setActiveMode(mode);
      // 20121001 - 601.2c
      // 601.2c The player announces his or her choice of an appropriate player, object, or zone for
      // each target the spell requires. A spell may require some targets only if an alternative or
      // additional cost (such as a buyback or kicker cost), or a particular mode, was chosen for
      // it;
      // otherwise, the spell is cast as though it did not require those targets. If the spell has a
      // variable number of targets, the player announces how many targets he or she will choose
      // before
      // he or she announces those targets. The same target can't be chosen multiple times for any
      // one
      // instance of the word "target" on the spell. However, if the spell uses the word "target" in
      // multiple places, the same object, player, or zone can be chosen once for each instance of
      // the
      // word "target" (as long as it fits the targeting criteria). If any effects say that an
      // object
      // or player must be chosen as a target, the player chooses targets so that he or she obeys
      // the
      // maximum possible number of such effects without violating any rules or effects that say
      // that
      // an object or player can't be chosen as a target. The chosen players, objects, and/or zones
      // each become a target of that spell. (Any abilities that trigger when those players,
      // objects,
      // and/or zones become the target of a spell trigger at this point; they'll wait to be put on
      // the stack until the spell has finished being cast.)

      if (sourceObject != null
          && !this.getAbilityType()
              .equals(AbilityType.TRIGGERED)) { // triggered abilities check this already in
        // playerImpl.triggerAbility
        sourceObject.adjustTargets(this, game);
      }
      if (mode.getTargets().size() > 0
          && mode.getTargets()
                  .chooseTargets(
                      getEffects().get(0).getOutcome(), this.controllerId, this, noMana, game)
              == false) {
        if ((variableManaCost != null || announceString != null) && !game.isSimulation()) {
          game.informPlayer(
              controller,
              (sourceObject != null ? sourceObject.getIdName() : "")
                  + ": no valid targets with this value of X");
        }
        return false; // when activation of ability is canceled during target selection
      }
    } // end modes

    // TODO: Handle optionalCosts at the same time as already OptionalAdditionalSourceCosts are
    // handled.
    for (Cost cost : optionalCosts) {
      if (cost instanceof ManaCost) {
        cost.clearPaid();
        if (controller.chooseUse(
            Outcome.Benefit, "Pay optional cost " + cost.getText() + "?", this, game)) {
          manaCostsToPay.add((ManaCost) cost);
        }
      }
    }
    // 20100716 - 601.2e
    if (sourceObject != null) {
      sourceObject.adjustCosts(this, game);
      if (sourceObject instanceof Card) {
        for (Ability ability : ((Card) sourceObject).getAbilities(game)) {
          if (ability instanceof AdjustingSourceCosts) {
            ((AdjustingSourceCosts) ability).adjustCosts(this, game);
          }
        }
      } else {
        for (Ability ability : sourceObject.getAbilities()) {
          if (ability instanceof AdjustingSourceCosts) {
            ((AdjustingSourceCosts) ability).adjustCosts(this, game);
          }
        }
      }
    }

    // this is a hack to prevent mana abilities with mana costs from causing endless loops - pay
    // other costs first
    if (this instanceof ManaAbility
        && !costs.pay(this, game, sourceId, controllerId, noMana, null)) {
      logger.debug("activate mana ability failed - non mana costs");
      return false;
    }

    // 20101001 - 601.2e
    if (costModificationActive) {
      game.getContinuousEffects().costModification(this, game);
    } else {
      costModificationActive = true;
    }

    UUID activatorId = controllerId;
    if ((this instanceof ActivatedAbilityImpl)
        && ((ActivatedAbilityImpl) this).getActivatorId() != null) {
      activatorId = ((ActivatedAbilityImpl) this).getActivatorId();
    }

    // 20100716 - 601.2f  (noMana is not used here, because mana costs were cleared for this ability
    // before adding additional costs and applying cost modification effects)
    if (!manaCostsToPay.pay(this, game, sourceId, activatorId, false, null)) {
      return false; // cancel during mana payment
    }

    // 20100716 - 601.2g
    if (!costs.pay(this, game, sourceId, activatorId, noMana, null)) {
      logger.debug("activate failed - non mana costs");
      return false;
    }
    if (!game.isSimulation()) {
      // inform about x costs now, so canceled announcements are not shown in the log
      if (announceString != null) {
        game.informPlayers(announceString);
      }
      if (variableManaCost != null) {
        int xValue = getManaCostsToPay().getX();
        game.informPlayers(
            controller.getLogName()
                + " announces a value of "
                + xValue
                + " for "
                + variableManaCost.getText());
      }
    }
    activated = true;
    // fire if tapped for mana (may only fire now because else costs of ability itself can be payed
    // with mana of abilities that trigger for that event
    if (this.getAbilityType().equals(AbilityType.MANA)) {
      for (Cost cost : costs) {
        if (cost instanceof TapSourceCost) {
          Mana mana = null;
          Effect effect = getEffects().get(0);
          if (effect instanceof DynamicManaEffect) {
            mana = ((DynamicManaEffect) effect).getMana(game, this);
          } else if (effect instanceof BasicManaEffect) {
            mana = ((BasicManaEffect) effect).getMana(game, this);
          }
          if (mana != null
              && mana.getAny()
                  == 0) { // if mana == null or Any > 0 the event has to be fired in the mana effect
            // to know which mana was produced
            ManaEvent event =
                new ManaEvent(
                    GameEvent.EventType.TAPPED_FOR_MANA, sourceId, sourceId, controllerId, mana);
            if (!game.replaceEvent(event)) {
              game.fireEvent(event);
            }
          }
          break;
        }
      }
    }
    return true;
  }
示例#21
0
 public Mana computeMana(boolean netMana, Game game, Ability source) {
   this.computedMana.clear();
   int count = amount.calculate(game, source, this);
   if (mana.getBlack() > 0) {
     computedMana.setBlack(count);
   } else if (mana.getBlue() > 0) {
     computedMana.setBlue(count);
   } else if (mana.getGreen() > 0) {
     computedMana.setGreen(count);
   } else if (mana.getRed() > 0) {
     computedMana.setRed(count);
   } else if (mana.getWhite() > 0) {
     computedMana.setWhite(count);
   } else if (mana.getAny() > 0) {
     if (netMana) {
       computedMana.setAny(count);
     } else {
       Player controller = game.getPlayer(source.getControllerId());
       if (controller != null) {
         for (int i = 0; i < count; i++) {
           ChoiceColor choiceColor = new ChoiceColor();
           while (!controller.choose(Outcome.Benefit, choiceColor, game)) {
             if (!controller.isInGame()) {
               return computedMana;
             }
           }
           if (choiceColor.getColor().isBlack()) {
             computedMana.addBlack();
           } else if (choiceColor.getColor().isBlue()) {
             computedMana.addBlue();
           } else if (choiceColor.getColor().isRed()) {
             computedMana.addRed();
           } else if (choiceColor.getColor().isGreen()) {
             computedMana.addGreen();
           } else if (choiceColor.getColor().isWhite()) {
             computedMana.addWhite();
           }
         }
       }
     }
   } else {
     computedMana.setColorless(count);
   }
   return computedMana;
 }
示例#22
0
 @Override
 public boolean apply(Game game, Ability source) {
   Player you = game.getPlayer(source.getControllerId());
   if (you != null) {
     Mana mana = new Mana();
     for (Permanent permanent : game.getBattlefield().getAllActivePermanents(you.getId())) {
       if (mana.getBlack() == 0 && permanent.getColor().isBlack()) {
         mana.addBlack();
       }
       if (mana.getBlue() == 0 && permanent.getColor().isBlue()) {
         mana.addBlue();
       }
       if (mana.getRed() == 0 && permanent.getColor().isRed()) {
         mana.addRed();
       }
       if (mana.getGreen() == 0 && permanent.getColor().isGreen()) {
         mana.addGreen();
       }
       if (mana.getWhite() == 0 && permanent.getColor().isWhite()) {
         mana.addWhite();
       }
     }
     you.getManaPool().addMana(mana, game, source);
     return true;
   }
   return false;
 }
 @Override
 public boolean apply(Game game, Ability source) {
   Mana types = getManaTypes(game, source);
   Choice choice = new ChoiceImpl(true);
   choice.setMessage("Pick a mana color");
   if (types.getBlack() > 0) {
     choice.getChoices().add("Black");
   }
   if (types.getRed() > 0) {
     choice.getChoices().add("Red");
   }
   if (types.getBlue() > 0) {
     choice.getChoices().add("Blue");
   }
   if (types.getGreen() > 0) {
     choice.getChoices().add("Green");
   }
   if (types.getWhite() > 0) {
     choice.getChoices().add("White");
   }
   if (types.getAny() > 0) {
     choice.getChoices().add("Black");
     choice.getChoices().add("Red");
     choice.getChoices().add("Blue");
     choice.getChoices().add("Green");
     choice.getChoices().add("White");
   }
   if (choice.getChoices().size() > 0) {
     Player player = game.getPlayer(source.getControllerId());
     if (choice.getChoices().size() == 1) {
       choice.setChoice(choice.getChoices().iterator().next());
     } else {
       player.choose(outcome, choice, game);
     }
     if (choice.getChoice() != null) {
       Mana mana = new Mana();
       switch (choice.getChoice()) {
         case "Black":
           mana.setBlack(1);
           break;
         case "Blue":
           mana.setBlue(1);
           break;
         case "Red":
           mana.setRed(1);
           break;
         case "Green":
           mana.setGreen(1);
           break;
         case "White":
           mana.setWhite(1);
           break;
       }
       checkToFirePossibleEvents(mana, game, source);
       player.getManaPool().addMana(mana, game, source);
     }
   }
   return true;
 }