From c19f78bf7b92c826a9d8b847af28ca4dd1d43ffc Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Fri, 29 Sep 2017 13:09:59 -0400 Subject: [PATCH] Implemented Harbor Guardian --- .../src/mage/cards/h/HarborGuardian.java | 101 ++++++++++++++++++ Mage.Sets/src/mage/sets/Mirage.java | 1 + 2 files changed, 102 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/h/HarborGuardian.java diff --git a/Mage.Sets/src/mage/cards/h/HarborGuardian.java b/Mage.Sets/src/mage/cards/h/HarborGuardian.java new file mode 100644 index 0000000000..ef4c8b3819 --- /dev/null +++ b/Mage.Sets/src/mage/cards/h/HarborGuardian.java @@ -0,0 +1,101 @@ +/* + * 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.h; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.AttacksTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.constants.SubType; +import mage.abilities.keyword.ReachAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.game.Game; +import mage.players.Player; + +/** + * + * @author TheElk801 + */ +public class HarborGuardian extends CardImpl { + + public HarborGuardian(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{W}{U}"); + + this.subtype.add(SubType.GARGOYLE); + this.power = new MageInt(3); + this.toughness = new MageInt(4); + + // Reach + this.addAbility(ReachAbility.getInstance()); + + // Whenever Harbor Guardian attacks, defending player may draw a card. + this.addAbility(new AttacksTriggeredAbility(new HarborGuardianEffect(), false)); + } + + public HarborGuardian(final HarborGuardian card) { + super(card); + } + + @Override + public HarborGuardian copy() { + return new HarborGuardian(this); + } +} + +class HarborGuardianEffect extends OneShotEffect { + + public HarborGuardianEffect() { + super(Outcome.DrawCard); + staticText = "defending player may draw a card"; + } + + public HarborGuardianEffect(final HarborGuardianEffect effect) { + super(effect); + } + + @Override + public HarborGuardianEffect copy() { + return new HarborGuardianEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + UUID defenderId = game.getCombat().getDefenderId(source.getSourceId()); + Player defender = game.getPlayer(defenderId); + if (defender != null) { + if (defender.chooseUse(outcome, "Draw a card?", source, game)) { + defender.drawCards(1, game); + } + } + return false; + } +} diff --git a/Mage.Sets/src/mage/sets/Mirage.java b/Mage.Sets/src/mage/sets/Mirage.java index a765c877a3..7fe7c9695f 100644 --- a/Mage.Sets/src/mage/sets/Mirage.java +++ b/Mage.Sets/src/mage/sets/Mirage.java @@ -163,6 +163,7 @@ public class Mirage extends ExpansionSet { cards.add(new SetCardInfo("Hall of Gemstone", 119, Rarity.RARE, mage.cards.h.HallOfGemstone.class)); cards.add(new SetCardInfo("Hammer of Bogardan", 181, Rarity.RARE, mage.cards.h.HammerOfBogardan.class)); cards.add(new SetCardInfo("Harbinger of Night", 26, Rarity.RARE, mage.cards.h.HarbingerOfNight.class)); + cards.add(new SetCardInfo("Harbor Guardian", 326, Rarity.UNCOMMON, mage.cards.h.HarborGuardian.class)); cards.add(new SetCardInfo("Harmattan Efreet", 69, Rarity.UNCOMMON, mage.cards.h.HarmattanEfreet.class)); cards.add(new SetCardInfo("Hazerider Drake", 328, Rarity.UNCOMMON, mage.cards.h.HazeriderDrake.class)); cards.add(new SetCardInfo("Healing Salve", 224, Rarity.COMMON, mage.cards.h.HealingSalve.class));