From 60ef4ce0da8d164b8ccbafb2156ce4728ea46059 Mon Sep 17 00:00:00 2001 From: spjspj Date: Tue, 4 Jul 2017 22:08:05 +1000 Subject: [PATCH] Implement 1 cards (HOU) --- .../src/mage/cards/c/ChampionOfWits.java | 52 ++++--------- .../src/mage/cards/r/ResilientKhenra.java | 78 +++++++++++++++++++ .../src/mage/sets/HourOfDevastation.java | 1 + 3 files changed, 93 insertions(+), 38 deletions(-) create mode 100644 Mage.Sets/src/mage/cards/r/ResilientKhenra.java diff --git a/Mage.Sets/src/mage/cards/c/ChampionOfWits.java b/Mage.Sets/src/mage/cards/c/ChampionOfWits.java index c861acbd6a..d280fac8f9 100644 --- a/Mage.Sets/src/mage/cards/c/ChampionOfWits.java +++ b/Mage.Sets/src/mage/cards/c/ChampionOfWits.java @@ -29,19 +29,18 @@ package mage.cards.c; import java.util.UUID; import mage.MageInt; -import mage.MageObject; import mage.abilities.Ability; import mage.abilities.common.EntersBattlefieldTriggeredAbility; import mage.abilities.costs.mana.ManaCostsImpl; -import mage.abilities.effects.OneShotEffect; +import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.dynamicvalue.common.SourcePermanentPowerCount; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.DrawCardSourceControllerEffect; +import mage.abilities.effects.common.discard.DiscardControllerEffect; import mage.abilities.keyword.EternalizeAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; -import mage.constants.Outcome; -import mage.game.Game; -import mage.game.permanent.Permanent; -import mage.players.Player; /** * @@ -58,7 +57,14 @@ public class ChampionOfWits extends CardImpl { this.toughness = new MageInt(1); // When Champion of Wits enters the battlefield, you may draw cards equal to its power. If you do, discard two cards - this.addAbility(new EntersBattlefieldTriggeredAbility(new ChampionOfWitsEffect(), true)); + DynamicValue xValue = new SourcePermanentPowerCount(); + Effect effect = new DrawCardSourceControllerEffect(xValue); + effect.setText("you may draw cards equal to its power"); + Ability ability = new EntersBattlefieldTriggeredAbility(effect, true); + effect = new DiscardControllerEffect(2); + effect.setText("If you do, discard two cards"); + ability.addEffect(effect); + this.addAbility(ability); // Eternalize {5}{U}{U} this.addAbility(new EternalizeAbility(new ManaCostsImpl("{5}{U}{U}"), this)); @@ -72,34 +78,4 @@ public class ChampionOfWits extends CardImpl { public ChampionOfWits copy() { return new ChampionOfWits(this); } -} - -class ChampionOfWitsEffect extends OneShotEffect { - - public ChampionOfWitsEffect() { - super(Outcome.Benefit); - staticText = "you may draw cards equal to its power. If you do, discard two cards."; - } - - public ChampionOfWitsEffect(final ChampionOfWitsEffect effect) { - super(effect); - } - - @Override - public boolean apply(Game game, Ability source) { - Permanent permanent = game.getPermanentOrLKIBattlefield(source.getSourceId()); - Player controller = game.getPlayer(source.getControllerId()); - MageObject sourceObject = game.getObject(source.getSourceId()); - if (controller != null && permanent != null && sourceObject != null) { - controller.drawCards(permanent.getPower().getValue(), game); - controller.discard(2, false, source, game); - return true; - } - return false; - } - - @Override - public ChampionOfWitsEffect copy() { - return new ChampionOfWitsEffect(this); - } -} +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/cards/r/ResilientKhenra.java b/Mage.Sets/src/mage/cards/r/ResilientKhenra.java new file mode 100644 index 0000000000..88533bde67 --- /dev/null +++ b/Mage.Sets/src/mage/cards/r/ResilientKhenra.java @@ -0,0 +1,78 @@ +/* + * 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.r; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.dynamicvalue.common.SourcePermanentPowerCount; +import mage.abilities.effects.common.continuous.BoostTargetEffect; +import mage.abilities.keyword.EternalizeAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.target.common.TargetCreaturePermanent; + +/** + * + * @author spjspj + */ +public class ResilientKhenra extends CardImpl { + + public ResilientKhenra(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{G}"); + + this.subtype.add("Jackal"); + this.subtype.add("Wizard"); + this.power = new MageInt(2); + this.toughness = new MageInt(2); + + // When Resilient Khenra enters the battlefield, you may have target creature get +X/+X until end of turn, where X is Resilient Khenra's power. + DynamicValue xValue = new SourcePermanentPowerCount(); + Ability ability = new EntersBattlefieldTriggeredAbility(new BoostTargetEffect(xValue, xValue, Duration.EndOfTurn, true), true); + ability.addTarget(new TargetCreaturePermanent()); + this.addAbility(ability); + + // Eternalize {4}{G}{G} + this.addAbility(new EternalizeAbility(new ManaCostsImpl("{4}{G}{G}"), this)); + + } + + public ResilientKhenra(final ResilientKhenra card) { + super(card); + } + + @Override + public ResilientKhenra copy() { + return new ResilientKhenra(this); + } +} diff --git a/Mage.Sets/src/mage/sets/HourOfDevastation.java b/Mage.Sets/src/mage/sets/HourOfDevastation.java index 30b42df5f9..fafa94997b 100644 --- a/Mage.Sets/src/mage/sets/HourOfDevastation.java +++ b/Mage.Sets/src/mage/sets/HourOfDevastation.java @@ -142,6 +142,7 @@ public class HourOfDevastation extends ExpansionSet { cards.add(new SetCardInfo("Razaketh's Rite", 74, Rarity.UNCOMMON, mage.cards.r.RazakethsRite.class)); cards.add(new SetCardInfo("Reason // Believe", 154, Rarity.RARE, mage.cards.r.ReasonBelieve.class)); cards.add(new SetCardInfo("Refuse // Cooperate", 156, Rarity.RARE, mage.cards.r.RefuseCooperate.class)); + cards.add(new SetCardInfo("Resilient Khenra", 131, Rarity.RARE, mage.cards.r.ResilientKhenra.class)); cards.add(new SetCardInfo("Resolute Survivors", 142, Rarity.UNCOMMON, mage.cards.r.ResoluteSurvivors.class)); cards.add(new SetCardInfo("Rhonas's Last Stand", 132, Rarity.RARE, mage.cards.r.RhonassLastStand.class)); cards.add(new SetCardInfo("Rhonas's Stalwart", 133, Rarity.COMMON, mage.cards.r.RhonassStalwart.class));