diff --git a/Mage.Sets/src/mage/sets/alarareborn/Brainbite.java b/Mage.Sets/src/mage/sets/alarareborn/Brainbite.java new file mode 100644 index 0000000000..6d1dcfd385 --- /dev/null +++ b/Mage.Sets/src/mage/sets/alarareborn/Brainbite.java @@ -0,0 +1,112 @@ +/* + * 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.alarareborn; + +import java.util.UUID; + +import mage.Constants; +import mage.Constants.CardType; +import mage.Constants.Rarity; +import mage.abilities.Ability; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.DrawCardControllerEffect; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.filter.FilterCard; +import mage.game.Game; +import mage.players.Player; +import mage.target.TargetCard; +import mage.target.common.TargetOpponent; + +/** + * + * @author Loki + */ +public class Brainbite extends CardImpl { + + public Brainbite(UUID ownerId) { + super(ownerId, 18, "Brainbite", Rarity.COMMON, new CardType[]{CardType.SORCERY}, "{2}{U}{B}"); + this.expansionSetCode = "ARB"; + + this.color.setBlue(true); + this.color.setBlack(true); + + // Target opponent reveals his or her hand. You choose a card from it. That player discards that card. + this.getSpellAbility().addEffect(new BrainbiteEffect()); + // Draw a card. + this.getSpellAbility().addEffect(new DrawCardControllerEffect(1)); + this.getSpellAbility().addTarget(new TargetOpponent()); + } + + public Brainbite(final Brainbite card) { + super(card); + } + + @Override + public Brainbite copy() { + return new Brainbite(this); + } +} + +class BrainbiteEffect extends OneShotEffect { + + public BrainbiteEffect() { + super(Constants.Outcome.Discard); + staticText = "Target opponent reveals his or her hand. You choose a card from it. That player discards that card"; + } + + public BrainbiteEffect(final BrainbiteEffect effect) { + super(effect); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getFirstTarget()); + if (player != null) { + player.revealCards("Brainbite", player.getHand(), game); + Player you = game.getPlayer(source.getControllerId()); + if (you != null) { + TargetCard target = new TargetCard(Constants.Zone.PICK, new FilterCard()); + target.setRequired(true); + if (you.choose(Constants.Outcome.Benefit, player.getHand(), target, game)) { + Card card = player.getHand().get(target.getFirstTarget(), game); + if (card != null) { + return player.discard(card, source, game); + } + } + } + } + return false; + } + + @Override + public BrainbiteEffect copy() { + return new BrainbiteEffect(this); + } + +} diff --git a/Mage.Sets/src/mage/sets/alarareborn/GlassdustHulk.java b/Mage.Sets/src/mage/sets/alarareborn/GlassdustHulk.java new file mode 100644 index 0000000000..6b47a0b9d7 --- /dev/null +++ b/Mage.Sets/src/mage/sets/alarareborn/GlassdustHulk.java @@ -0,0 +1,114 @@ +/* + * 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.alarareborn; + +import java.util.UUID; + +import mage.Constants; +import mage.Constants.CardType; +import mage.Constants.Rarity; +import mage.MageInt; +import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.common.continious.BoostSourceEffect; +import mage.abilities.effects.common.continious.GainAbilitySourceEffect; +import mage.abilities.keyword.CyclingAbility; +import mage.abilities.keyword.UnblockableAbility; +import mage.cards.CardImpl; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.events.ZoneChangeEvent; +import mage.game.permanent.Permanent; + +/** + * + * @author Loki + */ +public class GlassdustHulk extends CardImpl { + + public GlassdustHulk(UUID ownerId) { + super(ownerId, 7, "Glassdust Hulk", Rarity.COMMON, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{3}{W}{U}"); + this.expansionSetCode = "ARB"; + this.subtype.add("Golem"); + + this.color.setBlue(true); + this.color.setWhite(true); + this.power = new MageInt(3); + this.toughness = new MageInt(4); + + // Whenever another artifact enters the battlefield under your control, Glassdust Hulk gets +1/+1 until end of turn and is unblockable this turn. + this.addAbility(new GlassdustHulkTriggeredAbility()); + this.addAbility(new CyclingAbility(new ManaCostsImpl("{W/U}"))); + } + + public GlassdustHulk(final GlassdustHulk card) { + super(card); + } + + @Override + public GlassdustHulk copy() { + return new GlassdustHulk(this); + } +} + +class GlassdustHulkTriggeredAbility extends TriggeredAbilityImpl { + GlassdustHulkTriggeredAbility() { + super(Constants.Zone.BATTLEFIELD, new BoostSourceEffect(1, 1, Constants.Duration.EndOfTurn)); + this.addEffect(new GainAbilitySourceEffect(UnblockableAbility.getInstance(), Constants.Duration.EndOfTurn)); + } + + GlassdustHulkTriggeredAbility(final GlassdustHulkTriggeredAbility ability) { + super(ability); + } + + @Override + public GlassdustHulkTriggeredAbility copy() { + return new GlassdustHulkTriggeredAbility(this); + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + if (event.getType() == GameEvent.EventType.ZONE_CHANGE && !event.getTargetId().equals(this.getSourceId())) { + ZoneChangeEvent zEvent = (ZoneChangeEvent)event; + if (zEvent.getToZone() == Constants.Zone.BATTLEFIELD) { + Permanent permanent = game.getPermanent(event.getTargetId()); + if (permanent != null && permanent.getCardType().contains(CardType.ARTIFACT) + && permanent.getControllerId().equals(this.controllerId)) { + return true; + } + } + } + return false; + } + + @Override + public String getRule() { + return "Whenever another artifact enters the battlefield under your control, {this} gets +1/+1 until end of turn and is unblockable this turn."; + } +} + diff --git a/Mage.Sets/src/mage/sets/alarareborn/MaskOfRiddles.java b/Mage.Sets/src/mage/sets/alarareborn/MaskOfRiddles.java new file mode 100644 index 0000000000..ad5571cdd0 --- /dev/null +++ b/Mage.Sets/src/mage/sets/alarareborn/MaskOfRiddles.java @@ -0,0 +1,74 @@ +/* + * 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.alarareborn; + +import java.util.UUID; + +import mage.Constants; +import mage.Constants.CardType; +import mage.Constants.Rarity; +import mage.abilities.common.DealsCombatDamageToAPlayerAttachedTriggeredAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.costs.mana.GenericManaCost; +import mage.abilities.effects.common.DrawCardControllerEffect; +import mage.abilities.effects.common.continious.GainAbilityAttachedEffect; +import mage.abilities.keyword.EquipAbility; +import mage.abilities.keyword.FearAbility; +import mage.cards.CardImpl; + +/** + * + * @author Loki + */ +public class MaskOfRiddles extends CardImpl { + + public MaskOfRiddles(UUID ownerId) { + super(ownerId, 25, "Mask of Riddles", Rarity.UNCOMMON, new CardType[]{CardType.ARTIFACT}, "{U}{B}"); + this.expansionSetCode = "ARB"; + this.subtype.add("Equipment"); + + this.color.setBlue(true); + this.color.setBlack(true); + + // Equipped creature has fear. + this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new GainAbilityAttachedEffect(FearAbility.getInstance(), Constants.AttachmentType.EQUIPMENT))); + // Whenever equipped creature deals combat damage to a player, you may draw a card. + this.addAbility(new DealsCombatDamageToAPlayerAttachedTriggeredAbility(new DrawCardControllerEffect(1), "equipped", true)); + // Equip {2} + this.addAbility(new EquipAbility(Constants.Outcome.AddAbility, new GenericManaCost(2))); + } + + public MaskOfRiddles(final MaskOfRiddles card) { + super(card); + } + + @Override + public MaskOfRiddles copy() { + return new MaskOfRiddles(this); + } +} diff --git a/Mage.Sets/src/mage/sets/alarareborn/StormcallersBoon.java b/Mage.Sets/src/mage/sets/alarareborn/StormcallersBoon.java new file mode 100644 index 0000000000..655b98ae59 --- /dev/null +++ b/Mage.Sets/src/mage/sets/alarareborn/StormcallersBoon.java @@ -0,0 +1,69 @@ +/* + * 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.alarareborn; + +import java.util.UUID; + +import mage.Constants; +import mage.Constants.CardType; +import mage.Constants.Rarity; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.common.SacrificeSourceCost; +import mage.abilities.effects.common.continious.GainAbilityControlledEffect; +import mage.abilities.keyword.CascadeAbility; +import mage.abilities.keyword.FlyingAbility; +import mage.cards.CardImpl; +import mage.filter.common.FilterControlledCreaturePermanent; + +/** + * + * @author Loki + */ +public class StormcallersBoon extends CardImpl { + + public StormcallersBoon(UUID ownerId) { + super(ownerId, 13, "Stormcaller's Boon", Rarity.COMMON, new CardType[]{CardType.ENCHANTMENT}, "{2}{W}{U}"); + this.expansionSetCode = "ARB"; + + this.color.setBlue(true); + this.color.setWhite(true); + + // Sacrifice Stormcaller's Boon: Creatures you control gain flying until end of turn. + this.addAbility(new SimpleActivatedAbility(Constants.Zone.BATTLEFIELD, new GainAbilityControlledEffect(FlyingAbility.getInstance(), Constants.Duration.EndOfTurn, new FilterControlledCreaturePermanent("Creatures")), new SacrificeSourceCost())); + this.addAbility(new CascadeAbility()); + } + + public StormcallersBoon(final StormcallersBoon card) { + super(card); + } + + @Override + public StormcallersBoon copy() { + return new StormcallersBoon(this); + } +} diff --git a/Mage.Sets/src/mage/sets/zendikar/GatekeeperOfMalakir.java b/Mage.Sets/src/mage/sets/zendikar/GatekeeperOfMalakir.java index a277e4bf3f..df56465f59 100644 --- a/Mage.Sets/src/mage/sets/zendikar/GatekeeperOfMalakir.java +++ b/Mage.Sets/src/mage/sets/zendikar/GatekeeperOfMalakir.java @@ -33,7 +33,10 @@ import mage.Constants.Duration; import mage.Constants.Rarity; import mage.MageInt; import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.condition.common.KickedCondition; +import mage.abilities.costs.mana.KickerManaCost; import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.decorator.ConditionalTriggeredAbility; import mage.abilities.effects.common.continious.GainAbilitySourceEffect; import mage.abilities.effects.common.SacrificeEffect; import mage.abilities.keyword.KickerAbility; @@ -65,12 +68,13 @@ public class GatekeeperOfMalakir extends CardImpl { this.power = new MageInt(2); this.toughness = new MageInt(2); - EntersBattlefieldTriggeredAbility sacAbility = + this.getSpellAbility().addOptionalCost(new KickerManaCost("{B}")); + + EntersBattlefieldTriggeredAbility ability = new EntersBattlefieldTriggeredAbility(new SacrificeEffect(filter, 1, "target player")); - sacAbility.addTarget(new TargetPlayer()); - KickerAbility ability = new KickerAbility(new GainAbilitySourceEffect(sacAbility, Duration.OneUse), false); - ability.addCost(new ManaCostsImpl("{B}")); - this.addAbility(ability); + ability.addTarget(new TargetPlayer()); + + this.addAbility(new ConditionalTriggeredAbility(ability, KickedCondition.getInstance(), "When {this} enters the battlefield, if it was kicked, target player sacrifices a creature")); } public GatekeeperOfMalakir(final GatekeeperOfMalakir card) { diff --git a/Mage/src/mage/abilities/common/DealsCombatDamageToAPlayerAttachedTriggeredAbility.java b/Mage/src/mage/abilities/common/DealsCombatDamageToAPlayerAttachedTriggeredAbility.java new file mode 100644 index 0000000000..5ad47c3566 --- /dev/null +++ b/Mage/src/mage/abilities/common/DealsCombatDamageToAPlayerAttachedTriggeredAbility.java @@ -0,0 +1,63 @@ +package mage.abilities.common; + +import mage.Constants; +import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.DiscardTargetEffect; +import mage.abilities.effects.common.UntapAllLandsControllerEffect; +import mage.game.Game; +import mage.game.events.DamagedPlayerEvent; +import mage.game.events.GameEvent; +import mage.game.permanent.Permanent; +import mage.target.targetpointer.FixedTarget; + +/** + * @author Loki + */ +public class DealsCombatDamageToAPlayerAttachedTriggeredAbility extends TriggeredAbilityImpl { + private boolean setFixedTargetPointer; + private String attachedDescription; + + public DealsCombatDamageToAPlayerAttachedTriggeredAbility(Effect effect, String attachedDescription, boolean optional) { + this(effect, attachedDescription, optional, false); + } + + public DealsCombatDamageToAPlayerAttachedTriggeredAbility(Effect effect, String attachedDescription, boolean optional, boolean setFixedTargetPointer) { + super(Constants.Zone.BATTLEFIELD, effect, optional); + this.setFixedTargetPointer = setFixedTargetPointer; + this.attachedDescription = attachedDescription; + } + + public DealsCombatDamageToAPlayerAttachedTriggeredAbility(final DealsCombatDamageToAPlayerAttachedTriggeredAbility ability) { + super(ability); + this.setFixedTargetPointer = ability.setFixedTargetPointer; + this.attachedDescription = ability.attachedDescription; + } + + @Override + public DealsCombatDamageToAPlayerAttachedTriggeredAbility copy() { + return new DealsCombatDamageToAPlayerAttachedTriggeredAbility(this); + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + if (event instanceof DamagedPlayerEvent) { + DamagedPlayerEvent damageEvent = (DamagedPlayerEvent) event; + Permanent p = game.getPermanent(event.getSourceId()); + if (damageEvent.isCombatDamage() && p != null && p.getAttachments().contains(this.getSourceId())) { + if (setFixedTargetPointer) { + for (Effect effect : this.getEffects()) { + effect.setTargetPointer(new FixedTarget(event.getPlayerId())); + } + } + return true; + } + } + return false; + } + + @Override + public String getRule() { + return "Whenever " + attachedDescription + " creature deals combat damage to a player, " + super.getRule(); + } +}