diff --git a/Mage.Sets/src/mage/cards/c/CurseOfOpulence.java b/Mage.Sets/src/mage/cards/c/CurseOfOpulence.java index c6c9359074..985f98d4a6 100644 --- a/Mage.Sets/src/mage/cards/c/CurseOfOpulence.java +++ b/Mage.Sets/src/mage/cards/c/CurseOfOpulence.java @@ -1,9 +1,5 @@ - package mage.cards.c; -import java.util.HashSet; -import java.util.Set; -import java.util.UUID; import mage.abilities.Ability; import mage.abilities.common.EnchantedPlayerAttackedTriggeredAbility; import mage.abilities.effects.Effect; @@ -23,8 +19,11 @@ import mage.players.Player; import mage.target.TargetPlayer; import mage.target.targetpointer.FixedTarget; +import java.util.HashSet; +import java.util.Set; +import java.util.UUID; + /** - * * @author Saga */ public final class CurseOfOpulence extends CardImpl { @@ -44,7 +43,7 @@ public final class CurseOfOpulence extends CardImpl { this.addAbility(new EnchantedPlayerAttackedTriggeredAbility(new CurseOfOpulenceEffect())); } - public CurseOfOpulence(final CurseOfOpulence card) { + private CurseOfOpulence(final CurseOfOpulence card) { super(card); } @@ -58,12 +57,10 @@ class CurseOfOpulenceEffect extends OneShotEffect { CurseOfOpulenceEffect() { super(Outcome.Benefit); - this.staticText = "create a colorless artifact token named Gold. It has " - + "\"sacrifice this artifact: Add one mana of any color.\" " - + "Each opponent attacking that player does the same."; + this.staticText = "create a Gold token. Each opponent attacking that player does the same."; } - CurseOfOpulenceEffect(final CurseOfOpulenceEffect effect) { + private CurseOfOpulenceEffect(final CurseOfOpulenceEffect effect) { super(effect); } @@ -75,28 +72,28 @@ class CurseOfOpulenceEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { Permanent enchantment = game.getPermanentOrLKIBattlefield(source.getSourceId()); - if (enchantment != null) { - Player enchantedPlayer = game.getPlayer(enchantment.getAttachedTo()); - if (enchantedPlayer != null) { - Set players = new HashSet<>(); - for (UUID attacker : game.getCombat().getAttackers()) { - UUID defender = game.getCombat().getDefenderId(attacker); - if (defender.equals(enchantedPlayer.getId()) - && game.getPlayer(source.getControllerId()).hasOpponent(game.getPermanent(attacker).getControllerId(), game)) { - players.add(game.getPermanent(attacker).getControllerId()); - } - } - players.add(source.getControllerId()); - for (UUID player : players) { - game.getPlayer(player); - Effect effect = new CreateTokenTargetEffect(new GoldToken()); - effect.setTargetPointer(new FixedTarget(player)); - effect.apply(game, source); - } - } - return true; - + if (enchantment == null) { + return false; } - return false; + Player enchantedPlayer = game.getPlayer(enchantment.getAttachedTo()); + if (enchantedPlayer == null) { + return false; + } + Set players = new HashSet<>(); + for (UUID attacker : game.getCombat().getAttackers()) { + UUID defender = game.getCombat().getDefenderId(attacker); + if (defender.equals(enchantedPlayer.getId()) + && game.getPlayer(source.getControllerId()).hasOpponent(game.getPermanent(attacker).getControllerId(), game)) { + players.add(game.getPermanent(attacker).getControllerId()); + } + } + players.add(source.getControllerId()); + for (UUID player : players) { + game.getPlayer(player); + Effect effect = new CreateTokenTargetEffect(new GoldToken()); + effect.setTargetPointer(new FixedTarget(player)); + effect.apply(game, source); + } + return true; } } diff --git a/Mage.Sets/src/mage/cards/g/Gild.java b/Mage.Sets/src/mage/cards/g/Gild.java index 7f6141ab77..d48e3d98ad 100644 --- a/Mage.Sets/src/mage/cards/g/Gild.java +++ b/Mage.Sets/src/mage/cards/g/Gild.java @@ -1,7 +1,5 @@ - package mage.cards.g; -import java.util.UUID; import mage.abilities.effects.Effect; import mage.abilities.effects.common.CreateTokenEffect; import mage.abilities.effects.common.ExileTargetEffect; @@ -11,22 +9,21 @@ import mage.constants.CardType; import mage.game.permanent.token.GoldToken; import mage.target.common.TargetCreaturePermanent; +import java.util.UUID; + /** - * * @author LevelX2 */ public final class Gild extends CardImpl { public Gild(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{3}{B}"); - + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{3}{B}"); // Exile target creature. this.getSpellAbility().addEffect(new ExileTargetEffect()); this.getSpellAbility().addTarget(new TargetCreaturePermanent()); // Create a colorless artifact token named Gold. It has "Sacrifice this artifact: Add one mana of any color." Effect effect = new CreateTokenEffect(new GoldToken()); - effect.setText("Create a colorless artifact token named Gold. It has \"Sacrifice this artifact: Add one mana of any color.\""); this.getSpellAbility().addEffect(effect); } diff --git a/Mage.Sets/src/mage/cards/k/KingMacarTheGoldCursed.java b/Mage.Sets/src/mage/cards/k/KingMacarTheGoldCursed.java index c9ce38abf2..804dbb30c1 100644 --- a/Mage.Sets/src/mage/cards/k/KingMacarTheGoldCursed.java +++ b/Mage.Sets/src/mage/cards/k/KingMacarTheGoldCursed.java @@ -1,4 +1,3 @@ - package mage.cards.k; import mage.MageInt; @@ -34,7 +33,7 @@ public final class KingMacarTheGoldCursed extends CardImpl { Ability ability = new InspiredAbility(new ExileTargetEffect(), true); ability.addTarget(new TargetCreaturePermanent()); Effect effect = new CreateTokenEffect(new GoldToken()); - effect.setText("If you do, create a colorless artifact token named Gold. It has \"Sacrifice this artifact: Add one mana of any color.\""); + effect.setText("If you do, create a Gold token"); ability.addEffect(effect); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/t/TheFirstIroanGames.java b/Mage.Sets/src/mage/cards/t/TheFirstIroanGames.java index 0fb645d1c5..2110079f1a 100644 --- a/Mage.Sets/src/mage/cards/t/TheFirstIroanGames.java +++ b/Mage.Sets/src/mage/cards/t/TheFirstIroanGames.java @@ -54,10 +54,7 @@ public final class TheFirstIroanGames extends CardImpl { sagaAbility.addHint(FerociousHint.instance); // IV — Create a Gold token. - sagaAbility.addChapterEffect( - this, SagaChapter.CHAPTER_IV, new CreateTokenEffect(new GoldToken()) - .setText("create a Gold token") - ); + sagaAbility.addChapterEffect(this, SagaChapter.CHAPTER_IV, new CreateTokenEffect(new GoldToken())); } private TheFirstIroanGames(final TheFirstIroanGames card) { diff --git a/Mage/src/main/java/mage/constants/SubType.java b/Mage/src/main/java/mage/constants/SubType.java index 4c495ad93b..3aef6dae37 100644 --- a/Mage/src/main/java/mage/constants/SubType.java +++ b/Mage/src/main/java/mage/constants/SubType.java @@ -43,6 +43,7 @@ public enum SubType { EQUIPMENT("Equipment", SubTypeSet.ArtifactType), FOOD("Food", SubTypeSet.ArtifactType), FORTIFICATION("Fortification", SubTypeSet.ArtifactType), + GOLD("Gold", SubTypeSet.ArtifactType), TREASURE("Treasure", SubTypeSet.ArtifactType), VEHICLE("Vehicle", SubTypeSet.ArtifactType), // 205.3m : Creatures and tribals share their lists of subtypes; these subtypes are called creature types. diff --git a/Mage/src/main/java/mage/game/permanent/token/GoldToken.java b/Mage/src/main/java/mage/game/permanent/token/GoldToken.java index 65f263911b..9f82f171dc 100644 --- a/Mage/src/main/java/mage/game/permanent/token/GoldToken.java +++ b/Mage/src/main/java/mage/game/permanent/token/GoldToken.java @@ -1,41 +1,38 @@ - - package mage.game.permanent.token; +import mage.abilities.costs.Cost; +import mage.abilities.costs.common.SacrificeSourceCost; +import mage.abilities.mana.AnyColorManaAbility; +import mage.constants.CardType; +import mage.constants.SubType; + import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import mage.abilities.costs.common.SacrificeSourceCost; -import mage.abilities.effects.mana.AddManaOfAnyColorEffect; -import mage.abilities.mana.SimpleManaAbility; -import mage.constants.CardType; -import mage.constants.Zone; /** - * * @author LevelX2 */ public final class GoldToken extends TokenImpl { - + static final private List tokenImageSets = new ArrayList<>(); + static { - tokenImageSets.addAll(Arrays.asList("BNG", "C17")); + tokenImageSets.addAll(Arrays.asList("BNG", "C17", "THB")); } public GoldToken() { - this((String)null); - } - - public GoldToken(String setCode) { - super("Gold", "colorless artifact token named Gold with \"Sacrifice this artifact: Add one mana of any color.\""); + super("Gold", "Gold token"); availableImageSetCodes = tokenImageSets; - setOriginalExpansionSetCode(setCode); cardType.add(CardType.ARTIFACT); + subtype.add(SubType.GOLD); - this.addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, new AddManaOfAnyColorEffect(), new SacrificeSourceCost())); + Cost cost = new SacrificeSourceCost(); + cost.setText("Sacrifice this artifact"); + this.addAbility(new AnyColorManaAbility(cost)); } - public GoldToken(final GoldToken token) { + private GoldToken(final GoldToken token) { super(token); }