From 795bf74f1133fc09b80cb7002d967b76e9cf574b Mon Sep 17 00:00:00 2001 From: LoneFox Date: Sun, 20 Sep 2015 18:25:48 +0300 Subject: [PATCH] Add Demon token and use it for existing cards. --- .../sets/avacynrestored/DemonicRising.java | 16 +---- .../ObNixilisOfTheBlackOath.java | 24 +------- .../sets/innistrad/SkirsdagHighPriest.java | 17 +----- .../magicorigins/PriestOfTheBloodRite.java | 18 +----- .../mage/game/permanent/token/DemonToken.java | 60 +++++++++++++++++++ 5 files changed, 66 insertions(+), 69 deletions(-) create mode 100644 Mage/src/mage/game/permanent/token/DemonToken.java diff --git a/Mage.Sets/src/mage/sets/avacynrestored/DemonicRising.java b/Mage.Sets/src/mage/sets/avacynrestored/DemonicRising.java index b3f1f6ee60..c320fa3284 100644 --- a/Mage.Sets/src/mage/sets/avacynrestored/DemonicRising.java +++ b/Mage.Sets/src/mage/sets/avacynrestored/DemonicRising.java @@ -29,7 +29,6 @@ package mage.sets.avacynrestored; import mage.constants.CardType; import mage.constants.Rarity; -import mage.MageInt; import mage.ObjectColor; import mage.abilities.TriggeredAbility; import mage.abilities.common.BeginningOfYourEndStepTriggeredAbility; @@ -38,7 +37,7 @@ import mage.abilities.decorator.ConditionalTriggeredAbility; import mage.abilities.effects.common.CreateTokenEffect; import mage.abilities.keyword.FlyingAbility; import mage.cards.CardImpl; -import mage.game.permanent.token.Token; +import mage.game.permanent.token.DemonToken; import java.util.UUID; @@ -53,7 +52,6 @@ public class DemonicRising extends CardImpl { super(ownerId, 94, "Demonic Rising", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{3}{B}{B}"); this.expansionSetCode = "AVR"; - // At the beginning of your end step, if you control exactly one creature, put a 5/5 black Demon creature token with flying onto the battlefield. TriggeredAbility ability = new BeginningOfYourEndStepTriggeredAbility(new CreateTokenEffect(new DemonToken()), false); this.addAbility(new ConditionalTriggeredAbility(ability, OneControlledCreatureCondition.getInstance(), ruleText)); @@ -68,15 +66,3 @@ public class DemonicRising extends CardImpl { return new DemonicRising(this); } } - -class DemonToken extends Token { - public DemonToken() { - super("Demon", "a 5/5 black Demon creature token with flying"); - cardType.add(CardType.CREATURE); - color.setBlack(true); - subtype.add("Demon"); - power = new MageInt(5); - toughness = new MageInt(5); - addAbility(FlyingAbility.getInstance()); - } -} diff --git a/Mage.Sets/src/mage/sets/commander2014/ObNixilisOfTheBlackOath.java b/Mage.Sets/src/mage/sets/commander2014/ObNixilisOfTheBlackOath.java index 79cb66aa24..2593433d2e 100644 --- a/Mage.Sets/src/mage/sets/commander2014/ObNixilisOfTheBlackOath.java +++ b/Mage.Sets/src/mage/sets/commander2014/ObNixilisOfTheBlackOath.java @@ -28,7 +28,6 @@ package mage.sets.commander2014; import java.util.UUID; -import mage.MageInt; import mage.abilities.Ability; import mage.abilities.LoyaltyAbility; import mage.abilities.common.CanBeYourCommanderAbility; @@ -55,7 +54,7 @@ import mage.constants.Zone; import mage.counters.CounterType; import mage.game.Game; import mage.game.command.Emblem; -import mage.game.permanent.token.Token; +import mage.game.permanent.token.DemonToken; import mage.players.Player; import mage.target.common.TargetControlledCreaturePermanent; @@ -77,13 +76,13 @@ public class ObNixilisOfTheBlackOath extends CardImpl { this.addAbility(new LoyaltyAbility(new ObNixilisOfTheBlackOathEffect1(), 2)); // -2: Put a 5/5 black Demon creature token with flying onto the battlefield. You lose 2 life. - LoyaltyAbility loyaltyAbility = new LoyaltyAbility(new CreateTokenEffect(new ObNixilisDemonToken()), -2); + LoyaltyAbility loyaltyAbility = new LoyaltyAbility(new CreateTokenEffect(new DemonToken()), -2); loyaltyAbility.addEffect(new LoseLifeSourceControllerEffect(2)); this.addAbility(loyaltyAbility); // -8: You get an emblem with "{1}{B}, Sacrifice a creature: You gain X life and draw X cards, where X is the sacrificed creature's power." this.addAbility(new LoyaltyAbility(new GetEmblemEffect(new ObNixilisOfTheBlackOathEmblem()), -8)); - + // Ob Nixilis of the Black Oath can be your commander. this.addAbility(CanBeYourCommanderAbility.getInstance()); } @@ -134,23 +133,6 @@ class ObNixilisOfTheBlackOathEffect1 extends OneShotEffect { } -class ObNixilisDemonToken extends Token { - - ObNixilisDemonToken() { - super("Demon", "5/5 black Demon creature token with flying"); - setTokenType(1); - setOriginalExpansionSetCode("C14"); - cardType.add(CardType.CREATURE); - subtype.add("Demon"); - - color.setBlack(true); - power = new MageInt(5); - toughness = new MageInt(5); - - addAbility(FlyingAbility.getInstance()); - } -} - class ObNixilisOfTheBlackOathEmblem extends Emblem { // You get an emblem with "{1}{B}, Sacrifice a creature: You gain X life and draw X cards, where X is the sacrificed creature's power." public ObNixilisOfTheBlackOathEmblem() { diff --git a/Mage.Sets/src/mage/sets/innistrad/SkirsdagHighPriest.java b/Mage.Sets/src/mage/sets/innistrad/SkirsdagHighPriest.java index 08e333a7ef..16fef1058f 100644 --- a/Mage.Sets/src/mage/sets/innistrad/SkirsdagHighPriest.java +++ b/Mage.Sets/src/mage/sets/innistrad/SkirsdagHighPriest.java @@ -44,7 +44,7 @@ import mage.filter.common.FilterControlledCreaturePermanent; import mage.filter.predicate.Predicates; import mage.filter.predicate.permanent.TappedPredicate; import mage.game.Game; -import mage.game.permanent.token.Token; +import mage.game.permanent.token.DemonToken; import mage.target.common.TargetControlledCreaturePermanent; /** @@ -111,18 +111,3 @@ class SkirsdagHighPriestCost extends CostImpl { return paid; } } - -class DemonToken extends Token { - - DemonToken() { - super("Demon", "5/5 black Demon creature token with flying"); - cardType.add(CardType.CREATURE); - subtype.add("Demon"); - - color.setBlack(true); - power = new MageInt(5); - toughness = new MageInt(5); - - addAbility(FlyingAbility.getInstance()); - } -} diff --git a/Mage.Sets/src/mage/sets/magicorigins/PriestOfTheBloodRite.java b/Mage.Sets/src/mage/sets/magicorigins/PriestOfTheBloodRite.java index 6eed42819e..ad78041315 100644 --- a/Mage.Sets/src/mage/sets/magicorigins/PriestOfTheBloodRite.java +++ b/Mage.Sets/src/mage/sets/magicorigins/PriestOfTheBloodRite.java @@ -38,7 +38,7 @@ import mage.cards.CardImpl; import mage.constants.CardType; import mage.constants.Rarity; import mage.constants.TargetController; -import mage.game.permanent.token.Token; +import mage.game.permanent.token.DemonToken; /** * @@ -70,19 +70,3 @@ public class PriestOfTheBloodRite extends CardImpl { return new PriestOfTheBloodRite(this); } } - -class DemonToken extends Token { - - DemonToken() { - super("Demon", "5/5 black Demon creature token with flying"); - cardType.add(CardType.CREATURE); - subtype.add("Demon"); - setOriginalExpansionSetCode("ORI"); - - color.setBlack(true); - power = new MageInt(5); - toughness = new MageInt(5); - - addAbility(FlyingAbility.getInstance()); - } -} diff --git a/Mage/src/mage/game/permanent/token/DemonToken.java b/Mage/src/mage/game/permanent/token/DemonToken.java new file mode 100644 index 0000000000..72231decd6 --- /dev/null +++ b/Mage/src/mage/game/permanent/token/DemonToken.java @@ -0,0 +1,60 @@ +/* +* 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.game.permanent.token; + +import java.util.Arrays; +import mage.constants.CardType; +import mage.MageInt; +import mage.abilities.keyword.FlyingAbility; + +/** + * + * @author LoneFox + */ +public class DemonToken extends Token { + + public DemonToken() { + super("Demon", "1/1 black Demon creature token with flying"); + cardType.add(CardType.CREATURE); + color.setBlack(true); + subtype.add("Demon"); + power = new MageInt(5); + toughness = new MageInt(5); + addAbility(FlyingAbility.getInstance()); + availableImageSetCodes.addAll(Arrays.asList("INN", "AVR", "C14", "ORI")); + } + + @Override + public void setExpansionSetCodeForImage(String code) { + super.setExpansionSetCodeForImage(code); + if (getOriginalExpansionSetCode().equals("C14")) { + this.setTokenType(2); + } + } +}