Package mage.abilities

Examples of mage.abilities.ActivatedAbility


    this.addAbility(new LandfallAbility(new AddCountersSourceEffect("quest", 1), true));
    Costs costs = new CostsImpl();
    costs.add(new RemoveCountersSourceCost("quest", 3));
    costs.add(new SacrificeSourceCost());
    ActivatedAbility ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new GainLifeEffect(8), costs);
    this.addAbility(ability);
  }
View Full Code Here


    }
  }

  protected void activateAbility(Map<UUID, ? extends ActivatedAbility> abilities, Game game) {
    if (abilities.size() == 1) {
      ActivatedAbility ability = abilities.values().iterator().next();
      if (ability.getTargets().size() != 0 || !(ability.getCosts().size() == 1 && ability.getCosts().get(0) instanceof SacrificeSourceCost)) {
        activateAbility(ability, game);
        return;
      }
    }
    game.fireGetChoiceEvent(playerId, name, abilities.values());
View Full Code Here

        return result;
    }

    protected boolean canPlay(ActivatedAbility ability, ManaOptions available, MageObject sourceObject, Game game) {
        if (!(ability instanceof ManaAbility)) {
            ActivatedAbility copy = ability.copy();    
            copy.setCheckPlayableMode(); // prevents from endless loops for asking player to use effects by checking this mode
            if (!copy.canActivate(playerId, game)) {
                return false;
            }
            game.getContinuousEffects().costModification(copy, game);

            Card card = game.getCard(ability.getSourceId());
            if (card != null) {
                for (Ability ability0 : card.getAbilities()) {
                    if (ability0 instanceof AdjustingSourceCosts) {
                        // A workaround for Issue#457
                        if (!(ability0 instanceof ConvokeAbility)) {
                            ((AdjustingSourceCosts) ability0).adjustCosts(copy, game);
                        }
                    }
                }
            }

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

        this.addAbility(new LandfallAbility(new AddCountersSourceEffect(CounterType.QUEST.createInstance()), true));
        Costs costs = new CostsImpl();
        costs.add(new RemoveCountersSourceCost(CounterType.QUEST.createInstance(3)));
        costs.add(new SacrificeSourceCost());
        ActivatedAbility ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new GainLifeEffect(8), costs);
        this.addAbility(ability);
    }
View Full Code Here

TOP

Related Classes of mage.abilities.ActivatedAbility

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.