[BOK] 5 cards with Remove X Counters

This commit is contained in:
LevelX2 2012-09-16 20:18:35 +02:00
parent 48874a770a
commit e0f9a07023
6 changed files with 766 additions and 0 deletions

View file

@ -0,0 +1,116 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.betrayersofkamigawa;
import java.util.UUID;
import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.Constants.Zone;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.common.SpellCastTriggeredAbility;
import mage.abilities.costs.Cost;
import mage.abilities.costs.common.RemoveVariableCountersSourceCost;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.continious.BoostSourceEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.cards.CardImpl;
import mage.counters.CounterType;
import mage.filter.common.FilterSpiritOrArcaneCard;
import mage.game.Game;
/**
* @author LevelX2
*/
public class BlademaneBaku extends CardImpl<BlademaneBaku> {
private final static FilterSpiritOrArcaneCard filter = new FilterSpiritOrArcaneCard();
public BlademaneBaku(UUID ownerId) {
super(ownerId, 95, "Blademane Baku", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{1}{R}");
this.expansionSetCode = "BOK";
this.subtype.add("Spirit");
this.color.setRed(true);
this.power = new MageInt(1);
this.toughness = new MageInt(1);
// Whenever you cast a Spirit or Arcane spell, you may put a ki counter on Skullmane Baku.
this.addAbility(new SpellCastTriggeredAbility(new AddCountersSourceEffect(CounterType.KI.createInstance()), filter, true));
// {1}, Remove X ki counters from Blademane Baku: For each counter removed, Blademane Baku gets +2/+0 until end of turn.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BlademaneBakuBoostEffect(), new GenericManaCost(1));
ability.addCost(new RemoveVariableCountersSourceCost(CounterType.KI.createInstance(1)));
this.addAbility(ability);
}
public BlademaneBaku(final BlademaneBaku card) {
super(card);
}
@Override
public BlademaneBaku copy() {
return new BlademaneBaku(this);
}
class BlademaneBakuBoostEffect extends OneShotEffect<BlademaneBakuBoostEffect> {
public BlademaneBakuBoostEffect() {
super(Constants.Outcome.UnboostCreature);
staticText = "For each counter removed, {this} gets +2/+0 until end of turn";
}
public BlademaneBakuBoostEffect(BlademaneBakuBoostEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
int numberToBoost = 0;
for (Cost cost : source.getCosts()) {
if (cost instanceof RemoveVariableCountersSourceCost) {
numberToBoost = ((RemoveVariableCountersSourceCost)cost).getAmount() * 2;
}
}
if (numberToBoost >= 0) {
game.addEffect(new BoostSourceEffect(numberToBoost, 0, Constants.Duration.EndOfTurn), source);
return true;
}
return false;
}
@Override
public BlademaneBakuBoostEffect copy() {
return new BlademaneBakuBoostEffect(this);
}
}
}

View file

@ -0,0 +1,149 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.betrayersofkamigawa;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.MageInt;
import mage.Mana;
import mage.abilities.Ability;
import mage.abilities.common.SpellCastTriggeredAbility;
import mage.abilities.costs.Cost;
import mage.abilities.costs.common.RemoveVariableCountersSourceCost;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.effects.common.ManaEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.abilities.mana.BasicManaAbility;
import mage.cards.CardImpl;
import mage.choices.ChoiceColor;
import mage.counters.CounterType;
import mage.filter.common.FilterSpiritOrArcaneCard;
import mage.game.Game;
import mage.players.Player;
/**
* @author LevelX2
*/
public class PetalmaneBaku extends CardImpl<PetalmaneBaku> {
private final static FilterSpiritOrArcaneCard filter = new FilterSpiritOrArcaneCard();
public PetalmaneBaku(UUID ownerId) {
super(ownerId, 139, "Petalmane Baku", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{1}{G}");
this.expansionSetCode = "BOK";
this.subtype.add("Spirit");
this.color.setGreen(true);
this.power = new MageInt(1);
this.toughness = new MageInt(2);
// Whenever you cast a Spirit or Arcane spell, you may put a ki counter on Skullmane Baku.
this.addAbility(new SpellCastTriggeredAbility(new AddCountersSourceEffect(CounterType.KI.createInstance()), filter, true));
// {1}, Remove X ki counters from Petalmane Baku: Add X mana of any one color to your mana pool.
Ability ability = new PetalmaneBakuManaAbility();
ability.addCost(new GenericManaCost(1));
ability.addCost(new RemoveVariableCountersSourceCost(CounterType.KI.createInstance(1)));
this.addAbility(ability);
}
public PetalmaneBaku(final PetalmaneBaku card) {
super(card);
}
@Override
public PetalmaneBaku copy() {
return new PetalmaneBaku(this);
}
private class PetalmaneBakuManaAbility extends BasicManaAbility<PetalmaneBakuManaAbility> {
PetalmaneBakuManaAbility() {
super(new PetalmaneBakuManaEffect());
this.addChoice(new ChoiceColor());
}
PetalmaneBakuManaAbility(final PetalmaneBakuManaAbility ability) {
super(ability);
}
@Override
public PetalmaneBakuManaAbility copy() {
return new PetalmaneBakuManaAbility(this);
}
}
private class PetalmaneBakuManaEffect extends ManaEffect<PetalmaneBakuManaEffect> {
PetalmaneBakuManaEffect() {
super();
staticText = "Add X mana of any one color to your mana pool";
}
PetalmaneBakuManaEffect(final PetalmaneBakuManaEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
ChoiceColor choice = (ChoiceColor) source.getChoices().get(0);
Player player = game.getPlayer(source.getControllerId());
if (player != null && choice != null) {
int numberOfMana = 0;
for (Cost cost : source.getCosts()) {
if (cost instanceof RemoveVariableCountersSourceCost) {
numberOfMana = ((RemoveVariableCountersSourceCost)cost).getAmount();
}
}
if (choice.getColor().isBlack()) {
player.getManaPool().addMana(new Mana(0, 0, 0, 0, numberOfMana, 0, 0), game, source);
return true;
} else if (choice.getColor().isBlue()) {
player.getManaPool().addMana(new Mana(0, 0, numberOfMana, 0, 0, 0, 0), game, source);
return true;
} else if (choice.getColor().isRed()) {
player.getManaPool().addMana(new Mana(numberOfMana, 0, 0, 0, 0, 0, 0), game, source);
return true;
} else if (choice.getColor().isGreen()) {
player.getManaPool().addMana(new Mana(0, numberOfMana, 0, 0, 0, 0, 0), game, source);
return true;
} else if (choice.getColor().isWhite()) {
player.getManaPool().addMana(new Mana(0, 0, 0, numberOfMana, 0, 0, 0), game, source);
return true;
}
}
return false;
}
@Override
public PetalmaneBakuManaEffect copy() {
return new PetalmaneBakuManaEffect(this);
}
}
}

View file

@ -0,0 +1,133 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.betrayersofkamigawa;
import java.util.UUID;
import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.Constants.Zone;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.common.SpellCastTriggeredAbility;
import mage.abilities.costs.Cost;
import mage.abilities.costs.common.RemoveVariableCountersSourceCost;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.cards.CardImpl;
import mage.counters.CounterType;
import mage.filter.Filter;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.common.FilterSpiritOrArcaneCard;
import mage.filter.predicate.mageobject.ConvertedManaCostPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.common.TargetCreaturePermanent;
/**
* @author LevelX2
*/
public class QuillmaneBaku extends CardImpl<QuillmaneBaku> {
private final static FilterSpiritOrArcaneCard filter = new FilterSpiritOrArcaneCard();
public QuillmaneBaku(UUID ownerId) {
super(ownerId, 48, "Quillmane Baku", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{4}{U}");
this.expansionSetCode = "BOK";
this.subtype.add("Spirit");
this.color.setBlue(true);
this.power = new MageInt(3);
this.toughness = new MageInt(3);
// Whenever you cast a Spirit or Arcane spell, you may put a ki counter on Skullmane Baku.
this.addAbility(new SpellCastTriggeredAbility(new AddCountersSourceEffect(CounterType.KI.createInstance()), filter, true));
// {1}, Tap, Remove X ki counters from Quillmane Baku: Return target creature with converted mana cost X or less to its owner's hand.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new QuillmaneBakuReturnEffect(), new GenericManaCost(1));
ability.addCost(new TapSourceCost());
ability.addCost(new RemoveVariableCountersSourceCost(CounterType.KI.createInstance(1)));
ability.addTarget(new TargetCreaturePermanent());
this.addAbility(ability);
}
public QuillmaneBaku(final QuillmaneBaku card) {
super(card);
}
@Override
public QuillmaneBaku copy() {
return new QuillmaneBaku(this);
}
class QuillmaneBakuReturnEffect extends OneShotEffect<QuillmaneBakuReturnEffect> {
public QuillmaneBakuReturnEffect() {
super(Constants.Outcome.ReturnToHand);
this.staticText = "Return target creature with converted mana cost X or less to its owner's hand";
}
public QuillmaneBakuReturnEffect(final QuillmaneBakuReturnEffect effect) {
super(effect);
}
@Override
public QuillmaneBakuReturnEffect copy() {
return new QuillmaneBakuReturnEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null) {
return false;
}
int maxConvManaCost = 0;
for (Cost cost : source.getCosts()) {
if (cost instanceof RemoveVariableCountersSourceCost) {
maxConvManaCost = ((RemoveVariableCountersSourceCost)cost).getAmount();
}
}
FilterCreaturePermanent filter = new FilterCreaturePermanent("creature with converted mana cost " + maxConvManaCost + " or less");
filter.add(new ConvertedManaCostPredicate(Filter.ComparisonType.LessThan, maxConvManaCost + 1));
TargetCreaturePermanent target = new TargetCreaturePermanent(filter);
Permanent permanent = game.getPermanent(target.getFirstTarget());
if (permanent != null) {
return permanent.moveToZone(Zone.HAND, source.getId(), game, false);
}
return false;
}
}
}

View file

@ -0,0 +1,122 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.betrayersofkamigawa;
import java.util.UUID;
import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.Constants.Zone;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.common.SpellCastTriggeredAbility;
import mage.abilities.costs.Cost;
import mage.abilities.costs.common.RemoveVariableCountersSourceCost;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.continious.BoostSourceEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.cards.CardImpl;
import mage.counters.CounterType;
import mage.filter.common.FilterSpiritOrArcaneCard;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.common.TargetCreaturePermanent;
/**
* @author LevelX2
*/
public class SkullmaneBaku extends CardImpl<SkullmaneBaku> {
private final static FilterSpiritOrArcaneCard filter = new FilterSpiritOrArcaneCard();
public SkullmaneBaku(UUID ownerId) {
super(ownerId, 83, "Skullmane Baku", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{3}{B}{B}");
this.expansionSetCode = "BOK";
this.subtype.add("Spirit");
this.color.setBlack(true);
this.power = new MageInt(2);
this.toughness = new MageInt(1);
// Whenever you cast a Spirit or Arcane spell, you may put a ki counter on Skullmane Baku.
this.addAbility(new SpellCastTriggeredAbility(new AddCountersSourceEffect(CounterType.KI.createInstance()), filter, true));
// {1}, {T}, Remove X ki counters from Skullmane Baku: Target creature gets -X/-X until end of turn.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new SkullmaneBakuUnboostEffect(), new GenericManaCost(1));
ability.addCost(new TapSourceCost());
ability.addCost(new RemoveVariableCountersSourceCost(CounterType.KI.createInstance(1)));
ability.addTarget(new TargetCreaturePermanent());
this.addAbility(ability);
}
public SkullmaneBaku(final SkullmaneBaku card) {
super(card);
}
@Override
public SkullmaneBaku copy() {
return new SkullmaneBaku(this);
}
class SkullmaneBakuUnboostEffect extends OneShotEffect<SkullmaneBakuUnboostEffect> {
public SkullmaneBakuUnboostEffect() {
super(Constants.Outcome.UnboostCreature);
staticText = "Target creature gets -X/-X until end of turn";
}
public SkullmaneBakuUnboostEffect(SkullmaneBakuUnboostEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
int numberToUnboost = 0;
for (Cost cost : source.getCosts()) {
if (cost instanceof RemoveVariableCountersSourceCost) {
numberToUnboost = ((RemoveVariableCountersSourceCost)cost).getAmount() * -1;
}
}
Permanent creature = game.getPermanent(targetPointer.getFirst(game, source));
if (creature != null && numberToUnboost != 0) {
creature.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new BoostSourceEffect(numberToUnboost, numberToUnboost, Constants.Duration.EndOfTurn)), game);
}
return true;
}
@Override
public SkullmaneBakuUnboostEffect copy() {
return new SkullmaneBakuUnboostEffect(this);
}
}
}

View file

@ -0,0 +1,131 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.betrayersofkamigawa;
import java.util.List;
import java.util.UUID;
import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.Constants.Zone;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.common.SpellCastTriggeredAbility;
import mage.abilities.costs.Cost;
import mage.abilities.costs.common.RemoveVariableCountersSourceCost;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.cards.CardImpl;
import mage.counters.CounterType;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.common.FilterSpiritOrArcaneCard;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.TargetPermanent;
/**
* @author LevelX2
*/
public class WaxmaneBaku extends CardImpl<WaxmaneBaku> {
private final static FilterSpiritOrArcaneCard filter = new FilterSpiritOrArcaneCard();
public WaxmaneBaku(UUID ownerId) {
super(ownerId, 29, "Waxmane Baku", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{2}{W}");
this.expansionSetCode = "BOK";
this.subtype.add("Spirit");
this.color.setWhite(true);
this.power = new MageInt(2);
this.toughness = new MageInt(2);
// Whenever you cast a Spirit or Arcane spell, you may put a ki counter on Waxmane Baku.
this.addAbility(new SpellCastTriggeredAbility(new AddCountersSourceEffect(CounterType.KI.createInstance()), filter, true));
// {1}, Remove X ki counters from Waxmane Baku: Tap X target creatures.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new WaxmaneBakuTapEffect(), new GenericManaCost(1));
ability.addCost(new RemoveVariableCountersSourceCost(CounterType.KI.createInstance(1)));
this.addAbility(ability);
}
public WaxmaneBaku(final WaxmaneBaku card) {
super(card);
}
@Override
public WaxmaneBaku copy() {
return new WaxmaneBaku(this);
}
private class WaxmaneBakuTapEffect extends OneShotEffect<WaxmaneBakuTapEffect> {
FilterPermanent filter = new FilterCreaturePermanent();
public WaxmaneBakuTapEffect() {
super(Constants.Outcome.Tap);
staticText = "Tap X target creatures";
}
public WaxmaneBakuTapEffect(final WaxmaneBakuTapEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
int numberToTap = 0;
for (Cost cost : source.getCosts()) {
if (cost instanceof RemoveVariableCountersSourceCost) {
numberToTap = ((RemoveVariableCountersSourceCost)cost).getAmount();
}
}
TargetPermanent target = new TargetPermanent(numberToTap, filter);
if (target.canChoose(source.getControllerId(), game) && target.choose(Constants.Outcome.Tap, source.getControllerId(), source.getId(), game)) {
if (!target.getTargets().isEmpty()) {
List<UUID> targets = target.getTargets();
for (UUID targetId : targets) {
Permanent permanent = game.getPermanent(targetId);
if (permanent != null) {
permanent.tap(game);
}
}
}
return true;
}
return false;
}
@Override
public WaxmaneBakuTapEffect copy() {
return new WaxmaneBakuTapEffect(this);
}
}
}

View file

@ -0,0 +1,115 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.abilities.costs.common;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.costs.CostImpl;
import mage.abilities.costs.VariableCost;
import mage.counters.Counter;
import mage.filter.FilterMana;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
/**
*
* @author LevelX2
*/
public class RemoveVariableCountersSourceCost extends CostImpl<RemoveVariableCountersSourceCost> implements VariableCost {
protected int amountPaid = 0;
protected int minimalCountersToPay = 0;
private String name;
public RemoveVariableCountersSourceCost(Counter counter, int minimalCountersToPay) {
this.minimalCountersToPay = minimalCountersToPay;
this.name = counter.getName();
this.text = "Remove X " + name + " counter from {this}";
}
public RemoveVariableCountersSourceCost(Counter counter) {
this(counter, 0);
}
public RemoveVariableCountersSourceCost(final RemoveVariableCountersSourceCost cost) {
super(cost);
this.amountPaid = cost.amountPaid;
this.minimalCountersToPay = cost.minimalCountersToPay;
this.name = cost.name;
}
@Override
public boolean canPay(UUID sourceId, UUID controllerId, Game game) {
Permanent permanent = game.getPermanent(sourceId);
if (permanent.getCounters().getCount(name) >= minimalCountersToPay) {
return true;
}
return false;
}
@Override
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) {
Permanent permanent = game.getPermanent(sourceId);
Player player = game.getPlayer(permanent.getControllerId());
this.amountPaid = player.getAmount(minimalCountersToPay, permanent.getCounters().getCount(name), "Choose X counters to remove", game);
if (this.amountPaid >= minimalCountersToPay) {
permanent.removeCounters(name, amountPaid, game);
this.paid = true;
}
return paid;
}
@Override
public void clearPaid() {
paid = false;
amountPaid = 0;
}
@Override
public int getAmount() {
return amountPaid;
}
@Override
public void setAmount(int amount) {
amountPaid = amount;
}
@Override
public void setFilter(FilterMana filter) {
}
@Override
public RemoveVariableCountersSourceCost copy() {
return new RemoveVariableCountersSourceCost(this);
}
}