diff --git a/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/CardImageSource.java b/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/CardImageSource.java index b84f07cc1ad..5ac34ceb127 100644 --- a/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/CardImageSource.java +++ b/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/CardImageSource.java @@ -10,6 +10,8 @@ public interface CardImageSource { String generateURL(CardDownloadData card) throws Exception; String generateTokenUrl(CardDownloadData card) throws Exception; + String getNextHttpImageUrl(); + String getFileForHttpImage(String httpImageUrl); String getSourceName(); Float getAverageSize(); } diff --git a/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/MagicCardsImageSource.java b/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/MagicCardsImageSource.java index b6e2663a7ad..51955906833 100644 --- a/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/MagicCardsImageSource.java +++ b/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/MagicCardsImageSource.java @@ -151,6 +151,16 @@ public class MagicCardsImageSource implements CardImageSource { } return instance; } + + @Override + public String getNextHttpImageUrl() { + return null; + } + + @Override + public String getFileForHttpImage(String httpImageUrl) { + return null; + } @Override public String generateURL(CardDownloadData card) throws Exception { diff --git a/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/MtgImageSource.java b/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/MtgImageSource.java index 1ff1f21c035..b7f77ac791b 100644 --- a/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/MtgImageSource.java +++ b/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/MtgImageSource.java @@ -54,6 +54,16 @@ public class MtgImageSource implements CardImageSource { public String getSourceName() { return "mtgimage.com"; } + + @Override + public String getNextHttpImageUrl() { + return null; + } + + @Override + public String getFileForHttpImage(String httpImageUrl) { + return null; + } @Override public String generateURL(CardDownloadData card) throws Exception { diff --git a/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/MtgOnlTokensImageSource.java b/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/MtgOnlTokensImageSource.java new file mode 100644 index 00000000000..f91179d0b4b --- /dev/null +++ b/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/MtgOnlTokensImageSource.java @@ -0,0 +1,358 @@ +/* + * 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 org.mage.plugins.card.dl.sources; + +import java.io.IOException; +import java.net.URL; +import java.util.HashMap; +import org.apache.log4j.Logger; +import org.mage.plugins.card.images.CardDownloadData; +import org.mage.plugins.card.images.DownloadPictures; + +/** + * + * @author spjspj + */ +public class MtgOnlTokensImageSource implements CardImageSource { + + private static final Logger logger = Logger.getLogger(MtgOnlTokensImageSource.class); + + private static CardImageSource instance = new MtgOnlTokensImageSource(); + + public static CardImageSource getInstance() { + if (instance == null) { + instance = new MtgOnlTokensImageSource(); + } + return instance; + } + + @Override + public String getSourceName() { + return "http://mtg.onl/token-list/tokens/"; + } + + @Override + public Float getAverageSize() { + return 26.7f; + } + + @Override + public String getNextHttpImageUrl() { + if (copyUrlToImage == null) { + setupLinks(); + } + + for (String key : copyUrlToImageDone.keySet()) { + if (copyUrlToImageDone.get(key) == false) { + copyUrlToImageDone.put(key, true); + return key; + } + } + return null; + } + + @Override + public String getFileForHttpImage(String httpImageUrl) { + if (httpImageUrl != null) { + return copyUrlToImage.get(httpImageUrl); + } + return null; + } + + @Override + public String generateURL(CardDownloadData card) throws Exception { + return null; + } + + HashMap copyUrlToImage = null; + HashMap copyImageToUrl = null; + HashMap copyUrlToImageDone = null; + + private void setupLinks() { + if (copyUrlToImage != null) { + return; + } + copyUrlToImage = new HashMap(); + copyImageToUrl = new HashMap(); + copyUrlToImageDone = new HashMap(); + copyUrlToImage.put("Angel_B_3_3.jpg", "ANGEL.B.ANGEL.CREATURE.3.3.full.jpg"); + copyUrlToImage.put("Angel_W_3_3.jpg", "ANGEL.W.ANGEL.CREATURE.3.3.full.jpg"); + copyUrlToImage.put("Angel_W_4_4.jpg", "ANGEL.W.ANGEL.CREATURE.4.4.full.jpg"); + copyUrlToImage.put("Ape_G_2_2.jpg", "APE.G.APE.CREATURE.2.2.full.jpg"); + copyUrlToImage.put("Ape_G_3_3.jpg", "APE.G.APE.CREATURE.3.3.full.jpg"); + copyUrlToImage.put("Ashaya_the_Awoken_World_G_4_4.jpg", "ASHAYATHEAWOKENWORLD.G.ELEMENTAL.CREATURE.4.4.full.jpg"); + copyUrlToImage.put("Assassin_B_1_1.jpg", "ASSASSIN.B.ASSASSIN.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Assembly-Worker_2_2.jpg", "ASSEMBLYWORKER..ASSEMBLYWORKER.ARTIFACTCREATURE.2.2.full.jpg"); + copyUrlToImage.put("Avatar_W_y_y.jpg", "AVATAR.W.AVATAR.CREATURE.S.S.full.jpg"); + copyUrlToImage.put("Bat_B_1_1.jpg", "BAT.B.BAT.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Bat_B_1_2.jpg", "BAT.B.BAT.CREATURE.1.2.full.jpg"); + copyUrlToImage.put("Bear_G_2_2.jpg", "BEAR.G.BEAR.CREATURE.2.2.full.jpg"); + copyUrlToImage.put("Bear_G_4_4.jpg", "BEAR.G.BEAR.CREATURE.4.4.full.jpg"); + copyUrlToImage.put("Beast_B_3_3.jpg", "BEAST.B.BEAST.CREATURE.3.3.full.jpg"); + copyUrlToImage.put("Beast_G_3_3.jpg", "BEAST.G.BEAST.CREATURE.3.3.full.jpg"); + copyUrlToImage.put("Beast_G_2_2.jpg", "BEAST.G.BEAST.CREATURE.2.2.full.jpg"); + copyUrlToImage.put("Beast_G_4_4.jpg", "BEAST.G.BEAST.CREATURE.4.4.full.jpg"); + copyUrlToImage.put("Beast_G_5_5.jpg", "BEAST.G.BEAST.CREATURE.5.5.full.jpg"); + copyUrlToImage.put("Beast_RGW_8_8.jpg", "BEAST.WRG.BEAST.CREATURE.8.8.full.jpg"); + copyUrlToImage.put("Bird_Soldier_W_1_1.jpg", "BIRDSOLDIER.W.BIRD.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Bird_U_1_1.jpg", "BIRD.U.BIRD.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Bird_U_2_2.jpg", "BIRD.U.BIRD.CREATURE.2.2.full.jpg"); + copyUrlToImage.put("Bird_U_2_2_Enchantment.jpg", "BIRD.U.BIRD.ENCHANTMENTCREATURE.2.2.full.jpg"); + copyUrlToImage.put("Bird_WU_1_1.jpg", "BIRD.WU.BIRD.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Bird_W_1_1.jpg", "BIRD.W.BIRD.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Bird_W_3_3.jpg", "BIRD.W.BIRD.CREATURE.3.3.full.jpg"); + copyUrlToImage.put("Bird_W_3_4.jpg", "BIRD.W.BIRD.CREATURE.3.4.full.jpg"); + copyUrlToImage.put("Boar_G_2_2.jpg", "BOAR.G.BOAR.CREATURE.2.2.full.jpg"); + copyUrlToImage.put("Boar_G_3_3.jpg", "BOAR.G.BOAR.CREATURE.3.3.full.jpg"); + copyUrlToImage.put("Butterfly_G_1_1.jpg", "BUTTERFLY.G.INSECT.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Camarid_U_1_1.jpg", "CAMARID.U.CAMARID.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Caribou_W_0_1.jpg", "CARIBOU.W.CARIBOU.CREATURE.0.1.full.jpg"); + copyUrlToImage.put("Carnivore_R_3_1.jpg", "CARNIVORE.R.BEAST.CREATURE.3.1.full.jpg"); + copyUrlToImage.put("Cat_B_2_1.jpg", "CAT.B.CAT.CREATURE.2.1.full.jpg"); + copyUrlToImage.put("Cat_G_1_1.jpg", "CAT.G.CAT.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Cat_R_1_1.jpg", "CAT.R.CAT.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Cat_Soldier_W_1_1.jpg", "CATSOLDIER.W.CATSOLDIER.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Cat_W_2_2.jpg", "CAT.W.CAT.CREATURE.2.2.full.jpg"); + copyUrlToImage.put("Cat_Warrior_G_2_2.jpg", "CATWARRIOR.G.CATWARRIOR.CREATURE.2.2.full.jpg"); + copyUrlToImage.put("Centaur_G_3_3.jpg", "CENTAUR.G.CENTAUR.CREATURE.3.3.full.jpg"); + copyUrlToImage.put("Centaur_G_3_3_Enchantment.jpg", "CENTAUR.G.CENTAUR.ENCHANTMENTCREATURE.3.3.full.jpg"); + copyUrlToImage.put("Centaur_G_3_3_protection.jpg", "CENTAUR.G.CENTAUR.CREATURE.3.3a.full.jpg"); + copyUrlToImage.put("Citizen_W_1_1.jpg", "CITIZEN.W.CITIZEN.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Cleric_WB_1_1.jpg", "CLERIC.WB.CLERIC.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Cleric_W_2_1.jpg", "CLERIC.W.CLERIC.CREATUREENCHANTMENT.2.1.full.jpg"); + copyUrlToImage.put("Cloud_Sprite_U_1_1.jpg", "CLOUDSPRITE.U.FAERIE.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Clue.jpg", "CLUE..CLUE.ARTIFACT.0.0.full.jpg"); + copyUrlToImage.put("Construct_1_1.jpg", "CONSTRUCT..CONSTRUCT.ARTIFACTCREATURE.1.1.full.jpg"); + copyUrlToImage.put("Construct_6_12.jpg", "CONSTRUCT..CONSTRUCT.CREATUREARTIFACT.6.12.full.jpg"); + copyUrlToImage.put("Demon_B_5_5.jpg", "DEMON.B.DEMON.CREATURE.5.5.full.jpg"); + copyUrlToImage.put("Demon_B_y_y.jpg", "DEMON.B.DEMON.CREATURE.S.S.full.jpg"); + copyUrlToImage.put("Devil_R_1_1.jpg", "DEVIL.R.DEVIL.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Djinn_5_5.jpg", "DJINN..DJINN.ARTIFACTCREATURE.5.5.full.jpg"); + copyUrlToImage.put("Djinn_Monk_U_2_2.jpg", "DJINNMONK.U.DJINNMONK.CREATURE.2.2.full.jpg"); + copyUrlToImage.put("Dragon_RG_1_1.jpg", "DRAGON.RG.DRAGON.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Dragon_R_2_2.jpg", "DRAGON.R.DRAGON.CREATURE.2.2.full.jpg"); + copyUrlToImage.put("Dragon_R_4_4.jpg", "DRAGON.R.DRAGON.CREATURE.4.4.full.jpg"); + copyUrlToImage.put("Dragon_R_5_5.jpg", "DRAGON.R.DRAGON.CREATURE.5.5.full.jpg"); + copyUrlToImage.put("Dragon_R_6_6.jpg", "DRAGON.R.DRAGON.CREATURE.6.6.full.jpg"); + copyUrlToImage.put("Dragon_Spirit_U_5_5.jpg", "DRAGONSPIRIT.U.DRAGONSPIRIT.CREATURE.5.5.full.jpg"); + copyUrlToImage.put("Drake_UG_2_2.jpg", "DRAKE.UG.DRAKE.CREATURE.2.2.full.jpg"); + copyUrlToImage.put("Drake_U_2_2.jpg", "DRAKE.U.DRAKE.CREATURE.2.2.full.jpg"); + copyUrlToImage.put("Eldrazi_10_10.jpg", "ELDRAZI..ELDRAZI.CREATURE.10.10.full.jpg"); + copyUrlToImage.put("Eldrazi_Scion_1_1.jpg", "ELDRAZISCION..ELDRAZISCION.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Eldrazi_Spawn_0_1.jpg", "ELDRAZISPAWN..ELDRAZISPAWN.CREATURE.0.1.full.jpg"); + copyUrlToImage.put("Elemental_BR_5_5.jpg", "ELEMENTAL.BR.ELEMENTAL.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Elemental_GW_y_y.jpg", "ELEMENTAL.WG.ELEMENTAL.CREATURE.S.S.full.jpg"); + copyUrlToImage.put("Elemental_G_2_2.jpg", "ELEMENTAL.G.ELEMENTAL.CREATURE.2.2.full.jpg"); + copyUrlToImage.put("Elemental_G_4_4.jpg", "ELEMENTAL.G.ELEMENTAL.CREATURE.4.4.full.jpg"); + copyUrlToImage.put("Elemental_G_5_3.jpg", "ELEMENTAL.G.ELEMENTAL.CREATURE.5.3.full.jpg"); + copyUrlToImage.put("Elemental_G_7_7.jpg", "ELEMENTAL.G.ELEMENTAL.CREATURE.7.7.full.jpg"); + copyUrlToImage.put("Elemental_R_7_1.jpg", "ELEMENTAL.R.ELEMENTAL.CREATURE.7.1.full.jpg"); + copyUrlToImage.put("Elemental_Shaman_R_3_1.jpg", "ELEMENTALSHAMAN.R.ELEMENTALSHAMAN.CREATURE.3.1.full.jpg"); + copyUrlToImage.put("Elephant_G_3_3.jpg", "ELEPHANT.G.ELEPHANT.CREATURE.3.3.full.jpg"); + copyUrlToImage.put("Elf_Druid_G_1_1.jpg", "ELFDRUID.G.ELFDRUID.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Elf_G_1_1.jpg", "ELFWARRIOR.G.ELFWARRIOR.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Elf_Warrior_GW_1_1.jpg", "ELFWARRIOR.WG.ELFWARRIOR.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Elf_Warrior_G_1_1.jpg", "ELFWARRIOR.G.ELFWARRIOR.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Faerie_Rogue_B_1_1.jpg", "FAERIEROGUE.B.FAERIEROGUE.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Faerie_Rogue_UB_1_1.jpg", "FAERIEROGUE.UB.FAERIEROGUE.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Faerie_U_1_1.jpg", "FAERIE.U.FAERIE.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Festering_Goblin_B_1_1.jpg", "FESTERINGGOBLIN.B.ZOMBIEGOBLIN.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Fish_U_3_3.jpg", "FISH.U.FISH.CREATURE.3.3.full.jpg"); + copyUrlToImage.put("Frog_Lizard_G_3_3.jpg", "FROGLIZARD.G.FROGLIZARD.CREATURE.3.3.full.jpg"); + copyUrlToImage.put("Gargoyle_3_4.jpg", "GARGOYLE..GARGOYLE.CREATUREARTIFACT.3.4.full.jpg"); + copyUrlToImage.put("Germ_B_0_0.jpg", "GERM.B.GERM.CREATURE.0.0.full.jpg"); + copyUrlToImage.put("Giant_R_4_4.jpg", "GIANT.R.GIANT.CREATURE.4.4.full.jpg"); + copyUrlToImage.put("Giant_Warrior_RG_4_4.jpg", "GIANTWARRIOR.RG.GIANTWARRIOR.CREATURE.4.4.full.jpg"); + copyUrlToImage.put("Giant_Warrior_W_5_5.jpg", "GIANTWARRIOR.W.GIANTWARRIOR.CREATURE.5.5.full.jpg"); + copyUrlToImage.put("Gnome_1_1.jpg", "GNOME..GNOME.ARTIFACTCREATURE.1.1.full.jpg"); + copyUrlToImage.put("Goat_W_0_1.jpg", "GOAT.W.GOAT.CREATURE.0.1.full.jpg"); + copyUrlToImage.put("Goblin_R_1_1.jpg", "GOBLIN.R.GOBLIN.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Goblin_R_2_1.jpg", "GOBLIN.R.GOBLIN.CREATURE.2.1.full.jpg"); + copyUrlToImage.put("Goblin_Rogue_B_1_1.jpg", "GOBLINROGUE.B.GOBLINROGUE.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Goblin_Scout_R_1_1.jpg", "GOBLINSCOUT.R.GOBLINSCOUT.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Goblin_Soldier_RW_1_1.jpg", "GOBLINSOLDIER.WR.GOBLINSOLDIER.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Goblin_Warrior_RG_1_1.jpg", "GOBLINWARRIOR.RG.GOBLINWARRIOR.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Gold_.jpg", "GOLD...ARTIFACT.0.0.full.jpg"); + copyUrlToImage.put("Goldmeadow_Harrier_W_1_1.jpg", "GOLDMEADOWHARRIER.W.KITHKINSOLDIER.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Golem_3_3.jpg", "GOLEM..GOLEM.ARTIFACTCREATURE.3.3.full.jpg"); + copyUrlToImage.put("Golem_3_3_Enchantment.jpg", "GOLEM..GOLEM.ENCHANTMENTARTIFACTCREATURE.3.3.full.jpg"); + copyUrlToImage.put("Golem_9_9.jpg", "GOLEM..GOLEM.ARTIFACTCREATURE.9.9.full.jpg"); + copyUrlToImage.put("Graveborn_BR_3_1.jpg", "GRAVEBORN.BR.GRAVEBORN.CREATURE.3.1.full.jpg"); + copyUrlToImage.put("Griffin_W_2_2.jpg", "GRIFFIN.W.GRIFFIN.CREATURE.2.2.full.jpg"); + copyUrlToImage.put("Harpy_B_1_1.jpg", "HARPY.B.HARPY.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Hellion_R_4_4.jpg", "HELLION.R.HELLION.CREATURE.4.4.full.jpg"); + copyUrlToImage.put("Hippo_G_1_1.jpg", "HIPPO.G.HIPPO.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Homunculus_U_0_1.jpg", "HOMUNCULUS.U.HOMUNCULUS.CREATUREARTIFACT.0.1.full.jpg"); + copyUrlToImage.put("Homunculus_U_2_2.jpg", "HOMUNCULUS.U.HOMUNCULUS.CREATURE.2.2.full.jpg"); + copyUrlToImage.put("Hornet_1_1.jpg", "HORNET..INSECT.ARTIFACTCREATURE.1.1.full.jpg"); + copyUrlToImage.put("Horror_B_4_4.jpg", "HORROR.B.HORROR.CREATURE.4.4.full.jpg"); + copyUrlToImage.put("Horror_B_X_X.jpg", "HORROR.B.HORROR.CREATURE.X.X.full.jpg"); + copyUrlToImage.put("Horror_UB_1_1.jpg", "HORROR.UB.HORROR.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Horror_X_X.jpg", "HORROR..HORROR.ARTIFACTCREATURE.X.X.full.jpg"); + copyUrlToImage.put("Hound_G_1_1.jpg", "HOUND.G.HOUND.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Human_Cleric_WB_1_1.jpg", "HUMANCLERIC.WB.HUMANCLERIC.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Human_R_1_1.jpg", "HUMAN.R.HUMAN.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Human_Soldier_W_1_1.jpg", "HUMANSOLDIER.W.HUMANSOLDIER.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Human_W_1_1.jpg", "HUMAN.W.HUMAN.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Hydra_G_X_X.jpg", "HYDRA.G.HYDRA.CREATURE.X.X.full.jpg"); + copyUrlToImage.put("Illusion_U_1_1.jpg", "ILLUSION.U.ILLUSION.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Illusion_U_2_2.jpg", "ILLUSION.U.ILLUSION.CREATURE.2.2.full.jpg"); + copyUrlToImage.put("Insect_G_1_1.jpg", "INSECT.G.INSECT.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Insect_G_6_1.jpg", "INSECT.G.INSECT.CREATURE.6.1.full.jpg"); + copyUrlToImage.put("Kaldra_4_4.jpg", "KALDRA..AVATAR.CREATURE.4.4.full.jpg"); + copyUrlToImage.put("Kavu_B_3_3.jpg", "KAVU.B.KAVU.CREATURE.3.3.full.jpg"); + copyUrlToImage.put("Kelp_U_0_1.jpg", "KELP.U.PLANTWALL.CREATURE.0.1.full.jpg"); + copyUrlToImage.put("Kithkin_Soldier_W_1_1.jpg", "KITHKINSOLDIER.W.KITHKINSOLDIER.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Knight_Ally_W_2_2.jpg", "KNIGHTALLY.W.KNIGHTALLY.CREATURE.2.2.full.jpg"); + copyUrlToImage.put("Knight_B_2_2.jpg", "KNIGHT.B.KNIGHT.CREATURE.2.2.full.jpg"); + copyUrlToImage.put("Knight_W_1_1.jpg", "KNIGHT.W.KNIGHT.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Knight_W_2_2.jpg", "KNIGHT.W.KNIGHT.CREATURE.2.2.full.jpg"); + copyUrlToImage.put("Kobolds_of_Kher_Keep_R_0_1.jpg", "KOBOLDSOFKHERKEEP.R.KOBOLD.CREATURE.0.1.full.jpg"); + copyUrlToImage.put("Kor_Ally_W_1_1.jpg", "KORALLY.W.KORALLY.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Kor_Soldier_W_1_1.jpg", "KORSOLDIER.W.KORSOLDIER.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Kraken_U_9_9.jpg", "KRAKEN.U.KRAKEN.CREATURE.9.9.full.jpg"); + copyUrlToImage.put("Landmine_.jpg", "LANDMINE...ARTIFACT.0.0.full.jpg"); + copyUrlToImage.put("Lightning_Ranger_R_5_1.jpg", "LIGHTNINGRAGER.R.ELEMENTAL.CREATURE.5.1.full.jpg"); + copyUrlToImage.put("Lizard_G_2_2.jpg", "LIZARD.G.LIZARD.CREATURE.2.2.full.jpg"); + copyUrlToImage.put("Llanowar_Elves_G_1_1.jpg", "LLANOWARELVES.G.ELFDRUID.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Marit_Lage_B_20_20.jpg", "MARITLAGE.B.AVATAR.CREATURE.20.20.full.jpg"); + copyUrlToImage.put("Merfolk_U_1_1.jpg", "MERFOLK.U.MERFOLK.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Merfolk_Wizard_U_1_1.jpg", "MERFOLKWIZARD.U.MERFOLKWIZARD.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Metallic_Sliver_1_1.jpg", "METALLICSLIVER..SLIVER.CREATUREARTIFACT.1.1.full.jpg"); + copyUrlToImage.put("Minion_B_1_1.jpg", "MINION.B.MINION.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Minion_B_X_X.jpg", "MINION.B.MINION.CREATURE.X.X.full.jpg"); + copyUrlToImage.put("Minor_Demon_BR_1_1.jpg", "MINORDEMON.BR.DEMON.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Minotaur_R_2_3.jpg", "MINOTAUR.R.MINOTAUR.CREATURE.2.3.full.jpg"); + copyUrlToImage.put("Monk_W_1_1.jpg", "MONK.W.MONK.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Myr_1_1.jpg", "MYR..MYR.CREATUREARTIFACT.1.1.full.jpg"); + copyUrlToImage.put("Octopus_U_8_8.jpg", "OCTOPUS.U.OCTOPUS.CREATURE.8.8.full.jpg"); + copyUrlToImage.put("Ogre_R_3_3.jpg", "OGRE.R.OGRE.CREATURE.3.3.full.jpg"); + copyUrlToImage.put("Ogre_R_4_4.jpg", "OGRE.R.OGRE.CREATURE.4.4.full.jpg"); + copyUrlToImage.put("Ooze_G_1_1.jpg", "OOZE.G.OOZE.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Ooze_G_2_2.jpg", "OOZE.G.OOZE.CREATURE.2.2.full.jpg"); + copyUrlToImage.put("Ooze_G_3_3.jpg", "OOZE.G.OOZE.CREATURE.3.3.full.jpg"); + copyUrlToImage.put("Orb_U_X_X.jpg", "ORB.U.ORB.CREATURE.X.X.jpg.full.jpg"); + copyUrlToImage.put("Pegasus_W_1_1.jpg", "PEGASUS.W.PEGASUS.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Pentavite_1_1.jpg", "PENTAVITE..PENTAVITE.ARTIFACTCREATURE.1.1.full.jpg"); + copyUrlToImage.put("Pest_0_1.jpg", "PEST..PEST.ARTIFACTCREATURE.0.1.full.jpg"); + copyUrlToImage.put("Pincher_2_2.jpg", "PINCHER..PINCHER.CREATURE.2.2.full.jpg"); + copyUrlToImage.put("Plant_G_0_1.jpg", "PLANT.G.PLANT.CREATURE.0.1.full.jpg"); + copyUrlToImage.put("Plant_G_1_1.jpg", "PLANT.G.PLANT.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Rat_B_1_1.jpg", "RAT.B.RAT.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Reflection_W_2_2.jpg", "REFLECTION.W.REFLECTION.CREATURE.2.2.full.jpg"); + copyUrlToImage.put("Rhino_G_4_4.jpg", "RHINO.G.RHINO.CREATURE.4.4.full.jpg"); + copyUrlToImage.put("Rukh_R_4_4.jpg", "BIRD.R.BIRD.CREATURE.4.4.full.jpg"); + copyUrlToImage.put("Sand_1_1.jpg", "SAND..SAND.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Sand_Warrior_RGW_1_1.jpg", "SANDWARRIOR.WRG.SANDWARRIOR.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Saporling_G_1_1.jpg", "SAPROLING.G.SAPROLING.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Satyr_RG_2_2.jpg", "SATYR.RG.SATYR.CREATURE.2.2.full.jpg"); + copyUrlToImage.put("Serf_B_0_1.jpg", "SERF.B.SERF.CREATURE.0.1.full.jpg"); + copyUrlToImage.put("Shapeshifter_1_1.jpg", "SHAPESHIFTER..SHAPESHIFTER.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Skeleton_B_1_1.jpg", "SKELETON.B.SKELETON.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Sliver_1_1.jpg", "SLIVER..SLIVER.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Snake_1_1.jpg", "SNAKE..SNAKE.ARTIFACTCREATURE.1.1.full.jpg"); + copyUrlToImage.put("Snake_B_1_1.jpg", "SNAKE.B.SNAKE.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Snake_GB_1_1.jpg", "SNAKE.BG.SNAKE.ENCHANTMENTCREATURE.1.1.full.jpg"); + copyUrlToImage.put("Snake_GU_1_1.jpg", "SNAKE.UG.SNAKE.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Snake_G_1_1.jpg", "SNAKE.G.SNAKE.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Soldier_Ally_W_1_1.jpg", "SOLDIERALLY.W.SOLDIERALLY.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Soldier_RW_1_1.jpg", "SOLDIER.WR.SOLDIER.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Soldier_R_1_1.jpg", "SOLDIER.R.SOLDIER.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Soldier_W_1_1.jpg", "SOLDIER.W.SOLDIER.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Soldier_W_1_1_Enchantment.jpg", "SOLDIER.W.SOLDIER.ENCHANTMENTCREATURE.1.1.full.jpg"); + copyUrlToImage.put("Spark_Elemental_R_3_1.jpg", "SPARKELEMENTAL.R.ELEMENTAL.CREATURE.3.1.full.jpg"); + copyUrlToImage.put("Spawn_2_2.jpg", "SPAWN..SPAWN.ARTIFACTCREATURE.2.2.full.jpg"); + copyUrlToImage.put("Sphinx_U_4_4.jpg", "SPHINX.U.SPHINX.CREATURE.4.4.full.jpg"); + copyUrlToImage.put("Spider_B_2_4.jpg", "SPIDER.B.SPIDER.CREATURE.2.4.full.jpg"); + copyUrlToImage.put("Spider_G_1_2.jpg", "SPIDER.G.SPIDER.CREATURE.1.2.full.jpg"); + copyUrlToImage.put("Spider_G_1_3.jpg", "SPIDER.G.SPIDER.ENCHANTMENTCREATURE.1.3.full.jpg"); + copyUrlToImage.put("Spike_G_1_1.jpg", "SPIKE.G.SPIKE.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Spirit_1_1.jpg", "SPIRIT..SPIRIT.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Spirit_U_1_1.jpg", "SPIRIT.U.SPIRIT.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Spirit_WB_1_1.jpg", "SPIRIT.WB.SPIRIT.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Spirit_WB_y_y.jpg", "SPIRIT.WB.SPIRIT.ENCHANTMENTCREATURE.S.S.full.jpg"); + copyUrlToImage.put("Spirit_W_1_1.jpg", "SPIRIT.W.SPIRIT.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Spirit_W_3_3.jpg", "SPIRIT.W.SPIRIT.CREATURE.3.3.full.jpg"); + copyUrlToImage.put("Spirit_Warror_BG_y_y.jpg", "SPIRITWARRIOR.BG.SPIRITWARRIOR.CREATURE.S.S.full.jpg"); + copyUrlToImage.put("Squid_U_1_1.jpg", "SQUID.U.SQUID.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Squirrel_G_1_1.jpg", "SQUIRREL.G.SQUIRREL.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Stoneforged_Blade_.jpg", "STONEFORGEDBLADE..EQUIPMENT.ARTIFACT.0.0.full.jpg"); + copyUrlToImage.put("Tetravite_1_1.jpg", "TETRAVITE..TETRAVITE.CREATUREARTIFACT.1.1.full.jpg"); + copyUrlToImage.put("Thopter_1_1.jpg", "THOPTER..THOPTER.ARTIFACTCREATURE.1.1.full.jpg"); + copyUrlToImage.put("Thopter_U_1_1.jpg", "THOPTER.U.THOPTER.CREATUREARTIFACT.1.1.full.jpg"); + copyUrlToImage.put("Thrull_B_0_1.jpg", "THRULL.B.THRULL.CREATURE.0.1.full.jpg"); + copyUrlToImage.put("Thrull_B_1_1.jpg", "THRULL.B.THRULL.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Treefolk_G_X_X.jpg", "TREEFOLK.G.TREEFOLK.CREATURE.X.X.full.jpg"); + copyUrlToImage.put("Treefolk_Shaman_G_2_5.jpg", "TREEFOLKSHAMAN.G.TREEFOLKSHAMAN.CREATURE.2.5.full.jpg"); + copyUrlToImage.put("Treefolk_Warrior_G_y_y.jpg", "TREEFOLKWARRIOR.G.TREEFOLKWARRIOR.CREATURE.S.S.full.jpg"); + copyUrlToImage.put("Triskelavite_1_1.jpg", "TRISKELAVITE..TRISKELAVITE.ARTIFACTCREATURE.1.1.full.jpg"); + copyUrlToImage.put("Tuktuk_the_Returned_5_5.jpg", "TUKTUKTHERETURNED..GOBLIN.ARTIFACTCREATURE.5.5.full.jpg"); + copyUrlToImage.put("Urami_B_5_5.jpg", "URAMI.B.DEMONSPIRIT.CREATURE.5.5.full.jpg"); + copyUrlToImage.put("Vampire_B_1_1.jpg", "VAMPIRE.B.VAMPIRE.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Vampire_B_2_2.jpg", "VAMPIRE.B.VAMPIRE.CREATURE.2.2.full.jpg"); + copyUrlToImage.put("Vampire_B_X_X.jpg", "VAMPIRE.B.VAMPIRE.CREATURE.X.X.full.jpg"); + copyUrlToImage.put("Vampire_Knight_B_1_1.jpg", "VAMPIREKNIGHT.B.VAMPIREKNIGHT.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Voja_GW_2_2.jpg", "VOJA.WG.WOLF.CREATURE.2.2.full.jpg"); + copyUrlToImage.put("Wall_U_5_5.jpg", "WALL.U.WALL.CREATURE.5.5.full.jpg"); + copyUrlToImage.put("Warrior_B_2_1.jpg", "WARRIOR.B.WARRIOR.CREATURE.2.1.full.jpg"); + copyUrlToImage.put("Warrior_R_1_1.jpg", "WARRIOR.R.WARRIOR.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Warrior_W_1_1.jpg", "WARRIOR.W.WARRIOR.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Wasp_1_1.jpg", "WASP..INSECT.ARTIFACTCREATURE.1.1.full.jpg"); + copyUrlToImage.put("Weird_U_3_3.jpg", "WEIRD.U.WEIRD.CREATURE.3.3.full.jpg"); + copyUrlToImage.put("Whale_U_6_6.jpg", "WHALE.U.WHALE.CREATURE.6.6.full.jpg"); + copyUrlToImage.put("Wirefly_2_2.jpg", "WIREFLY..INSECT.ARTIFACTCREATURE.2.2.full.jpg"); + copyUrlToImage.put("Wolf_G_2_2.jpg", "WOLF.G.WOLF.CREATURE.2.2.full.jpg"); + copyUrlToImage.put("Wood_G_0_1.jpg", "WOOD.G.WALL.CREATURE.0.1.full.jpg"); + copyUrlToImage.put("Worm_BG_1_1.jpg", "WORM.BG.WORM.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Wurm_3_3.jpg", "WURM..WURM.ARTIFACTCREATURE.3.3.full.jpg"); + copyUrlToImage.put("Wurm_B_6_6.jpg", "WURM.B.WURM.CREATURE.6.6.full.jpg"); + copyUrlToImage.put("Wurm_G_6_6.jpg", "WURM.G.WURM.CREATURE.6.6.full.jpg"); + copyUrlToImage.put("Zombie_B_2_2.jpg", "ZOMBIE.B.ZOMBIE.CREATURE.2.2.full.jpg"); + copyUrlToImage.put("Zombie_B_2_2_Enchantment.jpg", "ZOMBIE.B.ZOMBIE.ENCHANTMENTCREATURE.2.2.full.jpg"); + copyUrlToImage.put("Zombie_B_5_5.jpg", "ZOMBIEGIANT.B.ZOMBIEGIANT.CREATURE.5.5.full.jpg"); + copyUrlToImage.put("Zombie_B_X_X.jpg", "ZOMBIE.B.ZOMBIE.CREATURE.X.X.full.jpg"); + copyUrlToImage.put("Zombie_Horror_B_X_X.jpg", "ZOMBIEHORROR.B.ZOMBIEHORROR.CREATURE.X.X.full.jpg"); + copyUrlToImage.put("Zombie_U_X_X.jpg", "ZOMBIE.U.ZOMBIE.CREATURE.X.X.full.jpg"); + copyUrlToImage.put("Zombie_Wizard_UB_1_1.jpg", "ZOMBIEWIZARD.BG.ZOMBIEWIZARD.CREATURE.1.1.full.jpg"); + copyUrlToImage.put("Zombie_Wizard_UB_1_1.jpg", "ZOMBIEWIZARD.UB.ZOMBIEWIZARD.CREATURE.1.1.full.jpg"); + + for (String key : copyUrlToImage.keySet()) { + copyUrlToImageDone.put(key, false); + copyImageToUrl.put(copyUrlToImage.get(key), key); + } + } + + @Override + public String generateTokenUrl(CardDownloadData card) throws IOException { + + if (copyUrlToImage == null) { + setupLinks(); + } + return null; + } +} diff --git a/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/MythicspoilerComSource.java b/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/MythicspoilerComSource.java index 7883eaecce5..11b1657c08d 100644 --- a/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/MythicspoilerComSource.java +++ b/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/MythicspoilerComSource.java @@ -234,4 +234,14 @@ public class MythicspoilerComSource implements CardImageSource { public Float getAverageSize() { return 50.0f; } + + @Override + public String getNextHttpImageUrl() { + return null; + } + + @Override + public String getFileForHttpImage(String httpImageUrl) { + return null; + } } diff --git a/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/TokensMtgImageSource.java b/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/TokensMtgImageSource.java index 0761b05cb4e..089085660bc 100644 --- a/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/TokensMtgImageSource.java +++ b/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/TokensMtgImageSource.java @@ -66,6 +66,16 @@ public class TokensMtgImageSource implements CardImageSource { public Float getAverageSize() { return 26.7f; } + + @Override + public String getNextHttpImageUrl() { + return null; + } + + @Override + public String getFileForHttpImage(String httpImageUrl) { + return null; + } @Override public String generateURL(CardDownloadData card) throws Exception { diff --git a/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/WizardCardsImageSource.java b/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/WizardCardsImageSource.java index 9045412d25e..b95f1f77f9a 100644 --- a/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/WizardCardsImageSource.java +++ b/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/WizardCardsImageSource.java @@ -266,6 +266,16 @@ public class WizardCardsImageSource implements CardImageSource { languageAliases.put("de", "German"); } + @Override + public String getNextHttpImageUrl() { + return null; + } + + @Override + public String getFileForHttpImage(String httpImageUrl) { + return null; + } + private Map getSetLinks(String cardSet) { ConcurrentHashMap setLinks = new ConcurrentHashMap<>(); ExecutorService executor = Executors.newFixedThreadPool(10); diff --git a/Mage.Client/src/main/java/org/mage/plugins/card/images/DownloadPictures.java b/Mage.Client/src/main/java/org/mage/plugins/card/images/DownloadPictures.java index 339db215fea..2a4a1ca9f43 100644 --- a/Mage.Client/src/main/java/org/mage/plugins/card/images/DownloadPictures.java +++ b/Mage.Client/src/main/java/org/mage/plugins/card/images/DownloadPictures.java @@ -58,6 +58,7 @@ import net.java.truevfs.kernel.spec.FsSyncException; import org.apache.log4j.Logger; import org.mage.plugins.card.dl.sources.CardImageSource; import org.mage.plugins.card.dl.sources.MagicCardsImageSource; +import org.mage.plugins.card.dl.sources.MtgOnlTokensImageSource; import org.mage.plugins.card.dl.sources.MythicspoilerComSource; import org.mage.plugins.card.dl.sources.TokensMtgImageSource; import org.mage.plugins.card.dl.sources.WizardCardsImageSource; @@ -145,6 +146,7 @@ public class DownloadPictures extends DefaultBoundedRangeModel implements Runnab "wizards.com", "mythicspoiler.com", "tokens.mtg.onl", //"mtgimage.com (HQ)", + "mtg.onl" //"mtgathering.ru HQ", //"mtgathering.ru MQ", //"mtgathering.ru LQ", @@ -172,6 +174,9 @@ public class DownloadPictures extends DefaultBoundedRangeModel implements Runnab case 3: cardImageSource = TokensMtgImageSource.getInstance(); break; + case 4: + cardImageSource = MtgOnlTokensImageSource.getInstance(); + break; } int count = DownloadPictures.this.cards.size(); float mb = (count * cardImageSource.getAverageSize()) / 1024; @@ -239,7 +244,7 @@ public class DownloadPictures extends DefaultBoundedRangeModel implements Runnab TFile file; for (CardInfo card : allCards) { if (!card.getCardNumber().isEmpty() && !"0".equals(card.getCardNumber()) && !card.getSetCode().isEmpty()) { - CardDownloadData url = new CardDownloadData(card.getName(), card.getSetCode(), card.getCardNumber(), card.usesVariousArt(), + CardDownloadData url = new CardDownloadData(card.getName(), card.getSetCode(), card.getCardNumber(), card.usesVariousArt(), 0, "", "", false, card.isDoubleFaced(), card.isNightCard()); file = new TFile(CardImageUtils.generateImagePath(url)); if (!file.exists()) { @@ -492,14 +497,29 @@ public class DownloadPictures extends DefaultBoundedRangeModel implements Runnab url = cardImageSource.generateURL(card); } - if (url != null) { + if (url == null) { + String imageRef = cardImageSource.getNextHttpImageUrl(); + String fileName = cardImageSource.getFileForHttpImage(imageRef); + if (imageRef != null && fileName != null) { + imageRef = cardImageSource.getSourceName() + imageRef; + try { + URL imageUrl = new URL(imageRef); + + Runnable task = new DownloadTask(imageUrl, fileName, 1); + executor.execute(task); + } catch (Exception ex) { + } + } else { + if (card != null) { + logger.info("Card not available on " + cardImageSource.getSourceName() + ": " + card.getName() + " (" + card.getSet() + ")"); + synchronized (sync) { + update(cardIndex + 1, cardsToDownload.size()); + } + } + } + } else if (url != null) { Runnable task = new DownloadTask(card, new URL(url), cardsToDownload.size()); executor.execute(task); - } else { - logger.info("Card not available on " + cardImageSource.getSourceName() + ": " + card.getName() + " (" + card.getSet() + ")"); - synchronized (sync) { - update(cardIndex + 1, cardsToDownload.size()); - } } } catch (Exception ex) { @@ -535,11 +555,23 @@ public class DownloadPictures extends DefaultBoundedRangeModel implements Runnab private final CardDownloadData card; private final URL url; private final int count; + private final String actualFilename; + private boolean useSpecifiedPaths; public DownloadTask(CardDownloadData card, URL url, int count) { this.card = card; this.url = url; this.count = count; + this.actualFilename = ""; + useSpecifiedPaths = false; + } + + public DownloadTask(URL url, String actualFilename, int count) { + this.card = null; + this.url = url; + this.count = count; + this.actualFilename = actualFilename; + useSpecifiedPaths = true; } @Override @@ -549,9 +581,20 @@ public class DownloadPictures extends DefaultBoundedRangeModel implements Runnab TFile outputFile = null; try { filePath.append(Constants.IO.imageBaseDir); - filePath.append(card.hashCode()).append(".").append(card.getName().replace(":", "").replace("//", "-")).append(".jpg"); - temporaryFile = new File(filePath.toString()); - String imagePath = CardImageUtils.generateImagePath(card); + if (!useSpecifiedPaths && card != null) { + filePath.append(card.hashCode()).append(".").append(card.getName().replace(":", "").replace("//", "-")).append(".jpg"); + temporaryFile = new File(filePath.toString()); + } + String imagePath; + if (useSpecifiedPaths) { + imagePath = CardImageUtils.getTokenBasePath(); // temporaryFile = plugins/images\NUM.jace, telepath unbound.jpg + imagePath += actualFilename; // imagePath = d:\xmage_images\ORI.zip\ORI\Jace,telepathunbound.jpg + String tmpFile = filePath + actualFilename + ".2"; + temporaryFile = new File(tmpFile.toString()); + } else { + imagePath = CardImageUtils.generateImagePath(card); + } + outputFile = new TFile(imagePath); if (!outputFile.exists()) { outputFile.getParentFile().mkdirs(); @@ -599,7 +642,7 @@ public class DownloadPictures extends DefaultBoundedRangeModel implements Runnab out.flush(); out.close(); - if (card.isTwoFacedCard()) { + if (card != null && card.isTwoFacedCard()) { BufferedImage image = ImageIO.read(temporaryFile); if (image.getHeight() == 470) { BufferedImage renderedImage = new BufferedImage(265, 370, BufferedImage.TYPE_INT_RGB); @@ -620,11 +663,13 @@ public class DownloadPictures extends DefaultBoundedRangeModel implements Runnab new TFile(temporaryFile).cp_rp(outputFile); } } else { - logger.warn("Image download for " + card.getName() - + (!card.getDownloadName().equals(card.getName()) ? " downloadname: " + card.getDownloadName() : "") - + "(" + card.getSet() + ") failed - responseCode: " + responseCode + " url: " + url.toString()); + if (card != null) { + logger.warn("Image download for " + card.getName() + + (!card.getDownloadName().equals(card.getName()) ? " downloadname: " + card.getDownloadName() : "") + + "(" + card.getSet() + ") failed - responseCode: " + responseCode + " url: " + url.toString()); + } if (logger.isDebugEnabled()) { // Shows the returned html from the request to the web server - logger.debug("Return ed HTML ERROR:\n" + convertStreamToString(((HttpURLConnection) httpConn).getErrorStream())); + logger.debug("Returned HTML ERROR:\n" + convertStreamToString(((HttpURLConnection) httpConn).getErrorStream())); } } diff --git a/Mage.Client/src/main/java/org/mage/plugins/card/utils/CardImageUtils.java b/Mage.Client/src/main/java/org/mage/plugins/card/utils/CardImageUtils.java index 8e69839c567..d527c659dcd 100644 --- a/Mage.Client/src/main/java/org/mage/plugins/card/utils/CardImageUtils.java +++ b/Mage.Client/src/main/java/org/mage/plugins/card/utils/CardImageUtils.java @@ -117,6 +117,17 @@ public class CardImageUtils { return buildPath(imagesDir, set); } } + + public static String getTokenBasePath() { + String useDefault = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_CARD_IMAGES_USE_DEFAULT, "true"); + String imagesPath = useDefault.equals("true") ? null : PreferencesDialog.getCachedValue(PreferencesDialog.KEY_CARD_IMAGES_PATH, null); + + if (PreferencesDialog.isSaveImagesToZip()) { + return imagesPath + TFile.separator + "TOK" + ".zip" + TFile.separator; + } else { + return imagesPath + TFile.separator + "TOK" + TFile.separator; + } + } private static String getTokenDescriptorImagePath(CardDownloadData card) { String useDefault = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_CARD_IMAGES_USE_DEFAULT, "true"); diff --git a/Mage.Common/src/mage/view/CardView.java b/Mage.Common/src/mage/view/CardView.java index ca3b6c48eed..18ef48839e9 100644 --- a/Mage.Common/src/mage/view/CardView.java +++ b/Mage.Common/src/mage/view/CardView.java @@ -246,14 +246,14 @@ public class CardView extends SimpleCardView { if (card instanceof Permanent) { this.mageObjectType = MageObjectType.PERMANENT; Permanent permanent = (Permanent) card; - this.loyalty = Integer.toString(permanent.getCounters().getCount(CounterType.LOYALTY)); + this.loyalty = Integer.toString(permanent.getCounters(game).getCount(CounterType.LOYALTY)); this.pairedCard = permanent.getPairedCard() != null ? permanent.getPairedCard().getSourceId() : null; if (!permanent.getControllerId().equals(permanent.getOwnerId())) { controlledByOwner = false; } - if (game != null && permanent.getCounters() != null && !permanent.getCounters().isEmpty()) { + if (game != null && permanent.getCounters(game) != null && !permanent.getCounters(game).isEmpty()) { counters = new ArrayList<>(); - for (Counter counter : permanent.getCounters().values()) { + for (Counter counter : permanent.getCounters(game).values()) { counters.add(new CounterView(counter)); } } @@ -348,7 +348,7 @@ public class CardView extends SimpleCardView { this.mageObjectType = MageObjectType.PERMANENT; this.power = Integer.toString(object.getPower().getValue()); this.toughness = Integer.toString(object.getToughness().getValue()); - this.loyalty = Integer.toString(((Permanent) object).getCounters().getCount(CounterType.LOYALTY)); + this.loyalty = Integer.toString(((Permanent) object).getCounters((Game)null).getCount(CounterType.LOYALTY)); } else { this.power = object.getPower().toString(); this.toughness = object.getToughness().toString(); diff --git a/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/ma/ArtificialScoringSystem.java b/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/ma/ArtificialScoringSystem.java index 9b0c0171975..2e3d0d8ccca 100644 --- a/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/ma/ArtificialScoringSystem.java +++ b/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/ma/ArtificialScoringSystem.java @@ -64,8 +64,8 @@ public class ArtificialScoringSystem { public static int getVariablePermanentScore(final Game game, final Permanent permanent) { - int score = permanent.getCounters().getCount(CounterType.CHARGE) * 30; - score += permanent.getCounters().getCount(CounterType.LEVEL) * 30; + int score = permanent.getCounters(game).getCount(CounterType.CHARGE) * 30; + score += permanent.getCounters(game).getCount(CounterType.LEVEL) * 30; score -= permanent.getDamage() * 2; if (!canTap(permanent)) { score += getTappedScore(permanent); diff --git a/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/ma/optimizers/impl/LevelUpOptimizer.java b/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/ma/optimizers/impl/LevelUpOptimizer.java index 9cfe9a10782..c3c8934fa1e 100644 --- a/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/ma/optimizers/impl/LevelUpOptimizer.java +++ b/Mage.Server.Plugins/Mage.Player.AI.MA/src/mage/player/ai/ma/optimizers/impl/LevelUpOptimizer.java @@ -30,7 +30,7 @@ public class LevelUpOptimizer extends BaseTreeOptimizer { if (permanent != null && permanent instanceof PermanentCard) { PermanentCard leveler = (PermanentCard) permanent; // check already existing Level counters and compare to maximum that make sense - if (permanent.getCounters().getCount(CounterType.LEVEL) >= leveler.getMaxLevelCounters()) { + if (permanent.getCounters(game).getCount(CounterType.LEVEL) >= leveler.getMaxLevelCounters()) { removeAbility(ability); } } diff --git a/Mage.Server.Plugins/Mage.Player.AI/src/main/java/mage/player/ai/simulators/CombatSimulator.java b/Mage.Server.Plugins/Mage.Player.AI/src/main/java/mage/player/ai/simulators/CombatSimulator.java index 00e7e3102d3..d2eb5ffdf94 100644 --- a/Mage.Server.Plugins/Mage.Player.AI/src/main/java/mage/player/ai/simulators/CombatSimulator.java +++ b/Mage.Server.Plugins/Mage.Player.AI/src/main/java/mage/player/ai/simulators/CombatSimulator.java @@ -68,7 +68,7 @@ public class CombatSimulator implements Serializable { } else { Permanent permanent = game.getPermanent(defenderId); - simCombat.planeswalkerLoyalty.put(defenderId, permanent.getCounters().getCount(CounterType.LOYALTY)); + simCombat.planeswalkerLoyalty.put(defenderId, permanent.getCounters(game).getCount(CounterType.LOYALTY)); } } return simCombat; diff --git a/Mage.Server.Plugins/Mage.Player.AIMinimax/src/mage/player/ai/GameStateEvaluator.java b/Mage.Server.Plugins/Mage.Player.AIMinimax/src/mage/player/ai/GameStateEvaluator.java index 16e131031eb..4887da0e61d 100644 --- a/Mage.Server.Plugins/Mage.Player.AIMinimax/src/mage/player/ai/GameStateEvaluator.java +++ b/Mage.Server.Plugins/Mage.Player.AIMinimax/src/mage/player/ai/GameStateEvaluator.java @@ -111,7 +111,7 @@ public class GameStateEvaluator { if (!(ability instanceof ManaAbility) && ability.canActivate(ability.getControllerId(), game)) value += ability.getEffects().size(); } - for (Counter counter: permanent.getCounters().values()) { + for (Counter counter: permanent.getCounters(game).values()) { if (!(counter instanceof BoostCounter)) { value += counter.getCount(); } diff --git a/Mage.Sets/src/mage/sets/alarareborn/AvenMimeomancer.java b/Mage.Sets/src/mage/sets/alarareborn/AvenMimeomancer.java index bed26c61364..31274e79240 100644 --- a/Mage.Sets/src/mage/sets/alarareborn/AvenMimeomancer.java +++ b/Mage.Sets/src/mage/sets/alarareborn/AvenMimeomancer.java @@ -116,7 +116,7 @@ class AvenEffect extends ContinuousEffectImpl { @Override public boolean isInactive(Ability source, Game game) { Permanent creature = game.getPermanent(this.targetPointer.getFirst(game, source)); - if (creature != null && creature.getCounters().getCount(CounterType.FEATHER) < 1) { + if (creature != null && creature.getCounters(game).getCount(CounterType.FEATHER) < 1) { return true; } return false; @@ -160,7 +160,7 @@ class AvenEffect2 extends ContinuousEffectImpl { @Override public boolean isInactive(Ability source, Game game) { Permanent creature = game.getPermanent(this.targetPointer.getFirst(game, source)); - if (creature != null && creature.getCounters().getCount(CounterType.FEATHER) < 1) { + if (creature != null && creature.getCounters(game).getCount(CounterType.FEATHER) < 1) { return true; } return false; diff --git a/Mage.Sets/src/mage/sets/alarareborn/MayaelsAria.java b/Mage.Sets/src/mage/sets/alarareborn/MayaelsAria.java index af7b7db6c20..a3baa40ad65 100644 --- a/Mage.Sets/src/mage/sets/alarareborn/MayaelsAria.java +++ b/Mage.Sets/src/mage/sets/alarareborn/MayaelsAria.java @@ -97,7 +97,7 @@ class MayaelsAriaEffect extends OneShotEffect { FilterCreaturePermanent filter = new FilterCreaturePermanent(); filter.add(new PowerPredicate(Filter.ComparisonType.GreaterThan, 4)); if (game.getState().getBattlefield().countAll(filter, controller.getId(), game) > 0) { - for (Permanent creature : game.getBattlefield().getAllActivePermanents(source.getControllerId())) { + for (Permanent creature : game.getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), source.getControllerId(), game)) { creature.addCounters(CounterType.P1P1.createInstance(), game); } } diff --git a/Mage.Sets/src/mage/sets/alarareborn/MindFuneral.java b/Mage.Sets/src/mage/sets/alarareborn/MindFuneral.java index 0fe7d721b9f..c7e82231fc6 100644 --- a/Mage.Sets/src/mage/sets/alarareborn/MindFuneral.java +++ b/Mage.Sets/src/mage/sets/alarareborn/MindFuneral.java @@ -104,7 +104,7 @@ class MindFuneralEffect extends OneShotEffect { cards.add(card); } opponent.revealCards("Mind Funeral", cards, game); - opponent.moveCards(cards, Zone.LIBRARY, Zone.GRAVEYARD, source, game); + opponent.moveCards(cards, Zone.GRAVEYARD, source, game); return true; } diff --git a/Mage.Sets/src/mage/sets/archenemy/MakeshiftMannequin.java b/Mage.Sets/src/mage/sets/archenemy/MakeshiftMannequin.java index cf248de7b5d..c3bd077fa03 100644 --- a/Mage.Sets/src/mage/sets/archenemy/MakeshiftMannequin.java +++ b/Mage.Sets/src/mage/sets/archenemy/MakeshiftMannequin.java @@ -141,7 +141,7 @@ class MakeshiftMannequinGainAbilityEffect extends ContinuousEffectImpl { @Override public boolean isInactive(Ability source, Game game) { Permanent permanent = game.getPermanent(this.getTargetPointer().getFirst(game, source)); - return permanent == null || permanent.getCounters().getCount(CounterType.MANNEQUIN) < 1; + return permanent == null || permanent.getCounters(game).getCount(CounterType.MANNEQUIN) < 1; } @Override diff --git a/Mage.Sets/src/mage/sets/avacynrestored/DescentIntoMadness.java b/Mage.Sets/src/mage/sets/avacynrestored/DescentIntoMadness.java index 25472b037ab..0bea2d7ccc6 100644 --- a/Mage.Sets/src/mage/sets/avacynrestored/DescentIntoMadness.java +++ b/Mage.Sets/src/mage/sets/avacynrestored/DescentIntoMadness.java @@ -117,7 +117,7 @@ class DescentIntoMadnessEffect extends OneShotEffect { sourcePermanent = (Permanent) game.getLastKnownInformation(source.getSourceId(), Zone.BATTLEFIELD); } if (sourcePermanent != null && controller != null) { - int count = sourcePermanent.getCounters().getCount(CounterType.DESPAIR); + int count = sourcePermanent.getCounters(game).getCount(CounterType.DESPAIR); if (count > 0) { // select the permanents and hand cards in turn order LinkedList selectedObjects = new LinkedList<>(); diff --git a/Mage.Sets/src/mage/sets/avacynrestored/HeraldOfWar.java b/Mage.Sets/src/mage/sets/avacynrestored/HeraldOfWar.java index ac3bc380356..9e73eb62c4c 100644 --- a/Mage.Sets/src/mage/sets/avacynrestored/HeraldOfWar.java +++ b/Mage.Sets/src/mage/sets/avacynrestored/HeraldOfWar.java @@ -94,7 +94,7 @@ class HeraldOfWarCostReductionEffect extends CostModificationEffectImpl { SpellAbility spellAbility = (SpellAbility) abilityToModify; Permanent sourcePermanent = game.getPermanent(source.getSourceId()); if (sourcePermanent != null) { - int amount = sourcePermanent.getCounters().getCount(CounterType.P1P1); + int amount = sourcePermanent.getCounters(game).getCount(CounterType.P1P1); if (amount > 0) { CardUtil.adjustCost(spellAbility, amount); return true; diff --git a/Mage.Sets/src/mage/sets/avacynrestored/OtherworldAtlas.java b/Mage.Sets/src/mage/sets/avacynrestored/OtherworldAtlas.java index 43594a8956f..ed7791b301c 100644 --- a/Mage.Sets/src/mage/sets/avacynrestored/OtherworldAtlas.java +++ b/Mage.Sets/src/mage/sets/avacynrestored/OtherworldAtlas.java @@ -91,7 +91,7 @@ class OtherworldAtlasDrawEffect extends OneShotEffect { Player sourcePlayer = game.getPlayer(source.getControllerId()); Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null) { - int amount = permanent.getCounters().getCount(CounterType.CHARGE); + int amount = permanent.getCounters(game).getCount(CounterType.CHARGE); if (amount > 0) { for (UUID playerId : game.getState().getPlayersInRange(sourcePlayer.getId(), game)) { Player player = game.getPlayer(playerId); diff --git a/Mage.Sets/src/mage/sets/battleforzendikar/BaneOfBalaGed.java b/Mage.Sets/src/mage/sets/battleforzendikar/BaneOfBalaGed.java index 77237357823..e57887451b4 100644 --- a/Mage.Sets/src/mage/sets/battleforzendikar/BaneOfBalaGed.java +++ b/Mage.Sets/src/mage/sets/battleforzendikar/BaneOfBalaGed.java @@ -93,7 +93,7 @@ class BaneOfBalaGedEffect extends OneShotEffect { if (defendingPlayer != null) { Target target = new TargetControlledPermanent(2); defendingPlayer.chooseTarget(outcome, target, source, game); - defendingPlayer.moveCards(new CardsImpl(target.getTargets()), null, Zone.EXILED, source, game); + defendingPlayer.moveCards(new CardsImpl(target.getTargets()), Zone.EXILED, source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/sets/battleforzendikar/BlightHerder.java b/Mage.Sets/src/mage/sets/battleforzendikar/BlightHerder.java index 51ba0d733fa..8ef26523373 100644 --- a/Mage.Sets/src/mage/sets/battleforzendikar/BlightHerder.java +++ b/Mage.Sets/src/mage/sets/battleforzendikar/BlightHerder.java @@ -107,7 +107,7 @@ class BlightHerderEffect extends OneShotEffect { if (target.canChoose(source.getSourceId(), source.getControllerId(), game)) { if (controller.chooseTarget(outcome, target, source, game)) { Cards cardsToGraveyard = new CardsImpl(target.getTargets()); - controller.moveCards(cardsToGraveyard, null, Zone.GRAVEYARD, source, game); + controller.moveCards(cardsToGraveyard, Zone.GRAVEYARD, source, game); return new CreateTokenEffect(new EldraziScionToken(), 3).apply(game, source); } } diff --git a/Mage.Sets/src/mage/sets/battleforzendikar/KioraMasterOfTheDepths.java b/Mage.Sets/src/mage/sets/battleforzendikar/KioraMasterOfTheDepths.java index c7919047f80..efccd05d309 100644 --- a/Mage.Sets/src/mage/sets/battleforzendikar/KioraMasterOfTheDepths.java +++ b/Mage.Sets/src/mage/sets/battleforzendikar/KioraMasterOfTheDepths.java @@ -192,7 +192,7 @@ class KioraRevealEffect extends OneShotEffect { } } } - controller.moveCards(cards, null, Zone.GRAVEYARD, source, game); + controller.moveCards(cards, Zone.GRAVEYARD, source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/sets/battleforzendikar/UlamogsDespoiler.java b/Mage.Sets/src/mage/sets/battleforzendikar/UlamogsDespoiler.java index 4943bc184c4..2ecd8cc067e 100644 --- a/Mage.Sets/src/mage/sets/battleforzendikar/UlamogsDespoiler.java +++ b/Mage.Sets/src/mage/sets/battleforzendikar/UlamogsDespoiler.java @@ -108,7 +108,7 @@ class UlamogsDespoilerEffect extends OneShotEffect { if (target.canChoose(source.getSourceId(), source.getControllerId(), game)) { if (controller.chooseTarget(outcome, target, source, game)) { Cards cardsToGraveyard = new CardsImpl(target.getTargets()); - controller.moveCards(cardsToGraveyard, null, Zone.GRAVEYARD, source, game); + controller.moveCards(cardsToGraveyard, Zone.GRAVEYARD, source, game); return new AddCountersSourceEffect(CounterType.P1P1.createInstance(4)).apply(game, source); } } diff --git a/Mage.Sets/src/mage/sets/battleforzendikar/UlamogsNullifier.java b/Mage.Sets/src/mage/sets/battleforzendikar/UlamogsNullifier.java index dcdff1c328f..54cbfa219e8 100644 --- a/Mage.Sets/src/mage/sets/battleforzendikar/UlamogsNullifier.java +++ b/Mage.Sets/src/mage/sets/battleforzendikar/UlamogsNullifier.java @@ -123,7 +123,7 @@ class UlamogsNullifierEffect extends OneShotEffect { if (target.canChoose(source.getSourceId(), source.getControllerId(), game)) { if (controller.chooseTarget(outcome, target, source, game)) { Cards cardsToGraveyard = new CardsImpl(target.getTargets()); - controller.moveCards(cardsToGraveyard, null, Zone.GRAVEYARD, source, game); + controller.moveCards(cardsToGraveyard, Zone.GRAVEYARD, source, game); game.getStack().counter(source.getFirstTarget(), source.getSourceId(), game); return true; } diff --git a/Mage.Sets/src/mage/sets/battleforzendikar/UndergrowthChampion.java b/Mage.Sets/src/mage/sets/battleforzendikar/UndergrowthChampion.java index 504b6eec6a6..245efb96da5 100644 --- a/Mage.Sets/src/mage/sets/battleforzendikar/UndergrowthChampion.java +++ b/Mage.Sets/src/mage/sets/battleforzendikar/UndergrowthChampion.java @@ -119,7 +119,7 @@ class UndergrowthChampionPreventionEffect extends PreventionEffectImpl { } } - if(removeCounter && permanent.getCounters().containsKey(CounterType.P1P1)) { + if(removeCounter && permanent.getCounters(game).containsKey(CounterType.P1P1)) { preventDamageAction(event, source, game); StringBuilder sb = new StringBuilder(permanent.getName()).append(": "); permanent.removeCounters(CounterType.P1P1.createInstance(), game); diff --git a/Mage.Sets/src/mage/sets/betrayersofkamigawa/SwayOfTheStars.java b/Mage.Sets/src/mage/sets/betrayersofkamigawa/SwayOfTheStars.java index 0e4f8ff9428..eb3fe8b0f41 100644 --- a/Mage.Sets/src/mage/sets/betrayersofkamigawa/SwayOfTheStars.java +++ b/Mage.Sets/src/mage/sets/betrayersofkamigawa/SwayOfTheStars.java @@ -91,8 +91,8 @@ class SwayOfTheStarsEffect extends OneShotEffect { for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) { Player player = game.getPlayer(playerId); if (player != null) { - player.moveCards(player.getHand(), Zone.HAND, Zone.LIBRARY, source, game); - player.moveCards(player.getGraveyard(), Zone.GRAVEYARD, Zone.LIBRARY, source, game); + player.moveCards(player.getHand(), Zone.LIBRARY, source, game); + player.moveCards(player.getGraveyard(), Zone.LIBRARY, source, game); FilterPermanent filter = new FilterPermanent(); filter.add(new OwnerIdPredicate(playerId)); for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, controller.getId(), source.getSourceId(), game)) { diff --git a/Mage.Sets/src/mage/sets/bornofthegods/AstralCornucopia.java b/Mage.Sets/src/mage/sets/bornofthegods/AstralCornucopia.java index 2df81d93576..5b920493608 100644 --- a/Mage.Sets/src/mage/sets/bornofthegods/AstralCornucopia.java +++ b/Mage.Sets/src/mage/sets/bornofthegods/AstralCornucopia.java @@ -93,7 +93,7 @@ class AstralCornucopiaManaAbility extends ManaAbility { netMana.clear(); Permanent sourcePermanent = game.getPermanent(getSourceId()); if (sourcePermanent != null) { - int counters = sourcePermanent.getCounters().getCount(CounterType.CHARGE.getName()); + int counters = sourcePermanent.getCounters(game).getCount(CounterType.CHARGE.getName()); if (counters > 0) { netMana.add(new Mana(0, 0, 0, 0, 0, 0, counters, 0)); } @@ -132,7 +132,7 @@ class AstralCornucopiaManaEffect extends ManaEffect { Permanent sourcePermanent = game.getPermanent(source.getSourceId()); if (choice.getChoice() != null) { String color = choice.getChoice(); - int counters = sourcePermanent.getCounters().getCount(CounterType.CHARGE.getName()); + int counters = sourcePermanent.getCounters(game).getCount(CounterType.CHARGE.getName()); switch (color) { case "Red": computedMana.setRed(counters); diff --git a/Mage.Sets/src/mage/sets/bornofthegods/SatyrWayfinder.java b/Mage.Sets/src/mage/sets/bornofthegods/SatyrWayfinder.java index 408c1a7a9c1..7c69c8281f3 100644 --- a/Mage.Sets/src/mage/sets/bornofthegods/SatyrWayfinder.java +++ b/Mage.Sets/src/mage/sets/bornofthegods/SatyrWayfinder.java @@ -113,7 +113,7 @@ class SatyrWayfinderEffect extends OneShotEffect { } } - controller.moveCards(cards, Zone.LIBRARY, Zone.GRAVEYARD, source, game); + controller.moveCards(cards, Zone.GRAVEYARD, source, game); } return true; } diff --git a/Mage.Sets/src/mage/sets/championsofkamigawa/GiftsUngiven.java b/Mage.Sets/src/mage/sets/championsofkamigawa/GiftsUngiven.java index 2ad8724c368..73fe0d0429d 100644 --- a/Mage.Sets/src/mage/sets/championsofkamigawa/GiftsUngiven.java +++ b/Mage.Sets/src/mage/sets/championsofkamigawa/GiftsUngiven.java @@ -119,8 +119,8 @@ class GiftsUngivenEffect extends OneShotEffect { } } - player.moveCards(cards, Zone.LIBRARY, Zone.GRAVEYARD, source, game); - player.moveCards(cardsToKeep, Zone.LIBRARY, Zone.HAND, source, game); + player.moveCards(cards, Zone.GRAVEYARD, source, game); + player.moveCards(cardsToKeep, Zone.HAND, source, game); } player.shuffleLibrary(source, game); return true; diff --git a/Mage.Sets/src/mage/sets/championsofkamigawa/Hankyu.java b/Mage.Sets/src/mage/sets/championsofkamigawa/Hankyu.java index cc32185da8d..d5d1e79f894 100644 --- a/Mage.Sets/src/mage/sets/championsofkamigawa/Hankyu.java +++ b/Mage.Sets/src/mage/sets/championsofkamigawa/Hankyu.java @@ -188,7 +188,7 @@ class HankyuCountersSourceCost extends CostImpl { public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { Permanent equipment = game.getPermanent(this.effectGivingEquipmentId); if (equipment != null ) { - this.removedCounters = equipment.getCounters().getCount(CounterType.AIM); + this.removedCounters = equipment.getCounters(game).getCount(CounterType.AIM); if (this.removedCounters > 0) { equipment.removeCounters("aim", this.removedCounters, game); } diff --git a/Mage.Sets/src/mage/sets/championsofkamigawa/InameDeathAspect.java b/Mage.Sets/src/mage/sets/championsofkamigawa/InameDeathAspect.java index 01b06c60d7c..f8e6173418b 100644 --- a/Mage.Sets/src/mage/sets/championsofkamigawa/InameDeathAspect.java +++ b/Mage.Sets/src/mage/sets/championsofkamigawa/InameDeathAspect.java @@ -98,7 +98,7 @@ class InameDeathAspectEffect extends SearchEffect { Player player = game.getPlayer(source.getControllerId()); if (player != null && player.searchLibrary(target, game)) { if (target.getTargets().size() > 0) { - player.moveCards(new CardsImpl(target.getTargets()), Zone.LIBRARY, Zone.GRAVEYARD, source, game); + player.moveCards(new CardsImpl(target.getTargets()), Zone.GRAVEYARD, source, game); } player.shuffleLibrary(source, game); return true; diff --git a/Mage.Sets/src/mage/sets/championsofkamigawa/PiousKitsune.java b/Mage.Sets/src/mage/sets/championsofkamigawa/PiousKitsune.java index d7a17269b4e..7422587a91a 100644 --- a/Mage.Sets/src/mage/sets/championsofkamigawa/PiousKitsune.java +++ b/Mage.Sets/src/mage/sets/championsofkamigawa/PiousKitsune.java @@ -112,7 +112,7 @@ class PiousKitsuneEffect extends OneShotEffect { if (game.getBattlefield().count(filter, source.getSourceId(), source.getControllerId(), game) > 0) { Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null) { - int life = permanent.getCounters().getCount(CounterType.DEVOTION); + int life = permanent.getCounters(game).getCount(CounterType.DEVOTION); if (life > 0) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { diff --git a/Mage.Sets/src/mage/sets/chronicles/LivingArmor.java b/Mage.Sets/src/mage/sets/chronicles/LivingArmor.java new file mode 100644 index 00000000000..5567e3a84e1 --- /dev/null +++ b/Mage.Sets/src/mage/sets/chronicles/LivingArmor.java @@ -0,0 +1,98 @@ +/* + * 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.sets.chronicles; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.common.SacrificeSourceCost; +import mage.abilities.costs.common.TapSourceCost; +import mage.abilities.effects.OneShotEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.counters.BoostCounter; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.target.common.TargetCreaturePermanent; + +/** + * + * @author Derpthemeus + */ +public class LivingArmor extends CardImpl { + + public LivingArmor(UUID ownerId) { + super(ownerId, 83, "Living Armor", Rarity.COMMON, new CardType[]{CardType.ARTIFACT}, "{4}"); + this.expansionSetCode = "CHR"; + + // {tap}, Sacrifice Living Armor: Put X +0/+1 counters on target creature, where X is that creature's converted mana cost. + Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new LivingArmorEffect(), new TapSourceCost()); + ability.addCost(new SacrificeSourceCost()); + ability.addTarget(new TargetCreaturePermanent()); + this.addAbility(ability); + } + + public LivingArmor(final LivingArmor card) { + super(card); + } + + @Override + public LivingArmor copy() { + return new LivingArmor(this); + } + + class LivingArmorEffect extends OneShotEffect { + + public LivingArmorEffect() { + super(Outcome.BoostCreature); + this.staticText = "Put X +0/+1 counters on target creature, where X is that creature's converted mana cost"; + } + + public LivingArmorEffect(final LivingArmorEffect effect) { + super(effect); + } + + @Override + public LivingArmorEffect copy() { + return new LivingArmorEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Permanent creature = game.getPermanent(source.getTargets().getFirstTarget()); + if (creature != null) { + int amount = creature.getConvertedManaCost(); + creature.addCounters(new BoostCounter(0, 1, amount), game); + } + return false; + } + } +} diff --git a/Mage.Sets/src/mage/sets/coldsnap/DarkDepths.java b/Mage.Sets/src/mage/sets/coldsnap/DarkDepths.java index 108f81524bf..f7d83f64094 100644 --- a/Mage.Sets/src/mage/sets/coldsnap/DarkDepths.java +++ b/Mage.Sets/src/mage/sets/coldsnap/DarkDepths.java @@ -131,7 +131,7 @@ class DarkDepthsAbility extends StateTriggeredAbility { @Override public boolean checkTrigger(GameEvent event, Game game) { Permanent permanent = game.getPermanent(getSourceId()); - return permanent != null && permanent.getCounters().getCount(CounterType.ICE) == 0; + return permanent != null && permanent.getCounters(game).getCount(CounterType.ICE) == 0; } @Override diff --git a/Mage.Sets/src/mage/sets/coldsnap/HibernationsEnd.java b/Mage.Sets/src/mage/sets/coldsnap/HibernationsEnd.java index 09d46b4974c..a4f224f38dd 100644 --- a/Mage.Sets/src/mage/sets/coldsnap/HibernationsEnd.java +++ b/Mage.Sets/src/mage/sets/coldsnap/HibernationsEnd.java @@ -128,7 +128,7 @@ class HibernationsEndEffect extends OneShotEffect { Player player = game.getPlayer(source.getControllerId()); Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId()); if (sourcePermanent != null && player != null) { - int newConvertedCost = sourcePermanent.getCounters().getCount("age"); + int newConvertedCost = sourcePermanent.getCounters(game).getCount("age"); FilterCard filter = new FilterCard("creature card with converted mana cost " + newConvertedCost); filter.add(new ConvertedManaCostPredicate(Filter.ComparisonType.Equal, newConvertedCost)); filter.add(new CardTypePredicate(CardType.CREATURE)); diff --git a/Mage.Sets/src/mage/sets/commander/AnimarSoulOfElements.java b/Mage.Sets/src/mage/sets/commander/AnimarSoulOfElements.java index e8c9e26074a..325e0302243 100644 --- a/Mage.Sets/src/mage/sets/commander/AnimarSoulOfElements.java +++ b/Mage.Sets/src/mage/sets/commander/AnimarSoulOfElements.java @@ -117,7 +117,7 @@ class AnimarCostReductionEffect extends CostModificationEffectImpl { Ability spellAbility = (SpellAbility) abilityToModify; Permanent sourcePermanent = game.getPermanent(source.getSourceId()); if (sourcePermanent != null && spellAbility != null) { - int amount = sourcePermanent.getCounters().getCount(CounterType.P1P1); + int amount = sourcePermanent.getCounters(game).getCount(CounterType.P1P1); if (amount > 0) { CardUtil.reduceCost(spellAbility, amount); return true; diff --git a/Mage.Sets/src/mage/sets/commander/BuriedAlive.java b/Mage.Sets/src/mage/sets/commander/BuriedAlive.java index 50a31595713..9201cdcf2f8 100644 --- a/Mage.Sets/src/mage/sets/commander/BuriedAlive.java +++ b/Mage.Sets/src/mage/sets/commander/BuriedAlive.java @@ -89,7 +89,7 @@ class BuriedAliveEffect extends SearchEffect { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { if (controller.searchLibrary(target, game)) { - controller.moveCards(new CardsImpl(target.getTargets()), Zone.LIBRARY, Zone.GRAVEYARD, source, game); + controller.moveCards(new CardsImpl(target.getTargets()), Zone.GRAVEYARD, source, game); } controller.shuffleLibrary(source, game); return true; diff --git a/Mage.Sets/src/mage/sets/commander/DesecratorHag.java b/Mage.Sets/src/mage/sets/commander/DesecratorHag.java index a5724d07483..fd5824cead5 100644 --- a/Mage.Sets/src/mage/sets/commander/DesecratorHag.java +++ b/Mage.Sets/src/mage/sets/commander/DesecratorHag.java @@ -124,7 +124,7 @@ class DesecratorHagEffect extends OneShotEffect { } } } else { - return you.moveCards(cards, null, Zone.HAND, source, game); + return you.moveCards(cards, Zone.HAND, source, game); } } return false; diff --git a/Mage.Sets/src/mage/sets/commander/VishKalBloodArbiter.java b/Mage.Sets/src/mage/sets/commander/VishKalBloodArbiter.java index 9594ad1d90d..55662f63eee 100644 --- a/Mage.Sets/src/mage/sets/commander/VishKalBloodArbiter.java +++ b/Mage.Sets/src/mage/sets/commander/VishKalBloodArbiter.java @@ -123,7 +123,7 @@ class VishKalBloodArbiterCost extends CostImpl { public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { Permanent permanent = game.getPermanent(sourceId); if (permanent != null) { - this.amount = permanent.getCounters().getCount(name); + this.amount = permanent.getCounters(game).getCount(name); permanent.removeCounters(name, amount, game); this.paid = true; } diff --git a/Mage.Sets/src/mage/sets/commander2013/Foster.java b/Mage.Sets/src/mage/sets/commander2013/Foster.java index 37b0e131171..509d514db37 100644 --- a/Mage.Sets/src/mage/sets/commander2013/Foster.java +++ b/Mage.Sets/src/mage/sets/commander2013/Foster.java @@ -126,7 +126,7 @@ class FosterEffect extends OneShotEffect { controller.moveCards(cardFound, Zone.HAND, source, game); cards.remove(cardFound); } - controller.moveCards(cards, Zone.LIBRARY, Zone.GRAVEYARD, source, game); + controller.moveCards(cards, Zone.GRAVEYARD, source, game); } return true; } diff --git a/Mage.Sets/src/mage/sets/commander2013/MarathWillOfTheWild.java b/Mage.Sets/src/mage/sets/commander2013/MarathWillOfTheWild.java index f56934af526..f3976e03af5 100644 --- a/Mage.Sets/src/mage/sets/commander2013/MarathWillOfTheWild.java +++ b/Mage.Sets/src/mage/sets/commander2013/MarathWillOfTheWild.java @@ -112,7 +112,7 @@ public class MarathWillOfTheWild extends CardImpl { if (ability instanceof SimpleActivatedAbility && ability.getModes().size() == 3) { Permanent sourcePermanent = game.getPermanent(ability.getSourceId()); if (sourcePermanent != null) { - int amount = sourcePermanent.getCounters().getCount(CounterType.P1P1); + int amount = sourcePermanent.getCounters(game).getCount(CounterType.P1P1); if (amount > 0) { for (VariableCost cost: ability.getManaCostsToPay().getVariableCosts()) { if (cost instanceof VariableManaCost) { @@ -192,7 +192,7 @@ class MarathWillOfTheWildRemoveCountersCost extends CostImpl { @Override public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { Permanent permanent = game.getPermanent(sourceId); - if (permanent != null && permanent.getCounters().getCount(CounterType.P1P1) > 0) { + if (permanent != null && permanent.getCounters(game).getCount(CounterType.P1P1) > 0) { return true; } return false; @@ -202,7 +202,7 @@ class MarathWillOfTheWildRemoveCountersCost extends CostImpl { public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { int amount = new ManacostVariableValue().calculate(game, ability, null); Permanent permanent = game.getPermanent(sourceId); - if (permanent != null && permanent.getCounters().getCount(CounterType.P1P1) >= amount) { + if (permanent != null && permanent.getCounters(game).getCount(CounterType.P1P1) >= amount) { permanent.removeCounters(CounterType.P1P1.getName(), amount, game); this.paid = true; } diff --git a/Mage.Sets/src/mage/sets/commander2013/PhantomNantuko.java b/Mage.Sets/src/mage/sets/commander2013/PhantomNantuko.java index 9f2d2f37d82..3c5de1ded54 100644 --- a/Mage.Sets/src/mage/sets/commander2013/PhantomNantuko.java +++ b/Mage.Sets/src/mage/sets/commander2013/PhantomNantuko.java @@ -129,7 +129,7 @@ class PhantomNantukoPreventionEffect extends PreventionEffectImpl { } } - if(removeCounter && permanent.getCounters().containsKey(CounterType.P1P1)) { + if(removeCounter && permanent.getCounters(game).containsKey(CounterType.P1P1)) { StringBuilder sb = new StringBuilder(permanent.getName()).append(": "); permanent.removeCounters(CounterType.P1P1.createInstance(), game); sb.append("Removed a +1/+1 counter "); diff --git a/Mage.Sets/src/mage/sets/commander2013/PlagueBoiler.java b/Mage.Sets/src/mage/sets/commander2013/PlagueBoiler.java index e29d0cf668c..61e86c34cd3 100644 --- a/Mage.Sets/src/mage/sets/commander2013/PlagueBoiler.java +++ b/Mage.Sets/src/mage/sets/commander2013/PlagueBoiler.java @@ -101,7 +101,7 @@ class PlagueBoilerEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); Permanent sourcePermanent = game.getPermanent(source.getSourceId()); if (controller != null && sourcePermanent != null) { - if (!sourcePermanent.getCounters().containsKey(CounterType.PLAGUE) || controller.chooseUse(outcome, "Put a plague counter on? (No removes one)", source, game)) { + if (!sourcePermanent.getCounters(game).containsKey(CounterType.PLAGUE) || controller.chooseUse(outcome, "Put a plague counter on? (No removes one)", source, game)) { return new AddCountersSourceEffect(CounterType.PLAGUE.createInstance(), true).apply(game, source); } else { return new RemoveCounterSourceEffect(CounterType.PLAGUE.createInstance()).apply(game, source); @@ -135,7 +135,7 @@ class PlagueBoilerTriggeredAbility extends TriggeredAbilityImpl { public boolean checkTrigger(GameEvent event, Game game) { if (event.getTargetId().equals(this.getSourceId()) && event.getData().equals(CounterType.PLAGUE.getName())) { Permanent sourcePermanent = game.getPermanent(this.getSourceId()); - if (sourcePermanent != null && sourcePermanent.getCounters().getCount(CounterType.PLAGUE) >= 3) { + if (sourcePermanent != null && sourcePermanent.getCounters(game).getCount(CounterType.PLAGUE) >= 3) { return true; } } diff --git a/Mage.Sets/src/mage/sets/commander2013/StrategicPlanning.java b/Mage.Sets/src/mage/sets/commander2013/StrategicPlanning.java index dcb1ecdcc7b..1db8513711b 100644 --- a/Mage.Sets/src/mage/sets/commander2013/StrategicPlanning.java +++ b/Mage.Sets/src/mage/sets/commander2013/StrategicPlanning.java @@ -101,7 +101,7 @@ class StrategicPlanningEffect extends OneShotEffect { cards.remove(card); } } - controller.moveCards(cards, Zone.LIBRARY, Zone.GRAVEYARD, source, game); + controller.moveCards(cards, Zone.GRAVEYARD, source, game); } return true; } diff --git a/Mage.Sets/src/mage/sets/commander2014/AEtherSnap.java b/Mage.Sets/src/mage/sets/commander2014/AEtherSnap.java index 922537d4314..7cae9c21f57 100644 --- a/Mage.Sets/src/mage/sets/commander2014/AEtherSnap.java +++ b/Mage.Sets/src/mage/sets/commander2014/AEtherSnap.java @@ -90,8 +90,8 @@ class AEtherSnapEffect extends OneShotEffect { for (Permanent permanent : game.getBattlefield().getActivePermanents(new FilterPermanent(), controller.getId(), source.getSourceId(), game)) { if (permanent instanceof PermanentToken) { controller.moveCardToExileWithInfo(permanent, null, "", source.getSourceId(), game, Zone.BATTLEFIELD, true); - } else if (!permanent.getCounters().isEmpty()) { - Counters counters = permanent.getCounters().copy(); + } else if (!permanent.getCounters(game).isEmpty()) { + Counters counters = permanent.getCounters(game).copy(); for (Counter counter : counters.values()) { permanent.removeCounters(counter, game); } diff --git a/Mage.Sets/src/mage/sets/commander2014/GraveSifter.java b/Mage.Sets/src/mage/sets/commander2014/GraveSifter.java index 8dffb1f83ca..9ce16fc6c13 100644 --- a/Mage.Sets/src/mage/sets/commander2014/GraveSifter.java +++ b/Mage.Sets/src/mage/sets/commander2014/GraveSifter.java @@ -111,7 +111,7 @@ class GraveSifterEffect extends OneShotEffect { filter.add(new SubtypePredicate(typeChoice.getChoice())); Target target = new TargetCardInYourGraveyard(0, Integer.MAX_VALUE, filter); player.chooseTarget(outcome, target, source, game); - player.moveCards(new CardsImpl(target.getTargets()), null, Zone.HAND, source, game); + player.moveCards(new CardsImpl(target.getTargets()), Zone.HAND, source, game); } } diff --git a/Mage.Sets/src/mage/sets/commander2014/StitcherGeralf.java b/Mage.Sets/src/mage/sets/commander2014/StitcherGeralf.java index 66079a6dc84..54409f0b92d 100644 --- a/Mage.Sets/src/mage/sets/commander2014/StitcherGeralf.java +++ b/Mage.Sets/src/mage/sets/commander2014/StitcherGeralf.java @@ -108,7 +108,7 @@ class StitcherGeralfEffect extends OneShotEffect { cards.addAll(player.getLibrary().getTopCards(game, 3)); } } - controller.moveCards(cards, Zone.LIBRARY, Zone.GRAVEYARD, source, game); + controller.moveCards(cards, Zone.GRAVEYARD, source, game); TargetCard target = new TargetCard(0,2,Zone.GRAVEYARD, new FilterCreatureCard("creature cards to exile")); controller.chooseTarget(outcome, cards, target, source, game); int power = 0; diff --git a/Mage.Sets/src/mage/sets/commander2015/BloodsporeThrinax.java b/Mage.Sets/src/mage/sets/commander2015/BloodsporeThrinax.java index 5a5d699db54..7c8a0d49226 100644 --- a/Mage.Sets/src/mage/sets/commander2015/BloodsporeThrinax.java +++ b/Mage.Sets/src/mage/sets/commander2015/BloodsporeThrinax.java @@ -106,7 +106,7 @@ class BloodsporeThrinaxEntersBattlefieldEffect extends ReplacementEffectImpl { Permanent sourceCreature = game.getPermanent(source.getSourceId()); Permanent creature = ((EntersTheBattlefieldEvent) event).getTarget(); if (sourceCreature != null && creature != null) { - int amount = sourceCreature.getCounters().getCount(CounterType.P1P1); + int amount = sourceCreature.getCounters(game).getCount(CounterType.P1P1); if (amount > 0) { creature.addCounters(CounterType.P1P1.createInstance(amount), game); } diff --git a/Mage.Sets/src/mage/sets/commander2015/ThiefOfBlood.java b/Mage.Sets/src/mage/sets/commander2015/ThiefOfBlood.java index 1d680880263..ac0ff03b420 100644 --- a/Mage.Sets/src/mage/sets/commander2015/ThiefOfBlood.java +++ b/Mage.Sets/src/mage/sets/commander2015/ThiefOfBlood.java @@ -101,7 +101,7 @@ class ThiefOfBloodEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { int countersRemoved = 0; for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), game)) { - Counters counters = permanent.getCounters().copy(); + Counters counters = permanent.getCounters(game).copy(); for (Counter counter : counters.values()) { permanent.removeCounters(counter.getName(), counter.getCount(), game); countersRemoved += counter.getCount(); diff --git a/Mage.Sets/src/mage/sets/conflux/GwafaHazidProfiteer.java b/Mage.Sets/src/mage/sets/conflux/GwafaHazidProfiteer.java index 938bdf266ad..ff96e311e0c 100644 --- a/Mage.Sets/src/mage/sets/conflux/GwafaHazidProfiteer.java +++ b/Mage.Sets/src/mage/sets/conflux/GwafaHazidProfiteer.java @@ -140,7 +140,7 @@ class GwafaHazidProfiteerEffect2 extends RestrictionEffect { @Override public boolean applies(Permanent permanent, Ability source, Game game) { - return permanent.getCounters().containsKey(CounterType.BRIBERY); + return permanent.getCounters(game).containsKey(CounterType.BRIBERY); } @Override diff --git a/Mage.Sets/src/mage/sets/conflux/TeleminPerformance.java b/Mage.Sets/src/mage/sets/conflux/TeleminPerformance.java index 9574a17f72d..3096f19222d 100644 --- a/Mage.Sets/src/mage/sets/conflux/TeleminPerformance.java +++ b/Mage.Sets/src/mage/sets/conflux/TeleminPerformance.java @@ -104,7 +104,7 @@ class TeleminPerformanceEffect extends OneShotEffect { } if (!cards.isEmpty()) { opponent.revealCards("Telemin Performance", cards, game); - opponent.moveCards(cards, Zone.LIBRARY, Zone.GRAVEYARD, source, game); + opponent.moveCards(cards, Zone.GRAVEYARD, source, game); } if (creature != null) { return creature.putOntoBattlefield(game, Zone.LIBRARY, source.getSourceId(), source.getControllerId()); diff --git a/Mage.Sets/src/mage/sets/darkascension/JarOfEyeballs.java b/Mage.Sets/src/mage/sets/darkascension/JarOfEyeballs.java index 8ffde604dc8..ebd5bf57141 100644 --- a/Mage.Sets/src/mage/sets/darkascension/JarOfEyeballs.java +++ b/Mage.Sets/src/mage/sets/darkascension/JarOfEyeballs.java @@ -148,7 +148,7 @@ class JarOfEyeballsCost extends CostImpl { public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { Permanent permanent = game.getPermanent(ability.getSourceId()); if (permanent != null) { - this.removedCounters = permanent.getCounters().getCount(CounterType.EYEBALL); + this.removedCounters = permanent.getCounters(game).getCount(CounterType.EYEBALL); if (this.removedCounters > 0) { permanent.removeCounters(CounterType.EYEBALL.createInstance(this.removedCounters), game); } diff --git a/Mage.Sets/src/mage/sets/darkascension/TrackersInstincts.java b/Mage.Sets/src/mage/sets/darkascension/TrackersInstincts.java index 3274bbb3c15..0e85ab4a983 100644 --- a/Mage.Sets/src/mage/sets/darkascension/TrackersInstincts.java +++ b/Mage.Sets/src/mage/sets/darkascension/TrackersInstincts.java @@ -118,7 +118,7 @@ class TrackersInstinctsEffect extends OneShotEffect { } } - controller.moveCards(cards, Zone.LIBRARY, Zone.GRAVEYARD, source, game); + controller.moveCards(cards, Zone.GRAVEYARD, source, game); } return true; } diff --git a/Mage.Sets/src/mage/sets/darksteel/AEtherVial.java b/Mage.Sets/src/mage/sets/darksteel/AEtherVial.java index 2b8937f5f92..d396249c524 100644 --- a/Mage.Sets/src/mage/sets/darksteel/AEtherVial.java +++ b/Mage.Sets/src/mage/sets/darksteel/AEtherVial.java @@ -101,7 +101,7 @@ class AEtherVialEffect extends OneShotEffect { return false; } } - int count = permanent.getCounters().getCount(CounterType.CHARGE); + int count = permanent.getCounters(game).getCount(CounterType.CHARGE); FilterCreatureCard filter = new FilterCreatureCard("creature card with converted mana cost equal to " + count); filter.add(new ConvertedManaCostPredicate(Filter.ComparisonType.Equal, count)); diff --git a/Mage.Sets/src/mage/sets/darksteel/ChromescaleDrake.java b/Mage.Sets/src/mage/sets/darksteel/ChromescaleDrake.java index 9f06247482a..5ebb37bde09 100644 --- a/Mage.Sets/src/mage/sets/darksteel/ChromescaleDrake.java +++ b/Mage.Sets/src/mage/sets/darksteel/ChromescaleDrake.java @@ -109,8 +109,8 @@ class ChromescaleDrakeEffect extends OneShotEffect { cards.remove(card); } } - controller.moveCards(cardsToHand, Zone.LIBRARY, Zone.HAND, source, game); - controller.moveCards(cards, Zone.LIBRARY, Zone.GRAVEYARD, source, game); + controller.moveCards(cardsToHand, Zone.HAND, source, game); + controller.moveCards(cards, Zone.GRAVEYARD, source, game); } return true; } diff --git a/Mage.Sets/src/mage/sets/darksteel/DarksteelReactor.java b/Mage.Sets/src/mage/sets/darksteel/DarksteelReactor.java index 9a559a9c108..363bfff68da 100644 --- a/Mage.Sets/src/mage/sets/darksteel/DarksteelReactor.java +++ b/Mage.Sets/src/mage/sets/darksteel/DarksteelReactor.java @@ -90,7 +90,7 @@ class DarksteelReactorStateTriggeredAbility extends StateTriggeredAbility { @Override public boolean checkTrigger(GameEvent event, Game game) { Permanent permanent = game.getPermanent(this.getSourceId()); - if(permanent != null && permanent.getCounters().getCount(CounterType.CHARGE) >= 20){ + if(permanent != null && permanent.getCounters(game).getCount(CounterType.CHARGE) >= 20){ return true; } return false; diff --git a/Mage.Sets/src/mage/sets/dissension/BoundDetermined.java b/Mage.Sets/src/mage/sets/dissension/BoundDetermined.java index b46d4946cd1..c199091d4a1 100644 --- a/Mage.Sets/src/mage/sets/dissension/BoundDetermined.java +++ b/Mage.Sets/src/mage/sets/dissension/BoundDetermined.java @@ -125,7 +125,7 @@ class BoundEffect extends OneShotEffect { TargetCardInYourGraveyard targetCard = new TargetCardInYourGraveyard(0, colors, new FilterCard("up to " + colors + " card" + (colors > 1 ? "s" : "") + " from your graveyard")); controller.chooseTarget(outcome, targetCard, source, game); - controller.moveCards(new CardsImpl(targetCard.getTargets()), null, Zone.HAND, source, game); + controller.moveCards(new CardsImpl(targetCard.getTargets()), Zone.HAND, source, game); } } } diff --git a/Mage.Sets/src/mage/sets/dissension/CytoplastRootKin.java b/Mage.Sets/src/mage/sets/dissension/CytoplastRootKin.java index 9c0de869b60..7d90f9c63e2 100644 --- a/Mage.Sets/src/mage/sets/dissension/CytoplastRootKin.java +++ b/Mage.Sets/src/mage/sets/dissension/CytoplastRootKin.java @@ -114,7 +114,7 @@ class CytoplastRootKinEffect extends OneShotEffect { if (sourcePermanent != null && targetPermanent != null && !sourcePermanent.getId().equals(targetPermanent.getId()) - && targetPermanent.getCounters().getCount(CounterType.P1P1) > 0) { + && targetPermanent.getCounters(game).getCount(CounterType.P1P1) > 0) { targetPermanent.removeCounters(CounterType.P1P1.createInstance(), game); sourcePermanent.addCounters(CounterType.P1P1.createInstance(), game); return true; diff --git a/Mage.Sets/src/mage/sets/dissension/MomirVigSimicVisionary.java b/Mage.Sets/src/mage/sets/dissension/MomirVigSimicVisionary.java index 38d5e605aec..d3a84fbd871 100644 --- a/Mage.Sets/src/mage/sets/dissension/MomirVigSimicVisionary.java +++ b/Mage.Sets/src/mage/sets/dissension/MomirVigSimicVisionary.java @@ -136,7 +136,7 @@ class MomirVigSimicVisionaryEffect extends OneShotEffect { cards.remove(card); } } - controller.moveCards(cardsToHand, null, Zone.HAND, source, game); + controller.moveCards(cardsToHand, Zone.HAND, source, game); return true; } } diff --git a/Mage.Sets/src/mage/sets/dissension/RiseFall.java b/Mage.Sets/src/mage/sets/dissension/RiseFall.java index 3df0737e4e4..58db402090f 100644 --- a/Mage.Sets/src/mage/sets/dissension/RiseFall.java +++ b/Mage.Sets/src/mage/sets/dissension/RiseFall.java @@ -108,7 +108,7 @@ class RiseEffect extends OneShotEffect { if (permanent != null) { cardsToHand.add(permanent); } - controller.moveCards(cardsToHand, null, Zone.HAND, source, game); + controller.moveCards(cardsToHand, Zone.HAND, source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/sets/dragonsmaze/BredForTheHunt.java b/Mage.Sets/src/mage/sets/dragonsmaze/BredForTheHunt.java index d7f5af5a277..02c57cb6654 100644 --- a/Mage.Sets/src/mage/sets/dragonsmaze/BredForTheHunt.java +++ b/Mage.Sets/src/mage/sets/dragonsmaze/BredForTheHunt.java @@ -89,7 +89,7 @@ class BredForTheHuntTriggeredAbility extends TriggeredAbilityImpl { public boolean checkTrigger(GameEvent event, Game game) { if (((DamagedEvent) event).isCombatDamage()) { Permanent creature = game.getPermanent(event.getSourceId()); - if (creature != null && creature.getControllerId().equals(getControllerId()) && creature.getCounters().getCount(CounterType.P1P1) > 0) { + if (creature != null && creature.getControllerId().equals(getControllerId()) && creature.getCounters(game).getCount(CounterType.P1P1) > 0) { return true; } } diff --git a/Mage.Sets/src/mage/sets/dragonsmaze/GiveTake.java b/Mage.Sets/src/mage/sets/dragonsmaze/GiveTake.java index 5f6c6940144..659d2721e2c 100644 --- a/Mage.Sets/src/mage/sets/dragonsmaze/GiveTake.java +++ b/Mage.Sets/src/mage/sets/dragonsmaze/GiveTake.java @@ -93,7 +93,7 @@ class TakeEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Permanent creature = game.getPermanent(targetPointer.getFirst(game, source)); if (creature != null) { - int numberCounters = creature.getCounters().getCount(CounterType.P1P1); + int numberCounters = creature.getCounters(game).getCount(CounterType.P1P1); if (numberCounters > 0) { creature.removeCounters(CounterType.P1P1.getName(), numberCounters, game); Player controller = game.getPlayer(source.getControllerId()); diff --git a/Mage.Sets/src/mage/sets/dragonsmaze/MirkoVoskMindDrinker.java b/Mage.Sets/src/mage/sets/dragonsmaze/MirkoVoskMindDrinker.java index f7db36f8b80..f835cf55385 100644 --- a/Mage.Sets/src/mage/sets/dragonsmaze/MirkoVoskMindDrinker.java +++ b/Mage.Sets/src/mage/sets/dragonsmaze/MirkoVoskMindDrinker.java @@ -119,7 +119,7 @@ class MirkoVoskMindDrinkerEffect extends OneShotEffect { } } player.revealCards("by " + sourceObject.getName() + " from " + player.getName(), cards, game); - player.moveCards(cards, Zone.LIBRARY, Zone.GRAVEYARD, source, game); + player.moveCards(cards, Zone.GRAVEYARD, source, game); return true; } } diff --git a/Mage.Sets/src/mage/sets/dragonsmaze/VorelOfTheHullClade.java b/Mage.Sets/src/mage/sets/dragonsmaze/VorelOfTheHullClade.java index f853e890911..f537d09c28e 100644 --- a/Mage.Sets/src/mage/sets/dragonsmaze/VorelOfTheHullClade.java +++ b/Mage.Sets/src/mage/sets/dragonsmaze/VorelOfTheHullClade.java @@ -107,7 +107,7 @@ class VorelOfTheHullCladeEffect extends OneShotEffect { if (target == null) { return false; } - for (Counter counter : target.getCounters().values()) { + for (Counter counter : target.getCounters(game).values()) { Counter newCounter = new Counter(counter.getName(), counter.getCount()); target.addCounters(newCounter, game); } diff --git a/Mage.Sets/src/mage/sets/dragonsoftarkir/GleamOfAuthority.java b/Mage.Sets/src/mage/sets/dragonsoftarkir/GleamOfAuthority.java index 43b9341a94a..156f757298e 100644 --- a/Mage.Sets/src/mage/sets/dragonsoftarkir/GleamOfAuthority.java +++ b/Mage.Sets/src/mage/sets/dragonsoftarkir/GleamOfAuthority.java @@ -111,7 +111,7 @@ class CountersOnControlledCount implements DynamicValue { Permanent enchantment = game.getPermanent(sourceAbility.getSourceId()); for (Permanent permanent : game.getState().getBattlefield().getAllActivePermanents(filter, sourceAbility.getControllerId(), game)) { if (!permanent.getId().equals(enchantment.getAttachedTo())) { - count += permanent.getCounters().getCount(CounterType.P1P1); + count += permanent.getCounters(game).getCount(CounterType.P1P1); } } return count; diff --git a/Mage.Sets/src/mage/sets/dragonsoftarkir/GurmagDrowner.java b/Mage.Sets/src/mage/sets/dragonsoftarkir/GurmagDrowner.java index facf0554825..48c93b2f49b 100644 --- a/Mage.Sets/src/mage/sets/dragonsoftarkir/GurmagDrowner.java +++ b/Mage.Sets/src/mage/sets/dragonsoftarkir/GurmagDrowner.java @@ -111,7 +111,7 @@ class GurmagDrownerEffect extends OneShotEffect { cards.remove(card); } } - controller.moveCards(cards, Zone.LIBRARY, Zone.GRAVEYARD, source, game); + controller.moveCards(cards, Zone.GRAVEYARD, source, game); } return true; } diff --git a/Mage.Sets/src/mage/sets/dragonsoftarkir/MythRealized.java b/Mage.Sets/src/mage/sets/dragonsoftarkir/MythRealized.java index 942e5171998..10247877cb0 100644 --- a/Mage.Sets/src/mage/sets/dragonsoftarkir/MythRealized.java +++ b/Mage.Sets/src/mage/sets/dragonsoftarkir/MythRealized.java @@ -131,7 +131,7 @@ class MythRealizedSetPTEffect extends ContinuousEffectImpl { if (controller != null) { Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null && new MageObjectReference(source.getSourceObject(game), game).refersTo(permanent, game)) { - int amount = permanent.getCounters().getCount(CounterType.LORE); + int amount = permanent.getCounters(game).getCount(CounterType.LORE); permanent.getPower().setValue(amount); permanent.getToughness().setValue(amount); return true; diff --git a/Mage.Sets/src/mage/sets/dragonsoftarkir/ProfanerOfTheDead.java b/Mage.Sets/src/mage/sets/dragonsoftarkir/ProfanerOfTheDead.java index 536cc50246f..a08fd37bed8 100644 --- a/Mage.Sets/src/mage/sets/dragonsoftarkir/ProfanerOfTheDead.java +++ b/Mage.Sets/src/mage/sets/dragonsoftarkir/ProfanerOfTheDead.java @@ -105,7 +105,7 @@ class ProfanerOfTheDeadReturnEffect extends OneShotEffect { for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) { cardsToHand.add(permanent); } - controller.moveCards(cardsToHand, null, Zone.HAND, source, game); + controller.moveCards(cardsToHand, Zone.HAND, source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/sets/dragonsoftarkir/ServantOfTheScale.java b/Mage.Sets/src/mage/sets/dragonsoftarkir/ServantOfTheScale.java index 2967f548d09..21ab714bb12 100644 --- a/Mage.Sets/src/mage/sets/dragonsoftarkir/ServantOfTheScale.java +++ b/Mage.Sets/src/mage/sets/dragonsoftarkir/ServantOfTheScale.java @@ -104,7 +104,7 @@ class ServantOfTheScaleEffect extends OneShotEffect { if (sourcePermanent != null && controller != null && (sourcePermanent.getZoneChangeCounter(game) == source.getSourceObjectZoneChangeCounter() // Token || sourcePermanent.getZoneChangeCounter(game) + 1 == source.getSourceObjectZoneChangeCounter())) { // PermanentCard - int amount = sourcePermanent.getCounters().getCount(CounterType.P1P1); + int amount = sourcePermanent.getCounters(game).getCount(CounterType.P1P1); if (amount > 0) { Effect effect = new AddCountersTargetEffect(CounterType.P1P1.createInstance(amount)); effect.setTargetPointer(targetPointer); diff --git a/Mage.Sets/src/mage/sets/eldritchmoon/IdentityThief.java b/Mage.Sets/src/mage/sets/eldritchmoon/IdentityThief.java index 12cbb8c3b69..2a3834b7e41 100644 --- a/Mage.Sets/src/mage/sets/eldritchmoon/IdentityThief.java +++ b/Mage.Sets/src/mage/sets/eldritchmoon/IdentityThief.java @@ -139,7 +139,7 @@ class IdentityThiefEffect extends OneShotEffect { Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId()); if (controller != null && permanent != null && sourcePermanent != null) { Permanent permanentReset = permanent.copy(); - permanentReset.getCounters().clear(); + permanentReset.getCounters(game).clear(); permanentReset.getPower().resetToBaseValue(); permanentReset.getToughness().resetToBaseValue(); CopyEffect copyEffect = new CopyEffect(Duration.EndOfTurn, permanentReset, source.getSourceId()); diff --git a/Mage.Sets/src/mage/sets/eldritchmoon/NoosegrafMob.java b/Mage.Sets/src/mage/sets/eldritchmoon/NoosegrafMob.java index 6d1c24d9066..f4c8a3ffdc4 100644 --- a/Mage.Sets/src/mage/sets/eldritchmoon/NoosegrafMob.java +++ b/Mage.Sets/src/mage/sets/eldritchmoon/NoosegrafMob.java @@ -96,7 +96,7 @@ class NoosegrafMobEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Permanent permanent = game.getPermanent(source.getSourceId()); Player controller = game.getPlayer(source.getControllerId()); - if (controller != null && permanent != null && permanent.getCounters().getCount(CounterType.P1P1) > 0) { + if (controller != null && permanent != null && permanent.getCounters(game).getCount(CounterType.P1P1) > 0) { permanent.removeCounters(CounterType.P1P1.createInstance(), game); Effect effect = new CreateTokenEffect(new ZombieToken()); return effect.apply(game, source); diff --git a/Mage.Sets/src/mage/sets/elspethvstezzeret/EchoingTruth.java b/Mage.Sets/src/mage/sets/elspethvstezzeret/EchoingTruth.java index 48d87e364e2..218e9d73721 100644 --- a/Mage.Sets/src/mage/sets/elspethvstezzeret/EchoingTruth.java +++ b/Mage.Sets/src/mage/sets/elspethvstezzeret/EchoingTruth.java @@ -103,7 +103,7 @@ class ReturnToHandAllNamedPermanentsEffect extends OneShotEffect { for (Permanent perm : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), game)) { cardsToHand.add(perm); } - controller.moveCards(cardsToHand, null, Zone.HAND, source, game); + controller.moveCards(cardsToHand, Zone.HAND, source, game); return true; } return true; diff --git a/Mage.Sets/src/mage/sets/eventide/GilderBairn.java b/Mage.Sets/src/mage/sets/eventide/GilderBairn.java index a17be6b9fe1..2c2d3f23420 100644 --- a/Mage.Sets/src/mage/sets/eventide/GilderBairn.java +++ b/Mage.Sets/src/mage/sets/eventide/GilderBairn.java @@ -98,7 +98,7 @@ class GilderBairnEffect extends OneShotEffect { if (target == null) { return false; } - for (Counter counter : target.getCounters().values()) { + for (Counter counter : target.getCounters(game).values()) { Counter newCounter = new Counter(counter.getName(), counter.getCount()); target.addCounters(newCounter, game); } diff --git a/Mage.Sets/src/mage/sets/eventide/Necroskitter.java b/Mage.Sets/src/mage/sets/eventide/Necroskitter.java index 054381415a5..3b790761ff8 100644 --- a/Mage.Sets/src/mage/sets/eventide/Necroskitter.java +++ b/Mage.Sets/src/mage/sets/eventide/Necroskitter.java @@ -103,7 +103,7 @@ class NecroskitterTriggeredAbility extends TriggeredAbilityImpl { if (zEvent.getFromZone() == Zone.BATTLEFIELD && zEvent.getToZone() == Zone.GRAVEYARD) { Permanent permanent = zEvent.getTarget(); if (permanent != null - && permanent.getCounters().containsKey(CounterType.M1M1) + && permanent.getCounters(game).containsKey(CounterType.M1M1) && game.getOpponents(controllerId).contains(permanent.getControllerId())) { for (Effect effect : this.getEffects()) { effect.setTargetPointer(new FixedTarget(event.getTargetId(), game.getState().getZoneChangeCounter(event.getTargetId()))); diff --git a/Mage.Sets/src/mage/sets/exodus/SpikeCannibal.java b/Mage.Sets/src/mage/sets/exodus/SpikeCannibal.java index 385b3ca0c40..65756c41f39 100644 --- a/Mage.Sets/src/mage/sets/exodus/SpikeCannibal.java +++ b/Mage.Sets/src/mage/sets/exodus/SpikeCannibal.java @@ -104,7 +104,7 @@ class SpikeCannibalEffect extends OneShotEffect { if (sourcePermanent != null) { for (Permanent creature : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), game)) { if (creature != sourcePermanent) { - int numberCounters = creature.getCounters().getCount(CounterType.P1P1); + int numberCounters = creature.getCounters(game).getCount(CounterType.P1P1); if (numberCounters > 0) { creature.removeCounters(CounterType.P1P1.getName(), numberCounters, game); countersRemoved += numberCounters; diff --git a/Mage.Sets/src/mage/sets/fatereforged/DaghatarTheAdamant.java b/Mage.Sets/src/mage/sets/fatereforged/DaghatarTheAdamant.java index 327de83e8cb..cdd50b828a5 100644 --- a/Mage.Sets/src/mage/sets/fatereforged/DaghatarTheAdamant.java +++ b/Mage.Sets/src/mage/sets/fatereforged/DaghatarTheAdamant.java @@ -111,7 +111,7 @@ class MoveCounterFromTargetToTargetEffect extends OneShotEffect { MageObject sourceObject = game.getObject(source.getSourceId()); if (sourceObject != null && controller != null) { Permanent fromPermanent = game.getPermanent(getTargetPointer().getFirst(game, source)); - if (fromPermanent != null && fromPermanent.getCounters().getCount(CounterType.P1P1) > 0) { + if (fromPermanent != null && fromPermanent.getCounters(game).getCount(CounterType.P1P1) > 0) { Permanent toPermanent = game.getPermanent(source.getTargets().get(1).getFirstTarget()); if (toPermanent != null) { fromPermanent.removeCounters(CounterType.P1P1.createInstance(), game); diff --git a/Mage.Sets/src/mage/sets/fatereforged/RenownedWeaponsmith.java b/Mage.Sets/src/mage/sets/fatereforged/RenownedWeaponsmith.java index 4a1a01b88ea..32dc1e76b5c 100644 --- a/Mage.Sets/src/mage/sets/fatereforged/RenownedWeaponsmith.java +++ b/Mage.Sets/src/mage/sets/fatereforged/RenownedWeaponsmith.java @@ -150,7 +150,7 @@ class RenownedWeaponsmithEffect extends OneShotEffect { Cards revealed = new CardsImpl(); revealed.add(card); controller.revealCards(sourceObject.getIdName(), revealed, game); - controller.moveCards(revealed, null, Zone.HAND, source, game); + controller.moveCards(revealed, Zone.HAND, source, game); } } controller.shuffleLibrary(source, game); diff --git a/Mage.Sets/src/mage/sets/fatereforged/SuddenReclamation.java b/Mage.Sets/src/mage/sets/fatereforged/SuddenReclamation.java index c12a2bd1798..f4468150a5c 100644 --- a/Mage.Sets/src/mage/sets/fatereforged/SuddenReclamation.java +++ b/Mage.Sets/src/mage/sets/fatereforged/SuddenReclamation.java @@ -110,7 +110,7 @@ class SuddenReclamationEffect extends OneShotEffect { cardsToHand.add(card); } } - controller.moveCards(cardsToHand, null, Zone.HAND, source, game); + controller.moveCards(cardsToHand, Zone.HAND, source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/sets/fifthdawn/EngineeredExplosives.java b/Mage.Sets/src/mage/sets/fifthdawn/EngineeredExplosives.java index e8d7576e5fc..cdf2d19367d 100644 --- a/Mage.Sets/src/mage/sets/fifthdawn/EngineeredExplosives.java +++ b/Mage.Sets/src/mage/sets/fifthdawn/EngineeredExplosives.java @@ -99,7 +99,7 @@ class EngineeredExplosivesEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { MageObject engineeredExplosives = game.getLastKnownInformation(source.getSourceId(), Zone.BATTLEFIELD); if(engineeredExplosives != null && engineeredExplosives instanceof Permanent){ - int count = ((Permanent)engineeredExplosives).getCounters().getCount(CounterType.CHARGE); + int count = ((Permanent)engineeredExplosives).getCounters(game).getCount(CounterType.CHARGE); for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) { if(permanent.getConvertedManaCost() == count){ permanent.destroy(source.getSourceId(), game, false); diff --git a/Mage.Sets/src/mage/sets/fifthedition/Recall.java b/Mage.Sets/src/mage/sets/fifthedition/Recall.java index f1af05b0fa4..194e66d8328 100644 --- a/Mage.Sets/src/mage/sets/fifthedition/Recall.java +++ b/Mage.Sets/src/mage/sets/fifthedition/Recall.java @@ -96,7 +96,7 @@ class RecallEffect extends OneShotEffect { TargetCardInYourGraveyard target = new TargetCardInYourGraveyard(cardsDiscarded.size(), new FilterCard()); target.setNotTarget(true); target.choose(Outcome.ReturnToHand, controller.getId(), source.getSourceId(), game); - controller.moveCards(new CardsImpl(target.getTargets()), null, Zone.HAND, source, game); + controller.moveCards(new CardsImpl(target.getTargets()), Zone.HAND, source, game); } return true; diff --git a/Mage.Sets/src/mage/sets/fifthedition/WindsOfChange.java b/Mage.Sets/src/mage/sets/fifthedition/WindsOfChange.java index 1086263c23f..0a3fb274df7 100644 --- a/Mage.Sets/src/mage/sets/fifthedition/WindsOfChange.java +++ b/Mage.Sets/src/mage/sets/fifthedition/WindsOfChange.java @@ -89,7 +89,7 @@ class WindsOfChangeEffect extends OneShotEffect { Player player = game.getPlayer(playerId); if (player != null) { permanentsCount.put(playerId, player.getHand().size()); - player.moveCards(player.getHand(), Zone.HAND, Zone.LIBRARY, source, game); + player.moveCards(player.getHand(), Zone.LIBRARY, source, game); player.shuffleLibrary(source, game); } } diff --git a/Mage.Sets/src/mage/sets/fourthedition/ClockworkAvian.java b/Mage.Sets/src/mage/sets/fourthedition/ClockworkAvian.java index 62e3877f288..87815b41c42 100644 --- a/Mage.Sets/src/mage/sets/fourthedition/ClockworkAvian.java +++ b/Mage.Sets/src/mage/sets/fourthedition/ClockworkAvian.java @@ -100,7 +100,7 @@ class AvianAddCountersSourceEffect extends AddCountersSourceEffect { @Override public boolean apply(Game game, Ability source) { //record how many counters - Counters permCounters = game.getPermanent(source.getSourceId()).getCounters(); + Counters permCounters = game.getPermanent(source.getSourceId()).getCounters(game); int countersWas = permCounters.getCount(CounterType.P1P0); if (countersWas < 4){ super.apply(game, source); diff --git a/Mage.Sets/src/mage/sets/fourthedition/CyclopeanMummy.java b/Mage.Sets/src/mage/sets/fourthedition/CyclopeanMummy.java new file mode 100644 index 00000000000..26703142ac1 --- /dev/null +++ b/Mage.Sets/src/mage/sets/fourthedition/CyclopeanMummy.java @@ -0,0 +1,52 @@ +/* + * 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.sets.fourthedition; + +import java.util.UUID; + +/** + * + * @author Derpthemeus + */ +public class CyclopeanMummy extends mage.sets.legends.CyclopeanMummy { + + public CyclopeanMummy(UUID ownerId) { + super(ownerId); + this.cardNumber = "12"; + this.expansionSetCode = "4ED"; + } + + public CyclopeanMummy(final CyclopeanMummy card) { + super(card); + } + + @Override + public CyclopeanMummy copy() { + return new CyclopeanMummy(this); + } +} diff --git a/Mage.Sets/src/mage/sets/futuresight/CoalitionRelic.java b/Mage.Sets/src/mage/sets/futuresight/CoalitionRelic.java index 8577a414ceb..adc57e3fd9e 100644 --- a/Mage.Sets/src/mage/sets/futuresight/CoalitionRelic.java +++ b/Mage.Sets/src/mage/sets/futuresight/CoalitionRelic.java @@ -97,7 +97,7 @@ class CoalitionRelicEffect extends OneShotEffect { Permanent sourcePermanent = game.getPermanent(source.getSourceId()); Player player = game.getPlayer(source.getControllerId()); if (sourcePermanent != null && player != null) { - int chargeCounters = sourcePermanent.getCounters().getCount(CounterType.CHARGE); + int chargeCounters = sourcePermanent.getCounters(game).getCount(CounterType.CHARGE); sourcePermanent.removeCounters(CounterType.CHARGE.createInstance(chargeCounters), game); Mana mana = new Mana(); ChoiceColor choice = new ChoiceColor(); diff --git a/Mage.Sets/src/mage/sets/futuresight/DustOfMoments.java b/Mage.Sets/src/mage/sets/futuresight/DustOfMoments.java index 1736ded2689..fe3eef96e3d 100644 --- a/Mage.Sets/src/mage/sets/futuresight/DustOfMoments.java +++ b/Mage.Sets/src/mage/sets/futuresight/DustOfMoments.java @@ -138,7 +138,7 @@ public class DustOfMoments extends CardImpl { if (permFilter.match(card, game)) { final String counterName = counter.getName(); if (shouldRemoveCounters()) { - final Counter existingCounterOfSameType = card.getCounters().get(counterName); + final Counter existingCounterOfSameType = card.getCounters(game).get(counterName); final int countersToRemove = Math.min(existingCounterOfSameType.getCount(), counter.getCount()); final Counter modifiedCounter = new Counter(counterName, countersToRemove); card.removeCounters(modifiedCounter, game); diff --git a/Mage.Sets/src/mage/sets/futuresight/LostAuramancers.java b/Mage.Sets/src/mage/sets/futuresight/LostAuramancers.java index 513cac67db2..d0a2b3b9e1e 100644 --- a/Mage.Sets/src/mage/sets/futuresight/LostAuramancers.java +++ b/Mage.Sets/src/mage/sets/futuresight/LostAuramancers.java @@ -104,7 +104,7 @@ class LostAuramancersAbility extends PutIntoGraveFromBattlefieldSourceTriggeredA public boolean checkTrigger(GameEvent event, Game game) { if (super.checkTrigger(event, game)) { Permanent permanent = (Permanent) game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD); - if (!permanent.getCounters().containsKey(CounterType.TIME) || permanent.getCounters().getCount(CounterType.TIME) == 0) { + if (!permanent.getCounters(game).containsKey(CounterType.TIME) || permanent.getCounters(game).getCount(CounterType.TIME) == 0) { return true; } } diff --git a/Mage.Sets/src/mage/sets/futuresight/MinionsMurmurs.java b/Mage.Sets/src/mage/sets/futuresight/MinionsMurmurs.java new file mode 100644 index 00000000000..cc280927c3a --- /dev/null +++ b/Mage.Sets/src/mage/sets/futuresight/MinionsMurmurs.java @@ -0,0 +1,92 @@ +/* + * 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.sets.futuresight; + +import java.util.UUID; +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.players.Player; + +/** + * + * @author Derpthemeus + */ +public class MinionsMurmurs extends CardImpl { + + public MinionsMurmurs(UUID ownerId) { + super(ownerId, 71, "Minions' Murmurs", Rarity.UNCOMMON, new CardType[]{CardType.SORCERY}, "{2}{B}{B}"); + this.expansionSetCode = "FUT"; + + // You draw X cards and you lose X life, where X is the number of creatures you control. + this.getSpellAbility().addEffect(new MinionsMurmursEffect()); + } + + public MinionsMurmurs(final MinionsMurmurs card) { + super(card); + } + + @Override + public MinionsMurmurs copy() { + return new MinionsMurmurs(this); + } + + class MinionsMurmursEffect extends OneShotEffect { + + public MinionsMurmursEffect() { + super(Outcome.DrawCard); + this.staticText = "You draw X cards and you lose X life, where X is the number of creatures you control"; + } + + public MinionsMurmursEffect(final MinionsMurmursEffect effect) { + super(effect); + } + + @Override + public MinionsMurmursEffect copy() { + return new MinionsMurmursEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + if (controller != null) { + int creaturesControlled = game.getBattlefield().countAll(new FilterCreaturePermanent(), controller.getId(), game); + controller.drawCards(creaturesControlled, game); + controller.loseLife(creaturesControlled, game); + return true; + } + return false; + } + } +} diff --git a/Mage.Sets/src/mage/sets/gatecrash/BalustradeSpy.java b/Mage.Sets/src/mage/sets/gatecrash/BalustradeSpy.java index eb65a004706..68c1ed6350f 100644 --- a/Mage.Sets/src/mage/sets/gatecrash/BalustradeSpy.java +++ b/Mage.Sets/src/mage/sets/gatecrash/BalustradeSpy.java @@ -115,7 +115,7 @@ class BalustradeSpyEffect extends OneShotEffect { } if (!cards.isEmpty()) { controller.revealCards(sourceObject.getName(), cards, game); - controller.moveCards(cards, Zone.LIBRARY, Zone.GRAVEYARD, source, game); + controller.moveCards(cards, Zone.GRAVEYARD, source, game); return true; } return true; diff --git a/Mage.Sets/src/mage/sets/gatecrash/Bioshift.java b/Mage.Sets/src/mage/sets/gatecrash/Bioshift.java index bb89a69a921..2f79caf7869 100644 --- a/Mage.Sets/src/mage/sets/gatecrash/Bioshift.java +++ b/Mage.Sets/src/mage/sets/gatecrash/Bioshift.java @@ -45,7 +45,6 @@ import mage.game.Game; import mage.game.permanent.Permanent; import mage.game.stack.StackObject; import mage.players.Player; -import mage.target.Target; import mage.target.common.TargetCreaturePermanent; /** @@ -114,7 +113,7 @@ class MoveCounterFromTargetToTargetEffect extends OneShotEffect { if (fromPermanent == null || toPermanent == null || !fromPermanent.getControllerId().equals(toPermanent.getControllerId())) { return false; } - int amountCounters = fromPermanent.getCounters().getCount(CounterType.P1P1); + int amountCounters = fromPermanent.getCounters(game).getCount(CounterType.P1P1); if (amountCounters > 0) { int amountToMove = controller.getAmount(0, amountCounters, "How many counters do you want to move?", game); if (amountToMove > 0) { diff --git a/Mage.Sets/src/mage/sets/gatecrash/BorborygmosEnraged.java b/Mage.Sets/src/mage/sets/gatecrash/BorborygmosEnraged.java index 2fe0f586e95..8781f08619a 100644 --- a/Mage.Sets/src/mage/sets/gatecrash/BorborygmosEnraged.java +++ b/Mage.Sets/src/mage/sets/gatecrash/BorborygmosEnraged.java @@ -121,8 +121,8 @@ class BorborygmosEnragedEffect extends OneShotEffect { cards.remove(card); } } - controller.moveCards(landCards, Zone.LIBRARY, Zone.HAND, source, game); - controller.moveCards(cards, Zone.LIBRARY, Zone.GRAVEYARD, source, game); + controller.moveCards(landCards, Zone.HAND, source, game); + controller.moveCards(cards, Zone.GRAVEYARD, source, game); } return true; } diff --git a/Mage.Sets/src/mage/sets/gatecrash/CoercedConfession.java b/Mage.Sets/src/mage/sets/gatecrash/CoercedConfession.java index b85bd19caa4..cc02f22092c 100644 --- a/Mage.Sets/src/mage/sets/gatecrash/CoercedConfession.java +++ b/Mage.Sets/src/mage/sets/gatecrash/CoercedConfession.java @@ -97,7 +97,7 @@ class CoercedConfessionMillEffect extends OneShotEffect { ++foundCreatures; } } - player.moveCards(cards, Zone.LIBRARY, Zone.GRAVEYARD, source, game); + player.moveCards(cards, Zone.GRAVEYARD, source, game); if (foundCreatures > 0) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { diff --git a/Mage.Sets/src/mage/sets/gatecrash/ConsumingAberration.java b/Mage.Sets/src/mage/sets/gatecrash/ConsumingAberration.java index 1cde6bde251..5ce7583a7f2 100644 --- a/Mage.Sets/src/mage/sets/gatecrash/ConsumingAberration.java +++ b/Mage.Sets/src/mage/sets/gatecrash/ConsumingAberration.java @@ -116,7 +116,7 @@ class ConsumingAberrationEffect extends OneShotEffect { } } player.revealCards("Consuming Aberrtion", cards, game); - player.moveCards(cards, Zone.LIBRARY, Zone.GRAVEYARD, source, game); + player.moveCards(cards, Zone.GRAVEYARD, source, game); } return true; } diff --git a/Mage.Sets/src/mage/sets/gatecrash/DimirCharm.java b/Mage.Sets/src/mage/sets/gatecrash/DimirCharm.java index 71b9e9393ee..2a2dd6ce4d0 100644 --- a/Mage.Sets/src/mage/sets/gatecrash/DimirCharm.java +++ b/Mage.Sets/src/mage/sets/gatecrash/DimirCharm.java @@ -129,7 +129,7 @@ class DimirCharmEffect extends OneShotEffect { card.moveToZone(Zone.LIBRARY, source.getSourceId(), game, true); cards.remove(card); } - controller.moveCards(cards, Zone.LIBRARY, Zone.GRAVEYARD, source, game); + controller.moveCards(cards, Zone.GRAVEYARD, source, game); } } } diff --git a/Mage.Sets/src/mage/sets/gatecrash/MindGrind.java b/Mage.Sets/src/mage/sets/gatecrash/MindGrind.java index b679769c81c..ff12970b23b 100644 --- a/Mage.Sets/src/mage/sets/gatecrash/MindGrind.java +++ b/Mage.Sets/src/mage/sets/gatecrash/MindGrind.java @@ -117,7 +117,7 @@ class MindGrindEffect extends OneShotEffect { } } player.revealCards("by " + sourceCard.getName() + " from " + player.getName(), cards, game); - player.moveCards(cards, Zone.LIBRARY, Zone.GRAVEYARD, source, game); + player.moveCards(cards, Zone.GRAVEYARD, source, game); } return true; } diff --git a/Mage.Sets/src/mage/sets/gatecrash/SimicFluxmage.java b/Mage.Sets/src/mage/sets/gatecrash/SimicFluxmage.java index ad91e5ba281..e74b6581c52 100644 --- a/Mage.Sets/src/mage/sets/gatecrash/SimicFluxmage.java +++ b/Mage.Sets/src/mage/sets/gatecrash/SimicFluxmage.java @@ -101,7 +101,7 @@ class MoveCounterFromSourceToTargetEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { Permanent sourcePermanent = game.getPermanent(source.getSourceId()); - if (sourcePermanent != null && sourcePermanent.getCounters().getCount(CounterType.P1P1) > 0) { + if (sourcePermanent != null && sourcePermanent.getCounters(game).getCount(CounterType.P1P1) > 0) { Permanent targetPermanent = game.getPermanent(targetPointer.getFirst(game, source)); if (targetPermanent != null) { sourcePermanent.removeCounters(CounterType.P1P1.createInstance(), game); diff --git a/Mage.Sets/src/mage/sets/gatecrash/UndercityInformer.java b/Mage.Sets/src/mage/sets/gatecrash/UndercityInformer.java index 3af182f815c..362ade6001a 100644 --- a/Mage.Sets/src/mage/sets/gatecrash/UndercityInformer.java +++ b/Mage.Sets/src/mage/sets/gatecrash/UndercityInformer.java @@ -117,7 +117,7 @@ class UndercityInformerEffect extends OneShotEffect { } } player.revealCards("Undercity Informer", cards, game); - player.moveCards(cards, Zone.LIBRARY, Zone.GRAVEYARD, source, game); + player.moveCards(cards, Zone.GRAVEYARD, source, game); return true; } } diff --git a/Mage.Sets/src/mage/sets/iceage/DemonicConsultation.java b/Mage.Sets/src/mage/sets/iceage/DemonicConsultation.java index 5e5525d46e1..19c9e51ce84 100644 --- a/Mage.Sets/src/mage/sets/iceage/DemonicConsultation.java +++ b/Mage.Sets/src/mage/sets/iceage/DemonicConsultation.java @@ -121,7 +121,7 @@ class DemonicConsultationEffect extends OneShotEffect { controller.moveCards(cardToHand, Zone.HAND, source, game); controller.revealCards(sourceObject.getIdName(), cardsToReaveal, game); cardsToReaveal.remove(cardToHand); - controller.moveCards(cardsToReaveal, null, Zone.EXILED, source, game); + controller.moveCards(cardsToReaveal, Zone.EXILED, source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/sets/innistrad/EssenceOfTheWild.java b/Mage.Sets/src/mage/sets/innistrad/EssenceOfTheWild.java index 7372a9e86b9..5ed4f834f0f 100644 --- a/Mage.Sets/src/mage/sets/innistrad/EssenceOfTheWild.java +++ b/Mage.Sets/src/mage/sets/innistrad/EssenceOfTheWild.java @@ -100,7 +100,7 @@ class EssenceOfTheWildEffect extends ReplacementEffectImpl { Permanent sourceObject = game.getPermanentOrLKIBattlefield(source.getSourceId()); if (sourceObject != null) { Permanent permanentReset = sourceObject.copy(); - permanentReset.getCounters().clear(); + permanentReset.getCounters(game).clear(); permanentReset.getPower().resetToBaseValue(); permanentReset.getToughness().resetToBaseValue(); game.addEffect(new CopyEffect(Duration.Custom, permanentReset, event.getTargetId()), source); diff --git a/Mage.Sets/src/mage/sets/innistrad/GarrukRelentless.java b/Mage.Sets/src/mage/sets/innistrad/GarrukRelentless.java index 1f43014bc50..5a27be7ae0c 100644 --- a/Mage.Sets/src/mage/sets/innistrad/GarrukRelentless.java +++ b/Mage.Sets/src/mage/sets/innistrad/GarrukRelentless.java @@ -112,7 +112,7 @@ class GarrukRelentlessTriggeredAbility extends TriggeredAbilityImpl { public boolean checkTrigger(GameEvent event, Game game) { if (event.getTargetId().equals(sourceId)) { Permanent permanent = game.getPermanent(sourceId); - if (permanent != null && !permanent.isTransformed() && permanent.getCounters().getCount(CounterType.LOYALTY) <= 2) { + if (permanent != null && !permanent.isTransformed() && permanent.getCounters(game).getCount(CounterType.LOYALTY) <= 2) { return true; } } diff --git a/Mage.Sets/src/mage/sets/innistrad/GutterGrime.java b/Mage.Sets/src/mage/sets/innistrad/GutterGrime.java index 39a459d4952..5b29b872442 100644 --- a/Mage.Sets/src/mage/sets/innistrad/GutterGrime.java +++ b/Mage.Sets/src/mage/sets/innistrad/GutterGrime.java @@ -173,7 +173,7 @@ class GutterGrimeCounters implements DynamicValue { public int calculate(Game game, Ability sourceAbility, Effect effect) { Permanent p = game.getPermanent(sourceId); if (p != null) { - return p.getCounters().getCount(CounterType.SLIME); + return p.getCounters(game).getCount(CounterType.SLIME); } return 0; } diff --git a/Mage.Sets/src/mage/sets/innistrad/LudevicsTestSubject.java b/Mage.Sets/src/mage/sets/innistrad/LudevicsTestSubject.java index 63d53328be4..44c51fea78a 100644 --- a/Mage.Sets/src/mage/sets/innistrad/LudevicsTestSubject.java +++ b/Mage.Sets/src/mage/sets/innistrad/LudevicsTestSubject.java @@ -96,8 +96,8 @@ class LudevicsTestSubjectEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Permanent p = game.getPermanent(source.getSourceId()); if (p != null) { - if (p.getCounters().getCount(CounterType.HATCHLING) >= 5) { - p.removeCounters(CounterType.HATCHLING.getName(), p.getCounters().getCount(CounterType.HATCHLING), game); + if (p.getCounters(game).getCount(CounterType.HATCHLING) >= 5) { + p.removeCounters(CounterType.HATCHLING.getName(), p.getCounters(game).getCount(CounterType.HATCHLING), game); TransformSourceEffect effect = new TransformSourceEffect(true); return effect.apply(game, source); } diff --git a/Mage.Sets/src/mage/sets/innistrad/MirrorMadPhantasm.java b/Mage.Sets/src/mage/sets/innistrad/MirrorMadPhantasm.java index 27469b25766..064e28e7487 100644 --- a/Mage.Sets/src/mage/sets/innistrad/MirrorMadPhantasm.java +++ b/Mage.Sets/src/mage/sets/innistrad/MirrorMadPhantasm.java @@ -108,7 +108,7 @@ class MirrorMadPhantasmEffect extends OneShotEffect { cards.add(card); } player.revealCards("Mirror-Mad Phantasm", cards, game); - player.moveCards(cards, Zone.LIBRARY, Zone.GRAVEYARD, source, game); + player.moveCards(cards, Zone.GRAVEYARD, source, game); return true; } } diff --git a/Mage.Sets/src/mage/sets/innistrad/Mulch.java b/Mage.Sets/src/mage/sets/innistrad/Mulch.java index edf5fa2f74e..836bf46cbb7 100644 --- a/Mage.Sets/src/mage/sets/innistrad/Mulch.java +++ b/Mage.Sets/src/mage/sets/innistrad/Mulch.java @@ -101,8 +101,8 @@ class MulchEffect extends OneShotEffect { otherCards.add(card); } } - controller.moveCards(landCards, Zone.LIBRARY, Zone.HAND, source, game); - controller.moveCards(otherCards, Zone.LIBRARY, Zone.GRAVEYARD, source, game); + controller.moveCards(landCards, Zone.HAND, source, game); + controller.moveCards(otherCards, Zone.GRAVEYARD, source, game); } return true; diff --git a/Mage.Sets/src/mage/sets/innistrad/TrepanationBlade.java b/Mage.Sets/src/mage/sets/innistrad/TrepanationBlade.java index 690d17eec3c..5694be079cd 100644 --- a/Mage.Sets/src/mage/sets/innistrad/TrepanationBlade.java +++ b/Mage.Sets/src/mage/sets/innistrad/TrepanationBlade.java @@ -120,7 +120,7 @@ class TrepanationBladeDiscardEffect extends OneShotEffect { } } } - player.moveCards(cards, Zone.LIBRARY, Zone.GRAVEYARD, source, game); + player.moveCards(cards, Zone.GRAVEYARD, source, game); if (!cards.isEmpty()) { player.revealCards(equipment.getName(), cards, game); game.getState().setValue(source.getSourceId().toString() + "_TrepanationBlade", cards.size()); diff --git a/Mage.Sets/src/mage/sets/invasion/DefilingTears.java b/Mage.Sets/src/mage/sets/invasion/DefilingTears.java new file mode 100644 index 00000000000..48e83daa971 --- /dev/null +++ b/Mage.Sets/src/mage/sets/invasion/DefilingTears.java @@ -0,0 +1,80 @@ +/* + * 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.sets.invasion; + +import java.util.UUID; +import mage.ObjectColor; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.RegenerateSourceEffect; +import mage.abilities.effects.common.continuous.BecomesColorTargetEffect; +import mage.abilities.effects.common.continuous.BoostTargetEffect; +import mage.abilities.effects.common.continuous.GainAbilityTargetEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.target.common.TargetCreaturePermanent; + +/** + * + * @author Derpthemeus + */ +public class DefilingTears extends CardImpl { + + public DefilingTears(UUID ownerId) { + super(ownerId, 99, "Defiling Tears", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{2}{B}"); + this.expansionSetCode = "INV"; + + // Until end of turn, target creature becomes black, gets +1/-1, and gains "{B}: Regenerate this creature." + this.getSpellAbility().addTarget(new TargetCreaturePermanent()); + + Effect effect = new BecomesColorTargetEffect(ObjectColor.BLACK, Duration.EndOfTurn); + effect.setText("Until end of turn, target creature becomes black"); + this.getSpellAbility().addEffect(effect); + + effect = new BoostTargetEffect(1, -1, Duration.EndOfTurn); + effect.setText(", gets +1/-1"); + this.getSpellAbility().addEffect(effect); + + effect = new GainAbilityTargetEffect(new SimpleActivatedAbility(Zone.BATTLEFIELD, new RegenerateSourceEffect(), new ManaCostsImpl("{B}")), Duration.EndOfTurn); + effect.setText(", and gains \"{B}: Regenerate this creature.\""); + this.getSpellAbility().addEffect(effect); + } + + public DefilingTears(final DefilingTears card) { + super(card); + } + + @Override + public DefilingTears copy() { + return new DefilingTears(this); + } +} diff --git a/Mage.Sets/src/mage/sets/invasion/RootingKavu.java b/Mage.Sets/src/mage/sets/invasion/RootingKavu.java new file mode 100644 index 00000000000..a896e662730 --- /dev/null +++ b/Mage.Sets/src/mage/sets/invasion/RootingKavu.java @@ -0,0 +1,102 @@ +/* + * 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.sets.invasion; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.DiesTriggeredAbility; +import mage.abilities.costs.common.ExileSourceFromGraveCost; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.DoIfCostPaid; +import mage.cards.CardImpl; +import mage.cards.Cards; +import mage.cards.CardsImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.filter.common.FilterCreatureCard; +import mage.game.Game; +import mage.players.Player; + +/** + * + * @author Derpthemeus + */ +public class RootingKavu extends CardImpl { + + public RootingKavu(UUID ownerId) { + super(ownerId, 207, "Rooting Kavu", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{2}{G}{G}"); + this.expansionSetCode = "INV"; + this.subtype.add("Kavu"); + this.power = new MageInt(4); + this.toughness = new MageInt(3); + + // When Rooting Kavu dies, you may exile it. If you do, shuffle all creature cards from your graveyard into your library. + this.addAbility(new DiesTriggeredAbility(new DoIfCostPaid(new RootingKavuEffect(), new ExileSourceFromGraveCost()))); + } + + public RootingKavu(final RootingKavu card) { + super(card); + } + + @Override + public RootingKavu copy() { + return new RootingKavu(this); + } + + class RootingKavuEffect extends OneShotEffect { + + public RootingKavuEffect() { + super(Outcome.Benefit); + this.staticText = "shuffle all creature cards from your graveyard into your library."; + } + + public RootingKavuEffect(final RootingKavuEffect effect) { + super(effect); + } + + @Override + public RootingKavuEffect copy() { + return new RootingKavuEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + if (controller != null) { + Cards cards = new CardsImpl(); + cards.addAll(controller.getGraveyard().getCards(new FilterCreatureCard(), game)); + controller.putCardsOnTopOfLibrary(cards, game, source, false); + controller.shuffleLibrary(source, game); + return true; + } + return false; + } + } +} diff --git a/Mage.Sets/src/mage/sets/invasion/ScarredPuma.java b/Mage.Sets/src/mage/sets/invasion/ScarredPuma.java new file mode 100644 index 00000000000..d956aa31421 --- /dev/null +++ b/Mage.Sets/src/mage/sets/invasion/ScarredPuma.java @@ -0,0 +1,111 @@ +/* + * 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.sets.invasion; + +import java.util.UUID; +import mage.MageInt; +import mage.ObjectColor; +import mage.abilities.Ability; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.RestrictionEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.filter.common.FilterAttackingCreature; +import mage.game.Game; +import mage.game.permanent.Permanent; + +/** + * + * @author Derpthemeus + */ +public class ScarredPuma extends CardImpl { + + public ScarredPuma(UUID ownerId) { + super(ownerId, 163, "Scarred Puma", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{R}"); + this.expansionSetCode = "INV"; + this.subtype.add("Cat"); + this.power = new MageInt(2); + this.toughness = new MageInt(1); + + // Scarred Puma can't attack unless a black or green creature also attacks. + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ScarredPumaEffect())); + } + + public ScarredPuma(final ScarredPuma card) { + super(card); + } + + @Override + public ScarredPuma copy() { + return new ScarredPuma(this); + } + + class ScarredPumaEffect extends RestrictionEffect { + + private final FilterAttackingCreature filter = new FilterAttackingCreature(); + + public ScarredPumaEffect() { + super(Duration.WhileOnBattlefield); + staticText = "{this} can't attack unless a black or green creature also attacks"; + } + + public ScarredPumaEffect(final ScarredPumaEffect effect) { + super(effect); + } + + @Override + public ScarredPumaEffect copy() { + return new ScarredPumaEffect(this); + } + + @Override + public boolean canAttackCheckAfter(int numberOfAttackers, Ability source, Game game) { + return false; + } + + @Override + public boolean applies(Permanent permanent, Ability source, Game game) { + if (permanent.getId().equals(source.getSourceId())) { + for (Permanent creature : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) { + //excludes itself (http://gatherer.wizards.com/Pages/Card/Details.aspx?multiverseid=23067) + if (creature.getId() != source.getSourceId()) { + ObjectColor color = creature.getColor(game); + if (color.isBlack() || color.isGreen()) { + return false; + } + } + } + return true; + } + return false; + } + } +} diff --git a/Mage.Sets/src/mage/sets/journeyintonyx/Hubris.java b/Mage.Sets/src/mage/sets/journeyintonyx/Hubris.java index 290ad41bed3..77c0366e205 100644 --- a/Mage.Sets/src/mage/sets/journeyintonyx/Hubris.java +++ b/Mage.Sets/src/mage/sets/journeyintonyx/Hubris.java @@ -101,7 +101,7 @@ class HubrisReturnEffect extends OneShotEffect { if (creature != null) { Cards cardsToHand = new CardsImpl(creature.getAttachments()); cardsToHand.add(creature); - controller.moveCards(cardsToHand, null, Zone.HAND, source, game); + controller.moveCards(cardsToHand, Zone.HAND, source, game); } } return true; diff --git a/Mage.Sets/src/mage/sets/journeyintonyx/SageOfHours.java b/Mage.Sets/src/mage/sets/journeyintonyx/SageOfHours.java index 49ed1548fad..1d9bd57025e 100644 --- a/Mage.Sets/src/mage/sets/journeyintonyx/SageOfHours.java +++ b/Mage.Sets/src/mage/sets/journeyintonyx/SageOfHours.java @@ -104,7 +104,7 @@ class SageOfHoursCost extends CostImpl { public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { Permanent permanent = game.getPermanent(ability.getSourceId()); if (permanent != null) { - this.removedCounters = permanent.getCounters().getCount(CounterType.P1P1); + this.removedCounters = permanent.getCounters(game).getCount(CounterType.P1P1); if (this.removedCounters > 0) { permanent.removeCounters(CounterType.P1P1.createInstance(this.removedCounters), game); } diff --git a/Mage.Sets/src/mage/sets/journeyintonyx/ScourgeOfFleets.java b/Mage.Sets/src/mage/sets/journeyintonyx/ScourgeOfFleets.java index 3385a47e0da..cca63ec9597 100644 --- a/Mage.Sets/src/mage/sets/journeyintonyx/ScourgeOfFleets.java +++ b/Mage.Sets/src/mage/sets/journeyintonyx/ScourgeOfFleets.java @@ -113,7 +113,7 @@ class ScourgeOfFleetsEffect extends OneShotEffect { for (Permanent permanent : game.getBattlefield().getActivePermanents(creatureFilter, source.getControllerId(), source.getSourceId(), game)) { cardsToHand.add(permanent); } - controller.moveCards(cardsToHand, null, Zone.HAND, source, game); + controller.moveCards(cardsToHand, Zone.HAND, source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/sets/journeyintonyx/SolidarityOfHeroes.java b/Mage.Sets/src/mage/sets/journeyintonyx/SolidarityOfHeroes.java index 12aac922535..63db68f8c73 100644 --- a/Mage.Sets/src/mage/sets/journeyintonyx/SolidarityOfHeroes.java +++ b/Mage.Sets/src/mage/sets/journeyintonyx/SolidarityOfHeroes.java @@ -93,7 +93,7 @@ class SolidarityOfHeroesEffect extends OneShotEffect { for (UUID targetId: getTargetPointer().getTargets(game, source)) { Permanent permanent = game.getPermanent(targetId); if (permanent != null) { - int existingCounters = permanent.getCounters().getCount(CounterType.P1P1); + int existingCounters = permanent.getCounters(game).getCount(CounterType.P1P1); if (existingCounters > 0) { permanent.addCounters(CounterType.P1P1.createInstance(existingCounters), game); } diff --git a/Mage.Sets/src/mage/sets/judgment/PhantomCentaur.java b/Mage.Sets/src/mage/sets/judgment/PhantomCentaur.java index 63680d0df06..88ad9b7801f 100644 --- a/Mage.Sets/src/mage/sets/judgment/PhantomCentaur.java +++ b/Mage.Sets/src/mage/sets/judgment/PhantomCentaur.java @@ -136,7 +136,7 @@ class PhantomCentaurPreventionEffect extends PreventionEffectImpl { } } - if(removeCounter && permanent.getCounters().containsKey(CounterType.P1P1)) { + if(removeCounter && permanent.getCounters(game).containsKey(CounterType.P1P1)) { StringBuilder sb = new StringBuilder(permanent.getName()).append(": "); permanent.removeCounters(CounterType.P1P1.createInstance(), game); sb.append("Removed a +1/+1 counter "); diff --git a/Mage.Sets/src/mage/sets/judgment/PhantomFlock.java b/Mage.Sets/src/mage/sets/judgment/PhantomFlock.java index 9f949c7ef07..c8de4202471 100644 --- a/Mage.Sets/src/mage/sets/judgment/PhantomFlock.java +++ b/Mage.Sets/src/mage/sets/judgment/PhantomFlock.java @@ -127,7 +127,7 @@ class PhantomFlockPreventionEffect extends PreventionEffectImpl { } } - if(removeCounter && permanent.getCounters().containsKey(CounterType.P1P1)) { + if(removeCounter && permanent.getCounters(game).containsKey(CounterType.P1P1)) { StringBuilder sb = new StringBuilder(permanent.getName()).append(": "); permanent.removeCounters(CounterType.P1P1.createInstance(), game); sb.append("Removed a +1/+1 counter "); diff --git a/Mage.Sets/src/mage/sets/judgment/PhantomNishoba.java b/Mage.Sets/src/mage/sets/judgment/PhantomNishoba.java index 51cb80804d3..06c79c80257 100644 --- a/Mage.Sets/src/mage/sets/judgment/PhantomNishoba.java +++ b/Mage.Sets/src/mage/sets/judgment/PhantomNishoba.java @@ -131,7 +131,7 @@ class PhantomNishobaPreventionEffect extends PreventionEffectImpl { } } - if(removeCounter && permanent.getCounters().containsKey(CounterType.P1P1)) { + if(removeCounter && permanent.getCounters(game).containsKey(CounterType.P1P1)) { StringBuilder sb = new StringBuilder(permanent.getName()).append(": "); permanent.removeCounters(CounterType.P1P1.createInstance(), game); sb.append("Removed a +1/+1 counter "); diff --git a/Mage.Sets/src/mage/sets/judgment/PhantomNomad.java b/Mage.Sets/src/mage/sets/judgment/PhantomNomad.java index 3c10caeb7a5..cbb20cd6756 100644 --- a/Mage.Sets/src/mage/sets/judgment/PhantomNomad.java +++ b/Mage.Sets/src/mage/sets/judgment/PhantomNomad.java @@ -126,7 +126,7 @@ class PhantomNomadPreventionEffect extends PreventionEffectImpl { } } - if(removeCounter && permanent.getCounters().containsKey(CounterType.P1P1)) { + if(removeCounter && permanent.getCounters(game).containsKey(CounterType.P1P1)) { StringBuilder sb = new StringBuilder(permanent.getName()).append(": "); permanent.removeCounters(CounterType.P1P1.createInstance(), game); sb.append("Removed a +1/+1 counter "); diff --git a/Mage.Sets/src/mage/sets/judgment/PhantomTiger.java b/Mage.Sets/src/mage/sets/judgment/PhantomTiger.java index 4c488085ad2..de1b49816f2 100644 --- a/Mage.Sets/src/mage/sets/judgment/PhantomTiger.java +++ b/Mage.Sets/src/mage/sets/judgment/PhantomTiger.java @@ -122,7 +122,7 @@ class PhantomTigerPreventionEffect extends PreventionEffectImpl { } } - if (removeCounter && permanent.getCounters().getCount(CounterType.P1P1) > 0) { + if (removeCounter && permanent.getCounters(game).getCount(CounterType.P1P1) > 0) { StringBuilder sb = new StringBuilder(permanent.getName()).append(": "); permanent.removeCounters(CounterType.P1P1.createInstance(), game); sb.append("Removed a +1/+1 counter "); diff --git a/Mage.Sets/src/mage/sets/khansoftarkir/BitterRevelation.java b/Mage.Sets/src/mage/sets/khansoftarkir/BitterRevelation.java index eea813a1263..5eaad045fb4 100644 --- a/Mage.Sets/src/mage/sets/khansoftarkir/BitterRevelation.java +++ b/Mage.Sets/src/mage/sets/khansoftarkir/BitterRevelation.java @@ -111,8 +111,8 @@ class BitterRevelationEffect extends OneShotEffect { } } } - player.moveCards(cardsToHand, Zone.LIBRARY, Zone.HAND, source, game); - player.moveCards(cards, Zone.LIBRARY, Zone.GRAVEYARD, source, game); + player.moveCards(cardsToHand, Zone.HAND, source, game); + player.moveCards(cards, Zone.GRAVEYARD, source, game); } return true; } diff --git a/Mage.Sets/src/mage/sets/khansoftarkir/BringLow.java b/Mage.Sets/src/mage/sets/khansoftarkir/BringLow.java index 3ecb45a5969..7dfee4808a7 100644 --- a/Mage.Sets/src/mage/sets/khansoftarkir/BringLow.java +++ b/Mage.Sets/src/mage/sets/khansoftarkir/BringLow.java @@ -83,7 +83,7 @@ class TargetHasCounterCondition implements Condition { if (!source.getTargets().isEmpty()) { Permanent permanent = game.getPermanent(source.getFirstTarget()); if (permanent != null) { - return permanent.getCounters().containsKey(counterType); + return permanent.getCounters(game).containsKey(counterType); } } return false; diff --git a/Mage.Sets/src/mage/sets/khansoftarkir/RiteOfTheSerpent.java b/Mage.Sets/src/mage/sets/khansoftarkir/RiteOfTheSerpent.java index 378c9afbe61..49aacd513d9 100644 --- a/Mage.Sets/src/mage/sets/khansoftarkir/RiteOfTheSerpent.java +++ b/Mage.Sets/src/mage/sets/khansoftarkir/RiteOfTheSerpent.java @@ -89,7 +89,7 @@ class RiteOfTheSerpentEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Permanent targetCreature = game.getPermanentOrLKIBattlefield(getTargetPointer().getFirst(game, source)); if (targetCreature != null) { - if (targetCreature.getCounters().containsKey(CounterType.P1P1)) { + if (targetCreature.getCounters(game).containsKey(CounterType.P1P1)) { new CreateTokenEffect(new SnakeToken("KTK")).apply(game, source); } return true; diff --git a/Mage.Sets/src/mage/sets/khansoftarkir/ScoutTheBorders.java b/Mage.Sets/src/mage/sets/khansoftarkir/ScoutTheBorders.java index 544e4564ac3..180f76c052e 100644 --- a/Mage.Sets/src/mage/sets/khansoftarkir/ScoutTheBorders.java +++ b/Mage.Sets/src/mage/sets/khansoftarkir/ScoutTheBorders.java @@ -122,7 +122,7 @@ class ScoutTheBordersEffect extends OneShotEffect { } } - controller.moveCards(cards, Zone.LIBRARY, Zone.GRAVEYARD, source, game); + controller.moveCards(cards, Zone.GRAVEYARD, source, game); } return true; } diff --git a/Mage.Sets/src/mage/sets/khansoftarkir/SultaiSoothsayer.java b/Mage.Sets/src/mage/sets/khansoftarkir/SultaiSoothsayer.java index 91fd0210d33..73cad4c73d4 100644 --- a/Mage.Sets/src/mage/sets/khansoftarkir/SultaiSoothsayer.java +++ b/Mage.Sets/src/mage/sets/khansoftarkir/SultaiSoothsayer.java @@ -108,7 +108,7 @@ class SultaiSoothsayerEffect extends OneShotEffect { cards.remove(card); } } - controller.moveCards(cards, Zone.LIBRARY, Zone.GRAVEYARD, source, game); + controller.moveCards(cards, Zone.GRAVEYARD, source, game); } return true; } diff --git a/Mage.Sets/src/mage/sets/khansoftarkir/VillainousWealth.java b/Mage.Sets/src/mage/sets/khansoftarkir/VillainousWealth.java index 7e9b1319f0f..ada3f95210d 100644 --- a/Mage.Sets/src/mage/sets/khansoftarkir/VillainousWealth.java +++ b/Mage.Sets/src/mage/sets/khansoftarkir/VillainousWealth.java @@ -103,7 +103,7 @@ class VillainousWealthEffect extends OneShotEffect { if (player != null) { Cards cardsToExile = new CardsImpl(); cardsToExile.addAll(player.getLibrary().getTopCards(game, source.getManaCostsToPay().getX())); - controller.moveCards(cardsToExile, null, Zone.EXILED, source, game); + controller.moveCards(cardsToExile, Zone.EXILED, source, game); if (controller.chooseUse(Outcome.PlayForFree, "Cast cards exiled with " + mageObject.getLogName() + " without paying its mana cost?", source, game)) { OuterLoop: while (cardsToExile.count(filter, game) > 0) { diff --git a/Mage.Sets/src/mage/sets/legends/CyclopeanMummy.java b/Mage.Sets/src/mage/sets/legends/CyclopeanMummy.java new file mode 100644 index 00000000000..ce89843d2e1 --- /dev/null +++ b/Mage.Sets/src/mage/sets/legends/CyclopeanMummy.java @@ -0,0 +1,63 @@ +/* + * 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.sets.legends; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.common.DiesTriggeredAbility; +import mage.abilities.effects.common.ExileSourceEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; + +/** + * + * @author Derpthemeus + */ +public class CyclopeanMummy extends CardImpl { + + public CyclopeanMummy(UUID ownerId) { + super(ownerId, 7, "Cyclopean Mummy", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{1}{B}"); + this.expansionSetCode = "LEG"; + this.subtype.add("Zombie"); + this.power = new MageInt(2); + this.toughness = new MageInt(1); + + // When Cyclopean Mummy dies, exile it. + this.addAbility(new DiesTriggeredAbility(new ExileSourceEffect())); + } + + public CyclopeanMummy(final CyclopeanMummy card) { + super(card); + } + + @Override + public CyclopeanMummy copy() { + return new CyclopeanMummy(this); + } +} diff --git a/Mage.Sets/src/mage/sets/legends/WalkingDead.java b/Mage.Sets/src/mage/sets/legends/WalkingDead.java new file mode 100644 index 00000000000..082c6aa0d7b --- /dev/null +++ b/Mage.Sets/src/mage/sets/legends/WalkingDead.java @@ -0,0 +1,65 @@ +/* + * 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.sets.legends; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.common.RegenerateSourceEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.Zone; + +/** + * + * @author Derpthemeus + */ +public class WalkingDead extends CardImpl { + + public WalkingDead(UUID ownerId) { + super(ownerId, 40, "Walking Dead", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{1}{B}"); + this.expansionSetCode = "LEG"; + this.subtype.add("Zombie"); + this.power = new MageInt(1); + this.toughness = new MageInt(1); + + // {B}: Regenerate Walking Dead. + this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new RegenerateSourceEffect(), new ManaCostsImpl("{B}"))); + } + + public WalkingDead(final WalkingDead card) { + super(card); + } + + @Override + public WalkingDead copy() { + return new WalkingDead(this); + } +} diff --git a/Mage.Sets/src/mage/sets/limitedalpha/ClockworkBeast.java b/Mage.Sets/src/mage/sets/limitedalpha/ClockworkBeast.java index fe322b6c506..c77adb96b1c 100644 --- a/Mage.Sets/src/mage/sets/limitedalpha/ClockworkBeast.java +++ b/Mage.Sets/src/mage/sets/limitedalpha/ClockworkBeast.java @@ -125,7 +125,7 @@ class BeastAddCountersSourceEffect extends AddCountersSourceEffect { @Override public boolean apply(Game game, Ability source) { - Counters permCounters = game.getPermanent(source.getSourceId()).getCounters(); + Counters permCounters = game.getPermanent(source.getSourceId()).getCounters(game); int countersWas = permCounters.getCount(CounterType.P1P0); if (countersWas < 7){ super.apply(game, source); diff --git a/Mage.Sets/src/mage/sets/limitedalpha/Timetwister.java b/Mage.Sets/src/mage/sets/limitedalpha/Timetwister.java index dcc0eb8c280..22b030ddad3 100644 --- a/Mage.Sets/src/mage/sets/limitedalpha/Timetwister.java +++ b/Mage.Sets/src/mage/sets/limitedalpha/Timetwister.java @@ -84,8 +84,8 @@ class TimetwisterEffect extends OneShotEffect { for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) { Player player = game.getPlayer(playerId); if (player != null) { - player.moveCards(player.getHand(), Zone.HAND, Zone.LIBRARY, source, game); - player.moveCards(player.getGraveyard(), Zone.GRAVEYARD, Zone.LIBRARY, source, game); + player.moveCards(player.getHand(), Zone.LIBRARY, source, game); + player.moveCards(player.getGraveyard(), Zone.LIBRARY, source, game); player.shuffleLibrary(source, game); } } diff --git a/Mage.Sets/src/mage/sets/lorwyn/AquitectsWill.java b/Mage.Sets/src/mage/sets/lorwyn/AquitectsWill.java index 8604c8ab21e..d3a2e72c25e 100644 --- a/Mage.Sets/src/mage/sets/lorwyn/AquitectsWill.java +++ b/Mage.Sets/src/mage/sets/lorwyn/AquitectsWill.java @@ -105,7 +105,7 @@ class AquitectsWillEffect extends BecomesBasicLandTargetEffect { if (land == null) { // if permanent left battlefield the effect can be removed because it was only valid for that object this.discard(); - } else if (land.getCounters().getCount(CounterType.FLOOD) > 0) { + } else if (land.getCounters(game).getCount(CounterType.FLOOD) > 0) { // only if Flood counter is on the object it becomes an Island.(it would be possible to remove and return the counters with e.g. Fate Transfer if the land becomes a creature too) super.apply(layer, sublayer, source, game); } diff --git a/Mage.Sets/src/mage/sets/lorwyn/AshlingThePilgrim.java b/Mage.Sets/src/mage/sets/lorwyn/AshlingThePilgrim.java index cefdfba27cb..d25c366a7ef 100644 --- a/Mage.Sets/src/mage/sets/lorwyn/AshlingThePilgrim.java +++ b/Mage.Sets/src/mage/sets/lorwyn/AshlingThePilgrim.java @@ -122,7 +122,7 @@ class AshlingThePilgrimEffect extends OneShotEffect { } info.activations++; if (info.activations == 3) { - int damage = sourcePermanent.getCounters().getCount(CounterType.P1P1); + int damage = sourcePermanent.getCounters(game).getCount(CounterType.P1P1); if (damage > 0) { sourcePermanent.removeCounters(CounterType.P1P1.getName(), damage, game); return new DamageEverythingEffect(damage, new FilterCreaturePermanent()).apply(game, source); diff --git a/Mage.Sets/src/mage/sets/magic2011/PhylacteryLich.java b/Mage.Sets/src/mage/sets/magic2011/PhylacteryLich.java index 6cf3a7c7243..5363d138333 100644 --- a/Mage.Sets/src/mage/sets/magic2011/PhylacteryLich.java +++ b/Mage.Sets/src/mage/sets/magic2011/PhylacteryLich.java @@ -100,7 +100,7 @@ public class PhylacteryLich extends CardImpl { @Override public boolean checkTrigger(GameEvent event, Game game) { for (Permanent perm : game.getBattlefield().getAllActivePermanents(controllerId)) { - if (perm.getCounters().getCount("phylactery") > 0) { + if (perm.getCounters(game).getCount("phylactery") > 0) { return false; } } diff --git a/Mage.Sets/src/mage/sets/magic2011/TimeReversal.java b/Mage.Sets/src/mage/sets/magic2011/TimeReversal.java index 546496984ab..f764227520d 100644 --- a/Mage.Sets/src/mage/sets/magic2011/TimeReversal.java +++ b/Mage.Sets/src/mage/sets/magic2011/TimeReversal.java @@ -86,8 +86,8 @@ class TimeReversalEffect extends OneShotEffect { for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) { Player player = game.getPlayer(playerId); if (player != null) { - player.moveCards(player.getHand(), Zone.HAND, Zone.LIBRARY, source, game); - player.moveCards(player.getGraveyard(), Zone.GRAVEYARD, Zone.LIBRARY, source, game); + player.moveCards(player.getHand(), Zone.LIBRARY, source, game); + player.moveCards(player.getGraveyard(), Zone.LIBRARY, source, game); player.shuffleLibrary(source, game); } } diff --git a/Mage.Sets/src/mage/sets/magic2012/PrimordialHydra.java b/Mage.Sets/src/mage/sets/magic2012/PrimordialHydra.java index f6f23863272..fb184e046b4 100644 --- a/Mage.Sets/src/mage/sets/magic2012/PrimordialHydra.java +++ b/Mage.Sets/src/mage/sets/magic2012/PrimordialHydra.java @@ -103,7 +103,7 @@ class PrimordialHydraDoubleEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Permanent sourcePermanent = game.getPermanent(source.getSourceId()); if (sourcePermanent != null) { - int amount = sourcePermanent.getCounters().getCount(CounterType.P1P1); + int amount = sourcePermanent.getCounters(game).getCount(CounterType.P1P1); if (amount > 0) { sourcePermanent.addCounters(CounterType.P1P1.createInstance(amount), game); } diff --git a/Mage.Sets/src/mage/sets/magic2012/SuturedGhoul.java b/Mage.Sets/src/mage/sets/magic2012/SuturedGhoul.java index 18fcd214815..fdfbd216747 100644 --- a/Mage.Sets/src/mage/sets/magic2012/SuturedGhoul.java +++ b/Mage.Sets/src/mage/sets/magic2012/SuturedGhoul.java @@ -120,7 +120,7 @@ class SuturedGhoulEffect extends OneShotEffect { } } Cards cardsToExile = new CardsImpl(target.getTargets()); - controller.moveCards(cardsToExile, null, Zone.EXILED, source, game); + controller.moveCards(cardsToExile, Zone.EXILED, source, game); String msg = count == 1 ? "1 card" : count + "cards"; game.informPlayers(permanent.getLogName() + ": " + controller.getLogName() + " exiled " + msg); diff --git a/Mage.Sets/src/mage/sets/magic2013/SlumberingDragon.java b/Mage.Sets/src/mage/sets/magic2013/SlumberingDragon.java index 22702ac44fc..4cd96d6799c 100644 --- a/Mage.Sets/src/mage/sets/magic2013/SlumberingDragon.java +++ b/Mage.Sets/src/mage/sets/magic2013/SlumberingDragon.java @@ -96,7 +96,7 @@ class SlumberingDragonEffect extends RestrictionEffect { @Override public boolean applies(Permanent permanent, Ability source, Game game) { if (permanent.getId().equals(source.getSourceId())) { - if (permanent.getCounters().getCount(CounterType.P1P1) >= 5) { + if (permanent.getCounters(game).getCount(CounterType.P1P1) >= 5) { return false; } return true; diff --git a/Mage.Sets/src/mage/sets/magic2014/DoorOfDestinies.java b/Mage.Sets/src/mage/sets/magic2014/DoorOfDestinies.java index 5a342a704b1..2c9a4e37a84 100644 --- a/Mage.Sets/src/mage/sets/magic2014/DoorOfDestinies.java +++ b/Mage.Sets/src/mage/sets/magic2014/DoorOfDestinies.java @@ -154,7 +154,7 @@ class BoostCreatureEffectEffect extends ContinuousEffectImpl { if (subtype != null) { for (Permanent perm : game.getBattlefield().getAllActivePermanents(filter, source.getControllerId(), game)) { if (perm.hasSubtype(subtype, game)) { - int boost = permanent.getCounters().getCount(CounterType.CHARGE); + int boost = permanent.getCounters(game).getCount(CounterType.CHARGE); perm.addPower(boost); perm.addToughness(boost); } diff --git a/Mage.Sets/src/mage/sets/magic2014/GlimpseTheFuture.java b/Mage.Sets/src/mage/sets/magic2014/GlimpseTheFuture.java index 53604abaeb9..0a0254fb409 100644 --- a/Mage.Sets/src/mage/sets/magic2014/GlimpseTheFuture.java +++ b/Mage.Sets/src/mage/sets/magic2014/GlimpseTheFuture.java @@ -109,7 +109,7 @@ class GlimpseTheFutureEffect extends OneShotEffect { cards.remove(card); } } - controller.moveCards(cards, Zone.LIBRARY, Zone.GRAVEYARD, source, game); + controller.moveCards(cards, Zone.GRAVEYARD, source, game); } return true; } diff --git a/Mage.Sets/src/mage/sets/magic2014/KalonianHydra.java b/Mage.Sets/src/mage/sets/magic2014/KalonianHydra.java index e76a552a26d..9f801bdb5ee 100644 --- a/Mage.Sets/src/mage/sets/magic2014/KalonianHydra.java +++ b/Mage.Sets/src/mage/sets/magic2014/KalonianHydra.java @@ -108,7 +108,7 @@ class KalonianHydraEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { List permanents = game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game); for (Permanent permanent : permanents) { - int existingCounters = permanent.getCounters().getCount(CounterType.P1P1); + int existingCounters = permanent.getCounters(game).getCount(CounterType.P1P1); if (existingCounters > 0) { permanent.addCounters(CounterType.P1P1.createInstance(existingCounters), game); } diff --git a/Mage.Sets/src/mage/sets/magic2015/ChasmSkulker.java b/Mage.Sets/src/mage/sets/magic2015/ChasmSkulker.java index 3f46ea78439..8594a94364f 100644 --- a/Mage.Sets/src/mage/sets/magic2015/ChasmSkulker.java +++ b/Mage.Sets/src/mage/sets/magic2015/ChasmSkulker.java @@ -101,7 +101,7 @@ class ChasmSkulkerEffect extends OneShotEffect { if (controller != null) { Permanent permanent = (Permanent) game.getLastKnownInformation(source.getSourceId(), Zone.BATTLEFIELD); if (permanent != null) { - int counters = permanent.getCounters().getCount(CounterType.P1P1); + int counters = permanent.getCounters(game).getCount(CounterType.P1P1); if (counters > 0) { return new CreateTokenEffect(new ChasmSkulkerSquidToken(), counters).apply(game, source); } diff --git a/Mage.Sets/src/mage/sets/magic2015/YisanTheWandererBard.java b/Mage.Sets/src/mage/sets/magic2015/YisanTheWandererBard.java index 56c2762021a..f799200c7c0 100644 --- a/Mage.Sets/src/mage/sets/magic2015/YisanTheWandererBard.java +++ b/Mage.Sets/src/mage/sets/magic2015/YisanTheWandererBard.java @@ -105,7 +105,7 @@ class YisanTheWandererBardEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId()); if (sourcePermanent != null && controller != null) { - int newConvertedCost = sourcePermanent.getCounters().getCount("verse"); + int newConvertedCost = sourcePermanent.getCounters(game).getCount("verse"); FilterCard filter = new FilterCard("creature card with converted mana cost " + newConvertedCost); filter.add(new ConvertedManaCostPredicate(Filter.ComparisonType.Equal, newConvertedCost)); filter.add(new CardTypePredicate(CardType.CREATURE)); diff --git a/Mage.Sets/src/mage/sets/magicorigins/GatherThePack.java b/Mage.Sets/src/mage/sets/magicorigins/GatherThePack.java index 924b1ac7385..b934172d148 100644 --- a/Mage.Sets/src/mage/sets/magicorigins/GatherThePack.java +++ b/Mage.Sets/src/mage/sets/magicorigins/GatherThePack.java @@ -103,12 +103,12 @@ class GatherThePackEffect extends OneShotEffect { Cards cardsToHand = new CardsImpl(target.getTargets()); if (cardsToHand.size() > 0) { cards.removeAll(cardsToHand); - controller.moveCards(cardsToHand, Zone.LIBRARY, Zone.HAND, source, game); + controller.moveCards(cardsToHand, Zone.HAND, source, game); } } } if (cards.size() > 0) { - controller.moveCards(cards, Zone.LIBRARY, Zone.GRAVEYARD, source, game); + controller.moveCards(cards, Zone.GRAVEYARD, source, game); } } return true; diff --git a/Mage.Sets/src/mage/sets/magicorigins/SphinxsTutelage.java b/Mage.Sets/src/mage/sets/magicorigins/SphinxsTutelage.java index d57feb4c445..3702e2683eb 100644 --- a/Mage.Sets/src/mage/sets/magicorigins/SphinxsTutelage.java +++ b/Mage.Sets/src/mage/sets/magicorigins/SphinxsTutelage.java @@ -120,7 +120,7 @@ class SphinxsTutelageEffect extends OneShotEffect { } } } - targetPlayer.moveCards(cards, Zone.LIBRARY, Zone.GRAVEYARD, source, game); + targetPlayer.moveCards(cards, Zone.GRAVEYARD, source, game); } while (colorShared && targetPlayer.canRespond()); return true; } diff --git a/Mage.Sets/src/mage/sets/magicplayerrewards/PowderKeg.java b/Mage.Sets/src/mage/sets/magicplayerrewards/PowderKeg.java index fa93f70731b..3e32f46a69f 100644 --- a/Mage.Sets/src/mage/sets/magicplayerrewards/PowderKeg.java +++ b/Mage.Sets/src/mage/sets/magicplayerrewards/PowderKeg.java @@ -93,7 +93,7 @@ class PowderKegEffect extends OneShotEffect { } } - int count = p.getCounters().getCount(CounterType.FUSE); + int count = p.getCounters(game).getCount(CounterType.FUSE); for (Permanent perm: game.getBattlefield().getAllActivePermanents()) { if (perm.getConvertedManaCost() == count && ((perm.getCardType().contains(CardType.ARTIFACT)) || (perm.getCardType().contains(CardType.CREATURE)))) { diff --git a/Mage.Sets/src/mage/sets/masterseditionii/ForgottenLore.java b/Mage.Sets/src/mage/sets/masterseditionii/ForgottenLore.java index 4dad8951946..3d8b9838a2b 100644 --- a/Mage.Sets/src/mage/sets/masterseditionii/ForgottenLore.java +++ b/Mage.Sets/src/mage/sets/masterseditionii/ForgottenLore.java @@ -131,7 +131,7 @@ class ForgottenLoreEffect extends OneShotEffect { if(card != null) { Cards cardsToHand = new CardsImpl(); cardsToHand.add(card); - you.moveCards(cardsToHand, Zone.GRAVEYARD, Zone.HAND, source, game); + you.moveCards(cardsToHand, Zone.HAND, source, game); } return true; } diff --git a/Mage.Sets/src/mage/sets/masterseditionii/ThoughtLash.java b/Mage.Sets/src/mage/sets/masterseditionii/ThoughtLash.java index cd7be652931..45b045fd0a7 100644 --- a/Mage.Sets/src/mage/sets/masterseditionii/ThoughtLash.java +++ b/Mage.Sets/src/mage/sets/masterseditionii/ThoughtLash.java @@ -131,7 +131,7 @@ class ThoughtLashExileLibraryEffect extends OneShotEffect { if (controller != null) { Cards cards = new CardsImpl(); cards.addAll(controller.getLibrary().getTopCards(game, controller.getLibrary().size())); - controller.moveCards(cards, Zone.LIBRARY, Zone.EXILED, source, game); + controller.moveCards(cards, Zone.EXILED, source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/sets/masterseditioniii/DivineIntervention.java b/Mage.Sets/src/mage/sets/masterseditioniii/DivineIntervention.java index 2fec7ff9d3d..14ede09f098 100644 --- a/Mage.Sets/src/mage/sets/masterseditioniii/DivineIntervention.java +++ b/Mage.Sets/src/mage/sets/masterseditioniii/DivineIntervention.java @@ -158,7 +158,7 @@ public class DivineIntervention extends CardImpl { Player controller = game.getPlayer(source.getControllerId()); Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId()); if (controller != null && sourcePermanent != null) { - if (game.getState().getZone(sourcePermanent.getId()) == Zone.BATTLEFIELD && sourcePermanent.getCounters().getCount(CounterType.INTERVENTION) == 0) { + if (game.getState().getZone(sourcePermanent.getId()) == Zone.BATTLEFIELD && sourcePermanent.getCounters(game).getCount(CounterType.INTERVENTION) == 0) { game.setDraw(controller.getId()); for (UUID player : game.getOpponents(controller.getId())) { diff --git a/Mage.Sets/src/mage/sets/masterseditioniv/Cyclone.java b/Mage.Sets/src/mage/sets/masterseditioniv/Cyclone.java index 80c3684f068..ef32c84afc1 100644 --- a/Mage.Sets/src/mage/sets/masterseditioniv/Cyclone.java +++ b/Mage.Sets/src/mage/sets/masterseditioniv/Cyclone.java @@ -93,7 +93,7 @@ class CycloneEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); Permanent permanent = game.getPermanent(source.getSourceId()); - int total = permanent.getCounters().getCount(CounterType.WIND); + int total = permanent.getCounters(game).getCount(CounterType.WIND); String greens = ""; diff --git a/Mage.Sets/src/mage/sets/masterseditioniv/CyclopeanMummy.java b/Mage.Sets/src/mage/sets/masterseditioniv/CyclopeanMummy.java new file mode 100644 index 00000000000..479d9420f9a --- /dev/null +++ b/Mage.Sets/src/mage/sets/masterseditioniv/CyclopeanMummy.java @@ -0,0 +1,52 @@ +/* + * 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.sets.masterseditioniv; + +import java.util.UUID; + +/** + * + * @author Derpthemeus + */ +public class CyclopeanMummy extends mage.sets.legends.CyclopeanMummy { + + public CyclopeanMummy(UUID ownerId) { + super(ownerId); + this.cardNumber = "72"; + this.expansionSetCode = "ME4"; + } + + public CyclopeanMummy(final CyclopeanMummy card) { + super(card); + } + + @Override + public CyclopeanMummy copy() { + return new CyclopeanMummy(this); + } +} diff --git a/Mage.Sets/src/mage/sets/mercadianmasques/BlackMarket.java b/Mage.Sets/src/mage/sets/mercadianmasques/BlackMarket.java index 7f37e44083d..664d7e94a59 100644 --- a/Mage.Sets/src/mage/sets/mercadianmasques/BlackMarket.java +++ b/Mage.Sets/src/mage/sets/mercadianmasques/BlackMarket.java @@ -91,7 +91,7 @@ class BlackMarketEffect extends OneShotEffect { Permanent sourcePermanent = game.getPermanent(source.getSourceId()); Player player = game.getPlayer(source.getControllerId()); if (sourcePermanent != null && player != null) { - int chargeCounters = sourcePermanent.getCounters().getCount(CounterType.CHARGE); + int chargeCounters = sourcePermanent.getCounters(game).getCount(CounterType.CHARGE); if (chargeCounters > 0){ player.getManaPool().addMana(Mana.BlackMana(chargeCounters), game, source); return true; diff --git a/Mage.Sets/src/mage/sets/mercadianmasques/VernalEquinox.java b/Mage.Sets/src/mage/sets/mercadianmasques/VernalEquinox.java new file mode 100644 index 00000000000..2a058df88a0 --- /dev/null +++ b/Mage.Sets/src/mage/sets/mercadianmasques/VernalEquinox.java @@ -0,0 +1,71 @@ +/* + * 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.sets.mercadianmasques; + +import java.util.UUID; + +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.common.continuous.CastAsThoughItHadFlashAllEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.filter.FilterCard; +import mage.filter.predicate.Predicates; +import mage.filter.predicate.mageobject.CardTypePredicate; + +/** + * + * @author maxlebedev + */ +public class VernalEquinox extends CardImpl { + + private static final FilterCard filter = new FilterCard("creature and enchantment cards"); + + static { + filter.add(Predicates.or(new CardTypePredicate(CardType.CREATURE), new CardTypePredicate(CardType.ENCHANTMENT))); + } + + public VernalEquinox(UUID ownerId) { + super(ownerId, 283, "Vernal Equinox", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{3}{G}"); + this.expansionSetCode = "MMQ"; + + // Any player may cast creature and enchantment cards as though they had flash. + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CastAsThoughItHadFlashAllEffect(Duration.WhileOnBattlefield, filter))); + } + + public VernalEquinox(final VernalEquinox card) { + super(card); + } + + @Override + public VernalEquinox copy() { + return new VernalEquinox(this); + } +} diff --git a/Mage.Sets/src/mage/sets/mirrodin/AltarOfShadows.java b/Mage.Sets/src/mage/sets/mirrodin/AltarOfShadows.java index e9cab6c8b78..bd7369c932c 100644 --- a/Mage.Sets/src/mage/sets/mirrodin/AltarOfShadows.java +++ b/Mage.Sets/src/mage/sets/mirrodin/AltarOfShadows.java @@ -101,7 +101,7 @@ class AltarOfShadowsEffect extends OneShotEffect { Permanent sourcePermanent = game.getPermanent(source.getSourceId()); Player player = game.getPlayer(source.getControllerId()); if (sourcePermanent != null && player != null) { - int chargeCounters = sourcePermanent.getCounters().getCount(CounterType.CHARGE); + int chargeCounters = sourcePermanent.getCounters(game).getCount(CounterType.CHARGE); if (chargeCounters > 0){ player.getManaPool().addMana(Mana.BlackMana(chargeCounters), game, source); return true; diff --git a/Mage.Sets/src/mage/sets/mirrodin/ChaliceOfTheVoid.java b/Mage.Sets/src/mage/sets/mirrodin/ChaliceOfTheVoid.java index 8d673250350..907b9ec9fcb 100644 --- a/Mage.Sets/src/mage/sets/mirrodin/ChaliceOfTheVoid.java +++ b/Mage.Sets/src/mage/sets/mirrodin/ChaliceOfTheVoid.java @@ -97,7 +97,7 @@ class ChaliceOfTheVoidTriggeredAbility extends TriggeredAbilityImpl { public boolean checkTrigger(GameEvent event, Game game) { Permanent chalice = game.getPermanent(getSourceId()); Spell spell = game.getStack().getSpell(event.getTargetId()); - if (spell != null && chalice != null && spell.getConvertedManaCost() == chalice.getCounters().getCount(CounterType.CHARGE)) { + if (spell != null && chalice != null && spell.getConvertedManaCost() == chalice.getCounters(game).getCount(CounterType.CHARGE)) { for (Effect effect : this.getEffects()) { effect.setTargetPointer(new FixedTarget(event.getTargetId())); } diff --git a/Mage.Sets/src/mage/sets/mirrodin/Disarm.java b/Mage.Sets/src/mage/sets/mirrodin/Disarm.java new file mode 100644 index 00000000000..e73dd79aaa5 --- /dev/null +++ b/Mage.Sets/src/mage/sets/mirrodin/Disarm.java @@ -0,0 +1,104 @@ +/* + * 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.sets.mirrodin; + +import java.util.UUID; +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.FilterPermanent; +import mage.filter.predicate.mageobject.SubtypePredicate; +import mage.filter.predicate.permanent.AttachedToPredicate; +import mage.filter.predicate.permanent.PermanentIdPredicate; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.target.common.TargetCreaturePermanent; + +/** + * + * @author Derpthemeus + */ +public class Disarm extends CardImpl { + + public Disarm(UUID ownerId) { + super(ownerId, 32, "Disarm", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{U}"); + this.expansionSetCode = "MRD"; + + // Unattach all Equipment from target creature. + this.getSpellAbility().addTarget(new TargetCreaturePermanent()); + this.getSpellAbility().addEffect(new DisarmEffect()); + } + + public Disarm(final Disarm card) { + super(card); + } + + @java.lang.Override + public Disarm copy() { + return new Disarm(this); + } + + class DisarmEffect extends OneShotEffect { + + public DisarmEffect() { + super(Outcome.UnboostCreature); + this.staticText = "Unattach all Equipment from target creature"; + } + + public DisarmEffect(final DisarmEffect effect) { + super(effect); + } + + @java.lang.Override + public DisarmEffect copy() { + return new DisarmEffect(this); + } + + @java.lang.Override + public boolean apply(Game game, Ability source) { + Permanent creature = game.getPermanent(targetPointer.getFirst(game, source)); + if (creature != null) { + FilterPermanent creatureFilter = new FilterPermanent(); + creatureFilter.add(new PermanentIdPredicate(creature.getId())); + + FilterPermanent equipmentFilter = new FilterPermanent(); + equipmentFilter.add(new AttachedToPredicate(creatureFilter)); + equipmentFilter.add(new SubtypePredicate("Equipment")); + + for (Permanent equipment : game.getBattlefield().getAllActivePermanents(equipmentFilter, game)) { + creature.removeAttachment(equipment.getId(), game); + } + return true; + } + return false; + } + } +} diff --git a/Mage.Sets/src/mage/sets/mirrodin/JinxedChoker.java b/Mage.Sets/src/mage/sets/mirrodin/JinxedChoker.java index 9ce1f78d594..aa37521d928 100644 --- a/Mage.Sets/src/mage/sets/mirrodin/JinxedChoker.java +++ b/Mage.Sets/src/mage/sets/mirrodin/JinxedChoker.java @@ -127,7 +127,7 @@ class JinxedChokerDynamicValue implements DynamicValue { int count = 0; if (permanent != null){ - count = permanent.getCounters().getCount(CounterType.CHARGE); + count = permanent.getCounters(game).getCount(CounterType.CHARGE); } return count; } @@ -169,7 +169,7 @@ class JinxedChokerCounterEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); Permanent sourcePermanent = game.getPermanent(source.getSourceId()); if (controller != null && sourcePermanent != null) { - if (!sourcePermanent.getCounters().containsKey(CounterType.CHARGE) || controller.chooseUse(outcome, "Put a charge counter on? (No removes one)", source, game)) { + if (!sourcePermanent.getCounters(game).containsKey(CounterType.CHARGE) || controller.chooseUse(outcome, "Put a charge counter on? (No removes one)", source, game)) { return new AddCountersSourceEffect(CounterType.CHARGE.createInstance(), true).apply(game, source); } else { return new RemoveCounterSourceEffect(CounterType.CHARGE.createInstance()).apply(game, source); diff --git a/Mage.Sets/src/mage/sets/mirrodin/OblivionStone.java b/Mage.Sets/src/mage/sets/mirrodin/OblivionStone.java index c48b20ca4a7..f74c4ec9c92 100644 --- a/Mage.Sets/src/mage/sets/mirrodin/OblivionStone.java +++ b/Mage.Sets/src/mage/sets/mirrodin/OblivionStone.java @@ -90,13 +90,13 @@ class OblivionStoneEffect extends OneShotEffect { @java.lang.Override public boolean apply(Game game, Ability source) { for (Permanent p : game.getBattlefield().getAllActivePermanents()) { - if (!(p.getCardType().contains(CardType.LAND) || p.getCounters().containsKey(CounterType.FATE))) { + if (!(p.getCardType().contains(CardType.LAND) || p.getCounters(game).containsKey(CounterType.FATE))) { p.destroy(source.getSourceId(), game, false); } } for (Permanent p : game.getBattlefield().getAllActivePermanents()) { - if (p.getCounters().containsKey(CounterType.FATE)) { - p.removeCounters(CounterType.FATE.getName(), p.getCounters().getCount(CounterType.FATE), game); + if (p.getCounters(game).containsKey(CounterType.FATE)) { + p.removeCounters(CounterType.FATE.getName(), p.getCounters(game).getCount(CounterType.FATE), game); } } return true; diff --git a/Mage.Sets/src/mage/sets/mirrodin/SpoilsOfTheVault.java b/Mage.Sets/src/mage/sets/mirrodin/SpoilsOfTheVault.java index 7b19e41816f..e49dd207a36 100644 --- a/Mage.Sets/src/mage/sets/mirrodin/SpoilsOfTheVault.java +++ b/Mage.Sets/src/mage/sets/mirrodin/SpoilsOfTheVault.java @@ -108,7 +108,7 @@ class SpoilsOfTheVaultEffect extends OneShotEffect { } } controller.revealCards(sourceObject.getIdName(), cardsToReveal, game); - controller.moveCards(cardsToExile, null, Zone.EXILED, source, game); + controller.moveCards(cardsToExile, Zone.EXILED, source, game); controller.loseLife(cardsToExile.size(), game); return true; diff --git a/Mage.Sets/src/mage/sets/mirrodin/VulshokBattlemaster.java b/Mage.Sets/src/mage/sets/mirrodin/VulshokBattlemaster.java new file mode 100644 index 00000000000..bd5ea4e431f --- /dev/null +++ b/Mage.Sets/src/mage/sets/mirrodin/VulshokBattlemaster.java @@ -0,0 +1,109 @@ +/* + * 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.sets.mirrodin; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.keyword.HasteAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.filter.FilterPermanent; +import mage.filter.predicate.mageobject.SubtypePredicate; +import mage.game.Game; +import mage.game.permanent.Permanent; + +/** + * + * @author Derpthemeus + */ +public class VulshokBattlemaster extends CardImpl { + + public VulshokBattlemaster(UUID ownerId) { + super(ownerId, 110, "Vulshok Battlemaster", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{4}{R}"); + this.expansionSetCode = "MRD"; + this.subtype.add("Human"); + this.subtype.add("Warrior"); + this.power = new MageInt(2); + this.toughness = new MageInt(2); + + // Haste + this.addAbility(HasteAbility.getInstance()); + // When Vulshok Battlemaster enters the battlefield, attach all Equipment on the battlefield to it. + this.addAbility(new EntersBattlefieldTriggeredAbility(new VulshokBattlemasterEffect())); + } + + public VulshokBattlemaster(final VulshokBattlemaster card) { + super(card); + } + + @java.lang.Override + public VulshokBattlemaster copy() { + return new VulshokBattlemaster(this); + } + + class VulshokBattlemasterEffect extends OneShotEffect { + + public VulshokBattlemasterEffect() { + super(Outcome.Benefit); + this.staticText = "attach all Equipment on the battlefield to it"; + } + + public VulshokBattlemasterEffect(final VulshokBattlemasterEffect effect) { + super(effect); + } + + @java.lang.Override + public VulshokBattlemasterEffect copy() { + return new VulshokBattlemasterEffect(this); + } + + @java.lang.Override + public boolean apply(Game game, Ability source) { + Permanent battlemaster = game.getPermanent(source.getSourceId()); + if (battlemaster != null) { + FilterPermanent filter = new FilterPermanent(); + filter.add(new SubtypePredicate("Equipment")); + for (Permanent equipment : game.getBattlefield().getAllActivePermanents(filter, game)) { + if (equipment != null) { + //If an Equipment can’t equip Vulshok Battlemaster, it isn’t attached to the Battlemaster, and it doesn’t become unattached (if it’s attached to a creature). (http://gatherer.wizards.com/Pages/Card/Details.aspx?multiverseid=48125) + if (!battlemaster.cantBeAttachedBy(equipment, game)) { + battlemaster.addAttachment(equipment.getId(), game); + } + } + } + return true; + } + return false; + } + } +} diff --git a/Mage.Sets/src/mage/sets/modernmasters2015/AllSunsDawn.java b/Mage.Sets/src/mage/sets/modernmasters2015/AllSunsDawn.java index 3a3bbbf4690..28b28e6af8d 100644 --- a/Mage.Sets/src/mage/sets/modernmasters2015/AllSunsDawn.java +++ b/Mage.Sets/src/mage/sets/modernmasters2015/AllSunsDawn.java @@ -120,7 +120,7 @@ class AllSunsDawnEffect extends OneShotEffect { cardsToHand.add(card); } } - controller.moveCards(cardsToHand, null, Zone.HAND, source, game); + controller.moveCards(cardsToHand, Zone.HAND, source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/sets/morningtide/KinsbaileBorderguard.java b/Mage.Sets/src/mage/sets/morningtide/KinsbaileBorderguard.java index 5080aa2baa5..14805d6f173 100644 --- a/Mage.Sets/src/mage/sets/morningtide/KinsbaileBorderguard.java +++ b/Mage.Sets/src/mage/sets/morningtide/KinsbaileBorderguard.java @@ -92,7 +92,7 @@ class AllCountersCount implements DynamicValue { Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(sourceAbility.getSourceId()); if(sourcePermanent != null) { int total = 0; - for(Counter counter : sourcePermanent.getCounters().values()) { + for(Counter counter : sourcePermanent.getCounters(game).values()) { total += counter.getCount(); } return total; diff --git a/Mage.Sets/src/mage/sets/morningtide/OonasBlackguard.java b/Mage.Sets/src/mage/sets/morningtide/OonasBlackguard.java index 085cd722d3b..46be4f2a8d6 100644 --- a/Mage.Sets/src/mage/sets/morningtide/OonasBlackguard.java +++ b/Mage.Sets/src/mage/sets/morningtide/OonasBlackguard.java @@ -157,7 +157,7 @@ class OonasBlackguardTriggeredAbility extends TriggeredAbilityImpl { public boolean checkTrigger(GameEvent event, Game game) { if (((DamagedPlayerEvent) event).isCombatDamage()) { Permanent creature = game.getPermanent(event.getSourceId()); - if (creature != null && creature.getControllerId().equals(getControllerId()) && creature.getCounters().getCount(CounterType.P1P1) > 0) { + if (creature != null && creature.getControllerId().equals(getControllerId()) && creature.getCounters(game).getCount(CounterType.P1P1) > 0) { for (Effect effect : this.getEffects()) { effect.setTargetPointer(new FixedTarget(event.getPlayerId())); } diff --git a/Mage.Sets/src/mage/sets/nemesis/TangleWire.java b/Mage.Sets/src/mage/sets/nemesis/TangleWire.java index 53644de7d9a..065bbd63043 100644 --- a/Mage.Sets/src/mage/sets/nemesis/TangleWire.java +++ b/Mage.Sets/src/mage/sets/nemesis/TangleWire.java @@ -103,7 +103,7 @@ class TangleWireEffect extends OneShotEffect { } int targetCount = game.getBattlefield().countAll(filter, player.getId(), game); - int counterCount = permanent.getCounters().getCount(CounterType.FADE); + int counterCount = permanent.getCounters(game).getCount(CounterType.FADE); int amount = Math.min(counterCount, targetCount); Target target = new TargetControlledPermanent(amount, amount, filter, true); diff --git a/Mage.Sets/src/mage/sets/newphyrexia/GremlinMine.java b/Mage.Sets/src/mage/sets/newphyrexia/GremlinMine.java index 53c8d39de80..02ecda3ba98 100644 --- a/Mage.Sets/src/mage/sets/newphyrexia/GremlinMine.java +++ b/Mage.Sets/src/mage/sets/newphyrexia/GremlinMine.java @@ -110,7 +110,7 @@ class GremlinMineEffect extends OneShotEffect { Permanent permanent = game.getPermanent(source.getFirstTarget()); if (player != null && permanent != null) { - int existingCount = permanent.getCounters().getCount(CounterType.CHARGE); + int existingCount = permanent.getCounters(game).getCount(CounterType.CHARGE); if (existingCount > 0) { Choice choice = new ChoiceImpl(); diff --git a/Mage.Sets/src/mage/sets/newphyrexia/HexParasite.java b/Mage.Sets/src/mage/sets/newphyrexia/HexParasite.java index 75cc958ff75..f67e1ff6206 100644 --- a/Mage.Sets/src/mage/sets/newphyrexia/HexParasite.java +++ b/Mage.Sets/src/mage/sets/newphyrexia/HexParasite.java @@ -99,14 +99,14 @@ class HexParasiteEffect extends OneShotEffect { if (permanent != null && player != null) { int toRemove = source.getManaCostsToPay().getX(); int removed = 0; - String[] counterNames = permanent.getCounters().keySet().toArray(new String[0]); + String[] counterNames = permanent.getCounters(game).keySet().toArray(new String[0]); for (String counterName : counterNames) { if (player.chooseUse(Outcome.Neutral, "Do you want to remove " + counterName + " counters?", source, game)) { - if (permanent.getCounters().get(counterName).getCount() == 1 || toRemove == 1) { + if (permanent.getCounters(game).get(counterName).getCount() == 1 || toRemove == 1) { permanent.removeCounters(counterName, 1, game); removed++; } else { - int amount = player.getAmount(1, Math.min(permanent.getCounters().get(counterName).getCount(), toRemove - removed), "How many?", game); + int amount = player.getAmount(1, Math.min(permanent.getCounters(game).get(counterName).getCount(), toRemove - removed), "How many?", game); if (amount > 0) { removed += amount; permanent.removeCounters(counterName, amount, game); diff --git a/Mage.Sets/src/mage/sets/newphyrexia/LifesFinale.java b/Mage.Sets/src/mage/sets/newphyrexia/LifesFinale.java index ad2893b38ab..71ee27cf4d8 100644 --- a/Mage.Sets/src/mage/sets/newphyrexia/LifesFinale.java +++ b/Mage.Sets/src/mage/sets/newphyrexia/LifesFinale.java @@ -98,7 +98,7 @@ class LifesFinaleEffect extends OneShotEffect { if (player != null && opponent != null) { TargetCardInLibrary target = new TargetCardInLibrary(0, 3, new FilterCreatureCard("creature cards from his library to put in his graveyard")); if (player.searchLibrary(target, game, opponent.getId())) { - player.moveCards(new CardsImpl(target.getTargets()), Zone.LIBRARY, Zone.GRAVEYARD, source, game); + player.moveCards(new CardsImpl(target.getTargets()), Zone.GRAVEYARD, source, game); } opponent.shuffleLibrary(source, game); return true; diff --git a/Mage.Sets/src/mage/sets/newphyrexia/ShrineOfPiercingVision.java b/Mage.Sets/src/mage/sets/newphyrexia/ShrineOfPiercingVision.java index ac8b2203805..9319ba4ef53 100644 --- a/Mage.Sets/src/mage/sets/newphyrexia/ShrineOfPiercingVision.java +++ b/Mage.Sets/src/mage/sets/newphyrexia/ShrineOfPiercingVision.java @@ -114,7 +114,7 @@ class ShrineOfPiercingVisionEffect extends OneShotEffect { if (player == null || permanent == null) { return false; } - int count = permanent.getCounters().getCount(CounterType.CHARGE); + int count = permanent.getCounters(game).getCount(CounterType.CHARGE); Cards cards = new CardsImpl(); count = Math.min(player.getLibrary().size(), count); diff --git a/Mage.Sets/src/mage/sets/oathofthegatewatch/GladehartCavalry.java b/Mage.Sets/src/mage/sets/oathofthegatewatch/GladehartCavalry.java index 9e535d57ee0..199b17ad02f 100644 --- a/Mage.Sets/src/mage/sets/oathofthegatewatch/GladehartCavalry.java +++ b/Mage.Sets/src/mage/sets/oathofthegatewatch/GladehartCavalry.java @@ -102,7 +102,7 @@ class GladehartCavalryTriggeredAbility extends TriggeredAbilityImpl { if (permanent != null && permanent.getControllerId().equals(this.getControllerId()) && permanent.getCardType().contains(CardType.CREATURE) - && permanent.getCounters().getCount(CounterType.P1P1) > 0) { + && permanent.getCounters(game).getCount(CounterType.P1P1) > 0) { return true; } } diff --git a/Mage.Sets/src/mage/sets/odyssey/BombSquad.java b/Mage.Sets/src/mage/sets/odyssey/BombSquad.java index 87bf9c3083e..f6b94f2535b 100644 --- a/Mage.Sets/src/mage/sets/odyssey/BombSquad.java +++ b/Mage.Sets/src/mage/sets/odyssey/BombSquad.java @@ -122,7 +122,7 @@ class BombSquadTriggeredAbility extends TriggeredAbilityImpl { if (event.getData().equals(CounterType.FUSE.getName())) { Permanent permanent = game.getPermanent(event.getTargetId()); if (permanent != null && filter.match(permanent, game)) { - if (4 <= permanent.getCounters().getCount(CounterType.FUSE)) { + if (4 <= permanent.getCounters(game).getCount(CounterType.FUSE)) { for (Effect effect : this.getEffects()) { effect.setTargetPointer(new FixedTarget(permanent.getId())); } @@ -159,7 +159,7 @@ class BombSquadDamgeEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Permanent creature = game.getPermanent(this.getTargetPointer().getFirst(game, source)); if (creature != null) { - creature.removeCounters(CounterType.FUSE.getName(), creature.getCounters().getCount(CounterType.FUSE), game); + creature.removeCounters(CounterType.FUSE.getName(), creature.getCounters(game).getCount(CounterType.FUSE), game); creature.destroy(source.getSourceId(), game, false); } if (creature == null) { diff --git a/Mage.Sets/src/mage/sets/odyssey/DelayingShield.java b/Mage.Sets/src/mage/sets/odyssey/DelayingShield.java index 2e7965676c5..29e69e6685d 100644 --- a/Mage.Sets/src/mage/sets/odyssey/DelayingShield.java +++ b/Mage.Sets/src/mage/sets/odyssey/DelayingShield.java @@ -134,7 +134,7 @@ class DelayingShieldUpkeepEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); Permanent permanent = game.getPermanent(source.getSourceId()); if (controller != null && permanent != null) { - int numCounters = permanent.getCounters().getCount(CounterType.DELAY); + int numCounters = permanent.getCounters(game).getCount(CounterType.DELAY); permanent.removeCounters(CounterType.DELAY.createInstance(numCounters), game); for (int i = numCounters; i > 0; i--) { if (controller.chooseUse(Outcome.Benefit, "Pay {1}{W}? (" + i + " counters left to pay)", source, game)) { diff --git a/Mage.Sets/src/mage/sets/onslaught/Aurification.java b/Mage.Sets/src/mage/sets/onslaught/Aurification.java index 92479ceca51..c864f15cfe8 100644 --- a/Mage.Sets/src/mage/sets/onslaught/Aurification.java +++ b/Mage.Sets/src/mage/sets/onslaught/Aurification.java @@ -155,7 +155,7 @@ public class Aurification extends CardImpl { public boolean apply(Game game, Ability source) { for (Permanent permanent : game.getBattlefield().getAllActivePermanents(CardType.CREATURE)) { if (permanent != null){ - permanent.getCounters().removeAllCounters(CounterType.GOLD); + permanent.getCounters(game).removeAllCounters(CounterType.GOLD); } } return true; diff --git a/Mage.Sets/src/mage/sets/onslaught/WeirdHarvest.java b/Mage.Sets/src/mage/sets/onslaught/WeirdHarvest.java index f430e4541d9..7fe96967e7b 100644 --- a/Mage.Sets/src/mage/sets/onslaught/WeirdHarvest.java +++ b/Mage.Sets/src/mage/sets/onslaught/WeirdHarvest.java @@ -118,7 +118,7 @@ class WeirdHarvestEffect extends OneShotEffect { if (player.searchLibrary(target, game)) { if (target.getTargets().size() > 0) { Cards cards = new CardsImpl(target.getTargets()); - player.moveCards(cards, null, Zone.HAND, source, game); + player.moveCards(cards, Zone.HAND, source, game); player.revealCards(sourceObject.getIdName() + " (" + player.getName() + ")", cards, game); } } diff --git a/Mage.Sets/src/mage/sets/planarchaos/FungalBehemoth.java b/Mage.Sets/src/mage/sets/planarchaos/FungalBehemoth.java index 41e396f1c47..d6191eea3d4 100644 --- a/Mage.Sets/src/mage/sets/planarchaos/FungalBehemoth.java +++ b/Mage.Sets/src/mage/sets/planarchaos/FungalBehemoth.java @@ -124,7 +124,7 @@ class P1P1CountersOnControlledCreaturesCount implements DynamicValue { public int calculate(Game game, Ability sourceAbility, Effect effect) { int count = 0; for (Permanent permanent : game.getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), sourceAbility.getControllerId(), game)) { - count += permanent.getCounters().getCount(CounterType.P1P1); + count += permanent.getCounters(game).getCount(CounterType.P1P1); } return count; } diff --git a/Mage.Sets/src/mage/sets/planarchaos/ShroudedLore.java b/Mage.Sets/src/mage/sets/planarchaos/ShroudedLore.java index 705affbb8bd..12bde406768 100644 --- a/Mage.Sets/src/mage/sets/planarchaos/ShroudedLore.java +++ b/Mage.Sets/src/mage/sets/planarchaos/ShroudedLore.java @@ -132,7 +132,7 @@ class ShroudedLoreEffect extends OneShotEffect { if(card != null) { Cards cardsToHand = new CardsImpl(); cardsToHand.add(card); - you.moveCards(cardsToHand, Zone.GRAVEYARD, Zone.HAND, source, game); + you.moveCards(cardsToHand, Zone.HAND, source, game); } return true; } diff --git a/Mage.Sets/src/mage/sets/prereleaseevents/Gleancrawler.java b/Mage.Sets/src/mage/sets/prereleaseevents/Gleancrawler.java index 6ae7bbbde66..4ad26bc5b41 100644 --- a/Mage.Sets/src/mage/sets/prereleaseevents/Gleancrawler.java +++ b/Mage.Sets/src/mage/sets/prereleaseevents/Gleancrawler.java @@ -117,7 +117,7 @@ class GleancrawlerEffect extends OneShotEffect { } } } - controller.moveCards(cardsToHand, Zone.GRAVEYARD, Zone.HAND, source, game); + controller.moveCards(cardsToHand, Zone.HAND, source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/sets/ravnica/Grozoth.java b/Mage.Sets/src/mage/sets/ravnica/Grozoth.java index f6dd13b3a67..040a36acb83 100644 --- a/Mage.Sets/src/mage/sets/ravnica/Grozoth.java +++ b/Mage.Sets/src/mage/sets/ravnica/Grozoth.java @@ -128,7 +128,7 @@ class GrozothEffect extends SearchEffect { } } player.revealCards(sourceCard.getIdName(), cards, game); - player.moveCards(cards, Zone.LIBRARY, Zone.HAND, source, game); + player.moveCards(cards, Zone.HAND, source, game); } player.shuffleLibrary(source, game); return true; diff --git a/Mage.Sets/src/mage/sets/ravnica/Necroplasm.java b/Mage.Sets/src/mage/sets/ravnica/Necroplasm.java index 3327d28d264..21b1eb9ec1b 100644 --- a/Mage.Sets/src/mage/sets/ravnica/Necroplasm.java +++ b/Mage.Sets/src/mage/sets/ravnica/Necroplasm.java @@ -103,7 +103,7 @@ class NecroplasmEffect extends OneShotEffect { Player player = game.getPlayer(source.getControllerId()); Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId()); if (player != null && sourcePermanent != null) { - int numCounters = sourcePermanent.getCounters().getCount(CounterType.P1P1); + int numCounters = sourcePermanent.getCounters(game).getCount(CounterType.P1P1); FilterCreaturePermanent filter = new FilterCreaturePermanent(); filter.add(new ConvertedManaCostPredicate(ComparisonType.Equal, numCounters)); for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) { diff --git a/Mage.Sets/src/mage/sets/returntoravnica/AzorsElocutors.java b/Mage.Sets/src/mage/sets/returntoravnica/AzorsElocutors.java index 39f8c09982f..1507245f11f 100644 --- a/Mage.Sets/src/mage/sets/returntoravnica/AzorsElocutors.java +++ b/Mage.Sets/src/mage/sets/returntoravnica/AzorsElocutors.java @@ -129,7 +129,7 @@ class AzorsElocutorsEffect extends OneShotEffect { Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null) { permanent.addCounters(new Counter("filibuster"), game); - if (permanent.getCounters().getCount("filibuster") > 4) { + if (permanent.getCounters(game).getCount("filibuster") > 4) { Player player = game.getPlayer(permanent.getControllerId()); if (player != null) { player.won(game); diff --git a/Mage.Sets/src/mage/sets/returntoravnica/DestroyTheEvidence.java b/Mage.Sets/src/mage/sets/returntoravnica/DestroyTheEvidence.java index 15dfea14f46..fd47c0782a0 100644 --- a/Mage.Sets/src/mage/sets/returntoravnica/DestroyTheEvidence.java +++ b/Mage.Sets/src/mage/sets/returntoravnica/DestroyTheEvidence.java @@ -114,7 +114,7 @@ class DestroyTheEvidenceEffect extends OneShotEffect { } } player.revealCards(sourceObject.getName(), cards, game, true); - player.moveCards(cards, Zone.LIBRARY, Zone.GRAVEYARD, source, game); + player.moveCards(cards, Zone.GRAVEYARD, source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/sets/returntoravnica/GrislySalvage.java b/Mage.Sets/src/mage/sets/returntoravnica/GrislySalvage.java index 2564e53eb49..531dce2b461 100644 --- a/Mage.Sets/src/mage/sets/returntoravnica/GrislySalvage.java +++ b/Mage.Sets/src/mage/sets/returntoravnica/GrislySalvage.java @@ -116,7 +116,7 @@ class GrislySalvageEffect extends OneShotEffect { cards.remove(card); } } - controller.moveCards(cards, Zone.LIBRARY, Zone.GRAVEYARD, source, game); + controller.moveCards(cards, Zone.GRAVEYARD, source, game); } return true; } diff --git a/Mage.Sets/src/mage/sets/returntoravnica/GuildFeud.java b/Mage.Sets/src/mage/sets/returntoravnica/GuildFeud.java index cabc13af231..0a685745d52 100644 --- a/Mage.Sets/src/mage/sets/returntoravnica/GuildFeud.java +++ b/Mage.Sets/src/mage/sets/returntoravnica/GuildFeud.java @@ -124,7 +124,7 @@ class GuildFeudEffect extends OneShotEffect { } } } - player.moveCards(topThreeCards, Zone.LIBRARY, Zone.GRAVEYARD, source, game); + player.moveCards(topThreeCards, Zone.GRAVEYARD, source, game); } } // If two creatures are put onto the battlefield this way, those creatures fight each other diff --git a/Mage.Sets/src/mage/sets/riseoftheeldrazi/RealmsUncharted.java b/Mage.Sets/src/mage/sets/riseoftheeldrazi/RealmsUncharted.java index 37a9c3372a2..46b55407229 100644 --- a/Mage.Sets/src/mage/sets/riseoftheeldrazi/RealmsUncharted.java +++ b/Mage.Sets/src/mage/sets/riseoftheeldrazi/RealmsUncharted.java @@ -128,8 +128,8 @@ class RealmsUnchartedEffect extends OneShotEffect { cards.removeAll(cardsToKeep); } } - controller.moveCards(cards, Zone.LIBRARY, Zone.GRAVEYARD, source, game); - controller.moveCards(cardsToKeep, Zone.LIBRARY, Zone.HAND, source, game); + controller.moveCards(cards, Zone.GRAVEYARD, source, game); + controller.moveCards(cardsToKeep, Zone.HAND, source, game); } controller.shuffleLibrary(source, game); return true; diff --git a/Mage.Sets/src/mage/sets/riseoftheeldrazi/SphinxBoneWand.java b/Mage.Sets/src/mage/sets/riseoftheeldrazi/SphinxBoneWand.java index cda66dbda5e..7352bac0e9c 100644 --- a/Mage.Sets/src/mage/sets/riseoftheeldrazi/SphinxBoneWand.java +++ b/Mage.Sets/src/mage/sets/riseoftheeldrazi/SphinxBoneWand.java @@ -99,7 +99,7 @@ class SphinxBoneWandEffect extends OneShotEffect { Permanent sourcePermanent = game.getPermanent(source.getSourceId()); if (sourcePermanent != null) { sourcePermanent.addCounters(CounterType.CHARGE.createInstance(), game); - int amount = sourcePermanent.getCounters().getCount(CounterType.CHARGE); + int amount = sourcePermanent.getCounters(game).getCount(CounterType.CHARGE); Permanent permanent = game.getPermanent(source.getFirstTarget()); if (permanent != null) { diff --git a/Mage.Sets/src/mage/sets/riseoftheeldrazi/ThoughtGorger.java b/Mage.Sets/src/mage/sets/riseoftheeldrazi/ThoughtGorger.java index d9fe95cd8f3..64cf6a6e4ff 100644 --- a/Mage.Sets/src/mage/sets/riseoftheeldrazi/ThoughtGorger.java +++ b/Mage.Sets/src/mage/sets/riseoftheeldrazi/ThoughtGorger.java @@ -130,7 +130,7 @@ class ThoughtGorgerEffectLeaves extends OneShotEffect { public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); Permanent thoughtGorgerLastState = (Permanent) game.getLastKnownInformation(source.getSourceId(), Zone.BATTLEFIELD); - int numberCounters = thoughtGorgerLastState.getCounters().getCount(CounterType.P1P1); + int numberCounters = thoughtGorgerLastState.getCounters(game).getCount(CounterType.P1P1); if (player != null) { player.drawCards(numberCounters, game); return true; diff --git a/Mage.Sets/src/mage/sets/scarsofmirrodin/CullingDais.java b/Mage.Sets/src/mage/sets/scarsofmirrodin/CullingDais.java index 81bff54a08b..74ab2c6d085 100644 --- a/Mage.Sets/src/mage/sets/scarsofmirrodin/CullingDais.java +++ b/Mage.Sets/src/mage/sets/scarsofmirrodin/CullingDais.java @@ -92,7 +92,7 @@ class CullingDaisEffect extends OneShotEffect { Permanent p = (Permanent) game.getLastKnownInformation(source.getSourceId(), Zone.BATTLEFIELD); Player player = game.getPlayer(source.getControllerId()); if (p != null && player != null) { - int count = p.getCounters().getCount(CounterType.CHARGE); + int count = p.getCounters(game).getCount(CounterType.CHARGE); player.drawCards(count, game); return true; } diff --git a/Mage.Sets/src/mage/sets/scarsofmirrodin/GenesisWave.java b/Mage.Sets/src/mage/sets/scarsofmirrodin/GenesisWave.java index 08d10749005..5ea5ce4ebdf 100644 --- a/Mage.Sets/src/mage/sets/scarsofmirrodin/GenesisWave.java +++ b/Mage.Sets/src/mage/sets/scarsofmirrodin/GenesisWave.java @@ -126,7 +126,7 @@ class GenesisWaveEffect extends OneShotEffect { } } controller.moveCards(toBattlefield, Zone.BATTLEFIELD, source, game, false, false, false, null); - controller.moveCards(cards, Zone.LIBRARY, Zone.GRAVEYARD, source, game); + controller.moveCards(cards, Zone.GRAVEYARD, source, game); } return true; } diff --git a/Mage.Sets/src/mage/sets/scarsofmirrodin/Grindclock.java b/Mage.Sets/src/mage/sets/scarsofmirrodin/Grindclock.java index 5819d908429..3df7499d4df 100644 --- a/Mage.Sets/src/mage/sets/scarsofmirrodin/Grindclock.java +++ b/Mage.Sets/src/mage/sets/scarsofmirrodin/Grindclock.java @@ -83,7 +83,7 @@ class GrindclockEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - int amount = game.getPermanent(source.getSourceId()).getCounters().getCount(CounterType.CHARGE); + int amount = game.getPermanent(source.getSourceId()).getCounters(game).getCount(CounterType.CHARGE); Player targetPlayer = game.getPlayer(source.getFirstTarget()); if (targetPlayer != null) { targetPlayer.moveCards(targetPlayer.getLibrary().getTopCards(game, amount), Zone.GRAVEYARD, source, game); diff --git a/Mage.Sets/src/mage/sets/scarsofmirrodin/LiegeOfTheTangle.java b/Mage.Sets/src/mage/sets/scarsofmirrodin/LiegeOfTheTangle.java index 6f46999fee7..9d06e013dcd 100644 --- a/Mage.Sets/src/mage/sets/scarsofmirrodin/LiegeOfTheTangle.java +++ b/Mage.Sets/src/mage/sets/scarsofmirrodin/LiegeOfTheTangle.java @@ -135,7 +135,7 @@ class LiegeOfTheTangleEffect extends ContinuousEffectImpl { for (Iterator it = affectedObjectList.iterator(); it.hasNext();) { Permanent perm = it.next().getPermanent(game); if (perm != null) { - if (perm.getCounters().getCount(CounterType.AWAKENING) > 0) { + if (perm.getCounters(game).getCount(CounterType.AWAKENING) > 0) { switch (layer) { case TypeChangingEffects_4: if (sublayer == SubLayer.NA) { diff --git a/Mage.Sets/src/mage/sets/scarsofmirrodin/RatchetBomb.java b/Mage.Sets/src/mage/sets/scarsofmirrodin/RatchetBomb.java index a5b43eea934..93c2f77f477 100644 --- a/Mage.Sets/src/mage/sets/scarsofmirrodin/RatchetBomb.java +++ b/Mage.Sets/src/mage/sets/scarsofmirrodin/RatchetBomb.java @@ -94,7 +94,7 @@ public class RatchetBomb extends CardImpl { } } - int count = p.getCounters().getCount(CounterType.CHARGE); + int count = p.getCounters(game).getCount(CounterType.CHARGE); for (Permanent perm: game.getBattlefield().getAllActivePermanents()) { if (perm.getConvertedManaCost() == count && !(perm.getCardType().contains(CardType.LAND))) { perm.destroy(source.getSourceId(), game, false); diff --git a/Mage.Sets/src/mage/sets/scourge/ForgottenAncient.java b/Mage.Sets/src/mage/sets/scourge/ForgottenAncient.java index 497d7b5b2ec..aad2b972b80 100644 --- a/Mage.Sets/src/mage/sets/scourge/ForgottenAncient.java +++ b/Mage.Sets/src/mage/sets/scourge/ForgottenAncient.java @@ -116,7 +116,7 @@ public class ForgottenAncient extends CardImpl { return false; } - int numCounters = sourcePermanent.getCounters().getCount(CounterType.P1P1); + int numCounters = sourcePermanent.getCounters(game).getCount(CounterType.P1P1); ArrayList counterMovements = new ArrayList<>(); do { diff --git a/Mage.Sets/src/mage/sets/seventhedition/AncestralMemories.java b/Mage.Sets/src/mage/sets/seventhedition/AncestralMemories.java index 32b515cc39f..8e748fb5a00 100644 --- a/Mage.Sets/src/mage/sets/seventhedition/AncestralMemories.java +++ b/Mage.Sets/src/mage/sets/seventhedition/AncestralMemories.java @@ -112,7 +112,7 @@ class AncestralMemoriesEffect extends OneShotEffect { } } } - player.moveCards(cards, Zone.LIBRARY, Zone.GRAVEYARD, source, game); + player.moveCards(cards, Zone.GRAVEYARD, source, game); } return true; } diff --git a/Mage.Sets/src/mage/sets/shadowmoor/AdviceFromTheFae.java b/Mage.Sets/src/mage/sets/shadowmoor/AdviceFromTheFae.java index 80c568ac4e8..f40fb47f995 100644 --- a/Mage.Sets/src/mage/sets/shadowmoor/AdviceFromTheFae.java +++ b/Mage.Sets/src/mage/sets/shadowmoor/AdviceFromTheFae.java @@ -115,7 +115,7 @@ class AdviceFromTheFaeEffect extends OneShotEffect { TargetCard target = new TargetCard(moreCreatures ? 2 : 1, Zone.LIBRARY, new FilterCard()); if (controller.choose(Outcome.DrawCard, cardsFromLibrary, target, game)) { cardsFromLibrary.removeAll(target.getTargets()); - controller.moveCards(new CardsImpl(target.getTargets()), null, Zone.HAND, source, game); + controller.moveCards(new CardsImpl(target.getTargets()), Zone.HAND, source, game); } controller.putCardsOnBottomOfLibrary(cardsFromLibrary, game, source, true); return true; diff --git a/Mage.Sets/src/mage/sets/shadowmoor/BlowflyInfestation.java b/Mage.Sets/src/mage/sets/shadowmoor/BlowflyInfestation.java index d3056ac4628..dbab73a32e5 100644 --- a/Mage.Sets/src/mage/sets/shadowmoor/BlowflyInfestation.java +++ b/Mage.Sets/src/mage/sets/shadowmoor/BlowflyInfestation.java @@ -92,7 +92,7 @@ class BlowflyInfestationCondition implements Condition { } } if (permanent != null) { - return permanent.getCounters().containsKey(CounterType.M1M1); + return permanent.getCounters(game).containsKey(CounterType.M1M1); } return false; } diff --git a/Mage.Sets/src/mage/sets/shadowmoor/FateTransfer.java b/Mage.Sets/src/mage/sets/shadowmoor/FateTransfer.java index 6555350861c..c0c3986a93a 100644 --- a/Mage.Sets/src/mage/sets/shadowmoor/FateTransfer.java +++ b/Mage.Sets/src/mage/sets/shadowmoor/FateTransfer.java @@ -102,7 +102,7 @@ class FateTransferEffect extends OneShotEffect { if (creatureToMoveCountersFrom != null && creatureToMoveCountersTo != null) { Permanent copyCreature = creatureToMoveCountersFrom.copy(); - for (Counter counter : copyCreature.getCounters().values()) { + for (Counter counter : copyCreature.getCounters(game).values()) { creatureToMoveCountersFrom.removeCounters(counter, game); creatureToMoveCountersTo.addCounters(counter, game); } diff --git a/Mage.Sets/src/mage/sets/shadowmoor/GriefTyrant.java b/Mage.Sets/src/mage/sets/shadowmoor/GriefTyrant.java index 6b1523ee1ee..1c7b61300e0 100644 --- a/Mage.Sets/src/mage/sets/shadowmoor/GriefTyrant.java +++ b/Mage.Sets/src/mage/sets/shadowmoor/GriefTyrant.java @@ -96,7 +96,7 @@ class GriefTyrantEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Permanent targetCreature = game.getPermanent(targetPointer.getFirst(game, source)); Permanent griefTyrant = game.getPermanentOrLKIBattlefield(source.getSourceId()); - int countersOnGriefTyrant = griefTyrant.getCounters().getCount(CounterType.M1M1); + int countersOnGriefTyrant = griefTyrant.getCounters(game).getCount(CounterType.M1M1); if (targetCreature != null) { targetCreature.addCounters(CounterType.M1M1.createInstance(countersOnGriefTyrant), game); return true; diff --git a/Mage.Sets/src/mage/sets/shadowmoor/Heartmender.java b/Mage.Sets/src/mage/sets/shadowmoor/Heartmender.java index 5d40d09f3da..bd8a7ba4439 100644 --- a/Mage.Sets/src/mage/sets/shadowmoor/Heartmender.java +++ b/Mage.Sets/src/mage/sets/shadowmoor/Heartmender.java @@ -99,7 +99,7 @@ class HeartmenderEffect extends OneShotEffect { } for (Permanent creature : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), game)) { if (creature != null - && creature.getCounters().getCount(counter.getName()) >= counter.getCount()) { + && creature.getCounters(game).getCount(counter.getName()) >= counter.getCount()) { creature.removeCounters(counter.getName(), counter.getCount(), game); game.informPlayers(new StringBuilder("Removed ").append(counter.getCount()).append(" ").append(counter.getName()) .append(" counter from ").append(creature.getName()).toString()); diff --git a/Mage.Sets/src/mage/sets/shadowmoor/LeechBonder.java b/Mage.Sets/src/mage/sets/shadowmoor/LeechBonder.java index 3877ea3184b..f4ca31fb615 100644 --- a/Mage.Sets/src/mage/sets/shadowmoor/LeechBonder.java +++ b/Mage.Sets/src/mage/sets/shadowmoor/LeechBonder.java @@ -119,13 +119,13 @@ class LeechBonderEffect extends OneShotEffect { } Choice choice = new ChoiceImpl(); Set possibleChoices = new HashSet<>(); - for (String counterName : fromPermanent.getCounters().keySet()) { + for (String counterName : fromPermanent.getCounters(game).keySet()) { possibleChoices.add(counterName); } choice.setChoices(possibleChoices); if (controller.choose(outcome, choice, game)) { String chosen = choice.getChoice(); - if (fromPermanent.getCounters().containsKey(chosen)) { + if (fromPermanent.getCounters(game).containsKey(chosen)) { CounterType counterType = CounterType.findByName(chosen); if (counterType != null) { Counter counter = counterType.createInstance(); diff --git a/Mage.Sets/src/mage/sets/shadowmoor/TwilightShepherd.java b/Mage.Sets/src/mage/sets/shadowmoor/TwilightShepherd.java index 7f684f62f4d..9b5f4c6fc7b 100644 --- a/Mage.Sets/src/mage/sets/shadowmoor/TwilightShepherd.java +++ b/Mage.Sets/src/mage/sets/shadowmoor/TwilightShepherd.java @@ -121,7 +121,7 @@ class TwilightShepherdEffect extends OneShotEffect { } } } - controller.moveCards(cardsToHand, Zone.GRAVEYARD, Zone.HAND, source, game); + controller.moveCards(cardsToHand, Zone.HAND, source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/sets/shadowmoor/Woeleecher.java b/Mage.Sets/src/mage/sets/shadowmoor/Woeleecher.java index d7ea5cad845..a3dfcc05ba3 100644 --- a/Mage.Sets/src/mage/sets/shadowmoor/Woeleecher.java +++ b/Mage.Sets/src/mage/sets/shadowmoor/Woeleecher.java @@ -102,9 +102,9 @@ class WoeleecherEffect extends OneShotEffect { Permanent target = game.getPermanent(source.getFirstTarget()); Player you = game.getPlayer(source.getControllerId()); if (target != null) { - numberCountersOriginal = target.getCounters().getCount(CounterType.M1M1); + numberCountersOriginal = target.getCounters(game).getCount(CounterType.M1M1); target.removeCounters(CounterType.M1M1.createInstance(), game); - numberCountersAfter = target.getCounters().getCount(CounterType.M1M1); + numberCountersAfter = target.getCounters(game).getCount(CounterType.M1M1); if (numberCountersAfter < numberCountersOriginal && you != null) { you.gainLife(2, game); return true; diff --git a/Mage.Sets/src/mage/sets/shadowsoverinnistrad/BrainInAJar.java b/Mage.Sets/src/mage/sets/shadowsoverinnistrad/BrainInAJar.java index 4994645e6ed..4ef113d70fd 100644 --- a/Mage.Sets/src/mage/sets/shadowsoverinnistrad/BrainInAJar.java +++ b/Mage.Sets/src/mage/sets/shadowsoverinnistrad/BrainInAJar.java @@ -106,7 +106,7 @@ class BrainInAJarCastEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); Permanent sourceObject = game.getPermanent(source.getSourceId()); if (controller != null && sourceObject != null) { - int counters = sourceObject.getCounters().getCount(CounterType.CHARGE); + int counters = sourceObject.getCounters(game).getCount(CounterType.CHARGE); FilterCard filter = new FilterInstantOrSorceryCard(); filter.add(new ConvertedManaCostPredicate(Filter.ComparisonType.Equal, counters)); int cardsToCast = controller.getHand().count(filter, source.getControllerId(), source.getSourceId(), game); diff --git a/Mage.Sets/src/mage/sets/shardsofalara/TidehollowSculler.java b/Mage.Sets/src/mage/sets/shardsofalara/TidehollowSculler.java index c9743be6bb4..d3aa48d02a2 100644 --- a/Mage.Sets/src/mage/sets/shardsofalara/TidehollowSculler.java +++ b/Mage.Sets/src/mage/sets/shardsofalara/TidehollowSculler.java @@ -149,7 +149,7 @@ class TidehollowScullerLeaveEffect extends OneShotEffect { int zoneChangeCounter = (sourceObject instanceof PermanentToken) ? source.getSourceObjectZoneChangeCounter() : source.getSourceObjectZoneChangeCounter() - 1; ExileZone exZone = game.getExile().getExileZone(CardUtil.getExileZoneId(game, source.getSourceId(), zoneChangeCounter)); if (exZone != null) { - controller.moveCards(exZone, null, Zone.HAND, source, game); + controller.moveCards(exZone, Zone.HAND, source, game); } return true; } diff --git a/Mage.Sets/src/mage/sets/stronghold/CrovaxTheCursed.java b/Mage.Sets/src/mage/sets/stronghold/CrovaxTheCursed.java index aac366b2002..cabc6f546db 100644 --- a/Mage.Sets/src/mage/sets/stronghold/CrovaxTheCursed.java +++ b/Mage.Sets/src/mage/sets/stronghold/CrovaxTheCursed.java @@ -113,11 +113,11 @@ class CrovaxTheCursedEffect extends OneShotEffect { if (creatures > 0 && controller.chooseUse(outcome, "Sacrifice a creature?", source, game)) { if (new SacrificeControllerEffect(new FilterCreaturePermanent(), 1, "").apply(game, source)) { if (sourceObject != null) { - sourceObject.getCounters().addCounter(CounterType.P1P1.createInstance()); + sourceObject.getCounters(game).addCounter(CounterType.P1P1.createInstance()); game.informPlayers(controller.getLogName() + " puts a +1/+1 counter on " + sourceObject.getName()); } } - } else if (sourceObject != null && sourceObject.getCounters().containsKey(CounterType.P1P1)) { + } else if (sourceObject != null && sourceObject.getCounters(game).containsKey(CounterType.P1P1)) { sourceObject.removeCounters(CounterType.P1P1.getName(), 1, game); game.informPlayers(controller.getLogName() + " removes a +1/+1 counter from " + sourceObject.getName()); } diff --git a/Mage.Sets/src/mage/sets/stronghold/HermitDruid.java b/Mage.Sets/src/mage/sets/stronghold/HermitDruid.java index 3eeb728570b..263463ad0b2 100644 --- a/Mage.Sets/src/mage/sets/stronghold/HermitDruid.java +++ b/Mage.Sets/src/mage/sets/stronghold/HermitDruid.java @@ -120,7 +120,7 @@ class HermitDruidEffect extends OneShotEffect { } while (library.size() > 0 && card != null && !filter.match(card, game)); if (!cards.isEmpty()) { - player.moveCards(cards, Zone.LIBRARY, Zone.GRAVEYARD, source, game); + player.moveCards(cards, Zone.GRAVEYARD, source, game); if (card != null) { cards.add(card); } diff --git a/Mage.Sets/src/mage/sets/tempest/EssenceBottle.java b/Mage.Sets/src/mage/sets/tempest/EssenceBottle.java index 2bc7202af2f..6ac36a749be 100644 --- a/Mage.Sets/src/mage/sets/tempest/EssenceBottle.java +++ b/Mage.Sets/src/mage/sets/tempest/EssenceBottle.java @@ -101,7 +101,7 @@ class EssenceBottleCost extends CostImpl { public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { Permanent permanent = game.getPermanent(ability.getSourceId()); if (permanent != null) { - this.removedCounters = permanent.getCounters().getCount(CounterType.ELIXIR); + this.removedCounters = permanent.getCounters(game).getCount(CounterType.ELIXIR); if (this.removedCounters > 0) { permanent.removeCounters(CounterType.ELIXIR.createInstance(this.removedCounters), game); } diff --git a/Mage.Sets/src/mage/sets/tempest/Grindstone.java b/Mage.Sets/src/mage/sets/tempest/Grindstone.java index e8332d026cf..dd947828c7d 100644 --- a/Mage.Sets/src/mage/sets/tempest/Grindstone.java +++ b/Mage.Sets/src/mage/sets/tempest/Grindstone.java @@ -115,7 +115,7 @@ class GrindstoneEffect extends OneShotEffect { colorShared = card1.getColor(game).shares(targetPlayer.getLibrary().removeFromTop(game).getColor(game)); } } - targetPlayer.moveCards(cards, Zone.LIBRARY, Zone.GRAVEYARD, source, game); + targetPlayer.moveCards(cards, Zone.GRAVEYARD, source, game); } while (colorShared && targetPlayer.canRespond()); return true; } diff --git a/Mage.Sets/src/mage/sets/tempest/Intuition.java b/Mage.Sets/src/mage/sets/tempest/Intuition.java index 5702eb8381a..46af1495f5e 100644 --- a/Mage.Sets/src/mage/sets/tempest/Intuition.java +++ b/Mage.Sets/src/mage/sets/tempest/Intuition.java @@ -122,7 +122,7 @@ class IntuitionEffect extends SearchEffect { cards.remove(card); controller.moveCards(card, Zone.HAND, source, game); } - controller.moveCards(cards, Zone.LIBRARY, Zone.GRAVEYARD, source, game); + controller.moveCards(cards, Zone.GRAVEYARD, source, game); } controller.shuffleLibrary(source, game); return true; diff --git a/Mage.Sets/src/mage/sets/tempest/LegacysAllure.java b/Mage.Sets/src/mage/sets/tempest/LegacysAllure.java index 0ece69c2ba6..63072ce7777 100644 --- a/Mage.Sets/src/mage/sets/tempest/LegacysAllure.java +++ b/Mage.Sets/src/mage/sets/tempest/LegacysAllure.java @@ -80,7 +80,7 @@ public class LegacysAllure extends CardImpl { if (ability.getOriginalId().equals(originalId)) { Permanent sourcePermanent = game.getPermanent(ability.getSourceId()); if (sourcePermanent != null) { - int numbCounters = sourcePermanent.getCounters().getCount("treasure"); + int numbCounters = sourcePermanent.getCounters(game).getCount("treasure"); FilterCreaturePermanent filter = new FilterCreaturePermanent("creature with power less than or equal to the number of treasure counters on " + getLogName()); filter.add(new PowerPredicate(Filter.ComparisonType.LessThan, numbCounters + 1)); ability.getTargets().clear(); diff --git a/Mage.Sets/src/mage/sets/tempest/Lobotomy.java b/Mage.Sets/src/mage/sets/tempest/Lobotomy.java index ea79144455a..104685c501f 100644 --- a/Mage.Sets/src/mage/sets/tempest/Lobotomy.java +++ b/Mage.Sets/src/mage/sets/tempest/Lobotomy.java @@ -154,7 +154,7 @@ class LobotomyEffect extends OneShotEffect { } if (!cardsToExile.isEmpty()) { - controller.moveCards(cardsToExile, null, Zone.EXILED, source, game); + controller.moveCards(cardsToExile, Zone.EXILED, source, game); } targetPlayer.shuffleLibrary(source, game); return true; diff --git a/Mage.Sets/src/mage/sets/tempest/Magmasaur.java b/Mage.Sets/src/mage/sets/tempest/Magmasaur.java index 2cdccfd05c0..2de4991ac7d 100644 --- a/Mage.Sets/src/mage/sets/tempest/Magmasaur.java +++ b/Mage.Sets/src/mage/sets/tempest/Magmasaur.java @@ -112,7 +112,7 @@ class MagmasaurEffect extends OneShotEffect { if (controller.chooseUse(outcome, "Remove a +1/+1 counter from " + sourceObject.getLogName() + "?", source, game)) { sourceObject.removeCounters(CounterType.P1P1.getName(), 1, game); } else { - int counters = sourceObject.getCounters().getCount(CounterType.P1P1); + int counters = sourceObject.getCounters(game).getCount(CounterType.P1P1); sourceObject.sacrifice(source.getSourceId(), game); new DamageEverythingEffect(counters, filter).apply(game, source); } diff --git a/Mage.Sets/src/mage/sets/tempest/TortureChamber.java b/Mage.Sets/src/mage/sets/tempest/TortureChamber.java index 5a464f1cd12..21965c84e66 100644 --- a/Mage.Sets/src/mage/sets/tempest/TortureChamber.java +++ b/Mage.Sets/src/mage/sets/tempest/TortureChamber.java @@ -106,7 +106,7 @@ class TortureChamberCost extends CostImpl { public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { Permanent permanent = game.getPermanent(ability.getSourceId()); if (permanent != null) { - this.removedCounters = permanent.getCounters().getCount(CounterType.PAIN); + this.removedCounters = permanent.getCounters(game).getCount(CounterType.PAIN); if (this.removedCounters > 0) { permanent.removeCounters(CounterType.PAIN.createInstance(this.removedCounters), game); } @@ -146,7 +146,7 @@ class TortureChamberEffect1 extends OneShotEffect { Player player = game.getPlayer(source.getControllerId()); Permanent permanent = game.getPermanent(source.getSourceId()); if (player != null && permanent != null) { - int painCounters = permanent.getCounters().getCount(CounterType.PAIN); + int painCounters = permanent.getCounters(game).getCount(CounterType.PAIN); player.damage(painCounters, source.getSourceId(), game, false, true); return true; } diff --git a/Mage.Sets/src/mage/sets/tempest/WoodSage.java b/Mage.Sets/src/mage/sets/tempest/WoodSage.java index e820268608a..9cc189ca734 100644 --- a/Mage.Sets/src/mage/sets/tempest/WoodSage.java +++ b/Mage.Sets/src/mage/sets/tempest/WoodSage.java @@ -123,8 +123,8 @@ class WoodSageEffect extends OneShotEffect { cards.remove(card); } } - controller.moveCards(cardsToHand, Zone.LIBRARY, Zone.HAND, source, game); - controller.moveCards(cards, Zone.LIBRARY, Zone.GRAVEYARD, source, game); + controller.moveCards(cardsToHand, Zone.HAND, source, game); + controller.moveCards(cards, Zone.GRAVEYARD, source, game); } return true; } diff --git a/Mage.Sets/src/mage/sets/thedark/DanceOfMany.java b/Mage.Sets/src/mage/sets/thedark/DanceOfMany.java index 147f295d9cc..406ad925989 100644 --- a/Mage.Sets/src/mage/sets/thedark/DanceOfMany.java +++ b/Mage.Sets/src/mage/sets/thedark/DanceOfMany.java @@ -163,7 +163,7 @@ class DanceOfManyExileTokenEffect extends OneShotEffect { for (Permanent permanent : tokenPermanents) { cards.add(permanent); } - controller.moveCards(cards, null, Zone.EXILED, source, game); + controller.moveCards(cards, Zone.EXILED, source, game); return true; } } diff --git a/Mage.Sets/src/mage/sets/thedark/LivingArmor.java b/Mage.Sets/src/mage/sets/thedark/LivingArmor.java new file mode 100644 index 00000000000..5a17b0441ea --- /dev/null +++ b/Mage.Sets/src/mage/sets/thedark/LivingArmor.java @@ -0,0 +1,54 @@ +/* + * 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.sets.thedark; + +import java.util.UUID; +import mage.constants.Rarity; + +/** + * + * @author Derpthemeus + */ +public class LivingArmor extends mage.sets.chronicles.LivingArmor { + + public LivingArmor(UUID ownerId) { + super(ownerId); + this.cardNumber = "101"; + this.expansionSetCode = "DRK"; + this.rarity = Rarity.UNCOMMON; + } + + public LivingArmor(final LivingArmor card) { + super(card); + } + + @Override + public LivingArmor copy() { + return new LivingArmor(this); + } +} diff --git a/Mage.Sets/src/mage/sets/theros/CommuneWithTheGods.java b/Mage.Sets/src/mage/sets/theros/CommuneWithTheGods.java index bd2e5256b6f..f69bde8dc03 100644 --- a/Mage.Sets/src/mage/sets/theros/CommuneWithTheGods.java +++ b/Mage.Sets/src/mage/sets/theros/CommuneWithTheGods.java @@ -122,7 +122,7 @@ class CommuneWithTheGodsEffect extends OneShotEffect { } } - controller.moveCards(cards, Zone.LIBRARY, Zone.GRAVEYARD, source, game); + controller.moveCards(cards, Zone.GRAVEYARD, source, game); } return true; } diff --git a/Mage.Sets/src/mage/sets/timeshifted/GrinningTotem.java b/Mage.Sets/src/mage/sets/timeshifted/GrinningTotem.java index 9f02ecd2f03..db36f22d58a 100644 --- a/Mage.Sets/src/mage/sets/timeshifted/GrinningTotem.java +++ b/Mage.Sets/src/mage/sets/timeshifted/GrinningTotem.java @@ -239,7 +239,7 @@ class GrinningTotemPutIntoGraveyardEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); ExileZone zone = game.getExile().getExileZone(exileZoneId); if (controller != null && zone != null) { - return controller.moveCards(zone, Zone.EXILED, Zone.GRAVEYARD, source, game); + return controller.moveCards(zone, Zone.GRAVEYARD, source, game); } return false; } diff --git a/Mage.Sets/src/mage/sets/timespiral/Clockspinning.java b/Mage.Sets/src/mage/sets/timespiral/Clockspinning.java index 293ffeb4c90..df4fbf408b6 100644 --- a/Mage.Sets/src/mage/sets/timespiral/Clockspinning.java +++ b/Mage.Sets/src/mage/sets/timespiral/Clockspinning.java @@ -95,13 +95,13 @@ class ClockspinningAddOrRemoveCounterEffect extends OneShotEffect { private Counter selectCounterType(Game game, Ability source, Permanent permanent) { Player controller = game.getPlayer(source.getControllerId()); - if (controller != null && permanent.getCounters().size() > 0) { + if (controller != null && permanent.getCounters(game).size() > 0) { String counterName = null; - if (permanent.getCounters().size() > 1) { + if (permanent.getCounters(game).size() > 1) { Choice choice = new ChoiceImpl(true); Set choices = new HashSet<>(2); - for (Counter counter : permanent.getCounters().values()) { - if (permanent.getCounters().getCount(counter.getName()) > 0) { + for (Counter counter : permanent.getCounters(game).values()) { + if (permanent.getCounters(game).getCount(counter.getName()) > 0) { choices.add(counter.getName()); } } @@ -110,7 +110,7 @@ class ClockspinningAddOrRemoveCounterEffect extends OneShotEffect { controller.choose(Outcome.Neutral, choice, game); counterName = choice.getChoice(); } else { - for (Counter counter : permanent.getCounters().values()) { + for (Counter counter : permanent.getCounters(game).values()) { if (counter.getCount() > 0) { counterName = counter.getName(); } diff --git a/Mage.Sets/src/mage/sets/timespiral/ClockworkHydra.java b/Mage.Sets/src/mage/sets/timespiral/ClockworkHydra.java index d66edb5b41c..6477000c753 100644 --- a/Mage.Sets/src/mage/sets/timespiral/ClockworkHydra.java +++ b/Mage.Sets/src/mage/sets/timespiral/ClockworkHydra.java @@ -106,7 +106,7 @@ class ClockworkHydraEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Permanent permanent = game.getPermanent(source.getSourceId()); Player controller = game.getPlayer(source.getControllerId()); - if (controller != null && permanent != null && permanent.getCounters().getCount(CounterType.P1P1) > 0) { + if (controller != null && permanent != null && permanent.getCounters(game).getCount(CounterType.P1P1) > 0) { permanent.removeCounters(CounterType.P1P1.createInstance(), game); Target target = new TargetCreatureOrPlayer(); if (controller.chooseTarget(outcome, target, source, game)) { diff --git a/Mage.Sets/src/mage/sets/timespiral/JhoirasTimebug.java b/Mage.Sets/src/mage/sets/timespiral/JhoirasTimebug.java index a6775e6a347..8eb3ea44e26 100644 --- a/Mage.Sets/src/mage/sets/timespiral/JhoirasTimebug.java +++ b/Mage.Sets/src/mage/sets/timespiral/JhoirasTimebug.java @@ -105,7 +105,7 @@ class JhoirasTimebugEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { Permanent permanent = game.getPermanent(this.getTargetPointer().getFirst(game, source)); - if (permanent != null && permanent.getCounters().containsKey(CounterType.TIME)) { + if (permanent != null && permanent.getCounters(game).containsKey(CounterType.TIME)) { if (controller.chooseUse(Outcome.Benefit, "Add a time counter? (Otherwise remove one)", source, game)) { permanent.addCounters(CounterType.TIME.createInstance(), game); } diff --git a/Mage.Sets/src/mage/sets/timespiral/PhantomWurm.java b/Mage.Sets/src/mage/sets/timespiral/PhantomWurm.java index 316f935abaa..49597fd9f37 100644 --- a/Mage.Sets/src/mage/sets/timespiral/PhantomWurm.java +++ b/Mage.Sets/src/mage/sets/timespiral/PhantomWurm.java @@ -124,7 +124,7 @@ class PhantomWurmPreventionEffect extends PreventionEffectImpl { } } - if(removeCounter && permanent.getCounters().containsKey(CounterType.P1P1)) { + if(removeCounter && permanent.getCounters(game).containsKey(CounterType.P1P1)) { StringBuilder sb = new StringBuilder(permanent.getName()).append(": "); permanent.removeCounters(CounterType.P1P1.createInstance(), game); sb.append("Removed a +1/+1 counter "); diff --git a/Mage.Sets/src/mage/sets/timespiral/ThelonOfHavenwood.java b/Mage.Sets/src/mage/sets/timespiral/ThelonOfHavenwood.java index fd063d51434..0211746a0c1 100644 --- a/Mage.Sets/src/mage/sets/timespiral/ThelonOfHavenwood.java +++ b/Mage.Sets/src/mage/sets/timespiral/ThelonOfHavenwood.java @@ -118,7 +118,7 @@ class ThelonOfHavenwoodBoostEffect extends ContinuousEffectImpl { @Override public boolean apply(Game game, Ability source) { for (Permanent creature : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) { - int numCounters = creature.getCounters().getCount(CounterType.SPORE); + int numCounters = creature.getCounters(game).getCount(CounterType.SPORE); if (numCounters > 0) { creature.addPower(numCounters); creature.addToughness(numCounters); diff --git a/Mage.Sets/src/mage/sets/torment/CephalidVandal.java b/Mage.Sets/src/mage/sets/torment/CephalidVandal.java index 58ead923f01..e7a0fffd5ee 100644 --- a/Mage.Sets/src/mage/sets/torment/CephalidVandal.java +++ b/Mage.Sets/src/mage/sets/torment/CephalidVandal.java @@ -97,7 +97,7 @@ class CephalidVandalEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null && controller != null) { - int amount = permanent.getCounters().getCount(CounterType.SHRED); + int amount = permanent.getCounters(game).getCount(CounterType.SHRED); controller.moveCards(controller.getLibrary().getTopCards(game, amount), Zone.GRAVEYARD, source, game); } return true; diff --git a/Mage.Sets/src/mage/sets/torment/MesmericFiend.java b/Mage.Sets/src/mage/sets/torment/MesmericFiend.java index 9654d92bff6..0fc01307b6c 100644 --- a/Mage.Sets/src/mage/sets/torment/MesmericFiend.java +++ b/Mage.Sets/src/mage/sets/torment/MesmericFiend.java @@ -147,7 +147,7 @@ class MesmericFiendLeaveEffect extends OneShotEffect { int zoneChangeCounter = (sourceObject instanceof PermanentToken) ? source.getSourceObjectZoneChangeCounter() : source.getSourceObjectZoneChangeCounter() - 1; ExileZone exZone = game.getExile().getExileZone(CardUtil.getExileZoneId(game, source.getSourceId(), zoneChangeCounter)); if (exZone != null) { - return controller.moveCards(exZone, null, Zone.HAND, source, game); + return controller.moveCards(exZone, Zone.HAND, source, game); } } return false; diff --git a/Mage.Sets/src/mage/sets/urzaslegacy/Anthroplasm.java b/Mage.Sets/src/mage/sets/urzaslegacy/Anthroplasm.java index 09abe519993..5a941a92057 100644 --- a/Mage.Sets/src/mage/sets/urzaslegacy/Anthroplasm.java +++ b/Mage.Sets/src/mage/sets/urzaslegacy/Anthroplasm.java @@ -100,7 +100,7 @@ class AnthroplasmEffect extends OneShotEffect { Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null) { //Remove all +1/+1 counters - permanent.removeCounters(permanent.getCounters().get(CounterType.P1P1.getName()), game); + permanent.removeCounters(permanent.getCounters(game).get(CounterType.P1P1.getName()), game); //put X +1/+1 counters permanent.addCounters(CounterType.P1P1.createInstance(source.getManaCostsToPay().getX()), game); return true; diff --git a/Mage.Sets/src/mage/sets/urzaslegacy/MoltenHydra.java b/Mage.Sets/src/mage/sets/urzaslegacy/MoltenHydra.java index 3e0f9f8cc73..48f3cbdb9c4 100644 --- a/Mage.Sets/src/mage/sets/urzaslegacy/MoltenHydra.java +++ b/Mage.Sets/src/mage/sets/urzaslegacy/MoltenHydra.java @@ -114,7 +114,7 @@ class RemoveAllCountersSourceCost extends CostImpl { public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { Permanent permanent = game.getPermanent(sourceId); if (permanent != null) { - this.amount = permanent.getCounters().getCount(name); + this.amount = permanent.getCounters(game).getCount(name); permanent.removeCounters(name, amount, game); this.paid = true; } diff --git a/Mage.Sets/src/mage/sets/urzassaga/NoRestForTheWicked.java b/Mage.Sets/src/mage/sets/urzassaga/NoRestForTheWicked.java index 8d3b3c4a02d..b05c92e0a00 100644 --- a/Mage.Sets/src/mage/sets/urzassaga/NoRestForTheWicked.java +++ b/Mage.Sets/src/mage/sets/urzassaga/NoRestForTheWicked.java @@ -101,7 +101,7 @@ class NoRestForTheWickedEffect extends OneShotEffect { } } } - controller.moveCards(cardsToHand, null, Zone.HAND, source, game); + controller.moveCards(cardsToHand, Zone.HAND, source, game); return true; } return false; diff --git a/Mage.Sets/src/mage/sets/urzassaga/Smokestack.java b/Mage.Sets/src/mage/sets/urzassaga/Smokestack.java index 4622fa38b22..42d7bcbbdb3 100644 --- a/Mage.Sets/src/mage/sets/urzassaga/Smokestack.java +++ b/Mage.Sets/src/mage/sets/urzassaga/Smokestack.java @@ -93,7 +93,7 @@ class SmokestackEffect extends OneShotEffect { Player activePlayer = game.getPlayer(getTargetPointer().getFirst(game, source)); Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId()); if (activePlayer != null && sourcePermanent != null) { - int count = sourcePermanent.getCounters().getCount("Soot"); + int count = sourcePermanent.getCounters(game).getCount("Soot"); if (count > 0) { int amount = Math.min(count, game.getBattlefield().countAll(new FilterControlledPermanent(), activePlayer.getId(), game)); Target target = new TargetControlledPermanent(amount, amount, new FilterControlledPermanent(), false); diff --git a/Mage.Sets/src/mage/sets/urzassaga/VileRequiem.java b/Mage.Sets/src/mage/sets/urzassaga/VileRequiem.java index e5d630bcae6..eb05d84c599 100644 --- a/Mage.Sets/src/mage/sets/urzassaga/VileRequiem.java +++ b/Mage.Sets/src/mage/sets/urzassaga/VileRequiem.java @@ -88,7 +88,7 @@ public class VileRequiem extends CardImpl { if (ability.getOriginalId().equals(originalId)) { Permanent sourcePermanent = game.getPermanent(ability.getSourceId()); if (sourcePermanent != null) { - int numberCounters = sourcePermanent.getCounters().getCount(CounterType.VERSE); + int numberCounters = sourcePermanent.getCounters(game).getCount(CounterType.VERSE); ability.getTargets().clear(); FilterCreaturePermanent newFilter = filter.copy(); newFilter.setMessage(new StringBuilder("up to ").append(CardUtil.numberToText(numberCounters)).append(" target nonblack creatures").toString()); diff --git a/Mage.Sets/src/mage/sets/urzassaga/Wirecat.java b/Mage.Sets/src/mage/sets/urzassaga/Wirecat.java new file mode 100644 index 00000000000..d69736110f0 --- /dev/null +++ b/Mage.Sets/src/mage/sets/urzassaga/Wirecat.java @@ -0,0 +1,105 @@ +/* + * 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.sets.urzassaga; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.RestrictionEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.filter.common.FilterEnchantmentPermanent; +import mage.game.Game; +import mage.game.permanent.Permanent; + +/** + * + * @author Derpthemeus + */ +public class Wirecat extends CardImpl { + + public Wirecat(UUID ownerId) { + super(ownerId, 317, "Wirecat", Rarity.UNCOMMON, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{4}"); + this.expansionSetCode = "USG"; + this.subtype.add("Cat"); + this.power = new MageInt(4); + this.toughness = new MageInt(3); + + // Wirecat can't attack or block if an enchantment is on the battlefield. + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new WirecatEffect())); + } + + public Wirecat(final Wirecat card) { + super(card); + } + + @Override + public Wirecat copy() { + return new Wirecat(this); + } + + class WirecatEffect extends RestrictionEffect { + + public WirecatEffect() { + super(Duration.WhileOnBattlefield); + staticText = "{this} can't attack or block if an enchantment is on the battlefield"; + } + + public WirecatEffect(final WirecatEffect effect) { + super(effect); + } + + @Override + public WirecatEffect copy() { + return new WirecatEffect(this); + } + + @Override + public boolean canAttackCheckAfter(int numberOfAttackers, Ability source, Game game) { + return false; + } + + @Override + public boolean canBlockCheckAfter(Ability source, Game game) { + return false; + } + + @Override + public boolean applies(Permanent permanent, Ability source, Game game) { + if (permanent.getId().equals(source.getSourceId())) { + FilterEnchantmentPermanent filter = new FilterEnchantmentPermanent(); + return game.getBattlefield().contains(filter, 1, game); + } + return false; + } + } +} diff --git a/Mage.Sets/src/mage/sets/vintagemasters/MarchesaTheBlackRose.java b/Mage.Sets/src/mage/sets/vintagemasters/MarchesaTheBlackRose.java index f59007cb13f..50f525e503f 100644 --- a/Mage.Sets/src/mage/sets/vintagemasters/MarchesaTheBlackRose.java +++ b/Mage.Sets/src/mage/sets/vintagemasters/MarchesaTheBlackRose.java @@ -121,7 +121,7 @@ class MarchesaTheBlackRoseTriggeredAbility extends TriggeredAbilityImpl { if (permanent != null && permanent.getControllerId().equals(this.getControllerId()) && permanent.getCardType().contains(CardType.CREATURE) - && permanent.getCounters().getCount(CounterType.P1P1) > 0) { + && permanent.getCounters(game).getCount(CounterType.P1P1) > 0) { for (Effect effect : this.getEffects()) { effect.setTargetPointer(new FixedTarget(permanent.getId(), permanent.getZoneChangeCounter(game) + 1)); } diff --git a/Mage.Sets/src/mage/sets/vintagemasters/SaprolingBurst.java b/Mage.Sets/src/mage/sets/vintagemasters/SaprolingBurst.java index aa82cc0b0c5..97f10ddd56b 100644 --- a/Mage.Sets/src/mage/sets/vintagemasters/SaprolingBurst.java +++ b/Mage.Sets/src/mage/sets/vintagemasters/SaprolingBurst.java @@ -151,7 +151,7 @@ class SaprolingBurstTokenDynamicValue implements DynamicValue { public int calculate(Game game, Ability sourceAbility, Effect effect) { Permanent permanent = this.saprolingBurstMOR.getPermanent(game); if (permanent != null) { - return permanent.getCounters().getCount(CounterType.FADE); + return permanent.getCounters(game).getCount(CounterType.FADE); } return 0; } diff --git a/Mage.Sets/src/mage/sets/visions/PhyrexianMarauder.java b/Mage.Sets/src/mage/sets/visions/PhyrexianMarauder.java index b28df13771b..f52a2517472 100644 --- a/Mage.Sets/src/mage/sets/visions/PhyrexianMarauder.java +++ b/Mage.Sets/src/mage/sets/visions/PhyrexianMarauder.java @@ -99,7 +99,7 @@ class PhyrexianMarauderCantAttackUnlessYouPayEffect extends CantAttackBlockUnles public ManaCosts getManaCostToPay(GameEvent event, Ability source, Game game) { Permanent sourceObject = game.getPermanent(source.getSourceId()); if (sourceObject != null) { - int counter = sourceObject.getCounters().getCount(CounterType.P1P1); + int counter = sourceObject.getCounters(game).getCount(CounterType.P1P1); if (counter > 0) { return new ManaCostsImpl<>("{" + counter + "}"); } diff --git a/Mage.Sets/src/mage/sets/weatherlight/SpinningDarkness.java b/Mage.Sets/src/mage/sets/weatherlight/SpinningDarkness.java index 3adbb45eb8b..94ca45fde91 100644 --- a/Mage.Sets/src/mage/sets/weatherlight/SpinningDarkness.java +++ b/Mage.Sets/src/mage/sets/weatherlight/SpinningDarkness.java @@ -118,7 +118,7 @@ class SpinningDarknessCost extends CostImpl { } i++; } - paid = controller.moveCards(cardsToExile, Zone.GRAVEYARD, Zone.EXILED, ability, game); + paid = controller.moveCards(cardsToExile, Zone.EXILED, ability, game); } } return paid; diff --git a/Mage.Sets/src/mage/sets/worldwake/QuestForTheNihilStone.java b/Mage.Sets/src/mage/sets/worldwake/QuestForTheNihilStone.java index 86429ffe035..65f6c15be99 100644 --- a/Mage.Sets/src/mage/sets/worldwake/QuestForTheNihilStone.java +++ b/Mage.Sets/src/mage/sets/worldwake/QuestForTheNihilStone.java @@ -134,7 +134,7 @@ class QuestForTheNihilStoneTriggeredAbility2 extends TriggeredAbilityImpl { Player opponent = game.getPlayer(event.getPlayerId()); if (opponent != null && opponent.getHand().size() == 0 - && quest.getCounters().getCount(CounterType.QUEST) >= 2) { + && quest.getCounters(game).getCount(CounterType.QUEST) >= 2) { for (Effect effect : this.getEffects()) { effect.setTargetPointer(new FixedTarget(opponent.getId())); return true; diff --git a/Mage.Sets/src/mage/sets/worldwake/QuestForUlasTemple.java b/Mage.Sets/src/mage/sets/worldwake/QuestForUlasTemple.java index 62939a97ce6..511505a4452 100644 --- a/Mage.Sets/src/mage/sets/worldwake/QuestForUlasTemple.java +++ b/Mage.Sets/src/mage/sets/worldwake/QuestForUlasTemple.java @@ -141,7 +141,7 @@ class QuestForUlasTempleTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkTrigger(GameEvent event, Game game) { Permanent quest = game.getPermanent(super.getSourceId()); - return quest != null && quest.getCounters().getCount(CounterType.QUEST) >= 3; + return quest != null && quest.getCounters(game).getCount(CounterType.QUEST) >= 3; } @Override diff --git a/Mage.Sets/src/mage/sets/zendikar/ArchmageAscension.java b/Mage.Sets/src/mage/sets/zendikar/ArchmageAscension.java index bf5da3cf616..98323b03867 100644 --- a/Mage.Sets/src/mage/sets/zendikar/ArchmageAscension.java +++ b/Mage.Sets/src/mage/sets/zendikar/ArchmageAscension.java @@ -158,7 +158,7 @@ class ArchmageAscensionReplacementEffect extends ReplacementEffectImpl { Player you = game.getPlayer(source.getControllerId()); return event.getPlayerId().equals(source.getControllerId()) && archmage != null - && archmage.getCounters().getCount(CounterType.QUEST) >= 6 + && archmage.getCounters(game).getCount(CounterType.QUEST) >= 6 && you != null && you.chooseUse(Outcome.Benefit, "Would you like to search your library instead of drawing a card?", source, game); } diff --git a/Mage.Sets/src/mage/sets/zendikar/BeastHunt.java b/Mage.Sets/src/mage/sets/zendikar/BeastHunt.java index 9c0ccd380df..d663b1876cf 100644 --- a/Mage.Sets/src/mage/sets/zendikar/BeastHunt.java +++ b/Mage.Sets/src/mage/sets/zendikar/BeastHunt.java @@ -96,8 +96,8 @@ class BeastHuntEffect extends OneShotEffect { cards.remove(card); } } - controller.moveCards(cardsToHand, Zone.LIBRARY, Zone.HAND, source, game); - controller.moveCards(cards, Zone.LIBRARY, Zone.GRAVEYARD, source, game); + controller.moveCards(cardsToHand, Zone.HAND, source, game); + controller.moveCards(cards, Zone.GRAVEYARD, source, game); } return true; } diff --git a/Mage.Sets/src/mage/sets/zendikar/BeastmasterAscension.java b/Mage.Sets/src/mage/sets/zendikar/BeastmasterAscension.java index c396f64f6db..718265ee1e5 100644 --- a/Mage.Sets/src/mage/sets/zendikar/BeastmasterAscension.java +++ b/Mage.Sets/src/mage/sets/zendikar/BeastmasterAscension.java @@ -84,7 +84,7 @@ class BeastmasterAscensionEffect extends BoostControlledEffect { @Override public boolean apply(Game game, Ability source) { Permanent permanent = game.getPermanent(source.getSourceId()); - if (permanent != null && permanent.getCounters().getCount(CounterType.QUEST) > 6) { + if (permanent != null && permanent.getCounters(game).getCount(CounterType.QUEST) > 6) { super.apply(game, source); } return false; diff --git a/Mage.Sets/src/mage/sets/zendikar/EternityVessel.java b/Mage.Sets/src/mage/sets/zendikar/EternityVessel.java index e98268f67c0..2717b1f5a9d 100644 --- a/Mage.Sets/src/mage/sets/zendikar/EternityVessel.java +++ b/Mage.Sets/src/mage/sets/zendikar/EternityVessel.java @@ -117,7 +117,7 @@ class EternityVesselEffect2 extends OneShotEffect { Permanent vessel = game.getPermanent(source.getSourceId()); Player controller = game.getPlayer(source.getControllerId()); if (vessel != null && controller != null) { - controller.setLife(vessel.getCounters().getCount(CounterType.CHARGE), game); + controller.setLife(vessel.getCounters(game).getCount(CounterType.CHARGE), game); return true; } return false; diff --git a/Mage.Sets/src/mage/sets/zendikar/LuminarchAscension.java b/Mage.Sets/src/mage/sets/zendikar/LuminarchAscension.java index 2a679d24b86..1fa4e3c90c4 100644 --- a/Mage.Sets/src/mage/sets/zendikar/LuminarchAscension.java +++ b/Mage.Sets/src/mage/sets/zendikar/LuminarchAscension.java @@ -125,7 +125,7 @@ class SourceHasCountersCost extends CostImpl { @Override public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { - return (game.getPermanent(sourceId).getCounters().getCount(counterType) >= counters); + return (game.getPermanent(sourceId).getCounters(game).getCount(counterType) >= counters); } @Override diff --git a/Mage.Sets/src/mage/sets/zendikar/ObsidianFireheart.java b/Mage.Sets/src/mage/sets/zendikar/ObsidianFireheart.java index 20326b53f7c..5347f1fa919 100644 --- a/Mage.Sets/src/mage/sets/zendikar/ObsidianFireheart.java +++ b/Mage.Sets/src/mage/sets/zendikar/ObsidianFireheart.java @@ -115,7 +115,7 @@ class ObsidianFireheartGainAbilityEffect extends GainAbilityTargetEffect { @Override public boolean isInactive(Ability source, Game game) { Permanent land = game.getPermanent(this.targetPointer.getFirst(game, source)); - if (land != null && land.getCounters().getCount(CounterType.BLAZE) < 1) { + if (land != null && land.getCounters(game).getCount(CounterType.BLAZE) < 1) { return true; } return false; diff --git a/Mage.Sets/src/mage/sets/zendikar/PyromancerAscension.java b/Mage.Sets/src/mage/sets/zendikar/PyromancerAscension.java index e45e614d651..95793a88a77 100644 --- a/Mage.Sets/src/mage/sets/zendikar/PyromancerAscension.java +++ b/Mage.Sets/src/mage/sets/zendikar/PyromancerAscension.java @@ -151,7 +151,7 @@ class PyromancerAscensionCopyTriggeredAbility extends TriggeredAbilityImpl { Spell spell = game.getStack().getSpell(event.getTargetId()); if (isControlledInstantOrSorcery(spell)) { Permanent permanent = game.getBattlefield().getPermanent(this.getSourceId()); - if (permanent != null && permanent.getCounters().getCount(CounterType.QUEST) >= 2) { + if (permanent != null && permanent.getCounters(game).getCount(CounterType.QUEST) >= 2) { this.getEffects().get(0).setTargetPointer(new FixedTarget(spell.getId())); return true; } diff --git a/Mage.Sets/src/mage/sets/zendikar/VampireHexmage.java b/Mage.Sets/src/mage/sets/zendikar/VampireHexmage.java index b51edc62b2c..819b24d691a 100644 --- a/Mage.Sets/src/mage/sets/zendikar/VampireHexmage.java +++ b/Mage.Sets/src/mage/sets/zendikar/VampireHexmage.java @@ -100,7 +100,7 @@ class VampireHexmageEffect extends OneShotEffect { Permanent permanent = game.getPermanent(target.getFirstTarget()); if (permanent != null) { - for(Counter counter : permanent.getCounters().values()){ + for(Counter counter : permanent.getCounters(game).values()){ permanent.removeCounters(counter, game); } diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/activated/LevelUpAbilityTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/activated/LevelUpAbilityTest.java index 8eda402cc24..dfc038e1a60 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/activated/LevelUpAbilityTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/activated/LevelUpAbilityTest.java @@ -27,7 +27,7 @@ public class LevelUpAbilityTest extends CardTestPlayerBase { execute(); Permanent master = getPermanent("Transcendent Master", playerA.getId()); - Assert.assertTrue(master.getCounters().isEmpty()); + Assert.assertTrue(master.getCounters(currentGame).isEmpty()); Assert.assertEquals(3, master.getPower().getValue()); Assert.assertEquals(3, master.getToughness().getValue()); @@ -49,7 +49,7 @@ public class LevelUpAbilityTest extends CardTestPlayerBase { execute(); Permanent master = getPermanent("Transcendent Master", playerA.getId()); - Assert.assertEquals(1, master.getCounters().getCount(CounterType.LEVEL)); + Assert.assertEquals(1, master.getCounters(currentGame).getCount(CounterType.LEVEL)); Assert.assertEquals(3, master.getPower().getValue()); Assert.assertEquals(3, master.getToughness().getValue()); @@ -73,7 +73,7 @@ public class LevelUpAbilityTest extends CardTestPlayerBase { execute(); Permanent master = getPermanent("Transcendent Master", playerA.getId()); - Assert.assertEquals(6, master.getCounters().getCount(CounterType.LEVEL)); + Assert.assertEquals(6, master.getCounters(currentGame).getCount(CounterType.LEVEL)); Assert.assertEquals(6, master.getPower().getValue()); Assert.assertEquals(6, master.getToughness().getValue()); @@ -99,7 +99,7 @@ public class LevelUpAbilityTest extends CardTestPlayerBase { execute(); Permanent master = getPermanent("Transcendent Master", playerA.getId()); - Assert.assertEquals(12, master.getCounters().getCount(CounterType.LEVEL)); + Assert.assertEquals(12, master.getCounters(currentGame).getCount(CounterType.LEVEL)); Assert.assertEquals("Power different", 9, master.getPower().getValue()); Assert.assertEquals("Toughness different", 9, master.getToughness().getValue()); @@ -123,7 +123,7 @@ public class LevelUpAbilityTest extends CardTestPlayerBase { execute(); Permanent master = getPermanent("Transcendent Master", playerA.getId()); - Assert.assertEquals(15, master.getCounters().getCount(CounterType.LEVEL)); + Assert.assertEquals(15, master.getCounters(currentGame).getCount(CounterType.LEVEL)); Assert.assertEquals("Power different", 9, master.getPower().getValue()); Assert.assertEquals("Toughness different", 9, master.getToughness().getValue()); diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/copy/VesuvaTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/copy/VesuvaTest.java index 5115f62996b..7ac84a509ab 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/copy/VesuvaTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/copy/VesuvaTest.java @@ -96,7 +96,7 @@ public class VesuvaTest extends CardTestPlayerBase { Permanent darkDepth = getPermanent("Dark Depths", playerA); if (darkDepth != null) { - Assert.assertEquals(10, darkDepth.getCounters().getCount("ice")); + Assert.assertEquals(10, darkDepth.getCounters(currentGame).getCount("ice")); } assertTappedCount("Dark Depths", true, 1); } diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/single/ChronozoaTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/single/ChronozoaTest.java index 7125bdce733..0112beef2c9 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/single/ChronozoaTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/single/ChronozoaTest.java @@ -65,7 +65,7 @@ public class ChronozoaTest extends CardTestPlayerBase { Assert.assertEquals("Chronozoa has to be a token", true, creature instanceof PermanentToken); // Make sure each token has 2 time counters - final Counters counters = creature.getCounters(); + final Counters counters = creature.getCounters(currentGame); Assert.assertEquals(1, counters.size()); for(final Counter counter : counters.values()) { Assert.assertEquals(CounterType.TIME.getName(), counter.getName()); diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/single/DustOfMomentsTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/single/DustOfMomentsTest.java index bd0af195e47..0368051b658 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/single/DustOfMomentsTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/single/DustOfMomentsTest.java @@ -30,7 +30,7 @@ public class DustOfMomentsTest extends CardTestPlayerBase { for (final Permanent creature : activeCreatures) { Assert.assertEquals("Chronozoa", creature.getName()); - Assert.assertEquals(3, creature.getCounters().getCount(CounterType.TIME)); + Assert.assertEquals(3, creature.getCounters(currentGame).getCount(CounterType.TIME)); } // Check time counters on kraken assertCounterOnExiledCardCount("Deep-Sea Kraken", CounterType.TIME, 6); diff --git a/Mage.Tests/src/test/java/org/mage/test/player/TestPlayer.java b/Mage.Tests/src/test/java/org/mage/test/player/TestPlayer.java index 68f3b51f58a..62e89e3e74f 100644 --- a/Mage.Tests/src/test/java/org/mage/test/player/TestPlayer.java +++ b/Mage.Tests/src/test/java/org/mage/test/player/TestPlayer.java @@ -1882,24 +1882,6 @@ public class TestPlayer implements Player { return computerPlayer.getCommanderId(); } - @Override - @Deprecated - public boolean moveCards(Cards cards, Zone fromZone, Zone toZone, Ability source, Game game) { - return computerPlayer.moveCards(cards, fromZone, toZone, source, game); - } - - @Override - @Deprecated - public boolean moveCards(Card card, Zone fromZone, Zone toZone, Ability source, Game game) { - return computerPlayer.moveCards(card, toZone, source, game); - } - - @Override - @Deprecated - public boolean moveCards(Set cards, Zone toZone, Ability source, Game game) { - return computerPlayer.moveCards(cards, toZone, source, game); - } - @Override public boolean moveCardToHandWithInfo(Card card, UUID sourceId, Game game) { return computerPlayer.moveCardToHandWithInfo(card, sourceId, game); @@ -2156,7 +2138,7 @@ public class TestPlayer implements Player { } @Override - public boolean moveCards(Set cards, Zone fromZone, Zone toZone, Ability source, Game game) { + public boolean moveCards(Set cards, Zone toZone, Ability source, Game game) { return computerPlayer.moveCards(cards, toZone, source, game); } diff --git a/Mage.Tests/src/test/java/org/mage/test/serverside/base/impl/CardTestPlayerAPIImpl.java b/Mage.Tests/src/test/java/org/mage/test/serverside/base/impl/CardTestPlayerAPIImpl.java index e4177371fc9..fc92814a8b6 100644 --- a/Mage.Tests/src/test/java/org/mage/test/serverside/base/impl/CardTestPlayerAPIImpl.java +++ b/Mage.Tests/src/test/java/org/mage/test/serverside/base/impl/CardTestPlayerAPIImpl.java @@ -30,7 +30,6 @@ import org.junit.Assert; import org.junit.Before; import org.mage.test.player.TestPlayer; import org.mage.test.serverside.base.CardTestAPI; -import org.mage.test.serverside.base.CardTestAPI.GameResult; import org.mage.test.serverside.base.MageTestPlayerBase; /** @@ -637,7 +636,7 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement } } Assert.assertNotNull("There is no such permanent " + (player == null ? "" : "for player " + player.getName()) + " on the battlefield, cardName=" + cardName, found); - Assert.assertEquals("(Battlefield) Counter counts are not equal (" + cardName + ":" + type + ")", count, found.getCounters().getCount(type)); + Assert.assertEquals("(Battlefield) Counter counts are not equal (" + cardName + ":" + type + ")", count, found.getCounters(currentGame).getCount(type)); } /** diff --git a/Mage.Tests/src/test/java/org/mage/test/stub/PlayerStub.java b/Mage.Tests/src/test/java/org/mage/test/stub/PlayerStub.java index 9a601cb185c..dbc17018ca1 100644 --- a/Mage.Tests/src/test/java/org/mage/test/stub/PlayerStub.java +++ b/Mage.Tests/src/test/java/org/mage/test/stub/PlayerStub.java @@ -1093,21 +1093,6 @@ public class PlayerStub implements Player { return null; } - @Override - public boolean moveCards(Cards cards, Zone fromZone, Zone toZone, Ability source, Game game) { - return false; - } - - @Override - public boolean moveCards(Card card, Zone fromZone, Zone toZone, Ability source, Game game) { - return false; - } - - @Override - public boolean moveCards(Set cards, Zone fromZone, Zone toZone, Ability source, Game game) { - return false; - } - @Override public boolean moveCards(Card card, Zone toZone, Ability source, Game game) { return false; diff --git a/Mage/src/main/java/mage/abilities/condition/common/AttachedToCounterCondition.java b/Mage/src/main/java/mage/abilities/condition/common/AttachedToCounterCondition.java index f23dfc3505a..644d753a09a 100644 --- a/Mage/src/main/java/mage/abilities/condition/common/AttachedToCounterCondition.java +++ b/Mage/src/main/java/mage/abilities/condition/common/AttachedToCounterCondition.java @@ -70,13 +70,13 @@ public class AttachedToCounterCondition implements Condition { return false; } if (from != -1) { //range compare - int count = attachedTo.getCounters().getCount(counterType); + int count = attachedTo.getCounters(game).getCount(counterType); if (to == Integer.MAX_VALUE) { return count >= from; } return count >= from && count <= to; } else { // single compare (lte) - return attachedTo.getCounters().getCount(counterType) >= amount; + return attachedTo.getCounters(game).getCount(counterType) >= amount; } } } diff --git a/Mage/src/main/java/mage/abilities/condition/common/LastTimeCounterRemovedCondition.java b/Mage/src/main/java/mage/abilities/condition/common/LastTimeCounterRemovedCondition.java index 0c47125c9ca..a68e20036f7 100644 --- a/Mage/src/main/java/mage/abilities/condition/common/LastTimeCounterRemovedCondition.java +++ b/Mage/src/main/java/mage/abilities/condition/common/LastTimeCounterRemovedCondition.java @@ -26,7 +26,7 @@ public class LastTimeCounterRemovedCondition implements Condition{ permanent = (Permanent) game.getLastKnownInformation(source.getSourceId(), Zone.BATTLEFIELD); } if (permanent != null) { - final int timeCounters = permanent.getCounters().getCount(CounterType.TIME); + final int timeCounters = permanent.getCounters(game).getCount(CounterType.TIME); return timeCounters == 0; } else { return false; diff --git a/Mage/src/main/java/mage/abilities/condition/common/PermanentHasCounterCondition.java b/Mage/src/main/java/mage/abilities/condition/common/PermanentHasCounterCondition.java index 815e0b3bb3a..b20f5d4b77c 100644 --- a/Mage/src/main/java/mage/abilities/condition/common/PermanentHasCounterCondition.java +++ b/Mage/src/main/java/mage/abilities/condition/common/PermanentHasCounterCondition.java @@ -67,19 +67,19 @@ public class PermanentHasCounterCondition implements Condition { for (Permanent permanent : permanents) { switch (this.type) { case FEWER_THAN: - if (permanent.getCounters().getCount(this.counterType) < this.amount) { + if (permanent.getCounters(game).getCount(this.counterType) < this.amount) { conditionApplies = true; break; } break; case MORE_THAN: - if (permanent.getCounters().getCount(this.counterType) > this.amount) { + if (permanent.getCounters(game).getCount(this.counterType) > this.amount) { conditionApplies = true; break; } break; case EQUAL_TO: - if (permanent.getCounters().getCount(this.counterType) == this.amount) { + if (permanent.getCounters(game).getCount(this.counterType) == this.amount) { conditionApplies = true; break; } diff --git a/Mage/src/main/java/mage/abilities/condition/common/SourceHasCounterCondition.java b/Mage/src/main/java/mage/abilities/condition/common/SourceHasCounterCondition.java index 9471e7aab82..96434483e0f 100644 --- a/Mage/src/main/java/mage/abilities/condition/common/SourceHasCounterCondition.java +++ b/Mage/src/main/java/mage/abilities/condition/common/SourceHasCounterCondition.java @@ -76,7 +76,7 @@ public class SourceHasCounterCondition implements Condition { if (card != null) { count = card.getCounters(game).getCount(counterType); } else { - count = permanent.getCounters().getCount(counterType); + count = permanent.getCounters(game).getCount(counterType); } if (to == Integer.MAX_VALUE) { return count >= from; @@ -86,7 +86,7 @@ public class SourceHasCounterCondition implements Condition { if (card != null) { return card.getCounters(game).getCount(counterType) >= amount; } else { - return permanent.getCounters().getCount(counterType) >= amount; + return permanent.getCounters(game).getCount(counterType) >= amount; } } } diff --git a/Mage/src/main/java/mage/abilities/costs/common/PayLoyaltyCost.java b/Mage/src/main/java/mage/abilities/costs/common/PayLoyaltyCost.java index 5cb975d7b1f..9944d89abcd 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/PayLoyaltyCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/PayLoyaltyCost.java @@ -59,15 +59,15 @@ public class PayLoyaltyCost extends CostImpl { @Override public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { Permanent planeswalker = game.getPermanent(sourceId); - return planeswalker != null && planeswalker.getCounters().getCount(CounterType.LOYALTY) + amount >= 0 && planeswalker.canLoyaltyBeUsed(game); + return planeswalker != null && planeswalker.getCounters(game).getCount(CounterType.LOYALTY) + amount >= 0 && planeswalker.canLoyaltyBeUsed(game); } @Override public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { Permanent planeswalker = game.getPermanent(sourceId); - if (planeswalker != null && planeswalker.getCounters().getCount(CounterType.LOYALTY) + amount >= 0 && planeswalker.canLoyaltyBeUsed(game)) { + if (planeswalker != null && planeswalker.getCounters(game).getCount(CounterType.LOYALTY) + amount >= 0 && planeswalker.canLoyaltyBeUsed(game)) { if (amount > 0) { - planeswalker.getCounters().addCounter(CounterType.LOYALTY.createInstance(amount)); + planeswalker.getCounters(game).addCounter(CounterType.LOYALTY.createInstance(amount)); } else if (amount < 0) { planeswalker.removeCounters(CounterType.LOYALTY.getName(), Math.abs(amount), game); } diff --git a/Mage/src/main/java/mage/abilities/costs/common/PayVariableLoyaltyCost.java b/Mage/src/main/java/mage/abilities/costs/common/PayVariableLoyaltyCost.java index 7536b0df023..4a19e7ea423 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/PayVariableLoyaltyCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/PayVariableLoyaltyCost.java @@ -72,7 +72,7 @@ public class PayVariableLoyaltyCost extends VariableCostImpl { int maxValue = 0; Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null) { - maxValue = permanent.getCounters().getCount(CounterType.LOYALTY.getName()); + maxValue = permanent.getCounters(game).getCount(CounterType.LOYALTY.getName()); } return maxValue; } diff --git a/Mage/src/main/java/mage/abilities/costs/common/RemoveCounterCost.java b/Mage/src/main/java/mage/abilities/costs/common/RemoveCounterCost.java index 38be9ace0eb..100beada6cd 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/RemoveCounterCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/RemoveCounterCost.java @@ -93,16 +93,16 @@ public class RemoveCounterCost extends CostImpl { for (UUID targetId : target.getTargets()) { Permanent permanent = game.getPermanent(targetId); if (permanent != null) { - if (permanent.getCounters().size() > 0 && (counterTypeToRemove == null || permanent.getCounters().containsKey(counterTypeToRemove))) { + if (permanent.getCounters(game).size() > 0 && (counterTypeToRemove == null || permanent.getCounters(game).containsKey(counterTypeToRemove))) { String counterName = null; if (counterTypeToRemove != null) { counterName = counterTypeToRemove.getName(); - } else if (permanent.getCounters().size() > 1 && counterTypeToRemove == null) { + } else if (permanent.getCounters(game).size() > 1 && counterTypeToRemove == null) { Choice choice = new ChoiceImpl(true); Set choices = new HashSet<>(); - for (Counter counter : permanent.getCounters().values()) { - if (permanent.getCounters().getCount(counter.getName()) > 0) { + for (Counter counter : permanent.getCounters(game).values()) { + if (permanent.getCounters(game).getCount(counter.getName()) > 0) { choices.add(counter.getName()); } } @@ -111,7 +111,7 @@ public class RemoveCounterCost extends CostImpl { controller.choose(Outcome.UnboostCreature, choice, game); counterName = choice.getChoice(); } else { - for (Counter counter : permanent.getCounters().values()) { + for (Counter counter : permanent.getCounters(game).values()) { if (counter.getCount() > 0) { counterName = counter.getName(); } @@ -119,16 +119,16 @@ public class RemoveCounterCost extends CostImpl { } if (counterName != null) { int countersLeft = countersToRemove - countersRemoved; - int countersOnPermanent = permanent.getCounters().getCount(counterName); + int countersOnPermanent = permanent.getCounters(game).getCount(counterName); int numberOfCountersSelected = 1; if (countersLeft > 1 && countersOnPermanent > 1) { numberOfCountersSelected = controller.getAmount(1, Math.min(countersLeft, countersOnPermanent), new StringBuilder("Remove how many counters from ").append(permanent.getIdName()).toString(), game); } permanent.removeCounters(counterName, numberOfCountersSelected, game); - if (permanent.getCounters().getCount(counterName) == 0) { + if (permanent.getCounters(game).getCount(counterName) == 0) { // this removes only the item with number = 0 from the collection - permanent.getCounters().removeCounter(counterName); + permanent.getCounters(game).removeCounter(counterName); } countersRemoved += numberOfCountersSelected; if (!game.isSimulation()) { diff --git a/Mage/src/main/java/mage/abilities/costs/common/RemoveCountersSourceCost.java b/Mage/src/main/java/mage/abilities/costs/common/RemoveCountersSourceCost.java index ebf92959f44..66b8f49efa8 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/RemoveCountersSourceCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/RemoveCountersSourceCost.java @@ -64,7 +64,7 @@ public class RemoveCountersSourceCost extends CostImpl { @Override public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { Permanent permanent = game.getPermanent(sourceId); - if (permanent != null && permanent.getCounters().getCount(name) >= amount) { + if (permanent != null && permanent.getCounters(game).getCount(name) >= amount) { return true; } return false; @@ -73,7 +73,7 @@ public class RemoveCountersSourceCost extends CostImpl { @Override public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { Permanent permanent = game.getPermanent(sourceId); - if (permanent != null && permanent.getCounters().getCount(name) >= amount) { + if (permanent != null && permanent.getCounters(game).getCount(name) >= amount) { permanent.removeCounters(name, amount, game); this.paid = true; } diff --git a/Mage/src/main/java/mage/abilities/costs/common/RemoveVariableCountersSourceCost.java b/Mage/src/main/java/mage/abilities/costs/common/RemoveVariableCountersSourceCost.java index 7678d644736..be4ce5e09d3 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/RemoveVariableCountersSourceCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/RemoveVariableCountersSourceCost.java @@ -92,7 +92,7 @@ public class RemoveVariableCountersSourceCost extends VariableCostImpl { int maxValue = 0; Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null) { - maxValue = permanent.getCounters().getCount(counterName); + maxValue = permanent.getCounters(game).getCount(counterName); } return maxValue; } diff --git a/Mage/src/main/java/mage/abilities/costs/common/RemoveVariableCountersTargetCost.java b/Mage/src/main/java/mage/abilities/costs/common/RemoveVariableCountersTargetCost.java index 6e243296567..bb5160b0129 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/RemoveVariableCountersTargetCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/RemoveVariableCountersTargetCost.java @@ -95,9 +95,9 @@ public class RemoveVariableCountersTargetCost extends VariableCostImpl { int maxValue = 0; for (Permanent permanent :game.getBattlefield().getAllActivePermanents(filter, source.getControllerId(), game)) { if (counterTypeToRemove != null) { - maxValue += permanent.getCounters().getCount(counterTypeToRemove); + maxValue += permanent.getCounters(game).getCount(counterTypeToRemove); } else { - for(Counter counter :permanent.getCounters().values()){ + for(Counter counter :permanent.getCounters(game).values()){ maxValue += counter.getCount(); } } diff --git a/Mage/src/main/java/mage/abilities/dynamicvalue/common/CountersCount.java b/Mage/src/main/java/mage/abilities/dynamicvalue/common/CountersCount.java index eb317e61012..5b239827fc0 100644 --- a/Mage/src/main/java/mage/abilities/dynamicvalue/common/CountersCount.java +++ b/Mage/src/main/java/mage/abilities/dynamicvalue/common/CountersCount.java @@ -62,7 +62,7 @@ public class CountersCount implements DynamicValue { public int calculate(Game game, Ability sourceAbility, Effect effect) { int count = 0; for (Permanent permanent : game.getBattlefield().getAllActivePermanents(filter, game)) { - count += permanent.getCounters().getCount(counter); + count += permanent.getCounters(game).getCount(counter); } return count; } diff --git a/Mage/src/main/java/mage/abilities/dynamicvalue/common/CountersSourceCount.java b/Mage/src/main/java/mage/abilities/dynamicvalue/common/CountersSourceCount.java index d132ed29a60..53c1a7f2c64 100644 --- a/Mage/src/main/java/mage/abilities/dynamicvalue/common/CountersSourceCount.java +++ b/Mage/src/main/java/mage/abilities/dynamicvalue/common/CountersSourceCount.java @@ -23,7 +23,7 @@ public class CountersSourceCount implements DynamicValue { public int calculate(Game game, Ability sourceAbility, Effect effect) { Permanent permanent = game.getPermanentOrLKIBattlefield(sourceAbility.getSourceId()); if (permanent != null) { - return permanent.getCounters().getCount(counter); + return permanent.getCounters(game).getCount(counter); } return 0; } diff --git a/Mage/src/main/java/mage/abilities/effects/ApplyCountersEffect.java b/Mage/src/main/java/mage/abilities/effects/ApplyCountersEffect.java index ce497867d9d..320fff976f0 100644 --- a/Mage/src/main/java/mage/abilities/effects/ApplyCountersEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/ApplyCountersEffect.java @@ -55,7 +55,7 @@ public class ApplyCountersEffect extends ContinuousEffectImpl { @Override public boolean apply(Game game, Ability source) { for (Permanent permanent: game.getBattlefield().getAllActivePermanents(CardType.CREATURE)) { - for (BoostCounter counter: permanent.getCounters().getBoostCounters()) { + for (BoostCounter counter: permanent.getCounters(game).getBoostCounters()) { permanent.addPower(counter.getPower() * counter.getCount()); permanent.addToughness(counter.getToughness() * counter.getCount()); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/EnvoyEffect.java b/Mage/src/main/java/mage/abilities/effects/common/EnvoyEffect.java index d9e584f607e..4ca8bb884eb 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/EnvoyEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/EnvoyEffect.java @@ -84,7 +84,7 @@ public class EnvoyEffect extends OneShotEffect { } } cards.removeAll(cardsToHand); - controller.moveCards(cardsToHand, null, Zone.HAND, source, game); + controller.moveCards(cardsToHand, Zone.HAND, source, game); controller.putCardsOnBottomOfLibrary(cards, game, source, true); return true; } diff --git a/Mage/src/main/java/mage/abilities/effects/common/ExileCardsFromTopOfLibraryTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/ExileCardsFromTopOfLibraryTargetEffect.java index 7a6e0a52314..9ca03c05f0d 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/ExileCardsFromTopOfLibraryTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/ExileCardsFromTopOfLibraryTargetEffect.java @@ -53,7 +53,7 @@ public class ExileCardsFromTopOfLibraryTargetEffect extends OneShotEffect { if (targetPlayer != null) { Cards cards = new CardsImpl(); cards.addAll(targetPlayer.getLibrary().getTopCards(game, amount)); - return targetPlayer.moveCards(cards, null, Zone.EXILED, source, game); + return targetPlayer.moveCards(cards, Zone.EXILED, source, game); } return false; } diff --git a/Mage/src/main/java/mage/abilities/effects/common/LookLibraryControllerEffect.java b/Mage/src/main/java/mage/abilities/effects/common/LookLibraryControllerEffect.java index e6c84829921..cb152f0370e 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/LookLibraryControllerEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/LookLibraryControllerEffect.java @@ -171,7 +171,7 @@ public class LookLibraryControllerEffect extends OneShotEffect { } break; case GRAVEYARD: - player.moveCards(cards, Zone.LIBRARY, Zone.GRAVEYARD, source, game); + player.moveCards(cards, Zone.GRAVEYARD, source, game); break; default: // not supported yet diff --git a/Mage/src/main/java/mage/abilities/effects/common/RemoveAllCountersSourceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/RemoveAllCountersSourceEffect.java index 0327dd6dd65..52ac8c477e3 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/RemoveAllCountersSourceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/RemoveAllCountersSourceEffect.java @@ -62,7 +62,7 @@ public class RemoveAllCountersSourceEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Permanent sourcePermanent = game.getPermanent(source.getSourceId()); if (sourcePermanent != null) { - int count = sourcePermanent.getCounters().getCount(counterType); + int count = sourcePermanent.getCounters(game).getCount(counterType); sourcePermanent.removeCounters(counterType.getName(), count, game); return true; } diff --git a/Mage/src/main/java/mage/abilities/effects/common/ReturnToHandChosenPermanentEffect.java b/Mage/src/main/java/mage/abilities/effects/common/ReturnToHandChosenPermanentEffect.java index e0781818931..ccb9e974786 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/ReturnToHandChosenPermanentEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/ReturnToHandChosenPermanentEffect.java @@ -77,7 +77,7 @@ public class ReturnToHandChosenPermanentEffect extends OneShotEffect { if (available > 0) { TargetControlledPermanent target = new TargetControlledPermanent(Math.min(number, available), number, filter, true); if (player.chooseTarget(this.outcome, target, source, game)) { - player.moveCards(new CardsImpl(target.getTargets()), Zone.BATTLEFIELD, Zone.HAND, source, game); + player.moveCards(new CardsImpl(target.getTargets()), Zone.HAND, source, game); } } return true; diff --git a/Mage/src/main/java/mage/abilities/effects/common/RevealLibraryPutIntoHandEffect.java b/Mage/src/main/java/mage/abilities/effects/common/RevealLibraryPutIntoHandEffect.java index 19e50a63aca..22b744a50c3 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/RevealLibraryPutIntoHandEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/RevealLibraryPutIntoHandEffect.java @@ -97,7 +97,7 @@ public class RevealLibraryPutIntoHandEffect extends OneShotEffect { cards.remove(card); } } - controller.moveCards(cardsToHand, null, Zone.HAND, source, game); + controller.moveCards(cardsToHand, Zone.HAND, source, game); controller.putCardsOnBottomOfLibrary(cards, game, source, anyOrder); return true; } diff --git a/Mage/src/main/java/mage/abilities/effects/common/ShuffleIntoLibraryGraveOfSourceOwnerEffect.java b/Mage/src/main/java/mage/abilities/effects/common/ShuffleIntoLibraryGraveOfSourceOwnerEffect.java index 9a320f3a7eb..563a3d4c47b 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/ShuffleIntoLibraryGraveOfSourceOwnerEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/ShuffleIntoLibraryGraveOfSourceOwnerEffect.java @@ -58,7 +58,7 @@ public class ShuffleIntoLibraryGraveOfSourceOwnerEffect extends OneShotEffect { } Player owner = game.getPlayer(ownerId); if (owner != null) { - owner.moveCards(owner.getGraveyard(), null, Zone.LIBRARY, source, game); + owner.moveCards(owner.getGraveyard(), Zone.LIBRARY, source, game); owner.shuffleLibrary(source, game); return true; } diff --git a/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersSourceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersSourceEffect.java index a39c2b7de8b..0ea83b7f345 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersSourceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersSourceEffect.java @@ -127,10 +127,10 @@ public class AddCountersSourceEffect extends OneShotEffect { countersToAdd--; } newCounter.add(countersToAdd); - int before = permanent.getCounters().getCount(newCounter.getName()); + int before = permanent.getCounters(game).getCount(newCounter.getName()); permanent.addCounters(newCounter, game); if (informPlayers && !game.isSimulation()) { - int amountAdded = permanent.getCounters().getCount(newCounter.getName()) - before; + int amountAdded = permanent.getCounters(game).getCount(newCounter.getName()) - before; Player player = game.getPlayer(source.getControllerId()); if (player != null) { game.informPlayers(player.getLogName() + " puts " + amountAdded + " " + newCounter.getName().toLowerCase() + " counter on " + permanent.getLogName()); diff --git a/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersTargetEffect.java index efe8af78ed2..00567000649 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersTargetEffect.java @@ -96,9 +96,9 @@ public class AddCountersTargetEffect extends OneShotEffect { newCounter.remove(newCounter.getCount()); } newCounter.add(calculated); - int before = permanent.getCounters().getCount(counter.getName()); + int before = permanent.getCounters(game).getCount(counter.getName()); permanent.addCounters(newCounter, game); - int numberAdded = permanent.getCounters().getCount(counter.getName()) - before; + int numberAdded = permanent.getCounters(game).getCount(counter.getName()) - before; affectedTargets++; if (!game.isSimulation()) { game.informPlayers(sourceObject.getLogName() + ": " + controller.getLogName() + " puts " @@ -114,7 +114,7 @@ public class AddCountersTargetEffect extends OneShotEffect { + counter.getCount() + " " + counter.getName().toLowerCase() + " counter on " + player.getLogName()); } } else if (card != null) { - card.addCounters(counter.getName(), counter.getCount(), game); + card.addCounters(counter, game); if (!game.isSimulation()) { game.informPlayers(new StringBuilder("Added ").append(counter.getCount()).append(" ").append(counter.getName()) .append(" counter to ").append(card.getName()) diff --git a/Mage/src/main/java/mage/abilities/effects/common/counter/ProliferateEffect.java b/Mage/src/main/java/mage/abilities/effects/common/counter/ProliferateEffect.java index b85e47bf840..7ae35237b81 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/counter/ProliferateEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/counter/ProliferateEffect.java @@ -75,23 +75,25 @@ public class ProliferateEffect extends OneShotEffect { UUID chosen = (UUID) target.getTargets().get(idx); Permanent permanent = game.getPermanent(chosen); if (permanent != null) { - if (permanent.getCounters().size() > 0) { - if (permanent.getCounters().size() == 1) { - for (Counter counter : permanent.getCounters().values()) { - permanent.addCounters(counter.getName(), 1, game); + if (permanent.getCounters(game).size() > 0) { + if (permanent.getCounters(game).size() == 1) { + for (Counter counter : permanent.getCounters(game).values()) { + Counter newCounter = new Counter(counter.getName()); + permanent.addCounters(newCounter, game); } } else { Choice choice = new ChoiceImpl(true); Set choices = new HashSet<>(); - for (Counter counter : permanent.getCounters().values()) { + for (Counter counter : permanent.getCounters(game).values()) { choices.add(counter.getName()); } choice.setChoices(choices); choice.setMessage("Choose a counter to proliferate (" + permanent.getIdName() + ")"); controller.choose(Outcome.Benefit, choice, game); - for (Counter counter : permanent.getCounters().values()) { + for (Counter counter : permanent.getCounters(game).values()) { if (counter.getName().equals(choice.getChoice())) { - permanent.addCounters(counter.getName(), 1, game); + Counter newCounter = new Counter(counter.getName()); + permanent.addCounters(newCounter, game); break; } } diff --git a/Mage/src/main/java/mage/abilities/effects/common/counter/RemoveCounterSourceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/counter/RemoveCounterSourceEffect.java index 3c075450d9e..a371859fc5a 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/counter/RemoveCounterSourceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/counter/RemoveCounterSourceEffect.java @@ -57,7 +57,7 @@ public class RemoveCounterSourceEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { Permanent permanent = game.getPermanent(source.getSourceId()); - if (permanent != null && permanent.getCounters().getCount(counter.getName()) >= counter.getCount()) { + if (permanent != null && permanent.getCounters(game).getCount(counter.getName()) >= counter.getCount()) { permanent.removeCounters(counter.getName(), counter.getCount(), game); if (!game.isSimulation()) { game.informPlayers("Removed " + counter.getCount() + " " + counter.getName() + " counter from " + permanent.getLogName()); diff --git a/Mage/src/main/java/mage/abilities/effects/common/counter/RemoveCounterTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/counter/RemoveCounterTargetEffect.java index b596453d62b..ff8a03f950b 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/counter/RemoveCounterTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/counter/RemoveCounterTargetEffect.java @@ -71,7 +71,7 @@ public class RemoveCounterTargetEffect extends OneShotEffect { Permanent p = game.getPermanent(targetPointer.getFirst(game, source)); if(p != null) { Counter toRemove = (counter == null ? selectCounterType(game, source, p) : counter); - if(toRemove != null && p.getCounters().getCount(toRemove.getName()) >= toRemove.getCount()) { + if(toRemove != null && p.getCounters(game).getCount(toRemove.getName()) >= toRemove.getCount()) { p.removeCounters(toRemove.getName(), toRemove.getCount(), game); if(!game.isSimulation()) game.informPlayers("Removed " + toRemove.getCount() + " " + toRemove.getName() @@ -93,13 +93,13 @@ public class RemoveCounterTargetEffect extends OneShotEffect { private Counter selectCounterType(Game game, Ability source, Permanent permanent) { Player controller = game.getPlayer(source.getControllerId()); - if(controller != null && permanent.getCounters().size() > 0) { + if(controller != null && permanent.getCounters(game).size() > 0) { String counterName = null; - if(permanent.getCounters().size() > 1) { + if(permanent.getCounters(game).size() > 1) { Choice choice = new ChoiceImpl(true); Set choices = new HashSet<>(); - for(Counter counter : permanent.getCounters().values()) { - if (permanent.getCounters().getCount(counter.getName()) > 0) { + for(Counter counter : permanent.getCounters(game).values()) { + if (permanent.getCounters(game).getCount(counter.getName()) > 0) { choices.add(counter.getName()); } } @@ -108,7 +108,7 @@ public class RemoveCounterTargetEffect extends OneShotEffect { controller.choose(Outcome.Detriment, choice, game); counterName = choice.getChoice(); } else { - for(Counter counter : permanent.getCounters().values()) { + for(Counter counter : permanent.getCounters(game).values()) { if(counter.getCount() > 0) { counterName = counter.getName(); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/search/SearchLibraryPutInHandEffect.java b/Mage/src/main/java/mage/abilities/effects/common/search/SearchLibraryPutInHandEffect.java index de5bbdc6c2d..a992a18e792 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/search/SearchLibraryPutInHandEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/search/SearchLibraryPutInHandEffect.java @@ -98,7 +98,7 @@ public class SearchLibraryPutInHandEffect extends SearchEffect { cards.add(card); } } - controller.moveCards(cards, null, Zone.HAND, source, game); + controller.moveCards(cards, Zone.HAND, source, game); if (revealCards) { String name = "Reveal"; Card sourceCard = game.getCard(source.getSourceId()); diff --git a/Mage/src/main/java/mage/abilities/effects/keyword/SweepEffect.java b/Mage/src/main/java/mage/abilities/effects/keyword/SweepEffect.java index 53dadbe70f6..229b7d8bea1 100644 --- a/Mage/src/main/java/mage/abilities/effects/keyword/SweepEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/keyword/SweepEffect.java @@ -74,7 +74,7 @@ public class SweepEffect extends OneShotEffect { Target target = new TargetPermanent(0, Integer.MAX_VALUE, filter, true); if (controller.chooseTarget(outcome, target, source, game)) { game.getState().setValue(CardUtil.getCardZoneString("sweep", source.getSourceId(), game), target.getTargets().size()); - controller.moveCards(new CardsImpl(target.getTargets()), null, Zone.HAND, source, game); + controller.moveCards(new CardsImpl(target.getTargets()), Zone.HAND, source, game); } return true; } diff --git a/Mage/src/main/java/mage/abilities/keyword/CumulativeUpkeepAbility.java b/Mage/src/main/java/mage/abilities/keyword/CumulativeUpkeepAbility.java index 7fdecb10d31..eb8e0e7bac0 100644 --- a/Mage/src/main/java/mage/abilities/keyword/CumulativeUpkeepAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/CumulativeUpkeepAbility.java @@ -98,7 +98,7 @@ class CumulativeUpkeepEffect extends OneShotEffect { Player player = game.getPlayer(source.getControllerId()); Permanent permanent = game.getPermanent(source.getSourceId()); if (player != null && permanent != null) { - int ageCounter = permanent.getCounters().getCount(CounterType.AGE); + int ageCounter = permanent.getCounters(game).getCount(CounterType.AGE); if (cumulativeCost instanceof ManaCost) { ManaCostsImpl totalCost = new ManaCostsImpl<>(); for (int i = 0; i < ageCounter; i++) { diff --git a/Mage/src/main/java/mage/abilities/keyword/FadingAbility.java b/Mage/src/main/java/mage/abilities/keyword/FadingAbility.java index e8e45295810..2a8ec6fc76f 100644 --- a/Mage/src/main/java/mage/abilities/keyword/FadingAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/FadingAbility.java @@ -62,7 +62,7 @@ class FadingEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null) { - int amount = permanent.getCounters().getCount(CounterType.FADE); + int amount = permanent.getCounters(game).getCount(CounterType.FADE); if (amount > 0) { permanent.removeCounters(CounterType.FADE.createInstance(), game); } else { diff --git a/Mage/src/main/java/mage/abilities/keyword/GraftAbility.java b/Mage/src/main/java/mage/abilities/keyword/GraftAbility.java index c201f81c012..c60b3c4bb04 100644 --- a/Mage/src/main/java/mage/abilities/keyword/GraftAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/GraftAbility.java @@ -95,7 +95,7 @@ public class GraftAbility extends TriggeredAbilityImpl { if (sourcePermanent != null && permanent != null && !sourcePermanent.getId().equals(permanent.getId()) - && sourcePermanent.getCounters().containsKey(CounterType.P1P1) + && sourcePermanent.getCounters(game).containsKey(CounterType.P1P1) && filter.match(permanent, game)) { for (Effect effect : this.getEffects()) { effect.setTargetPointer(new FixedTarget(event.getTargetId())); @@ -168,7 +168,7 @@ class GraftDistributeCounterEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Permanent sourcePermanent = game.getPermanent(source.getSourceId()); if (sourcePermanent != null) { - int numberOfCounters = sourcePermanent.getCounters().getCount(CounterType.P1P1); + int numberOfCounters = sourcePermanent.getCounters(game).getCount(CounterType.P1P1); if (numberOfCounters > 0) { Permanent targetCreature = game.getPermanent(targetPointer.getFirst(game, source)); if (targetCreature != null) { diff --git a/Mage/src/main/java/mage/abilities/keyword/ModularAbility.java b/Mage/src/main/java/mage/abilities/keyword/ModularAbility.java index 5efdb7a01a7..62800ca7842 100644 --- a/Mage/src/main/java/mage/abilities/keyword/ModularAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/ModularAbility.java @@ -75,7 +75,7 @@ public class ModularAbility extends DiesTriggeredAbility { public boolean checkTrigger(GameEvent event, Game game) { if (super.checkTrigger(event, game)) { ZoneChangeEvent zEvent = (ZoneChangeEvent) event; - if (zEvent.getTarget().getCounters().getCount(CounterType.P1P1) > 0) { + if (zEvent.getTarget().getCounters(game).getCount(CounterType.P1P1) > 0) { return true; } } @@ -157,7 +157,7 @@ class ModularDistributeCounterEffect extends OneShotEffect { Permanent targetArtifact = game.getPermanent(targetPointer.getFirst(game, source)); Player player = game.getPlayer(source.getControllerId()); if (sourcePermanent != null && targetArtifact != null && player != null) { - int numberOfCounters = sourcePermanent.getCounters().getCount(CounterType.P1P1); + int numberOfCounters = sourcePermanent.getCounters(game).getCount(CounterType.P1P1); if (numberOfCounters > 0) { targetArtifact.addCounters(CounterType.P1P1.createInstance(numberOfCounters), game); } diff --git a/Mage/src/main/java/mage/abilities/keyword/PersistAbility.java b/Mage/src/main/java/mage/abilities/keyword/PersistAbility.java index 3f4a297c7de..085d893a495 100644 --- a/Mage/src/main/java/mage/abilities/keyword/PersistAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/PersistAbility.java @@ -65,7 +65,7 @@ public class PersistAbility extends DiesTriggeredAbility { public boolean checkTrigger(GameEvent event, Game game) { if (super.checkTrigger(event, game)) { Permanent permanent = ((ZoneChangeEvent) event).getTarget(); - if (permanent.getCounters().getCount(CounterType.M1M1) == 0) { + if (permanent.getCounters(game).getCount(CounterType.M1M1) == 0) { FixedTarget fixedTarget = new FixedTarget(permanent.getId()); fixedTarget.init(game, this); return true; diff --git a/Mage/src/main/java/mage/abilities/keyword/TransmuteAbility.java b/Mage/src/main/java/mage/abilities/keyword/TransmuteAbility.java index 8ed7e284468..100c0e74734 100644 --- a/Mage/src/main/java/mage/abilities/keyword/TransmuteAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/TransmuteAbility.java @@ -85,7 +85,7 @@ class TransmuteEffect extends OneShotEffect { if (target.getTargets().size() > 0) { Cards revealed = new CardsImpl(target.getTargets()); controller.revealCards(sourceObject.getIdName(), revealed, game); - controller.moveCards(revealed, null, Zone.HAND, source, game); + controller.moveCards(revealed, Zone.HAND, source, game); } } controller.shuffleLibrary(source, game); diff --git a/Mage/src/main/java/mage/abilities/keyword/UndyingAbility.java b/Mage/src/main/java/mage/abilities/keyword/UndyingAbility.java index 237989397a2..66df34d1fb0 100644 --- a/Mage/src/main/java/mage/abilities/keyword/UndyingAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/UndyingAbility.java @@ -35,7 +35,7 @@ public class UndyingAbility extends DiesTriggeredAbility { public boolean checkTrigger(GameEvent event, Game game) { if (super.checkTrigger(event, game)) { Permanent permanent = (Permanent) game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD); - if (!permanent.getCounters().containsKey(CounterType.P1P1) || permanent.getCounters().getCount(CounterType.P1P1) == 0) { + if (!permanent.getCounters(game).containsKey(CounterType.P1P1) || permanent.getCounters(game).getCount(CounterType.P1P1) == 0) { return true; } } diff --git a/Mage/src/main/java/mage/abilities/keyword/UnleashAbility.java b/Mage/src/main/java/mage/abilities/keyword/UnleashAbility.java index ec109329661..eb0a9ec4a36 100644 --- a/Mage/src/main/java/mage/abilities/keyword/UnleashAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/UnleashAbility.java @@ -136,7 +136,7 @@ class UnleashRestrictionEffect extends RestrictionEffect { @Override public boolean applies(Permanent permanent, Ability source, Game game) { if (permanent != null && permanent.getId().equals(source.getSourceId())) { - if (permanent.getCounters().getCount(CounterType.P1P1) > 0) { + if (permanent.getCounters(game).getCount(CounterType.P1P1) > 0) { return true; } } diff --git a/Mage/src/main/java/mage/abilities/keyword/VanishingSacrificeAbility.java b/Mage/src/main/java/mage/abilities/keyword/VanishingSacrificeAbility.java index b6f2dc6a103..642c563e214 100644 --- a/Mage/src/main/java/mage/abilities/keyword/VanishingSacrificeAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/VanishingSacrificeAbility.java @@ -28,7 +28,7 @@ public class VanishingSacrificeAbility extends TriggeredAbilityImpl { if (event.getData().equals("time") && event.getTargetId().equals(this.getSourceId())) { Permanent p = game.getPermanent(this.getSourceId()); if (p != null) { - return p.getCounters().getCount(CounterType.TIME) == 0; + return p.getCounters(game).getCount(CounterType.TIME) == 0; } } return false; diff --git a/Mage/src/main/java/mage/abilities/keyword/VanishingUpkeepAbility.java b/Mage/src/main/java/mage/abilities/keyword/VanishingUpkeepAbility.java index 2b5bf00431a..30994dc7a90 100644 --- a/Mage/src/main/java/mage/abilities/keyword/VanishingUpkeepAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/VanishingUpkeepAbility.java @@ -64,7 +64,7 @@ class VanishingEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Permanent p = game.getPermanent(source.getSourceId()); if (p != null) { - int amount = p.getCounters().getCount(CounterType.TIME); + int amount = p.getCounters(game).getCount(CounterType.TIME); if (amount > 0) { p.removeCounters(CounterType.TIME.createInstance(), game); game.informPlayers("Removed a time counter from " + p.getLogName() + " (" + amount + " left)"); diff --git a/Mage/src/main/java/mage/cards/Card.java b/Mage/src/main/java/mage/cards/Card.java index 3befec124b1..abea174164f 100644 --- a/Mage/src/main/java/mage/cards/Card.java +++ b/Mage/src/main/java/mage/cards/Card.java @@ -40,6 +40,7 @@ import mage.constants.Zone; import mage.counters.Counter; import mage.counters.Counters; import mage.game.Game; +import mage.game.GameState; import mage.game.permanent.Permanent; public interface Card extends MageObject { @@ -140,6 +141,8 @@ public interface Card extends MageObject { boolean putOntoBattlefield(Game game, Zone fromZone, UUID sourceId, UUID controllerId, boolean tapped, boolean facedown, ArrayList appliedEffects); + void setZone(Zone zone, Game game); + List getMana(); void build(); @@ -152,9 +155,7 @@ public interface Card extends MageObject { Counters getCounters(Game game); - boolean addCounters(String name, int amount, Game game); - - boolean addCounters(String name, int amount, Game game, ArrayList appliedEffects); + Counters getCounters(GameState state); boolean addCounters(Counter counter, Game game); @@ -173,6 +174,4 @@ public interface Card extends MageObject { * returned */ Card getMainCard(); - - void setZone(Zone zone, Game game); } diff --git a/Mage/src/main/java/mage/cards/CardImpl.java b/Mage/src/main/java/mage/cards/CardImpl.java index 050e5d5ee02..ebe0e0aa52c 100644 --- a/Mage/src/main/java/mage/cards/CardImpl.java +++ b/Mage/src/main/java/mage/cards/CardImpl.java @@ -53,6 +53,7 @@ import mage.counters.Counters; import mage.game.CardAttribute; import mage.game.CardState; import mage.game.Game; +import mage.game.GameState; import mage.game.command.Commander; import mage.game.events.GameEvent; import mage.game.events.ZoneChangeEvent; @@ -655,34 +656,19 @@ public abstract class CardImpl extends MageObjectImpl implements Card { @Override public Counters getCounters(Game game) { - return game.getState().getCardState(this.objectId).getCounters(); + return getCounters(game.getState()); } @Override - public boolean addCounters(String name, int amount, Game game) { - return addCounters(name, amount, game, null); + public Counters getCounters(GameState state) { + return state.getCardState(this.objectId).getCounters(); } - @Override - public boolean addCounters(String name, int amount, Game game, ArrayList appliedEffects) { - boolean returnCode = true; - GameEvent countersEvent = GameEvent.getEvent(GameEvent.EventType.ADD_COUNTERS, objectId, ownerId, name, amount); - countersEvent.setAppliedEffects(appliedEffects); - if (!game.replaceEvent(countersEvent)) { - for (int i = 0; i < countersEvent.getAmount(); i++) { - GameEvent event = GameEvent.getEvent(GameEvent.EventType.ADD_COUNTER, objectId, ownerId, name, 1); - event.setAppliedEffects(appliedEffects); - if (!game.replaceEvent(event)) { - game.getState().getCardState(this.objectId).getCounters().addCounter(name, 1); - game.fireEvent(GameEvent.getEvent(GameEvent.EventType.COUNTER_ADDED, objectId, ownerId, name, 1)); - } else { - returnCode = false; - } - } - } else { - returnCode = false; - } - return returnCode; + /** + * @return The controller if available otherwise the owner. + */ + protected UUID getControllerOrOwner() { + return ownerId; } @Override @@ -693,22 +679,27 @@ public abstract class CardImpl extends MageObjectImpl implements Card { @Override public boolean addCounters(Counter counter, Game game, ArrayList appliedEffects) { boolean returnCode = true; - GameEvent countersEvent = GameEvent.getEvent(GameEvent.EventType.ADD_COUNTERS, objectId, ownerId, counter.getName(), counter.getCount()); + GameEvent countersEvent = GameEvent.getEvent(GameEvent.EventType.ADD_COUNTERS, objectId, getControllerOrOwner(), counter.getName(), counter.getCount()); countersEvent.setAppliedEffects(appliedEffects); if (!game.replaceEvent(countersEvent)) { int amount = countersEvent.getAmount(); + int finalAmount = amount; for (int i = 0; i < amount; i++) { Counter eventCounter = counter.copy(); - eventCounter.remove(amount - 1); - GameEvent event = GameEvent.getEvent(GameEvent.EventType.ADD_COUNTER, objectId, ownerId, counter.getName(), 1); + eventCounter.remove(eventCounter.getCount() - 1); + GameEvent event = GameEvent.getEvent(GameEvent.EventType.ADD_COUNTER, objectId, getControllerOrOwner(), counter.getName(), 1); event.setAppliedEffects(appliedEffects); if (!game.replaceEvent(event)) { - game.getState().getCardState(this.objectId).getCounters().addCounter(eventCounter); - game.fireEvent(GameEvent.getEvent(GameEvent.EventType.COUNTER_ADDED, objectId, ownerId, counter.getName(), 1)); + getCounters(game).addCounter(eventCounter); + game.fireEvent(GameEvent.getEvent(GameEvent.EventType.COUNTER_ADDED, objectId, getControllerOrOwner(), counter.getName(), 1)); } else { + finalAmount--; returnCode = false; } } + if(finalAmount > 0) { + game.fireEvent(GameEvent.getEvent(GameEvent.EventType.COUNTERS_ADDED, objectId, getControllerOrOwner(), counter.getName(), amount)); + } } else { returnCode = false; } @@ -718,8 +709,8 @@ public abstract class CardImpl extends MageObjectImpl implements Card { @Override public void removeCounters(String name, int amount, Game game) { for (int i = 0; i < amount; i++) { - game.getState().getCardState(this.objectId).getCounters().removeCounter(name, 1); - GameEvent event = GameEvent.getEvent(GameEvent.EventType.COUNTER_REMOVED, objectId, ownerId); + getCounters(game).removeCounter(name, 1); + GameEvent event = GameEvent.getEvent(GameEvent.EventType.COUNTER_REMOVED, objectId, getControllerOrOwner()); event.setData(name); game.fireEvent(event); } diff --git a/Mage/src/main/java/mage/cards/MeldCard.java b/Mage/src/main/java/mage/cards/MeldCard.java index d49cc2c53fc..d7ccc2d6578 100644 --- a/Mage/src/main/java/mage/cards/MeldCard.java +++ b/Mage/src/main/java/mage/cards/MeldCard.java @@ -346,21 +346,4 @@ public abstract class MeldCard extends CardImpl { return returnState; } } - - @Override - public boolean addCounters(String name, int amount, Game game, ArrayList appliedEffects) { - if (this.isMelded()) { - return super.addCounters(name, amount, game, appliedEffects); - } else { - // can this really happen? - boolean returnState = true; - if (topLastZoneChangeCounter == topHalfCard.getZoneChangeCounter(game)) { - returnState |= topHalfCard.addCounters(name, amount, game, appliedEffects); - } - if (bottomLastZoneChangeCounter == bottomHalfCard.getZoneChangeCounter(game)) { - returnState |= bottomHalfCard.addCounters(name, amount, game, appliedEffects); - } - return returnState; - } - } } diff --git a/Mage/src/main/java/mage/filter/common/FilterPermanentOrPlayerWithCounter.java b/Mage/src/main/java/mage/filter/common/FilterPermanentOrPlayerWithCounter.java index 44d4330b85e..e175fc7fe42 100644 --- a/Mage/src/main/java/mage/filter/common/FilterPermanentOrPlayerWithCounter.java +++ b/Mage/src/main/java/mage/filter/common/FilterPermanentOrPlayerWithCounter.java @@ -59,7 +59,7 @@ public class FilterPermanentOrPlayerWithCounter extends FilterPermanentOrPlayer return false; } } else if (o instanceof Permanent) { - if (((Permanent)o).getCounters().size() == 0) { + if (((Permanent)o).getCounters(game).size() == 0) { return false; } } diff --git a/Mage/src/main/java/mage/filter/predicate/permanent/CounterAnyPredicate.java b/Mage/src/main/java/mage/filter/predicate/permanent/CounterAnyPredicate.java index 68c9d6f3c20..67b7c998d82 100644 --- a/Mage/src/main/java/mage/filter/predicate/permanent/CounterAnyPredicate.java +++ b/Mage/src/main/java/mage/filter/predicate/permanent/CounterAnyPredicate.java @@ -43,7 +43,7 @@ public class CounterAnyPredicate implements Predicate { @Override public boolean apply(Permanent input, Game game) { - for (Counter counter: input.getCounters().values()) { + for (Counter counter: input.getCounters(game).values()) { if (counter.getCount()> 0) { return true; } diff --git a/Mage/src/main/java/mage/filter/predicate/permanent/CounterPredicate.java b/Mage/src/main/java/mage/filter/predicate/permanent/CounterPredicate.java index dd746ddad9c..8058f2796da 100644 --- a/Mage/src/main/java/mage/filter/predicate/permanent/CounterPredicate.java +++ b/Mage/src/main/java/mage/filter/predicate/permanent/CounterPredicate.java @@ -51,9 +51,9 @@ public class CounterPredicate implements Predicate { @Override public boolean apply(Permanent input, Game game) { if (counter == null) { - return !input.getCounters().keySet().isEmpty(); + return !input.getCounters(game).keySet().isEmpty(); } else { - return input.getCounters().containsKey(counter); + return input.getCounters(game).containsKey(counter); } } diff --git a/Mage/src/main/java/mage/game/GameImpl.java b/Mage/src/main/java/mage/game/GameImpl.java index ee2365a7314..2e3b7272147 100644 --- a/Mage/src/main/java/mage/game/GameImpl.java +++ b/Mage/src/main/java/mage/game/GameImpl.java @@ -1723,7 +1723,7 @@ public abstract class GameImpl implements Game, Serializable { } if (perm.getCardType().contains(CardType.PLANESWALKER)) { //20091005 - 704.5i - if (perm.getCounters().getCount(CounterType.LOYALTY) == 0) { + if (perm.getCounters(this).getCount(CounterType.LOYALTY) == 0) { if (movePermanentToGraveyardWithInfo(perm)) { somethingHappened = true; continue; @@ -1871,12 +1871,12 @@ public abstract class GameImpl implements Game, Serializable { } //20110501 - 704.5r - if (perm.getCounters().containsKey(CounterType.P1P1) && perm.getCounters().containsKey(CounterType.M1M1)) { - int p1p1 = perm.getCounters().getCount(CounterType.P1P1); - int m1m1 = perm.getCounters().getCount(CounterType.M1M1); + if (perm.getCounters(this).containsKey(CounterType.P1P1) && perm.getCounters(this).containsKey(CounterType.M1M1)) { + int p1p1 = perm.getCounters(this).getCount(CounterType.P1P1); + int m1m1 = perm.getCounters(this).getCount(CounterType.M1M1); int min = Math.min(p1p1, m1m1); - perm.getCounters().removeCounter(CounterType.P1P1, min); - perm.getCounters().removeCounter(CounterType.M1M1, min); + perm.getCounters(this).removeCounter(CounterType.P1P1, min); + perm.getCounters(this).removeCounter(CounterType.M1M1, min); } } diff --git a/Mage/src/main/java/mage/game/GameState.java b/Mage/src/main/java/mage/game/GameState.java index eec7695c562..2e48c954ce0 100644 --- a/Mage/src/main/java/mage/game/GameState.java +++ b/Mage/src/main/java/mage/game/GameState.java @@ -264,7 +264,7 @@ public class GameState implements Serializable, Copyable { sb.append("permanents"); for (Permanent permanent : battlefield.getAllPermanents()) { - sb.append(permanent.getValue()); + sb.append(permanent.getValue(this)); } sb.append("spells"); @@ -305,7 +305,7 @@ public class GameState implements Serializable, Copyable { sb.append("permanents"); List perms = new ArrayList<>(); for (Permanent permanent : battlefield.getAllPermanents()) { - perms.add(permanent.getValue()); + perms.add(permanent.getValue(this)); } Collections.sort(perms); sb.append(perms); @@ -357,7 +357,7 @@ public class GameState implements Serializable, Copyable { sb.append("permanents"); List perms = new ArrayList<>(); for (Permanent permanent : battlefield.getAllPermanents()) { - perms.add(permanent.getValue()); + perms.add(permanent.getValue(this)); } Collections.sort(perms); sb.append(perms); diff --git a/Mage/src/main/java/mage/game/permanent/Permanent.java b/Mage/src/main/java/mage/game/permanent/Permanent.java index 1d20fa05168..9d8be10a821 100644 --- a/Mage/src/main/java/mage/game/permanent/Permanent.java +++ b/Mage/src/main/java/mage/game/permanent/Permanent.java @@ -40,6 +40,7 @@ import mage.constants.Zone; import mage.counters.Counters; import mage.game.Controllable; import mage.game.Game; +import mage.game.GameState; public interface Permanent extends Card, Controllable { @@ -103,8 +104,6 @@ public interface Permanent extends Card, Controllable { void setSecondCardFace(Card card); - Counters getCounters(); - List getAttachments(); UUID getAttachedTo(); @@ -161,7 +160,7 @@ public interface Permanent extends Card, Controllable { boolean entersBattlefield(UUID sourceId, Game game, Zone fromZone, boolean fireEvent); - String getValue(); + String getValue(GameState state); @Deprecated void addAbility(Ability ability); diff --git a/Mage/src/main/java/mage/game/permanent/PermanentImpl.java b/Mage/src/main/java/mage/game/permanent/PermanentImpl.java index 84aeff54b68..48ae2916cdc 100644 --- a/Mage/src/main/java/mage/game/permanent/PermanentImpl.java +++ b/Mage/src/main/java/mage/game/permanent/PermanentImpl.java @@ -65,6 +65,7 @@ import mage.counters.Counter; import mage.counters.CounterType; import mage.counters.Counters; import mage.game.Game; +import mage.game.GameState; import mage.game.command.CommandObject; import mage.game.events.DamageCreatureEvent; import mage.game.events.DamagePlaneswalkerEvent; @@ -219,12 +220,12 @@ public abstract class PermanentImpl extends CardImpl implements Permanent { } @Override - public String getValue() { + public String getValue(GameState state) { StringBuilder sb = threadLocalBuilder.get(); sb.append(controllerId).append(name).append(tapped).append(damage); sb.append(subtype).append(supertype).append(power.getValue()).append(toughness.getValue()); sb.append(abilities.getValue()); - for (Counter counter : getCounters().values()) { + for (Counter counter : getCounters(state).values()) { sb.append(counter.getName()).append(counter.getCount()); } return sb.toString(); @@ -322,83 +323,19 @@ public abstract class PermanentImpl extends CardImpl implements Permanent { getAbilities().clear(); } - @Override - public Counters getCounters() { - return counters; - } - @Override public Counters getCounters(Game game) { return counters; } @Override - public boolean addCounters(String name, int amount, Game game) { - return addCounters(name, amount, game, null); + public Counters getCounters(GameState state) { + return counters; } @Override - public boolean addCounters(String name, int amount, Game game, ArrayList appliedEffects) { - boolean returnCode = true; - GameEvent countersEvent = GameEvent.getEvent(GameEvent.EventType.ADD_COUNTERS, objectId, controllerId, name, amount); - countersEvent.setAppliedEffects(appliedEffects); - if (!game.replaceEvent(countersEvent)) { - for (int i = 0; i < countersEvent.getAmount(); i++) { - GameEvent event = GameEvent.getEvent(GameEvent.EventType.ADD_COUNTER, objectId, controllerId, name, 1); - event.setAppliedEffects(appliedEffects); - if (!game.replaceEvent(event)) { - counters.addCounter(name, 1); - game.fireEvent(GameEvent.getEvent(GameEvent.EventType.COUNTER_ADDED, objectId, controllerId, name, 1)); - } else { - returnCode = false; - } - } - game.fireEvent(GameEvent.getEvent(GameEvent.EventType.COUNTERS_ADDED, objectId, controllerId, name, amount)); - } else { - returnCode = false; - } - return returnCode; - } - - @Override - public boolean addCounters(Counter counter, Game game, ArrayList appliedEffects) { - boolean returnCode = true; - GameEvent countersEvent = GameEvent.getEvent(GameEvent.EventType.ADD_COUNTERS, objectId, controllerId, counter.getName(), counter.getCount()); - countersEvent.setAppliedEffects(appliedEffects); - if (!game.replaceEvent(countersEvent)) { - int amount = countersEvent.getAmount(); - for (int i = 0; i < amount; i++) { - Counter eventCounter = counter.copy(); - eventCounter.remove(eventCounter.getCount() - 1); - GameEvent event = GameEvent.getEvent(GameEvent.EventType.ADD_COUNTER, objectId, controllerId, counter.getName(), 1); - event.setAppliedEffects(appliedEffects); - if (!game.replaceEvent(event)) { - counters.addCounter(eventCounter); - game.fireEvent(GameEvent.getEvent(GameEvent.EventType.COUNTER_ADDED, objectId, controllerId, counter.getName(), 1)); - } else { - returnCode = false; - } - } - game.fireEvent(GameEvent.getEvent(GameEvent.EventType.COUNTERS_ADDED, objectId, controllerId, counter.getName(), amount)); - } else { - returnCode = false; - } - return returnCode; - } - - @Override - public void removeCounters(String name, int amount, Game game) { - for (int i = 0; i < amount; i++) { - counters.removeCounter(name, 1); - GameEvent event = GameEvent.getEvent(GameEvent.EventType.COUNTER_REMOVED, objectId, controllerId); - event.setData(name); - game.fireEvent(event); - } - } - - @Override - public void removeCounters(Counter counter, Game game) { - removeCounters(counter.getName(), counter.getCount(), game); + protected UUID getControllerOrOwner() { + return controllerId; } @Override @@ -878,10 +815,10 @@ public abstract class PermanentImpl extends CardImpl implements Permanent { int actualDamage = event.getAmount(); if (actualDamage > 0) { int countersToRemove = actualDamage; - if (countersToRemove > getCounters().getCount(CounterType.LOYALTY)) { - countersToRemove = getCounters().getCount(CounterType.LOYALTY); + if (countersToRemove > getCounters(game).getCount(CounterType.LOYALTY)) { + countersToRemove = getCounters(game).getCount(CounterType.LOYALTY); } - getCounters().removeCounter(CounterType.LOYALTY, countersToRemove); + getCounters(game).removeCounter(CounterType.LOYALTY, countersToRemove); game.fireEvent(new DamagedPlaneswalkerEvent(objectId, sourceId, controllerId, actualDamage, combat)); return actualDamage; } diff --git a/Mage/src/main/java/mage/game/permanent/PermanentMeld.java b/Mage/src/main/java/mage/game/permanent/PermanentMeld.java index 36d4f336b0b..6bd0f13116a 100644 --- a/Mage/src/main/java/mage/game/permanent/PermanentMeld.java +++ b/Mage/src/main/java/mage/game/permanent/PermanentMeld.java @@ -159,18 +159,4 @@ public class PermanentMeld extends PermanentCard { } return false; } - - @Override - public boolean addCounters(String name, int amount, Game game, ArrayList appliedEffects) { - MeldCard meldCard = (MeldCard) this.getCard(); - if (meldCard.isMelded()) { - return super.addCounters(name, amount, game, appliedEffects); - } else { - // can this really happen? - boolean returnState = true; - returnState |= meldCard.getTopHalfCard().addCounters(name, amount, game, appliedEffects); - returnState |= meldCard.getBottomHalfCard().addCounters(name, amount, game, appliedEffects); - return returnState; - } - } } diff --git a/Mage/src/main/java/mage/game/stack/Spell.java b/Mage/src/main/java/mage/game/stack/Spell.java index 6ce48963faf..85e4b2bb860 100644 --- a/Mage/src/main/java/mage/game/stack/Spell.java +++ b/Mage/src/main/java/mage/game/stack/Spell.java @@ -56,6 +56,7 @@ import mage.constants.ZoneDetail; import mage.counters.Counter; import mage.counters.Counters; import mage.game.Game; +import mage.game.GameState; import mage.game.events.GameEvent; import mage.game.events.GameEvent.EventType; import mage.game.events.ZoneChangeEvent; @@ -829,13 +830,8 @@ public class Spell extends StackObjImpl implements Card { } @Override - public boolean addCounters(String name, int amount, Game game) { - return card.addCounters(name, amount, game); - } - - @Override - public boolean addCounters(String name, int amount, Game game, ArrayList appliedEffects) { - return card.addCounters(name, amount, game, appliedEffects); + public Counters getCounters(GameState state) { + return card.getCounters(state); } @Override diff --git a/Mage/src/main/java/mage/players/Player.java b/Mage/src/main/java/mage/players/Player.java index 72cdb89893b..f476c8c5a3f 100644 --- a/Mage/src/main/java/mage/players/Player.java +++ b/Mage/src/main/java/mage/players/Player.java @@ -654,27 +654,17 @@ public interface Player extends MageItem, Copyable { * Moves cards from one zone to another * * @param cards - * @param fromZone * @param toZone * @param source * @param game * @return */ - @Deprecated - boolean moveCards(Cards cards, Zone fromZone, Zone toZone, Ability source, Game game); - - @Deprecated - boolean moveCards(Card card, Zone fromZone, Zone toZone, Ability source, Game game); - - @Deprecated - boolean moveCards(Set cards, Zone fromZone, Zone toZone, Ability source, Game game); + boolean moveCards(Cards cards, Zone toZone, Ability source, Game game); boolean moveCards(Card card, Zone toZone, Ability source, Game game); boolean moveCards(Card card, Zone toZone, Ability source, Game game, boolean tapped, boolean faceDown, boolean byOwner, ArrayList appliedEffects); - boolean moveCards(Cards cards, Zone toZone, Ability source, Game game); - boolean moveCards(Set cards, Zone toZone, Ability source, Game game); /** diff --git a/Mage/src/main/java/mage/players/PlayerImpl.java b/Mage/src/main/java/mage/players/PlayerImpl.java index 67c344afbb6..d921af4bd41 100644 --- a/Mage/src/main/java/mage/players/PlayerImpl.java +++ b/Mage/src/main/java/mage/players/PlayerImpl.java @@ -1838,19 +1838,30 @@ public abstract class PlayerImpl implements Player, Serializable { @Override public boolean addCounters(Counter counter, Game game) { - boolean returnState = true; - int amount = counter.getCount(); - for (int i = 0; i < amount; i++) { - Counter eventCounter = counter.copy(); - eventCounter.remove(amount - 1); - if (!game.replaceEvent(GameEvent.getEvent(GameEvent.EventType.ADD_COUNTER, playerId, playerId, counter.getName(), counter.getCount()))) { - counters.addCounter(eventCounter); - game.fireEvent(GameEvent.getEvent(EventType.COUNTER_ADDED, playerId, playerId, counter.getName(), counter.getCount())); - } else { - returnState = false; + boolean returnCode = true; + GameEvent countersEvent = GameEvent.getEvent(EventType.ADD_COUNTERS, playerId, playerId, counter.getName(), counter.getCount()); + if (!game.replaceEvent(countersEvent)) { + int amount = countersEvent.getAmount(); + int finalAmount = amount; + for (int i = 0; i < amount; i++) { + Counter eventCounter = counter.copy(); + eventCounter.remove(amount - 1); + GameEvent event = GameEvent.getEvent(EventType.ADD_COUNTER, playerId, playerId, counter.getName(), 1); + if (!game.replaceEvent(event)) { + getCounters().addCounter(eventCounter); + game.fireEvent(GameEvent.getEvent(EventType.COUNTER_ADDED, playerId, playerId, counter.getName(), 1)); + } else { + finalAmount--; + returnCode = false; + } } + if(finalAmount > 0) { + game.fireEvent(GameEvent.getEvent(EventType.COUNTERS_ADDED, playerId, playerId, counter.getName(), amount)); + } + } else { + returnCode = false; } - return returnState; + return returnCode; } @Override @@ -3105,55 +3116,6 @@ public abstract class PlayerImpl implements Player, Serializable { return this.commanderId; } - @Override - public boolean moveCards(Cards cards, Zone fromZone, Zone toZone, Ability source, Game game) { - if (cards.isEmpty()) { - return true; - } - Set cardList = new HashSet<>(); - for (UUID cardId : cards) { - fromZone = game.getState().getZone(cardId); - if (Zone.BATTLEFIELD.equals(fromZone)) { - Permanent permanent = game.getPermanent(cardId); - if (permanent != null) { - cardList.add(permanent); - } - } else { - Card card = game.getCard(cardId); - if (card == null) { - Spell spell = game.getState().getStack().getSpell(cardId); - if (spell != null) { - if (!spell.isCopy()) { - card = spell.getCard(); - } else { - // If a spell is returned to its owner's hand, it's removed from the stack and thus will not resolve - game.getStack().remove(spell); - game.informPlayers(spell.getLogName() + " was removed from the stack"); - } - } - } - if (card != null) { - cardList.add(card); - } - } - } - return moveCards(cardList, toZone, source, game); - } - - @Override - public boolean moveCards(Card card, Zone fromZone, Zone toZone, Ability source, Game game) { - Set cardList = new HashSet<>(); - if (card != null) { - cardList.add(card); - } - return moveCards(cardList, toZone, source, game); - } - - @Override - public boolean moveCards(Set cards, Zone fromZone, Zone toZone, Ability source, Game game) { - return moveCards(cards, toZone, source, game); - } - @Override public boolean moveCards(Card card, Zone toZone, Ability source, Game game) { return moveCards(card, toZone, source, game, false, false, false, null); diff --git a/Mage/src/main/java/mage/target/common/TargetPermanentOrPlayerWithCounter.java b/Mage/src/main/java/mage/target/common/TargetPermanentOrPlayerWithCounter.java index 700c5c4f845..ae63a8aba97 100644 --- a/Mage/src/main/java/mage/target/common/TargetPermanentOrPlayerWithCounter.java +++ b/Mage/src/main/java/mage/target/common/TargetPermanentOrPlayerWithCounter.java @@ -80,7 +80,7 @@ public class TargetPermanentOrPlayerWithCounter extends TargetPermanentOrPlayer public boolean canTarget(UUID id, Game game) { Permanent permanent = game.getPermanent(id); if (permanent != null) { - if (permanent.getCounters().size() == 0) { + if (permanent.getCounters(game).size() == 0) { return false; } } @@ -97,7 +97,7 @@ public class TargetPermanentOrPlayerWithCounter extends TargetPermanentOrPlayer public boolean canTarget(UUID id, Ability source, Game game) { Permanent permanent = game.getPermanent(id); if (permanent != null) { - if (permanent.getCounters().size() == 0) { + if (permanent.getCounters(game).size() == 0) { return false; } }