use of mage.abilities.costs.mana.ManaCostsImpl in project mage by magefree.
the class ConditionalAsThoughTest method test_TargetCardInLibrary_CantUseAsAbilityTarget.
@Test(expected = IllegalArgumentException.class)
public void test_TargetCardInLibrary_CantUseAsAbilityTarget() {
Ability ability = new SimpleActivatedAbility(Zone.ALL, new InfoEffect("test"), new ManaCostsImpl("{R}"));
ability.addTarget(new TargetCardInLibrary());
}
use of mage.abilities.costs.mana.ManaCostsImpl in project mage by magefree.
the class ProwlAbility method addProwlCost.
public final AlternativeCost2 addProwlCost(String manaString) {
AlternativeCost2 prowlCost = new AlternativeCost2Impl(PROWL_KEYWORD, reminderText, new ManaCostsImpl(manaString));
prowlCosts.add(prowlCost);
return prowlCost;
}
use of mage.abilities.costs.mana.ManaCostsImpl in project mage by magefree.
the class ProwlAbility method askToActivateAlternativeCosts.
@Override
public boolean askToActivateAlternativeCosts(Ability ability, Game game) {
if (ability instanceof SpellAbility) {
Player player = game.getPlayer(ability.getControllerId());
if (player == null) {
return false;
}
if (ProwlCondition.instance.apply(game, ability)) {
this.resetProwl();
for (AlternativeCost2 prowlCost : prowlCosts) {
if (prowlCost.canPay(ability, this, ability.getControllerId(), game) && player.chooseUse(Outcome.Benefit, "Cast for " + PROWL_KEYWORD + " cost " + prowlCost.getText(true) + " ?", ability, game)) {
prowlCost.activate();
ability.getManaCostsToPay().clear();
ability.getCosts().clear();
for (Iterator it = ((Costs) prowlCost).iterator(); it.hasNext(); ) {
Cost cost = (Cost) it.next();
if (cost instanceof ManaCostsImpl) {
ability.getManaCostsToPay().add((ManaCostsImpl) cost.copy());
} else {
ability.getCosts().add(cost.copy());
}
}
}
}
}
}
return isActivated(ability, game);
}
use of mage.abilities.costs.mana.ManaCostsImpl in project mage by magefree.
the class KickerAbility method addKickerCost.
public final OptionalAdditionalCost addKickerCost(String manaString) {
OptionalAdditionalCost newCost = new OptionalAdditionalCostImpl(keywordText, reminderText, new ManaCostsImpl(manaString));
addKickerCostAndSetup(newCost);
return newCost;
}
use of mage.abilities.costs.mana.ManaCostsImpl in project mage by magefree.
the class CemeteryPucaEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Permanent copyToCreature = game.getPermanent(source.getSourceId());
if (copyToCreature != null) {
Permanent copyFromCreature = getTargetPointer().getFirstTargetPermanentOrLKI(game, source);
if (copyFromCreature != null) {
game.copyPermanent(Duration.WhileOnBattlefield, copyFromCreature, copyToCreature.getId(), source, new EmptyCopyApplier());
ContinuousEffect effect = new GainAbilityTargetEffect(new DiesCreatureTriggeredAbility(new DoIfCostPaid(new CemeteryPucaEffect(), new ManaCostsImpl("{1}")), false, StaticFilters.FILTER_PERMANENT_A_CREATURE, true), Duration.WhileOnBattlefield);
effect.setTargetPointer(new FixedTarget(copyToCreature.getId(), game));
game.addEffect(effect, source);
return true;
}
}
return false;
}
Aggregations