Package mage.abilities.mana

Examples of mage.abilities.mana.ManaOptions


  }

  protected ManaOptions getManaAvailable(Game game) {
    List<Permanent> manaPerms = this.getAvailableManaProducers(game);

    ManaOptions available = new ManaOptions();
    for (Permanent perm: manaPerms) {
      available.addMana(perm.getAbilities().getManaAbilities(Zone.BATTLEFIELD), game);
    }
    return available;
  }
View Full Code Here


    return result;
  }

  protected boolean canPlay(ActivatedAbility ability, ManaOptions available, Game game) {
    if (!(ability instanceof ManaAbility) && ability.canActivate(playerId, game)) {
      ManaOptions abilityOptions = ability.getManaCosts().getOptions();
      if (abilityOptions.size() == 0) {
        return true;
      }
      else {
        for (Mana mana: abilityOptions) {
          for (Mana avail: available) {
View Full Code Here

    return sbText.toString();
  }

  @Override
  public ManaOptions getOptions() {
    ManaOptions options = new ManaOptions();
    for (ManaCost cost: this) {
      options.addMana(cost.getOptions());
    }
    return options;
  }
View Full Code Here

  @Override
  public abstract T copy();

  public ManaCostImpl() {
    payment = new Mana();
    options = new ManaOptions();
  }
View Full Code Here

    return list;
  }

  protected void simulateOptions(Game game, Ability previousActions) {
    allActions.add(previousActions);
    ManaOptions available = getManaAvailable(game);
    available.addMana(manaPool.getMana());
    List<Ability> playables = game.getPlayer(playerId).getPlayable(game, filter, available, isSimulatedPlayer);
    for (Ability ability: playables) {
      List<Ability> options = game.getPlayer(playerId).getPlayableOptions(ability, game);
      if (options.size() == 0) {
        allActions.add(ability);
View Full Code Here

    playableInstant.clear();
    playableNonInstant.clear();
    unplayable.clear();
    playableAbilities.clear();
    Set<Card> nonLands = hand.getCards(new FilterNonlandCard(), game);
    ManaOptions available = getManaAvailable(game);
    available.addMana(manaPool.getMana());

    for (Card card: nonLands) {
      ManaOptions options = card.getManaCost().getOptions();
      if (card.getManaCost().getVariableCosts().size() > 0) {
        //don't use variable mana costs unless there is at least 3 extra mana for X
        for (Mana option: options) {
          option.add(Mana.ColorlessMana(3));
        }
      }
      for (Mana mana: options) {
        for (Mana avail: available) {
          if (mana.enough(avail)) {
            if (card.getCardType().contains(CardType.INSTANT))
              playableInstant.add(card);
            else
              playableNonInstant.add(card);
          }
          else {
            if (!playableInstant.contains(card) && !playableNonInstant.contains(card))
              unplayable.put(mana.needed(avail), card);
          }
        }
      }
    }
    for (Permanent permanent: game.getBattlefield().getAllActivePermanents(playerId)) {
      for (ActivatedAbility ability: permanent.getAbilities().getActivatedAbilities(Zone.BATTLEFIELD)) {
        if (!(ability instanceof ManaAbility) && ability.canActivate(playerId, game)) {
          if (ability instanceof EquipAbility && permanent.getAttachedTo() != null)
            continue;
          ManaOptions abilityOptions = ability.getManaCosts().getOptions();
          if (ability.getManaCosts().getVariableCosts().size() > 0) {
            //don't use variable mana costs unless there is at least 3 extra mana for X
            for (Mana option: abilityOptions) {
              option.add(Mana.ColorlessMana(3));
            }
          }
          if (abilityOptions.size() == 0) {
            playableAbilities.add(ability);
          }
          else {
            for (Mana mana: abilityOptions) {
              for (Mana avail: available) {
                if (mana.enough(avail)) {
                  playableAbilities.add(ability);
                }
              }
            }
          }
        }
      }
    }
    for (Card card: graveyard.getCards(game)) {
      for (ActivatedAbility ability: card.getAbilities().getActivatedAbilities(Zone.GRAVEYARD)) {
        if (ability.canActivate(playerId, game)) {
          ManaOptions abilityOptions = ability.getManaCosts().getOptions();
          if (abilityOptions.size() == 0) {
            playableAbilities.add(ability);
          }
          else {
            for (Mana mana: abilityOptions) {
              for (Mana avail: available) {
View Full Code Here

        List<Permanent> blockers = game.getBattlefield().getAllActivePermanents(blockFilter, playerId, game);
        return blockers;
    }

    protected ManaOptions getManaAvailable(Game game) {
        ManaOptions available = new ManaOptions();

        List<Permanent> manaPerms = this.getAvailableManaProducers(game);
        for (Permanent perm: manaPerms) {
            available.addMana(perm.getAbilities().getAvailableManaAbilities(Zone.BATTLEFIELD, game), game);
        }

        List<Permanent> manaPermsWithCost = this.getAvailableManaProducersWithCost(game);
        for (Permanent perm: manaPermsWithCost) {
            available.addManaWithCost(perm.getAbilities().getAvailableManaAbilities(Zone.BATTLEFIELD, game), game);
        }
        return available;
    }
View Full Code Here

                        }
                    }
                }
            }

            ManaOptions abilityOptions = copy.getManaCostsToPay().getOptions();
            if (abilityOptions.size() == 0) {
                return true;
            }
            else {
                for (Mana mana: abilityOptions) {
                    for (Mana avail: available) {
View Full Code Here

    public List<Ability> getPlayable(Game game, boolean hidden) {
        List<Ability> playable = new ArrayList<>();

        if (!shouldSkipGettingPlayable(game)) {

            ManaOptions availableMana = getManaAvailable(game);
            availableMana.addMana(manaPool.getMana());

            if (hidden) {
                for (Card card : hand.getUniqueCards(game)) {
                    for (Ability ability : card.getAbilities().getPlayableAbilities(Zone.HAND)) { // gets this activated ability from hand? (Morph?)
                        if (ability instanceof ActivatedAbility) {
View Full Code Here

            if (game.getPhase() != null && PhaseStep.CLEANUP.equals(game.getPhase().getStep().getType())) {
                for (Card card: hand.getCards(game)) {
                    playable.add(card.getId());
                }
            } else {
                ManaOptions available = getManaAvailable(game);
                available.addMana(manaPool.getMana());

                for (Card card : hand.getCards(game)) {
                    for (ActivatedAbility ability : card.getAbilities().getPlayableAbilities(Zone.HAND)) {
                        if (ability instanceof PlayLandAbility) {
                            if (game.getContinuousEffects().preventedByRuleModification(GameEvent.getEvent(GameEvent.EventType.PLAY_LAND, ability.getSourceId(), ability.getSourceId(), playerId), ability, game, true)) {
View Full Code Here

TOP

Related Classes of mage.abilities.mana.ManaOptions

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.