From 8c95d89fb78e0259415c19bc3f60991f8be1bd5d Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Wed, 2 Jan 2019 17:18:10 -0500 Subject: [PATCH] Implemented Dovin, Grand Arbiter --- .../src/mage/cards/d/DovinGrandArbiter.java | 106 ++++++++++++++++++ .../src/mage/sets/RavnicaAllegiance.java | 1 + Utils/cardClass.tmpl | 2 +- 3 files changed, 108 insertions(+), 1 deletion(-) create mode 100644 Mage.Sets/src/mage/cards/d/DovinGrandArbiter.java diff --git a/Mage.Sets/src/mage/cards/d/DovinGrandArbiter.java b/Mage.Sets/src/mage/cards/d/DovinGrandArbiter.java new file mode 100644 index 00000000000..61bc5f0656c --- /dev/null +++ b/Mage.Sets/src/mage/cards/d/DovinGrandArbiter.java @@ -0,0 +1,106 @@ +package mage.cards.d; + +import mage.abilities.Ability; +import mage.abilities.DelayedTriggeredAbility; +import mage.abilities.LoyaltyAbility; +import mage.abilities.common.PlaneswalkerEntersWithLoyaltyCountersAbility; +import mage.abilities.dynamicvalue.common.StaticValue; +import mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect; +import mage.abilities.effects.common.CreateTokenEffect; +import mage.abilities.effects.common.GainLifeEffect; +import mage.abilities.effects.common.LookLibraryAndPickControllerEffect; +import mage.abilities.effects.common.counter.AddCountersSourceEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.*; +import mage.counters.CounterType; +import mage.filter.StaticFilters; +import mage.game.Game; +import mage.game.events.DamagedPlayerEvent; +import mage.game.events.GameEvent; +import mage.game.permanent.Permanent; +import mage.game.permanent.token.ThopterColorlessToken; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class DovinGrandArbiter extends CardImpl { + + public DovinGrandArbiter(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, "{1}{W}{U}"); + + this.addSuperType(SuperType.LEGENDARY); + this.subtype.add(SubType.DOVIN); + this.addAbility(new PlaneswalkerEntersWithLoyaltyCountersAbility(3)); + + // +1: Until end of turn, whenever a creature you control deals combat damage to a player, put a loyalty counter on Dovin, Grand Arbiter. + this.addAbility(new LoyaltyAbility(new CreateDelayedTriggeredAbilityEffect( + new DovinGrandArbiterDelayedTriggeredAbility(), false + ), 1)); + + // -1: Create a 1/1 colorless Thopter artifact creature token with flying. You gain 1 life. + Ability ability = new LoyaltyAbility(new CreateTokenEffect(new ThopterColorlessToken()), -1); + ability.addEffect(new GainLifeEffect(1).setText("You gain 1 life.")); + this.addAbility(ability); + + // -7: Look at the top ten cards of your library. Put three of them into your hand and the rest on the bottom of your library in a random order. + this.addAbility(new LoyaltyAbility(new LookLibraryAndPickControllerEffect( + new StaticValue(10), false, + new StaticValue(3), StaticFilters.FILTER_CARD, + Zone.LIBRARY, false, false, false, + Zone.HAND, false, false, false + ).setText("Look at the top ten cards of your library. " + + "Put three of them into your hand and the rest " + + "on the bottom of your library in a random order."))); + } + + private DovinGrandArbiter(final DovinGrandArbiter card) { + super(card); + } + + @Override + public DovinGrandArbiter copy() { + return new DovinGrandArbiter(this); + } +} + +class DovinGrandArbiterDelayedTriggeredAbility extends DelayedTriggeredAbility { + + DovinGrandArbiterDelayedTriggeredAbility() { + super(new AddCountersSourceEffect(CounterType.LOYALTY.createInstance()), Duration.EndOfTurn); + } + + private DovinGrandArbiterDelayedTriggeredAbility(final DovinGrandArbiterDelayedTriggeredAbility ability) { + super(ability); + } + + @Override + public DovinGrandArbiterDelayedTriggeredAbility copy() { + return new DovinGrandArbiterDelayedTriggeredAbility(this); + } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.DAMAGED_PLAYER; + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + if (((DamagedPlayerEvent) event).isCombatDamage()) { + Permanent creature = game.getPermanent(event.getSourceId()); + if (creature != null && creature.isControlledBy(controllerId)) { + return true; + } + } + return false; + } + + @Override + public String getRule() { + return "Until end of turn, whenever a creature you control " + + "deals combat damage to a player, " + + "put a loyalty counter on {this}."; + } +} diff --git a/Mage.Sets/src/mage/sets/RavnicaAllegiance.java b/Mage.Sets/src/mage/sets/RavnicaAllegiance.java index be1cfd2021b..0452be07429 100644 --- a/Mage.Sets/src/mage/sets/RavnicaAllegiance.java +++ b/Mage.Sets/src/mage/sets/RavnicaAllegiance.java @@ -41,6 +41,7 @@ public final class RavnicaAllegiance extends ExpansionSet { cards.add(new SetCardInfo("Blood Crypt", 245, Rarity.RARE, mage.cards.b.BloodCrypt.class)); cards.add(new SetCardInfo("Breeding Pool", 246, Rarity.RARE, mage.cards.b.BreedingPool.class)); cards.add(new SetCardInfo("Deputy of Detention", 165, Rarity.RARE, mage.cards.d.DeputyOfDetention.class)); + cards.add(new SetCardInfo("Dovin, Grand Arbiter", 167, Rarity.MYTHIC, mage.cards.d.DovinGrandArbiter.class)); cards.add(new SetCardInfo("Emergency Powers", 169, Rarity.MYTHIC, mage.cards.e.EmergencyPowers.class)); cards.add(new SetCardInfo("Frenzied Arynx", 173, Rarity.COMMON, mage.cards.f.FrenziedArynx.class)); cards.add(new SetCardInfo("Gate Colossus", 232, Rarity.UNCOMMON, mage.cards.g.GateColossus.class)); diff --git a/Utils/cardClass.tmpl b/Utils/cardClass.tmpl index c78080f860f..a0368c0472f 100644 --- a/Utils/cardClass.tmpl +++ b/Utils/cardClass.tmpl @@ -30,7 +30,7 @@ public final class [=$className=] extends CardImpl { [=$subType=][=$colors=][= if ($power || $power eq 0) { if ($planeswalker eq 'true') { - $OUT .= "\n this.addAbility(new PlanswalkerEntersWithLoyalityCountersAbility($power));"; + $OUT .= "\n this.addAbility(new PlaneswalkerEntersWithLoyaltyCountersAbility($power));"; } else { $OUT .= "\n this.power = new MageInt($power);"; $OUT .= "\n this.toughness = new MageInt($toughness);";