Search in sources :

Example 1 with RemoveVariableCountersTargetCost

use of mage.abilities.costs.common.RemoveVariableCountersTargetCost in project mage by magefree.

the class OozeFluxCreateTokenEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    int xValue = 0;
    for (Cost cost : source.getCosts()) {
        if (cost instanceof RemoveVariableCountersTargetCost) {
            xValue = ((RemoveVariableCountersTargetCost) cost).getAmount();
            break;
        }
    }
    Token tokenCopy = token.copy();
    tokenCopy.getAbilities().newId();
    tokenCopy.getPower().modifyBaseValue(xValue);
    tokenCopy.getToughness().modifyBaseValue(xValue);
    tokenCopy.putOntoBattlefield(1, game, source, source.getControllerId());
    return true;
}
Also used : RemoveVariableCountersTargetCost(mage.abilities.costs.common.RemoveVariableCountersTargetCost) Token(mage.game.permanent.token.Token) OozeToken(mage.game.permanent.token.OozeToken) Cost(mage.abilities.costs.Cost) RemoveVariableCountersTargetCost(mage.abilities.costs.common.RemoveVariableCountersTargetCost)

Example 2 with RemoveVariableCountersTargetCost

use of mage.abilities.costs.common.RemoveVariableCountersTargetCost in project mage by magefree.

the class GallopingLizrogEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player player = game.getPlayer(source.getControllerId());
    if (player == null) {
        return false;
    }
    RemoveVariableCountersTargetCost variableCost = new RemoveVariableCountersTargetCost(StaticFilters.FILTER_CONTROLLED_CREATURE, CounterType.P1P1);
    int toPay = variableCost.announceXValue(source, game);
    Cost cost = variableCost.getFixedCostsFromAnnouncedValue(toPay);
    if (!cost.pay(source, game, source, source.getControllerId(), true)) {
        return false;
    }
    return new AddCountersSourceEffect(CounterType.P1P1.createInstance(2 * toPay)).apply(game, source);
}
Also used : AddCountersSourceEffect(mage.abilities.effects.common.counter.AddCountersSourceEffect) Player(mage.players.Player) RemoveVariableCountersTargetCost(mage.abilities.costs.common.RemoveVariableCountersTargetCost) Cost(mage.abilities.costs.Cost) RemoveVariableCountersTargetCost(mage.abilities.costs.common.RemoveVariableCountersTargetCost)

Aggregations

Cost (mage.abilities.costs.Cost)2 RemoveVariableCountersTargetCost (mage.abilities.costs.common.RemoveVariableCountersTargetCost)2 AddCountersSourceEffect (mage.abilities.effects.common.counter.AddCountersSourceEffect)1 OozeToken (mage.game.permanent.token.OozeToken)1 Token (mage.game.permanent.token.Token)1 Player (mage.players.Player)1