From a5c6cdd9cfa05ede47ff2aa57bca2fac5f5d6860 Mon Sep 17 00:00:00 2001 From: JOAC69 Date: Sun, 25 Sep 2016 00:16:01 -0500 Subject: [PATCH] Refactor - moved OozeToken to shared area --- .../src/mage/sets/gatecrash/MimingSlime.java | 26 +++++-------------- .../src/mage/sets/gatecrash/OozeFlux.java | 1 + .../src/mage/sets/magic2011/MitoticSlime.java | 15 ++--------- .../sets/returntoravnica/SlimeMolding.java | 24 ++++------------- .../riseoftheeldrazi/GelatinousGenesis.java | 14 +--------- .../shadowsoverinnistrad/InexorableBlob.java | 19 +++----------- .../sets/worldwake/CorruptedZendikon.java | 22 ++++------------ .../mage/game/permanent/token/OozeToken.java | 24 +++++++++++++++++ 8 files changed, 49 insertions(+), 96 deletions(-) create mode 100644 Mage/src/main/java/mage/game/permanent/token/OozeToken.java diff --git a/Mage.Sets/src/mage/sets/gatecrash/MimingSlime.java b/Mage.Sets/src/mage/sets/gatecrash/MimingSlime.java index 1146f4d423..3b6fc68a83 100644 --- a/Mage.Sets/src/mage/sets/gatecrash/MimingSlime.java +++ b/Mage.Sets/src/mage/sets/gatecrash/MimingSlime.java @@ -27,21 +27,21 @@ */ package mage.sets.gatecrash; -import java.util.List; -import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Outcome; -import mage.constants.Rarity; -import mage.MageInt; import mage.abilities.Ability; import mage.abilities.effects.OneShotEffect; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; import mage.filter.common.FilterCreaturePermanent; import mage.game.Game; import mage.game.permanent.Permanent; -import mage.game.permanent.token.Token; +import mage.game.permanent.token.OozeToken; import mage.players.Player; +import java.util.List; +import java.util.UUID; + /** * * @author LevelX2 @@ -103,15 +103,3 @@ class MimingSlimeEffect extends OneShotEffect { return false; } } - -class OozeToken extends Token { - public OozeToken() { - super("Ooze", "X/X green Ooze creature token"); - cardType.add(CardType.CREATURE); - subtype.add("Ooze"); - color.setGreen(true); - power = new MageInt(0); - toughness = new MageInt(0); - setOriginalExpansionSetCode("RTR"); - } -} diff --git a/Mage.Sets/src/mage/sets/gatecrash/OozeFlux.java b/Mage.Sets/src/mage/sets/gatecrash/OozeFlux.java index 074fec116f..a97fdc6e7b 100644 --- a/Mage.Sets/src/mage/sets/gatecrash/OozeFlux.java +++ b/Mage.Sets/src/mage/sets/gatecrash/OozeFlux.java @@ -42,6 +42,7 @@ import mage.cards.CardImpl; import mage.counters.CounterType; import mage.filter.common.FilterControlledCreaturePermanent; import mage.game.Game; +import mage.game.permanent.token.OozeToken; import mage.game.permanent.token.Token; /** diff --git a/Mage.Sets/src/mage/sets/magic2011/MitoticSlime.java b/Mage.Sets/src/mage/sets/magic2011/MitoticSlime.java index ee8e6f69f1..b9bf247756 100644 --- a/Mage.Sets/src/mage/sets/magic2011/MitoticSlime.java +++ b/Mage.Sets/src/mage/sets/magic2011/MitoticSlime.java @@ -35,6 +35,7 @@ import mage.MageInt; import mage.abilities.common.DiesTriggeredAbility; import mage.abilities.effects.common.CreateTokenEffect; import mage.cards.CardImpl; +import mage.game.permanent.token.OozeToken; import mage.game.permanent.token.Token; /** @@ -74,18 +75,6 @@ class Ooze2Token extends Token { color.setGreen(true); power = new MageInt(2); toughness = new MageInt(2); - this.addAbility(new DiesTriggeredAbility(new CreateTokenEffect(new Ooze1Token(), 2), false)); - } -} - -class Ooze1Token extends Token { - - public Ooze1Token() { - super("Ooze", "1/1 green Ooze creature tokens"); - cardType.add(CardType.CREATURE); - subtype.add("Ooze"); - color.setGreen(true); - power = new MageInt(1); - toughness = new MageInt(1); + this.addAbility(new DiesTriggeredAbility(new CreateTokenEffect(new OozeToken(new MageInt(1), new MageInt(1)), 2), false)); } } diff --git a/Mage.Sets/src/mage/sets/returntoravnica/SlimeMolding.java b/Mage.Sets/src/mage/sets/returntoravnica/SlimeMolding.java index d18e1990e6..ba508dd722 100644 --- a/Mage.Sets/src/mage/sets/returntoravnica/SlimeMolding.java +++ b/Mage.Sets/src/mage/sets/returntoravnica/SlimeMolding.java @@ -27,17 +27,16 @@ */ package mage.sets.returntoravnica; -import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; -import mage.MageInt; import mage.abilities.Ability; import mage.abilities.effects.OneShotEffect; import mage.cards.CardImpl; +import mage.constants.CardType; import mage.constants.Outcome; +import mage.constants.Rarity; import mage.game.Game; -import mage.game.permanent.token.Token; +import mage.game.permanent.token.OozeToken; + +import java.util.UUID; /** * @@ -91,16 +90,3 @@ class SlimeMoldingEffect extends OneShotEffect { return new SlimeMoldingEffect(this); } } - -class OozeToken extends Token { - - public OozeToken() { - super("Ooze", "X/X green ooze creature token"); - - cardType.add(CardType.CREATURE); - color.setGreen(true); - subtype.add("Ooze"); - power = new MageInt(0); - toughness = new MageInt(0); - } -} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/riseoftheeldrazi/GelatinousGenesis.java b/Mage.Sets/src/mage/sets/riseoftheeldrazi/GelatinousGenesis.java index 195e675e3c..5cf70f7e1f 100644 --- a/Mage.Sets/src/mage/sets/riseoftheeldrazi/GelatinousGenesis.java +++ b/Mage.Sets/src/mage/sets/riseoftheeldrazi/GelatinousGenesis.java @@ -31,13 +31,12 @@ import java.util.UUID; import mage.constants.CardType; import mage.constants.Rarity; -import mage.MageInt; import mage.abilities.Ability; import mage.abilities.effects.OneShotEffect; import mage.cards.CardImpl; import mage.constants.Outcome; import mage.game.Game; -import mage.game.permanent.token.Token; +import mage.game.permanent.token.OozeToken; /** * @@ -92,14 +91,3 @@ class GelatinousGenesisEffect extends OneShotEffect { } } -class OozeToken extends Token { - - public OozeToken() { - super("Ooze", "X/X green ooze creature token"); - cardType.add(CardType.CREATURE); - color.setGreen(true); - subtype.add("Ooze"); - power = new MageInt(0); - toughness = new MageInt(0); - } -} diff --git a/Mage.Sets/src/mage/sets/shadowsoverinnistrad/InexorableBlob.java b/Mage.Sets/src/mage/sets/shadowsoverinnistrad/InexorableBlob.java index 35084410ab..27a22512ea 100644 --- a/Mage.Sets/src/mage/sets/shadowsoverinnistrad/InexorableBlob.java +++ b/Mage.Sets/src/mage/sets/shadowsoverinnistrad/InexorableBlob.java @@ -27,7 +27,6 @@ */ package mage.sets.shadowsoverinnistrad; -import java.util.UUID; import mage.MageInt; import mage.abilities.common.AttacksTriggeredAbility; import mage.abilities.condition.common.DeliriumCondition; @@ -36,7 +35,9 @@ import mage.abilities.effects.common.CreateTokenEffect; import mage.cards.CardImpl; import mage.constants.CardType; import mage.constants.Rarity; -import mage.game.permanent.token.Token; +import mage.game.permanent.token.OozeToken; + +import java.util.UUID; /** * @@ -53,7 +54,7 @@ public class InexorableBlob extends CardImpl { // Delirium — Whenever Inexorable Blob attacks and there are at least four card types among cards in your graveyard, // put a 3/3 green Ooze creature token onto the battlefield tapped and attacking. - this.addAbility(new ConditionalTriggeredAbility(new AttacksTriggeredAbility(new CreateTokenEffect(new OozeToken(), 1, true, true), false), + this.addAbility(new ConditionalTriggeredAbility(new AttacksTriggeredAbility(new CreateTokenEffect(new OozeToken(new MageInt(3), new MageInt(3)), 1, true, true), false), DeliriumCondition.getInstance(), "Delirium — Whenever {this} attacks and there are at least four card types among cards in your graveyard, " + "put a 3/3 green Ooze creature token onto the battlefield tapped and attacking.")); @@ -68,15 +69,3 @@ public class InexorableBlob extends CardImpl { return new InexorableBlob(this); } } - -class OozeToken extends Token { - - public OozeToken() { - super("Ooze", "3/3 green Ooze creature token"); - cardType.add(CardType.CREATURE); - subtype.add("Ooze"); - color.setGreen(true); - power = new MageInt(3); - toughness = new MageInt(3); - } -} diff --git a/Mage.Sets/src/mage/sets/worldwake/CorruptedZendikon.java b/Mage.Sets/src/mage/sets/worldwake/CorruptedZendikon.java index 2c1c64681f..eb497d354f 100644 --- a/Mage.Sets/src/mage/sets/worldwake/CorruptedZendikon.java +++ b/Mage.Sets/src/mage/sets/worldwake/CorruptedZendikon.java @@ -27,9 +27,6 @@ */ package mage.sets.worldwake; -import java.util.UUID; - -import mage.constants.*; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.DiesAttachedTriggeredAbility; @@ -39,10 +36,13 @@ import mage.abilities.effects.common.ReturnToHandAttachedEffect; import mage.abilities.effects.common.continuous.BecomesCreatureAttachedEffect; import mage.abilities.keyword.EnchantAbility; import mage.cards.CardImpl; -import mage.game.permanent.token.Token; +import mage.constants.*; +import mage.game.permanent.token.OozeToken; import mage.target.TargetPermanent; import mage.target.common.TargetLandPermanent; +import java.util.UUID; + /** * * @author jeffwadsworth @@ -65,7 +65,7 @@ public class CorruptedZendikon extends CardImpl { Ability ability = new EnchantAbility(auraTarget.getTargetName()); this.addAbility(ability); - Ability ability2 = new SimpleStaticAbility(Zone.BATTLEFIELD, new BecomesCreatureAttachedEffect(new OozeToken(), "Enchanted land is a 3/3 black Ooze creature. It's still a land.", Duration.WhileOnBattlefield)); + Ability ability2 = new SimpleStaticAbility(Zone.BATTLEFIELD, new BecomesCreatureAttachedEffect(new OozeToken(new MageInt(3), new MageInt(3)), "Enchanted land is a 3/3 black Ooze creature. It's still a land.", Duration.WhileOnBattlefield)); this.addAbility(ability2); Ability ability3 = new DiesAttachedTriggeredAbility(new ReturnToHandAttachedEffect(), "enchanted land", false, false); @@ -81,15 +81,3 @@ public class CorruptedZendikon extends CardImpl { return new CorruptedZendikon(this); } } - -class OozeToken extends Token { - - OozeToken() { - super("Ooze", "3/3 black Ooze creature"); - cardType.add(CardType.CREATURE); - color.setBlack(true); - subtype.add("Ooze"); - power = new MageInt(3); - toughness = new MageInt(3); - } -} diff --git a/Mage/src/main/java/mage/game/permanent/token/OozeToken.java b/Mage/src/main/java/mage/game/permanent/token/OozeToken.java new file mode 100644 index 0000000000..60e7d26ee0 --- /dev/null +++ b/Mage/src/main/java/mage/game/permanent/token/OozeToken.java @@ -0,0 +1,24 @@ +package mage.game.permanent.token; + +import mage.MageInt; +import mage.constants.CardType; + +public class OozeToken extends Token { + public OozeToken(MageInt power, MageInt toughness) { + super("Ooze", power + "/" + toughness + " green ooze creature token"); + cardType.add(CardType.CREATURE); + color.setGreen(true); + subtype.add("Ooze"); + power = new MageInt(0); + toughness = new MageInt(0); + } + + public OozeToken() { + super("Ooze", "X/X green ooze creature token"); + cardType.add(CardType.CREATURE); + color.setGreen(true); + subtype.add("Ooze"); + power = new MageInt(0); + toughness = new MageInt(0); + } +}