From 4e5dc69d113182ba87ce6b1d60cc8ceb967bb4df Mon Sep 17 00:00:00 2001 From: emerald000 Date: Thu, 3 Nov 2016 02:34:11 -0400 Subject: [PATCH] [C16] Added Benefactor's Draught. --- .../src/mage/cards/b/BenefactorsDraught.java | 106 ++++++++++++++++++ Mage.Sets/src/mage/sets/Commander2016.java | 1 + 2 files changed, 107 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/b/BenefactorsDraught.java diff --git a/Mage.Sets/src/mage/cards/b/BenefactorsDraught.java b/Mage.Sets/src/mage/cards/b/BenefactorsDraught.java new file mode 100644 index 00000000000..7abc822e65f --- /dev/null +++ b/Mage.Sets/src/mage/cards/b/BenefactorsDraught.java @@ -0,0 +1,106 @@ +/* + * 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.cards.b; + +import java.util.UUID; +import mage.abilities.DelayedTriggeredAbility; +import mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect; +import mage.abilities.effects.common.DrawCardSourceControllerEffect; +import mage.abilities.effects.common.UntapAllEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.filter.common.FilterCreaturePermanent; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; +import mage.game.permanent.Permanent; +import mage.players.Player; + +/** + * + * @author emerald000 + */ +public class BenefactorsDraught extends CardImpl { + + public BenefactorsDraught(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{G}"); + + // Untap all creatures. + this.getSpellAbility().addEffect(new UntapAllEffect(new FilterCreaturePermanent())); + + // Until end of turn, whenever a creature an opponent controls blocks, draw a card. + this.getSpellAbility().addEffect(new CreateDelayedTriggeredAbilityEffect(new BenefactorsDraughtTriggeredAbility())); + + // Draw a card. + this.getSpellAbility().addEffect(new DrawCardSourceControllerEffect(1)); + } + + public BenefactorsDraught(final BenefactorsDraught card) { + super(card); + } + + @Override + public BenefactorsDraught copy() { + return new BenefactorsDraught(this); + } +} + +class BenefactorsDraughtTriggeredAbility extends DelayedTriggeredAbility { + + BenefactorsDraughtTriggeredAbility() { + super(new DrawCardSourceControllerEffect(1), Duration.EndOfTurn, false); + } + + BenefactorsDraughtTriggeredAbility(final BenefactorsDraughtTriggeredAbility ability) { + super(ability); + } + + @Override + public BenefactorsDraughtTriggeredAbility copy() { + return new BenefactorsDraughtTriggeredAbility(this); + } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.BLOCKER_DECLARED; + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + Permanent blocker = game.getPermanent(event.getSourceId()); + Player controller = game.getPlayer(this.getControllerId()); + return blocker != null && controller != null && game.isOpponent(controller, blocker.getControllerId()); + } + + @Override + public String getRule() { + return "Until end of turn, whenever a creature an opponent controls blocks, draw a card."; + } +} diff --git a/Mage.Sets/src/mage/sets/Commander2016.java b/Mage.Sets/src/mage/sets/Commander2016.java index 735d9d7514f..9f56983722d 100644 --- a/Mage.Sets/src/mage/sets/Commander2016.java +++ b/Mage.Sets/src/mage/sets/Commander2016.java @@ -73,6 +73,7 @@ public class Commander2016 extends ExpansionSet { cards.add(new SetCardInfo("Beacon of Unrest", 107, Rarity.RARE, mage.cards.b.BeaconOfUnrest.class)); cards.add(new SetCardInfo("Beast Within", 141, Rarity.UNCOMMON, mage.cards.b.BeastWithin.class)); cards.add(new SetCardInfo("Beastmaster Ascension", 142, Rarity.RARE, mage.cards.b.BeastmasterAscension.class)); + cards.add(new SetCardInfo("Benefactor's Draught", 21, Rarity.RARE, mage.cards.b.BenefactorsDraught.class)); cards.add(new SetCardInfo("Bituminous Blast", 182, Rarity.UNCOMMON, mage.cards.b.BituminousBlast.class)); cards.add(new SetCardInfo("Blasphemous Act", 120, Rarity.RARE, mage.cards.b.BlasphemousAct.class)); cards.add(new SetCardInfo("Blazing Archon", 58, Rarity.RARE, mage.cards.b.BlazingArchon.class));