use of mage.abilities.costs.common.RemoveAllCountersSourceCost in project mage by magefree.
the class SageOfHoursEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player != null) {
int countersRemoved = 0;
for (Cost cost : source.getCosts()) {
if (cost instanceof RemoveAllCountersSourceCost) {
countersRemoved = ((RemoveAllCountersSourceCost) cost).getRemovedCounters();
}
}
int turns = countersRemoved / 5;
for (int i = 0; i < turns; i++) {
game.getState().getTurnMods().add(new TurnMod(player.getId(), false));
}
game.informPlayers("Removed " + countersRemoved + " +1/+1 counters: " + player.getLogName() + " takes " + CardUtil.numberToText(turns, "an") + (turns > 1 ? " extra turns " : " extra turn ") + "after this one");
return true;
}
return false;
}
use of mage.abilities.costs.common.RemoveAllCountersSourceCost in project mage by magefree.
the class TortureChamberEffect2 method apply.
@Override
public boolean apply(Game game, Ability source) {
int countersRemoved = 0;
for (Cost cost : source.getCosts()) {
if (cost instanceof RemoveAllCountersSourceCost) {
countersRemoved = ((RemoveAllCountersSourceCost) cost).getRemovedCounters();
}
}
Permanent permanent = game.getPermanent(source.getFirstTarget());
if (permanent != null) {
permanent.damage(countersRemoved, source.getSourceId(), source, game, false, true);
return true;
}
return false;
}
use of mage.abilities.costs.common.RemoveAllCountersSourceCost in project mage by magefree.
the class EssenceBottleEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
int countersRemoved = 0;
for (Cost cost : source.getCosts()) {
if (cost instanceof RemoveAllCountersSourceCost) {
countersRemoved = ((RemoveAllCountersSourceCost) cost).getRemovedCounters();
}
}
Player player = game.getPlayer(source.getControllerId());
if (player != null) {
player.gainLife(countersRemoved * 2, game, source);
return true;
}
return false;
}
use of mage.abilities.costs.common.RemoveAllCountersSourceCost in project mage by magefree.
the class JarOfEyeballsEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller == null) {
return false;
}
int countersRemoved = 0;
for (Cost cost : source.getCosts()) {
if (cost instanceof RemoveAllCountersSourceCost) {
countersRemoved = ((RemoveAllCountersSourceCost) cost).getRemovedCounters();
}
}
Cards cards = new CardsImpl(controller.getLibrary().getTopCards(game, countersRemoved));
controller.lookAtCards(source, null, cards, game);
TargetCard target = new TargetCard(Zone.LIBRARY, new FilterCard("card to put into your hand"));
if (controller.choose(Outcome.DrawCard, cards, target, game)) {
Cards targetCards = new CardsImpl(target.getTargets());
controller.moveCards(targetCards, Zone.HAND, source, game);
cards.removeAll(targetCards);
}
controller.putCardsOnBottomOfLibrary(cards, game, source, true);
return true;
}
Aggregations