From 20247f2fefe46020677612716bc007557097bce8 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Thu, 20 Dec 2018 19:21:52 -0500 Subject: [PATCH] Implemented Tithe Taker --- Mage.Sets/src/mage/cards/t/TitheTaker.java | 89 +++++++++++++++++++ .../src/mage/sets/RavnicaAllegiance.java | 1 + 2 files changed, 90 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/t/TitheTaker.java diff --git a/Mage.Sets/src/mage/cards/t/TitheTaker.java b/Mage.Sets/src/mage/cards/t/TitheTaker.java new file mode 100644 index 0000000000..c5f184deb4 --- /dev/null +++ b/Mage.Sets/src/mage/cards/t/TitheTaker.java @@ -0,0 +1,89 @@ +package mage.cards.t; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.SpellAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.condition.common.MyTurnCondition; +import mage.abilities.effects.common.cost.CostModificationEffectImpl; +import mage.abilities.keyword.AfterlifeAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.*; +import mage.game.Game; +import mage.util.CardUtil; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class TitheTaker extends CardImpl { + + public TitheTaker(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{W}"); + + this.subtype.add(SubType.HUMAN); + this.subtype.add(SubType.SOLDIER); + this.power = new MageInt(2); + this.toughness = new MageInt(1); + + // During your turn, spells your opponents cast cost {1} more to cast and abilities your opponents activate cost {1} more to activate unless they're mana abilities. + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new TitheTakerCostReductionEffect())); + + // Afterlife 1 + this.addAbility(new AfterlifeAbility(1)); + } + + private TitheTaker(final TitheTaker card) { + super(card); + } + + @Override + public TitheTaker copy() { + return new TitheTaker(this); + } +} + +class TitheTakerCostReductionEffect extends CostModificationEffectImpl { + + TitheTakerCostReductionEffect() { + super(Duration.WhileOnBattlefield, Outcome.Benefit, CostModificationType.INCREASE_COST); + staticText = "During your turn, spells your opponents cast cost {1} more to cast " + + "and abilities your opponents activate cost {1} more to activate unless they're mana abilities."; + } + + private TitheTakerCostReductionEffect(TitheTakerCostReductionEffect effect) { + super(effect); + } + + @Override + public boolean apply(Game game, Ability source, Ability abilityToModify) { + if (abilityToModify.getAbilityType() == AbilityType.SPELL) { + SpellAbility spellAbility = (SpellAbility) abilityToModify; + CardUtil.adjustCost(spellAbility, -1); + } + if (abilityToModify.getAbilityType() == AbilityType.ACTIVATED) { + CardUtil.increaseCost(abilityToModify, 1); + } + return true; + } + + @Override + public boolean applies(Ability abilityToModify, Ability source, Game game) { + if (!MyTurnCondition.instance.apply(game, source)) { + return false; + } + if (!(abilityToModify.getAbilityType() == AbilityType.SPELL) + && !(abilityToModify.getAbilityType() == AbilityType.ACTIVATED)) { + return false; + } + return game.getOpponents(source.getControllerId()).contains(abilityToModify.getControllerId()); + } + + @Override + public TitheTakerCostReductionEffect copy() { + return new TitheTakerCostReductionEffect(this); + } + +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/RavnicaAllegiance.java b/Mage.Sets/src/mage/sets/RavnicaAllegiance.java index c0ab892ac5..fbadfbd759 100644 --- a/Mage.Sets/src/mage/sets/RavnicaAllegiance.java +++ b/Mage.Sets/src/mage/sets/RavnicaAllegiance.java @@ -45,6 +45,7 @@ public final class RavnicaAllegiance extends ExpansionSet { cards.add(new SetCardInfo("Rakdos Firewheeler", 197, Rarity.UNCOMMON, mage.cards.r.RakdosFirewheeler.class)); cards.add(new SetCardInfo("Rix Maadi Reveler", 109, Rarity.RARE, mage.cards.r.RixMaadiReveler.class)); cards.add(new SetCardInfo("The Haunt of Hightower", 273, Rarity.MYTHIC, mage.cards.t.TheHauntOfHightower.class)); + cards.add(new SetCardInfo("Tithe Taker", 27, Rarity.RARE, mage.cards.t.TitheTaker.class)); cards.add(new SetCardInfo("Zegana, Utopian Speaker", 214, Rarity.RARE, mage.cards.z.ZeganaUtopianSpeaker.class)); }