diff --git a/Mage.Sets/src/mage/sets/magic2010/Manabarbs.java b/Mage.Sets/src/mage/sets/magic2010/Manabarbs.java new file mode 100644 index 00000000000..2369a1acbf7 --- /dev/null +++ b/Mage.Sets/src/mage/sets/magic2010/Manabarbs.java @@ -0,0 +1,52 @@ +/* + * 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.magic2010; + +import java.util.UUID; + +/** + * + * @author nantuko + */ +public class Manabarbs extends mage.sets.tenth.Manabarbs { + + public Manabarbs(UUID ownerId) { + super(ownerId); + this.cardNumber = 149; + this.expansionSetCode = "M10"; + } + + public Manabarbs(final Manabarbs card) { + super(card); + } + + @Override + public Manabarbs copy() { + return new Manabarbs(this); + } +} diff --git a/Mage.Sets/src/mage/sets/magic2012/Manabarbs.java b/Mage.Sets/src/mage/sets/magic2012/Manabarbs.java new file mode 100644 index 00000000000..c0513841395 --- /dev/null +++ b/Mage.Sets/src/mage/sets/magic2012/Manabarbs.java @@ -0,0 +1,52 @@ +/* + * 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.magic2012; + +import java.util.UUID; + +/** + * + * @author nantuko + */ +public class Manabarbs extends mage.sets.tenth.Manabarbs { + + public Manabarbs(UUID ownerId) { + super(ownerId); + this.cardNumber = 150; + this.expansionSetCode = "M12"; + } + + public Manabarbs(final Manabarbs card) { + super(card); + } + + @Override + public Manabarbs copy() { + return new Manabarbs(this); + } +} diff --git a/Mage.Sets/src/mage/sets/tenth/Manabarbs.java b/Mage.Sets/src/mage/sets/tenth/Manabarbs.java new file mode 100644 index 00000000000..d660b9ad9b0 --- /dev/null +++ b/Mage.Sets/src/mage/sets/tenth/Manabarbs.java @@ -0,0 +1,108 @@ +/* + * 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.tenth; + +import java.util.UUID; + +import static mage.Constants.Zone; + +import mage.Constants; +import mage.Constants.CardType; +import mage.Constants.Rarity; +import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.DamageTargetEffect; +import mage.cards.CardImpl; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.permanent.Permanent; +import mage.target.targetpointer.FixedTarget; + +/** + * + * @author nantuko + */ +public class Manabarbs extends CardImpl { + + public Manabarbs(UUID ownerId) { + super(ownerId, 218, "Manabarbs", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{3}{R}"); + this.expansionSetCode = "10E"; + + this.color.setRed(true); + + // Whenever a player taps a land for mana, Manabarbs deals 1 damage to that player. + this.addAbility(new ManabarbsTriggeredAbility()); + } + + public Manabarbs(final Manabarbs card) { + super(card); + } + + @Override + public Manabarbs copy() { + return new Manabarbs(this); + } +} + +class ManabarbsTriggeredAbility extends TriggeredAbilityImpl { + + private static final String staticText = "Whenever a player taps a land for mana, Manabarbs deals 1 damage to that player."; + + public ManabarbsTriggeredAbility() { + super(Zone.BATTLEFIELD, new DamageTargetEffect(1)); + } + + public ManabarbsTriggeredAbility(ManabarbsTriggeredAbility ability) { + super(ability); + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + if (event.getType() == GameEvent.EventType.TAPPED_FOR_MANA) { + Permanent permanent = game.getPermanent(event.getSourceId()); + if (permanent == null) { + permanent = (Permanent) game.getLastKnownInformation(event.getSourceId(), Zone.BATTLEFIELD); + } + if (permanent != null && permanent.getCardType().contains(CardType.LAND)) { + getEffects().get(0).setTargetPointer(new FixedTarget(permanent.getControllerId())); + return true; + } + } + return false; + } + + @Override + public ManabarbsTriggeredAbility copy() { + return new ManabarbsTriggeredAbility(this); + } + + @Override + public String getRule() { + return staticText; + } +} diff --git a/Mage/src/mage/abilities/costs/common/TapSourceCost.java b/Mage/src/mage/abilities/costs/common/TapSourceCost.java index 463f95e0a15..f7f4f03e454 100644 --- a/Mage/src/mage/abilities/costs/common/TapSourceCost.java +++ b/Mage/src/mage/abilities/costs/common/TapSourceCost.java @@ -31,7 +31,9 @@ package mage.abilities.costs.common; import java.util.UUID; import mage.abilities.Ability; import mage.abilities.costs.CostImpl; +import mage.abilities.mana.ManaAbility; import mage.game.Game; +import mage.game.events.GameEvent; import mage.game.permanent.Permanent; /** @@ -53,6 +55,9 @@ public class TapSourceCost extends CostImpl { Permanent permanent = game.getPermanent(sourceId); if (permanent != null) { paid = permanent.tap(game); + if (paid && ability instanceof ManaAbility) { + game.fireEvent(GameEvent.getEvent(GameEvent.EventType.TAPPED_FOR_MANA, sourceId, sourceId, controllerId)); + } } return paid; } diff --git a/Mage/src/mage/game/events/GameEvent.java b/Mage/src/mage/game/events/GameEvent.java index 5f7555b7f79..9c8bc022288 100644 --- a/Mage/src/mage/game/events/GameEvent.java +++ b/Mage/src/mage/game/events/GameEvent.java @@ -96,7 +96,7 @@ public class GameEvent { //permanent events ENTERS_THE_BATTLEFIELD, - TAP, TAPPED, + TAP, TAPPED, TAPPED_FOR_MANA, UNTAP, UNTAPPED, FLIP, FLIPPED, UNFLIP, UNFLIPPED,