From 6ec0cdd34c70dfe9e78182ae191ba0be9b812f4c Mon Sep 17 00:00:00 2001 From: Noah Gleason Date: Fri, 22 Jun 2018 17:26:40 -0400 Subject: [PATCH] Implement Dwarven Sea Clan --- .../src/mage/cards/d/DwarvenSeaClan.java | 86 +++++++++++++++++++ Mage.Sets/src/mage/sets/Homelands.java | 1 + 2 files changed, 87 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/d/DwarvenSeaClan.java diff --git a/Mage.Sets/src/mage/cards/d/DwarvenSeaClan.java b/Mage.Sets/src/mage/cards/d/DwarvenSeaClan.java new file mode 100644 index 0000000000..3443e2074e --- /dev/null +++ b/Mage.Sets/src/mage/cards/d/DwarvenSeaClan.java @@ -0,0 +1,86 @@ +package mage.cards.d; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.ActivateIfConditionActivatedAbility; +import mage.abilities.common.delayed.AtTheEndOfCombatDelayedTriggeredAbility; +import mage.abilities.condition.Condition; +import mage.abilities.costs.common.TapSourceCost; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect; +import mage.abilities.effects.common.DamageTargetEffect; +import mage.constants.PhaseStep; +import mage.constants.SubType; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Zone; +import mage.filter.common.FilterAttackingOrBlockingCreature; +import mage.filter.predicate.permanent.ControllerControlsIslandPredicate; +import mage.game.Game; +import mage.target.common.TargetAttackingOrBlockingCreature; + +/** + * + * @author noahg + */ +public final class DwarvenSeaClan extends CardImpl { + + private static final FilterAttackingOrBlockingCreature filter = new FilterAttackingOrBlockingCreature(); + + static { + filter.add(new ControllerControlsIslandPredicate()); + } + + public DwarvenSeaClan(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{R}"); + + this.subtype.add(SubType.DWARF); + this.power = new MageInt(1); + this.toughness = new MageInt(1); + + // {tap}: Choose target attacking or blocking creature whose controller controls an Island. Dwarven Sea Clan deals 2 damage to that creature at end of combat. Activate this ability only before the end of combat step. + Effect effect = new CreateDelayedTriggeredAbilityEffect(new AtTheEndOfCombatDelayedTriggeredAbility(new DamageTargetEffect(2, true, "that creature"))); + effect.setText("Choose target attacking or blocking creature whose controller controls an Island. Dwarven Sea Clan deals 2 damage to that creature at end of combat."); + Ability ability = new ActivateIfConditionActivatedAbility( + Zone.BATTLEFIELD, + effect, + new TapSourceCost(), + BeforeEndCombatCondition.getInstance() + ); + ability.addTarget(new TargetAttackingOrBlockingCreature(1, 1, filter, false)); + addAbility(ability); + } + + public DwarvenSeaClan(final DwarvenSeaClan card) { + super(card); + } + + @Override + public DwarvenSeaClan copy() { + return new DwarvenSeaClan(this); + } +} + +class BeforeEndCombatCondition implements Condition { + private static final BeforeEndCombatCondition instance = new BeforeEndCombatCondition(); + + public static Condition getInstance() { + return instance; + } + + @Override + public boolean apply(Game game, Ability source) { + PhaseStep phaseStep = game.getStep().getType(); + if(phaseStep.getIndex() < PhaseStep.END_COMBAT.getIndex()) { + return true; + } + return false; + } + + @Override + public String toString() { + return "before the end of combat step"; + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/Homelands.java b/Mage.Sets/src/mage/sets/Homelands.java index 5de1fb7d4e..4502fe8dbd 100644 --- a/Mage.Sets/src/mage/sets/Homelands.java +++ b/Mage.Sets/src/mage/sets/Homelands.java @@ -89,6 +89,7 @@ public final class Homelands extends ExpansionSet { cards.add(new SetCardInfo("Dry Spell", "46a", Rarity.COMMON, DrySpell.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Dry Spell", "46b", Rarity.COMMON, DrySpell.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Dwarven Pony", 70, Rarity.RARE, mage.cards.d.DwarvenPony.class)); + cards.add(new SetCardInfo("Dwarven Sea Clan", 71, Rarity.RARE, mage.cards.d.DwarvenSeaClan.class)); cards.add(new SetCardInfo("Dwarven Trader", "72a", Rarity.COMMON, DwarvenTrader.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Dwarven Trader", "72b", Rarity.COMMON, DwarvenTrader.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Ebony Rhino", 106, Rarity.COMMON, mage.cards.e.EbonyRhino.class));