From e5344b7a960f5b2efbcc8ea5adfde86ffad941c3 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Thu, 21 Jan 2021 18:13:51 -0500 Subject: [PATCH] Refactoring snow mana to allow tracking how much is spent (Ready for Review) (#7406) * refactored mana methods to WUBRG order * more WUBRG refactoring * added new mana tracking object * fixed code error * fixed missing mana count * fixed null pointer exception in tests * fixed issue with equality * more equality fixes * some cosmetic changes to ManaTest * added copy method to setToMana * fixed some initialization issues * fixed serialization issue * [KHM] Implemented Search for Glory * updated mana handling to track snow * added tests for snow mana tracking * updated implementation of setter methods * updated paramater to use copy methods * fixed snow mana test to ensure proper mana tapping * replaced instances of getPayment with getUsedManaToPay * updated tracking of snow mana * reverted snow mana tracking removal * finished reverting change --- Mage.Sets/src/mage/cards/a/AncientSpring.java | 2 +- .../cards/a/ArixmethesSlumberingIsle.java | 2 +- .../src/mage/cards/a/AxebaneGuardian.java | 2 +- .../src/mage/cards/a/AzoriusChancery.java | 2 +- Mage.Sets/src/mage/cards/a/AzoriusSignet.java | 2 +- .../mage/cards/b/BalduvianTradingPost.java | 2 +- .../src/mage/cards/b/BurningTreeEmissary.java | 2 +- .../src/mage/cards/c/CadaverousBloom.java | 5 +- Mage.Sets/src/mage/cards/c/CascadeBluffs.java | 2 +- Mage.Sets/src/mage/cards/c/CoralAtoll.java | 2 +- .../src/mage/cards/c/CrosissAttendant.java | 2 +- .../src/mage/cards/d/DarigaazsAttendant.java | 2 +- .../src/mage/cards/d/DarkwaterCatacombs.java | 2 +- Mage.Sets/src/mage/cards/d/DarkwaterEgg.java | 2 +- Mage.Sets/src/mage/cards/d/DimirAqueduct.java | 2 +- Mage.Sets/src/mage/cards/d/DimirSignet.java | 2 +- .../src/mage/cards/d/DormantVolcano.java | 2 +- Mage.Sets/src/mage/cards/d/DoublingCube.java | 11 +- .../src/mage/cards/d/DromarsAttendant.java | 2 +- Mage.Sets/src/mage/cards/d/DroneHolocron.java | 4 +- Mage.Sets/src/mage/cards/e/Everglades.java | 2 +- Mage.Sets/src/mage/cards/f/FetidHeath.java | 2 +- .../src/mage/cards/f/FireLitThicket.java | 2 +- Mage.Sets/src/mage/cards/f/FloodedGrove.java | 2 +- .../src/mage/cards/g/GeothermalCrevice.java | 2 +- .../src/mage/cards/g/GoblinClearcutter.java | 8 +- .../src/mage/cards/g/GolgariRotFarm.java | 2 +- Mage.Sets/src/mage/cards/g/GolgariSignet.java | 2 +- Mage.Sets/src/mage/cards/g/GravenCairns.java | 2 +- Mage.Sets/src/mage/cards/g/GrinningIgnus.java | 2 +- Mage.Sets/src/mage/cards/g/GruulSignet.java | 2 +- Mage.Sets/src/mage/cards/g/GruulTurf.java | 2 +- Mage.Sets/src/mage/cards/g/GyreEngineer.java | 2 +- Mage.Sets/src/mage/cards/h/HarabazDruid.java | 2 +- Mage.Sets/src/mage/cards/h/HarvestMage.java | 2 - .../src/mage/cards/i/IrrigationDitch.java | 2 +- .../src/mage/cards/i/IzzetBoilerworks.java | 2 +- Mage.Sets/src/mage/cards/i/IzzetSignet.java | 2 +- Mage.Sets/src/mage/cards/j/JediHolocron.java | 4 +- Mage.Sets/src/mage/cards/j/JungleBasin.java | 2 +- Mage.Sets/src/mage/cards/k/Karoo.java | 2 +- .../src/mage/cards/k/KnotvineMystic.java | 2 +- .../mage/cards/l/LaviniaAzoriusRenegade.java | 2 +- .../src/mage/cards/m/MarduWarshrieker.java | 2 +- Mage.Sets/src/mage/cards/m/MorgueToad.java | 2 +- Mage.Sets/src/mage/cards/m/MossfireEgg.java | 2 +- .../src/mage/cards/m/MossfireValley.java | 2 +- Mage.Sets/src/mage/cards/m/MysticGate.java | 2 +- Mage.Sets/src/mage/cards/n/NantukoElder.java | 2 +- Mage.Sets/src/mage/cards/n/Nix.java | 2 +- .../mage/cards/o/OmnathLocusOfCreation.java | 2 +- .../src/mage/cards/o/OrcishLumberjack.java | 8 +- .../src/mage/cards/o/OrzhovBasilica.java | 2 +- Mage.Sets/src/mage/cards/o/OrzhovSignet.java | 2 +- .../src/mage/cards/o/OutlawHolocron.java | 4 +- .../src/mage/cards/p/PulseOfLlanowar.java | 5 +- .../src/mage/cards/r/RakdosCarnarium.java | 2 +- Mage.Sets/src/mage/cards/r/RakdosSignet.java | 2 +- .../src/mage/cards/r/RattleclawMystic.java | 2 +- .../src/mage/cards/r/RithsAttendant.java | 2 +- Mage.Sets/src/mage/cards/r/RoilingVortex.java | 2 +- Mage.Sets/src/mage/cards/s/SavageVentmaw.java | 2 +- .../src/mage/cards/s/SearchForGlory.java | 67 + .../src/mage/cards/s/SelesnyaSanctuary.java | 2 +- .../src/mage/cards/s/SelesnyaSignet.java | 2 +- .../src/mage/cards/s/ShadowbloodEgg.java | 2 +- .../src/mage/cards/s/ShadowbloodRidge.java | 2 +- .../src/mage/cards/s/SimicGrowthChamber.java | 2 +- Mage.Sets/src/mage/cards/s/SimicSignet.java | 2 +- Mage.Sets/src/mage/cards/s/SithHolocron.java | 4 +- Mage.Sets/src/mage/cards/s/SkycloudEgg.java | 2 +- .../src/mage/cards/s/SkycloudExpanse.java | 2 +- .../src/mage/cards/s/SoldeviExcavations.java | 2 +- Mage.Sets/src/mage/cards/s/SoulBurn.java | 12 +- .../src/mage/cards/s/SpringjackPasture.java | 2 +- Mage.Sets/src/mage/cards/s/SulfurVent.java | 2 +- .../src/mage/cards/s/SunderingStroke.java | 2 +- Mage.Sets/src/mage/cards/s/SungrassEgg.java | 2 +- .../src/mage/cards/s/SungrassPrairie.java | 2 +- Mage.Sets/src/mage/cards/s/SunkenRuins.java | 2 +- .../src/mage/cards/t/TrevasAttendant.java | 2 +- Mage.Sets/src/mage/cards/t/TwilightMire.java | 2 +- Mage.Sets/src/mage/cards/w/WildHolocron.java | 4 +- .../src/mage/cards/w/WirewoodChanneler.java | 2 +- Mage.Sets/src/mage/cards/w/WoodedBastion.java | 2 +- .../mage/cards/y/YurlokOfScorchThrash.java | 4 +- Mage.Sets/src/mage/sets/Kaldheim.java | 1 + .../conditional/ManaWasSpentToCastTest.java | 52 +- Mage/src/main/java/mage/ConditionalMana.java | 44 +- Mage/src/main/java/mage/Mana.java | 1141 +++++++++-------- .../condition/common/AdamantCondition.java | 4 +- .../common/ManaWasSpentCondition.java | 2 +- .../abilities/costs/mana/ManaCostImpl.java | 67 +- .../common/SnowManaSpentValue.java | 49 + .../dynamicvalue/common/SunburstCount.java | 2 +- Mage/src/main/java/mage/players/ManaPool.java | 49 +- .../main/java/mage/players/ManaPoolItem.java | 2 +- .../common/ManaSpentToCastWatcher.java | 2 +- Mage/src/test/java/mage/ManaTest.java | 25 +- 99 files changed, 1006 insertions(+), 720 deletions(-) create mode 100644 Mage.Sets/src/mage/cards/s/SearchForGlory.java create mode 100644 Mage/src/main/java/mage/abilities/dynamicvalue/common/SnowManaSpentValue.java diff --git a/Mage.Sets/src/mage/cards/a/AncientSpring.java b/Mage.Sets/src/mage/cards/a/AncientSpring.java index 597fefb4242..9c0773e9237 100644 --- a/Mage.Sets/src/mage/cards/a/AncientSpring.java +++ b/Mage.Sets/src/mage/cards/a/AncientSpring.java @@ -28,7 +28,7 @@ public final class AncientSpring extends CardImpl { // {tap}: Add {U}. this.addAbility(new BlueManaAbility()); // {tap}, Sacrifice Ancient Spring: Add {W}{B}. - Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 0, 0, 1, 1, 0, 0, 0), new TapSourceCost()); + Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(1, 0, 1, 0, 0, 0, 0, 0), new TapSourceCost()); ability.addCost(new SacrificeSourceCost()); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/a/ArixmethesSlumberingIsle.java b/Mage.Sets/src/mage/cards/a/ArixmethesSlumberingIsle.java index 54a880253dc..bbed41c68dd 100644 --- a/Mage.Sets/src/mage/cards/a/ArixmethesSlumberingIsle.java +++ b/Mage.Sets/src/mage/cards/a/ArixmethesSlumberingIsle.java @@ -58,7 +58,7 @@ public final class ArixmethesSlumberingIsle extends CardImpl { this.addAbility(new SpellCastControllerTriggeredAbility(new RemoveCounterSourceEffect(CounterType.SLUMBER.createInstance(1)), true)); // {T}: Add {G}{U}. - this.addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 1, 1, 0, 0, 0, 0, 0), new TapSourceCost())); + this.addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 1, 0, 0, 1, 0, 0, 0), new TapSourceCost())); } public ArixmethesSlumberingIsle(final ArixmethesSlumberingIsle card) { diff --git a/Mage.Sets/src/mage/cards/a/AxebaneGuardian.java b/Mage.Sets/src/mage/cards/a/AxebaneGuardian.java index 4c2fd3048e6..97bc3e581aa 100644 --- a/Mage.Sets/src/mage/cards/a/AxebaneGuardian.java +++ b/Mage.Sets/src/mage/cards/a/AxebaneGuardian.java @@ -39,7 +39,7 @@ public final class AxebaneGuardian extends CardImpl { this.addAbility(DefenderAbility.getInstance()); // {tap}: Add X mana in any combination of colors, where X is the number of creatures with defender you control. - this.addAbility(new DynamicManaAbility(new Mana(0,0,0,0,0,0,1, 0), new PermanentsOnBattlefieldCount(filter), + this.addAbility(new DynamicManaAbility(new Mana(0, 0, 0, 0,0, 0,1, 0), new PermanentsOnBattlefieldCount(filter), "Add X mana in any combination of colors, where X is the number of creatures with defender you control.")); } diff --git a/Mage.Sets/src/mage/cards/a/AzoriusChancery.java b/Mage.Sets/src/mage/cards/a/AzoriusChancery.java index db59de07679..c3655fd2151 100644 --- a/Mage.Sets/src/mage/cards/a/AzoriusChancery.java +++ b/Mage.Sets/src/mage/cards/a/AzoriusChancery.java @@ -31,7 +31,7 @@ public final class AzoriusChancery extends CardImpl { // When Azorius Chancery enters the battlefield, return a land you control to its owner's hand. this.addAbility(new EntersBattlefieldTriggeredAbility(new ReturnToHandChosenControlledPermanentEffect(filter), false)); // {tap}: Add {W}{U}. - this.addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 0, 1, 1, 0, 0, 0, 0), new TapSourceCost())); + this.addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(1, 1, 0, 0, 0, 0, 0, 0), new TapSourceCost())); } public AzoriusChancery(final AzoriusChancery card) { diff --git a/Mage.Sets/src/mage/cards/a/AzoriusSignet.java b/Mage.Sets/src/mage/cards/a/AzoriusSignet.java index ab51dfbd305..ae67c56c6e9 100644 --- a/Mage.Sets/src/mage/cards/a/AzoriusSignet.java +++ b/Mage.Sets/src/mage/cards/a/AzoriusSignet.java @@ -22,7 +22,7 @@ public final class AzoriusSignet extends CardImpl { super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{2}"); // {1}, {tap}: Add {W}{U}. - Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 0, 1, 1, 0, 0, 0, 0), new GenericManaCost(1)); + Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(1, 1, 0, 0, 0, 0, 0, 0), new GenericManaCost(1)); ability.addCost(new TapSourceCost()); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/b/BalduvianTradingPost.java b/Mage.Sets/src/mage/cards/b/BalduvianTradingPost.java index a1cb0d18d56..3ce99795da5 100644 --- a/Mage.Sets/src/mage/cards/b/BalduvianTradingPost.java +++ b/Mage.Sets/src/mage/cards/b/BalduvianTradingPost.java @@ -43,7 +43,7 @@ public final class BalduvianTradingPost extends CardImpl { this.addAbility(new SimpleStaticAbility(Zone.ALL, new EnterBattlefieldPayCostOrPutGraveyardEffect(new SacrificeTargetCost(new TargetControlledPermanent(filter))))); // {tap}: Add {C}{R}. - this.addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(1, 0, 0, 0, 0, 0, 0, 1), new TapSourceCost())); + this.addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 0, 0, 1, 0, 0, 0, 1), new TapSourceCost())); // {1}, {tap}: Balduvian Trading Post deals 1 damage to target attacking creature. Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DamageTargetEffect(1), new GenericManaCost(1)); diff --git a/Mage.Sets/src/mage/cards/b/BurningTreeEmissary.java b/Mage.Sets/src/mage/cards/b/BurningTreeEmissary.java index 34988ba008f..3f6e6d38acd 100644 --- a/Mage.Sets/src/mage/cards/b/BurningTreeEmissary.java +++ b/Mage.Sets/src/mage/cards/b/BurningTreeEmissary.java @@ -25,7 +25,7 @@ public final class BurningTreeEmissary extends CardImpl { this.toughness = new MageInt(2); // When Burning-Tree Emissary enters the battlefield, add {R}{G}. - this.addAbility(new EntersBattlefieldTriggeredAbility(new BasicManaEffect(new Mana(1,1,0,0,0,0,0, 0)))); + this.addAbility(new EntersBattlefieldTriggeredAbility(new BasicManaEffect(new Mana(0, 0, 0, 1,1, 0,0, 0)))); } public BurningTreeEmissary(final BurningTreeEmissary card) { diff --git a/Mage.Sets/src/mage/cards/c/CadaverousBloom.java b/Mage.Sets/src/mage/cards/c/CadaverousBloom.java index 251a217076c..fc9f6643334 100644 --- a/Mage.Sets/src/mage/cards/c/CadaverousBloom.java +++ b/Mage.Sets/src/mage/cards/c/CadaverousBloom.java @@ -69,11 +69,8 @@ class CadaverousBloomManaEffect extends BasicManaEffect { int count = player.getHand().size(); if (count > 0) { Mana mana = new Mana( - getManaTemplate().getRed() * count, + getManaTemplate().getWhite() * count, getManaTemplate().getBlue() * count, getManaTemplate().getBlack() * count, getManaTemplate().getRed() * count, getManaTemplate().getGreen() * count, - getManaTemplate().getBlue() * count, - getManaTemplate().getWhite() * count, - getManaTemplate().getBlack() * count, getManaTemplate().getGeneric() * count, getManaTemplate().getAny() * count, getManaTemplate().getColorless() * count diff --git a/Mage.Sets/src/mage/cards/c/CascadeBluffs.java b/Mage.Sets/src/mage/cards/c/CascadeBluffs.java index edf54b165b6..1f5809d859b 100644 --- a/Mage.Sets/src/mage/cards/c/CascadeBluffs.java +++ b/Mage.Sets/src/mage/cards/c/CascadeBluffs.java @@ -29,7 +29,7 @@ public final class CascadeBluffs extends CardImpl { ability.addCost(new TapSourceCost()); this.addAbility(ability); - ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(1, 0, 1, 0, 0, 0, 0, 0), new ManaCostsImpl("{U/R}")); + ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 1, 0, 1, 0, 0, 0, 0), new ManaCostsImpl("{U/R}")); ability.addCost(new TapSourceCost()); this.addAbility(ability); diff --git a/Mage.Sets/src/mage/cards/c/CoralAtoll.java b/Mage.Sets/src/mage/cards/c/CoralAtoll.java index b084d0e6ad7..a5def22126b 100644 --- a/Mage.Sets/src/mage/cards/c/CoralAtoll.java +++ b/Mage.Sets/src/mage/cards/c/CoralAtoll.java @@ -40,7 +40,7 @@ public final class CoralAtoll extends CardImpl { // When Coral Atoll enters the battlefield, sacrifice it unless you return an untapped Island you control to its owner's hand. this.addAbility(new EntersBattlefieldTriggeredAbility(new SacrificeSourceUnlessPaysEffect(new ReturnToHandChosenControlledPermanentCost(new TargetControlledPermanent(filter))))); // {tap}: Add {C}{U}. - this.addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 0, 1, 0, 0, 0, 0, 1), new TapSourceCost())); + this.addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 1, 0, 0, 0, 0, 0, 1), new TapSourceCost())); } diff --git a/Mage.Sets/src/mage/cards/c/CrosissAttendant.java b/Mage.Sets/src/mage/cards/c/CrosissAttendant.java index 71871c7f4e9..61720ff457c 100644 --- a/Mage.Sets/src/mage/cards/c/CrosissAttendant.java +++ b/Mage.Sets/src/mage/cards/c/CrosissAttendant.java @@ -28,7 +28,7 @@ public final class CrosissAttendant extends CardImpl { this.toughness = new MageInt(3); // {1}, Sacrifice Crosis's Attendant: Add {U}{B}{R}. - Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(1, 0, 1, 0, 1, 0, 0, 0), new ManaCostsImpl("{1}")); + Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 1, 1, 1, 0, 0, 0, 0), new ManaCostsImpl("{1}")); ability.addCost(new SacrificeSourceCost()); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/d/DarigaazsAttendant.java b/Mage.Sets/src/mage/cards/d/DarigaazsAttendant.java index 06863535b76..c2cdedc0280 100644 --- a/Mage.Sets/src/mage/cards/d/DarigaazsAttendant.java +++ b/Mage.Sets/src/mage/cards/d/DarigaazsAttendant.java @@ -28,7 +28,7 @@ public final class DarigaazsAttendant extends CardImpl { this.toughness = new MageInt(3); // {1}, Sacrifice Darigaaz's Attendant: Add {B}{R}{G}. - Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(1, 1, 0, 0, 1, 0, 0, 0), new ManaCostsImpl("{1}")); + Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 0, 1, 1, 1, 0, 0, 0), new ManaCostsImpl("{1}")); ability.addCost(new SacrificeSourceCost()); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/d/DarkwaterCatacombs.java b/Mage.Sets/src/mage/cards/d/DarkwaterCatacombs.java index 8748bdbe3fc..7f8dc2af184 100644 --- a/Mage.Sets/src/mage/cards/d/DarkwaterCatacombs.java +++ b/Mage.Sets/src/mage/cards/d/DarkwaterCatacombs.java @@ -22,7 +22,7 @@ public final class DarkwaterCatacombs extends CardImpl { super(ownerId,setInfo,new CardType[]{CardType.LAND},""); // {1}, {tap}: Add {U}{B}. - Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 0, 1, 0, 1, 0, 0, 0), new ManaCostsImpl("{1}")); + Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 1, 1, 0, 0, 0, 0, 0), new ManaCostsImpl("{1}")); ability.addCost(new TapSourceCost()); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/d/DarkwaterEgg.java b/Mage.Sets/src/mage/cards/d/DarkwaterEgg.java index eeefbdf44e2..69bc3e41699 100644 --- a/Mage.Sets/src/mage/cards/d/DarkwaterEgg.java +++ b/Mage.Sets/src/mage/cards/d/DarkwaterEgg.java @@ -24,7 +24,7 @@ public final class DarkwaterEgg extends CardImpl { super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{1}"); // {2}, {tap}, Sacrifice Darkwater Egg: Add {U}{B}. Draw a card. - ActivatedManaAbilityImpl ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 0, 1, 0, 1, 0, 0, 0), new ManaCostsImpl("{2}")); + ActivatedManaAbilityImpl ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 1, 1, 0, 0, 0, 0, 0), new ManaCostsImpl("{2}")); ability.addCost(new TapSourceCost()); ability.addCost(new SacrificeSourceCost()); ability.addEffect(new DrawCardSourceControllerEffect(1)); diff --git a/Mage.Sets/src/mage/cards/d/DimirAqueduct.java b/Mage.Sets/src/mage/cards/d/DimirAqueduct.java index a55923a750b..aa7a06211d6 100644 --- a/Mage.Sets/src/mage/cards/d/DimirAqueduct.java +++ b/Mage.Sets/src/mage/cards/d/DimirAqueduct.java @@ -30,7 +30,7 @@ public final class DimirAqueduct extends CardImpl { // When Dimir Aqueduct enters the battlefield, return a land you control to its owner's hand. this.addAbility(new EntersBattlefieldTriggeredAbility(new ReturnToHandChosenControlledPermanentEffect(filter))); // {tap}: Add {U}{B}. - this.addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 0, 1, 0, 1, 0, 0, 0), new TapSourceCost())); + this.addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 1, 1, 0, 0, 0, 0, 0), new TapSourceCost())); } public DimirAqueduct(final DimirAqueduct card) { diff --git a/Mage.Sets/src/mage/cards/d/DimirSignet.java b/Mage.Sets/src/mage/cards/d/DimirSignet.java index 99e5c3ce33f..aedb749fe59 100644 --- a/Mage.Sets/src/mage/cards/d/DimirSignet.java +++ b/Mage.Sets/src/mage/cards/d/DimirSignet.java @@ -21,7 +21,7 @@ public final class DimirSignet extends CardImpl { public DimirSignet (UUID ownerId, CardSetInfo setInfo) { super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{2}"); - Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 0, 1, 0, 1, 0, 0, 0), new GenericManaCost(1)); + Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 1, 1, 0, 0, 0, 0, 0), new GenericManaCost(1)); ability.addCost(new TapSourceCost()); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/d/DormantVolcano.java b/Mage.Sets/src/mage/cards/d/DormantVolcano.java index 55b938ce458..8b4abf5c4fe 100644 --- a/Mage.Sets/src/mage/cards/d/DormantVolcano.java +++ b/Mage.Sets/src/mage/cards/d/DormantVolcano.java @@ -42,7 +42,7 @@ public final class DormantVolcano extends CardImpl { this.addAbility(new EntersBattlefieldTriggeredAbility(new SacrificeSourceUnlessPaysEffect(new ReturnToHandChosenControlledPermanentCost(new TargetControlledPermanent(filter))))); // {tap}: Add {C}{R}. - this.addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(1, 0, 0, 0, 0, 0, 0, 1), new TapSourceCost())); + this.addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 0, 0, 1, 0, 0, 0, 1), new TapSourceCost())); } diff --git a/Mage.Sets/src/mage/cards/d/DoublingCube.java b/Mage.Sets/src/mage/cards/d/DoublingCube.java index 12618afe938..005972d6a1f 100644 --- a/Mage.Sets/src/mage/cards/d/DoublingCube.java +++ b/Mage.Sets/src/mage/cards/d/DoublingCube.java @@ -59,12 +59,9 @@ class DoublingCubeEffect extends ManaEffect { public List getNetMana(Game game, Mana possibleManaInPool, Ability source) { List netMana = new ArrayList<>(); netMana.add(new Mana( // remove possible mana conditions - possibleManaInPool.getRed(), - possibleManaInPool.getGreen(), - possibleManaInPool.getBlue(), - possibleManaInPool.getWhite(), - possibleManaInPool.getBlack(), - 0, // Generic may not be included + possibleManaInPool.getWhite(), possibleManaInPool.getBlue(), possibleManaInPool.getBlack(), possibleManaInPool.getRed(), + possibleManaInPool.getGreen(), + 0, // Generic may not be included possibleManaInPool.getAny(), possibleManaInPool.getColorless()) ); @@ -91,7 +88,7 @@ class DoublingCubeEffect extends ManaEffect { redMana += conditionalMana.getRed(); colorlessMana += conditionalMana.getColorless(); } - return new Mana(redMana, greenMana, blueMana, whiteMana, blackMana, 0, 0, colorlessMana); + return new Mana(whiteMana, blueMana, blackMana, redMana, greenMana, 0, 0, colorlessMana); } } return new Mana(); diff --git a/Mage.Sets/src/mage/cards/d/DromarsAttendant.java b/Mage.Sets/src/mage/cards/d/DromarsAttendant.java index ce7d4cbdd78..79d6bd64534 100644 --- a/Mage.Sets/src/mage/cards/d/DromarsAttendant.java +++ b/Mage.Sets/src/mage/cards/d/DromarsAttendant.java @@ -28,7 +28,7 @@ public final class DromarsAttendant extends CardImpl { this.toughness = new MageInt(3); // {1}, Sacrifice Dromar's Attendant: Add {W}{U}{B}. - Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 0, 1, 1, 1, 0, 0, 0), new ManaCostsImpl("{1}")); + Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(1, 1, 1, 0, 0, 0, 0, 0), new ManaCostsImpl("{1}")); ability.addCost(new SacrificeSourceCost()); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/d/DroneHolocron.java b/Mage.Sets/src/mage/cards/d/DroneHolocron.java index f3734bb3d1f..c26a416eea5 100644 --- a/Mage.Sets/src/mage/cards/d/DroneHolocron.java +++ b/Mage.Sets/src/mage/cards/d/DroneHolocron.java @@ -48,11 +48,11 @@ public final class DroneHolocron extends CardImpl { // {T}, Remove two charge counters from Drone Holocron: Add WU or UB. cost = new RemoveCountersSourceCost(CounterType.CHARGE.createInstance(2)); - ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 0, 1, 1, 0, 0, 0, 0), new TapSourceCost()); + ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(1, 1, 0, 0, 0, 0, 0, 0), new TapSourceCost()); ability.addCost(cost); this.addAbility(ability); - ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 0, 1, 0, 1, 0, 0, 0), new TapSourceCost()); + ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 1, 1, 0, 0, 0, 0, 0), new TapSourceCost()); ability.addCost(cost); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/e/Everglades.java b/Mage.Sets/src/mage/cards/e/Everglades.java index 668a5ffa3dd..445d998ebf2 100644 --- a/Mage.Sets/src/mage/cards/e/Everglades.java +++ b/Mage.Sets/src/mage/cards/e/Everglades.java @@ -42,7 +42,7 @@ public final class Everglades extends CardImpl { this.addAbility(new EntersBattlefieldTriggeredAbility(new SacrificeSourceUnlessPaysEffect(new ReturnToHandChosenControlledPermanentCost(new TargetControlledPermanent(1, 1, filter, true))))); // {tap}: Add {C}{B}. - this.addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 0, 0, 0, 1, 0, 0, 1), new TapSourceCost())); + this.addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 0, 1, 0, 0, 0, 0, 1), new TapSourceCost())); } diff --git a/Mage.Sets/src/mage/cards/f/FetidHeath.java b/Mage.Sets/src/mage/cards/f/FetidHeath.java index 4833f452da0..9bbbd9f0fbf 100644 --- a/Mage.Sets/src/mage/cards/f/FetidHeath.java +++ b/Mage.Sets/src/mage/cards/f/FetidHeath.java @@ -30,7 +30,7 @@ public final class FetidHeath extends CardImpl { ability.addCost(new TapSourceCost()); this.addAbility(ability); - ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 0, 0, 1, 1, 0, 0, 0), new ManaCostsImpl("{W/B}")); + ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(1, 0, 1, 0, 0, 0, 0, 0), new ManaCostsImpl("{W/B}")); ability.addCost(new TapSourceCost()); this.addAbility(ability); diff --git a/Mage.Sets/src/mage/cards/f/FireLitThicket.java b/Mage.Sets/src/mage/cards/f/FireLitThicket.java index eee5d4480d0..9c616df7308 100644 --- a/Mage.Sets/src/mage/cards/f/FireLitThicket.java +++ b/Mage.Sets/src/mage/cards/f/FireLitThicket.java @@ -28,7 +28,7 @@ public final class FireLitThicket extends CardImpl { ability.addCost(new TapSourceCost()); this.addAbility(ability); - ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(1, 1, 0, 0, 0, 0, 0, 0), new ManaCostsImpl("{R/G}")); + ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 0, 0, 1, 1, 0, 0, 0), new ManaCostsImpl("{R/G}")); ability.addCost(new TapSourceCost()); this.addAbility(ability); diff --git a/Mage.Sets/src/mage/cards/f/FloodedGrove.java b/Mage.Sets/src/mage/cards/f/FloodedGrove.java index 10a190bf964..4f188f34188 100644 --- a/Mage.Sets/src/mage/cards/f/FloodedGrove.java +++ b/Mage.Sets/src/mage/cards/f/FloodedGrove.java @@ -30,7 +30,7 @@ public final class FloodedGrove extends CardImpl { ability.addCost(new TapSourceCost()); this.addAbility(ability); - ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 1, 1, 0, 0, 0, 0, 0), new ManaCostsImpl("{G/U}")); + ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 1, 0, 0, 1, 0, 0, 0), new ManaCostsImpl("{G/U}")); ability.addCost(new TapSourceCost()); this.addAbility(ability); diff --git a/Mage.Sets/src/mage/cards/g/GeothermalCrevice.java b/Mage.Sets/src/mage/cards/g/GeothermalCrevice.java index a9265f8f232..b508813a1a0 100644 --- a/Mage.Sets/src/mage/cards/g/GeothermalCrevice.java +++ b/Mage.Sets/src/mage/cards/g/GeothermalCrevice.java @@ -28,7 +28,7 @@ public final class GeothermalCrevice extends CardImpl { // {tap}: Add {R}. this.addAbility(new RedManaAbility()); // {tap}, Sacrifice Geothermal Crevice: Add {B}{G}. - Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 1, 0, 0, 1, 0, 0, 0), new TapSourceCost()); + Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 0, 1, 0, 1, 0, 0, 0), new TapSourceCost()); ability.addCost(new SacrificeSourceCost()); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/g/GoblinClearcutter.java b/Mage.Sets/src/mage/cards/g/GoblinClearcutter.java index 4becf0f4854..f0b5ca9e98a 100644 --- a/Mage.Sets/src/mage/cards/g/GoblinClearcutter.java +++ b/Mage.Sets/src/mage/cards/g/GoblinClearcutter.java @@ -63,10 +63,10 @@ class GoblinClearCutterManaEffect extends ManaEffect { public GoblinClearCutterManaEffect() { super(); this.staticText = "Add 3 mana in any combination of {R} and/or {G}"; - netMana.add(new Mana(0, 3, 0, 0, 0, 0, 0, 0)); - netMana.add(new Mana(1, 2, 0, 0, 0, 0, 0, 0)); - netMana.add(new Mana(2, 1, 0, 0, 0, 0, 0, 0)); - netMana.add(new Mana(3, 0, 0, 0, 0, 0, 0, 0)); + netMana.add(new Mana(0, 0, 0, 0, 3, 0, 0, 0)); + netMana.add(new Mana(0, 0, 0, 1, 2, 0, 0, 0)); + netMana.add(new Mana(0, 0, 0, 2, 1, 0, 0, 0)); + netMana.add(new Mana(0, 0, 0, 3, 0, 0, 0, 0)); } public GoblinClearCutterManaEffect(final GoblinClearCutterManaEffect effect) { diff --git a/Mage.Sets/src/mage/cards/g/GolgariRotFarm.java b/Mage.Sets/src/mage/cards/g/GolgariRotFarm.java index 47fa90282d9..b30040db55d 100644 --- a/Mage.Sets/src/mage/cards/g/GolgariRotFarm.java +++ b/Mage.Sets/src/mage/cards/g/GolgariRotFarm.java @@ -31,7 +31,7 @@ public final class GolgariRotFarm extends CardImpl { // When Golgari Rot Farm enters the battlefield, return a land you control to its owner's hand. this.addAbility(new EntersBattlefieldTriggeredAbility(new ReturnToHandChosenControlledPermanentEffect(filter))); // {tap}: Add {B}{G}. - this.addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 1, 0, 0, 1, 0, 0, 0), new TapSourceCost())); + this.addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 0, 1, 0, 1, 0, 0, 0), new TapSourceCost())); } public GolgariRotFarm(final GolgariRotFarm card) { diff --git a/Mage.Sets/src/mage/cards/g/GolgariSignet.java b/Mage.Sets/src/mage/cards/g/GolgariSignet.java index adcabdae28a..abe9865b88f 100644 --- a/Mage.Sets/src/mage/cards/g/GolgariSignet.java +++ b/Mage.Sets/src/mage/cards/g/GolgariSignet.java @@ -21,7 +21,7 @@ public final class GolgariSignet extends CardImpl { public GolgariSignet (UUID ownerId, CardSetInfo setInfo) { super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{2}"); - Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 1, 0, 0, 1, 0, 0, 0), new GenericManaCost(1)); + Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 0, 1, 0, 1, 0, 0, 0), new GenericManaCost(1)); ability.addCost(new TapSourceCost()); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/g/GravenCairns.java b/Mage.Sets/src/mage/cards/g/GravenCairns.java index ef858289b07..797b0f6fc55 100644 --- a/Mage.Sets/src/mage/cards/g/GravenCairns.java +++ b/Mage.Sets/src/mage/cards/g/GravenCairns.java @@ -29,7 +29,7 @@ public final class GravenCairns extends CardImpl { ability.addCost(new TapSourceCost()); this.addAbility(ability); - ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(1, 0, 0, 0, 1, 0, 0, 0), new ManaCostsImpl("{B/R}")); + ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 0, 1, 1, 0, 0, 0, 0), new ManaCostsImpl("{B/R}")); ability.addCost(new TapSourceCost()); this.addAbility(ability); diff --git a/Mage.Sets/src/mage/cards/g/GrinningIgnus.java b/Mage.Sets/src/mage/cards/g/GrinningIgnus.java index 3ddea122596..04d50236850 100644 --- a/Mage.Sets/src/mage/cards/g/GrinningIgnus.java +++ b/Mage.Sets/src/mage/cards/g/GrinningIgnus.java @@ -28,7 +28,7 @@ public final class GrinningIgnus extends CardImpl { this.toughness = new MageInt(2); // {R}, Return Grinning Ignus to its owner's hand: Add {C}{C}{R}. Activate this ability only any time you could cast a sorcery. - Ability ability = new ActivateAsSorceryManaAbility(Zone.BATTLEFIELD, new Mana(1, 0, 0, 0, 0, 0, 0, 2), new ManaCostsImpl("{R}")); + Ability ability = new ActivateAsSorceryManaAbility(Zone.BATTLEFIELD, new Mana(0, 0, 0, 1, 0, 0, 0, 2), new ManaCostsImpl("{R}")); ability.addCost(new ReturnToHandFromBattlefieldSourceCost()); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/g/GruulSignet.java b/Mage.Sets/src/mage/cards/g/GruulSignet.java index fe8a00b18dc..c0b14232f3f 100644 --- a/Mage.Sets/src/mage/cards/g/GruulSignet.java +++ b/Mage.Sets/src/mage/cards/g/GruulSignet.java @@ -20,7 +20,7 @@ public final class GruulSignet extends CardImpl { public GruulSignet(UUID ownerId, CardSetInfo setInfo) { super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{2}"); - Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(1, 1, 0, 0, 0, 0, 0, 0), new GenericManaCost(1)); + Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 0, 0, 1, 1, 0, 0, 0), new GenericManaCost(1)); ability.addCost(new TapSourceCost()); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/g/GruulTurf.java b/Mage.Sets/src/mage/cards/g/GruulTurf.java index a36337b5754..6f2b46997c6 100644 --- a/Mage.Sets/src/mage/cards/g/GruulTurf.java +++ b/Mage.Sets/src/mage/cards/g/GruulTurf.java @@ -29,7 +29,7 @@ public final class GruulTurf extends CardImpl { this.addAbility(new EntersBattlefieldTriggeredAbility(new ReturnToHandChosenControlledPermanentEffect(filter), false)); - this.addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(1, 1, 0, 0, 0, 0, 0, 0), new TapSourceCost())); + this.addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 0, 0, 1, 1, 0, 0, 0), new TapSourceCost())); } public GruulTurf(final GruulTurf card) { diff --git a/Mage.Sets/src/mage/cards/g/GyreEngineer.java b/Mage.Sets/src/mage/cards/g/GyreEngineer.java index 94ee946a7d4..31496bb230e 100644 --- a/Mage.Sets/src/mage/cards/g/GyreEngineer.java +++ b/Mage.Sets/src/mage/cards/g/GyreEngineer.java @@ -26,7 +26,7 @@ public final class GyreEngineer extends CardImpl { this.toughness = new MageInt(1); // {T}: Add {G}{U}. - this.addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 1, 1, 0, 0, 0, 0, 0), new TapSourceCost())); + this.addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 1, 0, 0, 1, 0, 0, 0), new TapSourceCost())); } private GyreEngineer(final GyreEngineer card) { diff --git a/Mage.Sets/src/mage/cards/h/HarabazDruid.java b/Mage.Sets/src/mage/cards/h/HarabazDruid.java index f518ca17219..82b43e88d53 100644 --- a/Mage.Sets/src/mage/cards/h/HarabazDruid.java +++ b/Mage.Sets/src/mage/cards/h/HarabazDruid.java @@ -34,7 +34,7 @@ public final class HarabazDruid extends CardImpl { this.toughness = new MageInt(1); // {T}: Add X mana of any one color, where X is the number of Allies you control. - this.addAbility(new DynamicManaAbility(new Mana(0,0,0,0,0,0,1, 0), new PermanentsOnBattlefieldCount(filter), new TapSourceCost(), + this.addAbility(new DynamicManaAbility(new Mana(0, 0, 0, 0,0, 0,1, 0), new PermanentsOnBattlefieldCount(filter), new TapSourceCost(), "Add X mana of any one color, where X is the number of Allies you control", true)); } diff --git a/Mage.Sets/src/mage/cards/h/HarvestMage.java b/Mage.Sets/src/mage/cards/h/HarvestMage.java index 8dd0e8e0bde..e70f7a70258 100644 --- a/Mage.Sets/src/mage/cards/h/HarvestMage.java +++ b/Mage.Sets/src/mage/cards/h/HarvestMage.java @@ -2,7 +2,6 @@ package mage.cards.h; import java.util.UUID; import mage.MageInt; -import mage.MageObject; import mage.Mana; import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; @@ -21,7 +20,6 @@ import mage.constants.Zone; import mage.filter.common.FilterControlledPermanent; import mage.game.Game; import mage.game.events.GameEvent; -import mage.game.events.GameEvent.EventType; import mage.game.events.ManaEvent; import mage.game.permanent.Permanent; import mage.target.common.TargetCardInHand; diff --git a/Mage.Sets/src/mage/cards/i/IrrigationDitch.java b/Mage.Sets/src/mage/cards/i/IrrigationDitch.java index d27a85c4293..2683e941e0d 100644 --- a/Mage.Sets/src/mage/cards/i/IrrigationDitch.java +++ b/Mage.Sets/src/mage/cards/i/IrrigationDitch.java @@ -28,7 +28,7 @@ public final class IrrigationDitch extends CardImpl { // {tap}: Add {W}. this.addAbility(new WhiteManaAbility()); // {tap}, Sacrifice Irrigation Ditch: Add {G}{U}. - Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 1, 1, 0, 0, 0, 0, 0), new TapSourceCost()); + Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 1, 0, 0, 1, 0, 0, 0), new TapSourceCost()); ability.addCost(new SacrificeSourceCost()); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/i/IzzetBoilerworks.java b/Mage.Sets/src/mage/cards/i/IzzetBoilerworks.java index 17e4e26492a..d45925e5ecc 100644 --- a/Mage.Sets/src/mage/cards/i/IzzetBoilerworks.java +++ b/Mage.Sets/src/mage/cards/i/IzzetBoilerworks.java @@ -31,7 +31,7 @@ public final class IzzetBoilerworks extends CardImpl { // When Izzet Boilerworks enters the battlefield, return a land you control to its owner's hand. this.addAbility(new EntersBattlefieldTriggeredAbility(new ReturnToHandChosenControlledPermanentEffect(filter), false)); // {T}: Add {U}{R}. - this.addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(1, 0, 1, 0, 0, 0, 0, 0), new TapSourceCost())); + this.addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 1, 0, 1, 0, 0, 0, 0), new TapSourceCost())); } public IzzetBoilerworks(final IzzetBoilerworks card) { diff --git a/Mage.Sets/src/mage/cards/i/IzzetSignet.java b/Mage.Sets/src/mage/cards/i/IzzetSignet.java index 9f3599fb0a7..18b343157ef 100644 --- a/Mage.Sets/src/mage/cards/i/IzzetSignet.java +++ b/Mage.Sets/src/mage/cards/i/IzzetSignet.java @@ -22,7 +22,7 @@ public final class IzzetSignet extends CardImpl { super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{2}"); // {1}, {T}: Add {U}{R}. - Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(1, 0, 1, 0, 0, 0, 0, 0), new GenericManaCost(1)); + Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 1, 0, 1, 0, 0, 0, 0), new GenericManaCost(1)); ability.addCost(new TapSourceCost()); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/j/JediHolocron.java b/Mage.Sets/src/mage/cards/j/JediHolocron.java index c6e904d8a77..4ab70488f0d 100644 --- a/Mage.Sets/src/mage/cards/j/JediHolocron.java +++ b/Mage.Sets/src/mage/cards/j/JediHolocron.java @@ -48,11 +48,11 @@ public final class JediHolocron extends CardImpl { // {T}, Remove two charge counters from Jedi Holocron: Add GW or WU. cost = new RemoveCountersSourceCost(CounterType.CHARGE.createInstance(2)); - ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 1, 0, 1, 0, 0, 0, 0), new TapSourceCost()); + ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(1, 0, 0, 0, 1, 0, 0, 0), new TapSourceCost()); ability.addCost(cost); this.addAbility(ability); - ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 0, 1, 1, 0, 0, 0, 0), new TapSourceCost()); + ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(1, 1, 0, 0, 0, 0, 0, 0), new TapSourceCost()); ability.addCost(cost); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/j/JungleBasin.java b/Mage.Sets/src/mage/cards/j/JungleBasin.java index 9e9869e3d19..b1316a8f92a 100644 --- a/Mage.Sets/src/mage/cards/j/JungleBasin.java +++ b/Mage.Sets/src/mage/cards/j/JungleBasin.java @@ -42,7 +42,7 @@ public final class JungleBasin extends CardImpl { this.addAbility(new EntersBattlefieldTriggeredAbility(new SacrificeSourceUnlessPaysEffect(new ReturnToHandChosenControlledPermanentCost(new TargetControlledPermanent(filter))))); // {tap}: Add {C}{G}. - this.addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 1, 0, 0, 0, 0, 0, 1), new TapSourceCost())); + this.addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 0, 0, 0, 1, 0, 0, 1), new TapSourceCost())); } diff --git a/Mage.Sets/src/mage/cards/k/Karoo.java b/Mage.Sets/src/mage/cards/k/Karoo.java index d2cda91d0ca..394cb1df49c 100644 --- a/Mage.Sets/src/mage/cards/k/Karoo.java +++ b/Mage.Sets/src/mage/cards/k/Karoo.java @@ -42,7 +42,7 @@ public final class Karoo extends CardImpl { this.addAbility(new EntersBattlefieldTriggeredAbility(new SacrificeSourceUnlessPaysEffect(new ReturnToHandChosenControlledPermanentCost(new TargetControlledPermanent(filter))))); // {tap}: Add {C}{W}. - this.addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 0, 0, 1, 0, 0, 0, 1), new TapSourceCost())); + this.addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(1, 0, 0, 0, 0, 0, 0, 1), new TapSourceCost())); } diff --git a/Mage.Sets/src/mage/cards/k/KnotvineMystic.java b/Mage.Sets/src/mage/cards/k/KnotvineMystic.java index 43583d2a72e..e571b5b3ab1 100644 --- a/Mage.Sets/src/mage/cards/k/KnotvineMystic.java +++ b/Mage.Sets/src/mage/cards/k/KnotvineMystic.java @@ -31,7 +31,7 @@ public final class KnotvineMystic extends CardImpl { this.toughness = new MageInt(2); // {1}, {T}: Add {R}{G}{W}. - Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(1, 1, 0, 1, 0, 0, 0, 0), new TapSourceCost()); + Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(1, 0, 0, 1, 1, 0, 0, 0), new TapSourceCost()); ability.addManaCost(new GenericManaCost(1)); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/l/LaviniaAzoriusRenegade.java b/Mage.Sets/src/mage/cards/l/LaviniaAzoriusRenegade.java index 63bcd953116..8c75002d500 100644 --- a/Mage.Sets/src/mage/cards/l/LaviniaAzoriusRenegade.java +++ b/Mage.Sets/src/mage/cards/l/LaviniaAzoriusRenegade.java @@ -141,7 +141,7 @@ class LaviniaAzoriusRenegadeTriggeredAbility extends TriggeredAbilityImpl { public boolean checkTrigger(GameEvent event, Game game) { if (game.getPlayer(this.getControllerId()).hasOpponent(event.getPlayerId(), game)) { Spell spell = game.getStack().getSpell(event.getTargetId()); - if (spell != null && spell.getStackAbility().getManaCostsToPay().getPayment().count() == 0) { + if (spell != null && spell.getStackAbility().getManaCostsToPay().getUsedManaToPay().count() == 0) { for (Effect effect : this.getEffects()) { effect.setTargetPointer(new FixedTarget(event.getTargetId())); } diff --git a/Mage.Sets/src/mage/cards/m/MarduWarshrieker.java b/Mage.Sets/src/mage/cards/m/MarduWarshrieker.java index 7f05f3fa649..f7164ae574d 100644 --- a/Mage.Sets/src/mage/cards/m/MarduWarshrieker.java +++ b/Mage.Sets/src/mage/cards/m/MarduWarshrieker.java @@ -31,7 +31,7 @@ public final class MarduWarshrieker extends CardImpl { // Raid - When Mardu Warshrieker enters the battlefield, if you attacked this turn, add {R}{W}{B}. this.addAbility(new ConditionalInterveningIfTriggeredAbility(new EntersBattlefieldTriggeredAbility( - new AddManaToManaPoolSourceControllerEffect(new Mana(1, 0, 0, 1, 1, 0, 0, 0))), + new AddManaToManaPoolSourceControllerEffect(new Mana(1, 0, 1, 1, 0, 0, 0, 0))), RaidCondition.instance, "Raid — When {this} enters the battlefield, if you attacked this turn, add {R}{W}{B}.") .setAbilityWord(AbilityWord.RAID) diff --git a/Mage.Sets/src/mage/cards/m/MorgueToad.java b/Mage.Sets/src/mage/cards/m/MorgueToad.java index 7b71300c416..ad2419578f2 100644 --- a/Mage.Sets/src/mage/cards/m/MorgueToad.java +++ b/Mage.Sets/src/mage/cards/m/MorgueToad.java @@ -25,7 +25,7 @@ public final class MorgueToad extends CardImpl { this.toughness = new MageInt(2); // Sacrifice Morgue Toad: Add {U}{R}. - SimpleManaAbility ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(1, 0, 1, 0, 0, 0, 0, 0), new SacrificeSourceCost()); + SimpleManaAbility ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 1, 0, 1, 0, 0, 0, 0), new SacrificeSourceCost()); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/m/MossfireEgg.java b/Mage.Sets/src/mage/cards/m/MossfireEgg.java index 67f42acc1b0..81e5d4a7ac5 100644 --- a/Mage.Sets/src/mage/cards/m/MossfireEgg.java +++ b/Mage.Sets/src/mage/cards/m/MossfireEgg.java @@ -24,7 +24,7 @@ public final class MossfireEgg extends CardImpl { super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{1}"); // {2}, {tap}, Sacrifice Mossfire Egg: Add {R}{G}. Draw a card. - ActivatedManaAbilityImpl ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(1, 1, 0, 0, 0, 0, 0, 0), new ManaCostsImpl("{2}")); + ActivatedManaAbilityImpl ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 0, 0, 1, 1, 0, 0, 0), new ManaCostsImpl("{2}")); ability.addCost(new TapSourceCost()); ability.addCost(new SacrificeSourceCost()); ability.addEffect(new DrawCardSourceControllerEffect(1)); diff --git a/Mage.Sets/src/mage/cards/m/MossfireValley.java b/Mage.Sets/src/mage/cards/m/MossfireValley.java index 56de10d7836..ddfcdb7bcf7 100644 --- a/Mage.Sets/src/mage/cards/m/MossfireValley.java +++ b/Mage.Sets/src/mage/cards/m/MossfireValley.java @@ -22,7 +22,7 @@ public final class MossfireValley extends CardImpl { super(ownerId,setInfo,new CardType[]{CardType.LAND},""); // {1}, {tap}: Add {R}{G}. - Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(1, 1, 0, 0, 0, 0, 0, 0), new ManaCostsImpl("{1}")); + Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 0, 0, 1, 1, 0, 0, 0), new ManaCostsImpl("{1}")); ability.addCost(new TapSourceCost()); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/m/MysticGate.java b/Mage.Sets/src/mage/cards/m/MysticGate.java index 90815b6fcb5..8d69797bbeb 100644 --- a/Mage.Sets/src/mage/cards/m/MysticGate.java +++ b/Mage.Sets/src/mage/cards/m/MysticGate.java @@ -28,7 +28,7 @@ public final class MysticGate extends CardImpl { ability.addCost(new TapSourceCost()); this.addAbility(ability); - ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 0, 1, 1, 0, 0, 0, 0), new ManaCostsImpl("{W/U}")); + ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(1, 1, 0, 0, 0, 0, 0, 0), new ManaCostsImpl("{W/U}")); ability.addCost(new TapSourceCost()); this.addAbility(ability); diff --git a/Mage.Sets/src/mage/cards/n/NantukoElder.java b/Mage.Sets/src/mage/cards/n/NantukoElder.java index b184dbb8272..e0865fd24e0 100644 --- a/Mage.Sets/src/mage/cards/n/NantukoElder.java +++ b/Mage.Sets/src/mage/cards/n/NantukoElder.java @@ -27,7 +27,7 @@ public final class NantukoElder extends CardImpl { this.toughness = new MageInt(2); // {tap}: Add {C}{G}. - this.addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 1, 0, 0, 0, 0, 0, 1), new TapSourceCost())); + this.addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 0, 0, 0, 1, 0, 0, 1), new TapSourceCost())); } diff --git a/Mage.Sets/src/mage/cards/n/Nix.java b/Mage.Sets/src/mage/cards/n/Nix.java index 956b5a26faf..36b8ac514b4 100644 --- a/Mage.Sets/src/mage/cards/n/Nix.java +++ b/Mage.Sets/src/mage/cards/n/Nix.java @@ -51,7 +51,7 @@ enum NoManaSpentToCastTargetCondition implements Condition { if (targetId != null) { StackObject stackObject = game.getStack().getStackObject(targetId); if (stackObject != null) { - return stackObject.getStackAbility().getManaCostsToPay().getPayment().count() == 0; + return stackObject.getStackAbility().getManaCostsToPay().getUsedManaToPay().count() == 0; } } return false; diff --git a/Mage.Sets/src/mage/cards/o/OmnathLocusOfCreation.java b/Mage.Sets/src/mage/cards/o/OmnathLocusOfCreation.java index 58b657a7f9a..f10a3363d34 100644 --- a/Mage.Sets/src/mage/cards/o/OmnathLocusOfCreation.java +++ b/Mage.Sets/src/mage/cards/o/OmnathLocusOfCreation.java @@ -44,7 +44,7 @@ public final class OmnathLocusOfCreation extends CardImpl { ).setText("you gain 4 life if this is the first time this ability has resolved this turn."), false); ability.addEffect(new IfAbilityHasResolvedXTimesEffect( Outcome.PutManaInPool, 2, new BasicManaEffect(new Mana( - 1, 1, 1, 1, 0, 0, 0, 0 + 1, 1, 0, 1, 1, 0, 0, 0 ))).setText("If it's the second time, add {R}{G}{W}{U}.")); ability.addEffect(new IfAbilityHasResolvedXTimesEffect( Outcome.Damage, 3, new DamagePlayersEffect(4, TargetController.OPPONENT) diff --git a/Mage.Sets/src/mage/cards/o/OrcishLumberjack.java b/Mage.Sets/src/mage/cards/o/OrcishLumberjack.java index ff1c9b8f5c3..185b8826988 100644 --- a/Mage.Sets/src/mage/cards/o/OrcishLumberjack.java +++ b/Mage.Sets/src/mage/cards/o/OrcishLumberjack.java @@ -64,10 +64,10 @@ class OrcishLumberjackManaEffect extends ManaEffect { public OrcishLumberjackManaEffect() { super(); this.staticText = "Add three mana in any combination of {R} and/or {G}"; - netMana.add(new Mana(0, 3, 0, 0, 0, 0, 0, 0)); - netMana.add(new Mana(1, 2, 0, 0, 0, 0, 0, 0)); - netMana.add(new Mana(2, 1, 0, 0, 0, 0, 0, 0)); - netMana.add(new Mana(3, 0, 0, 0, 0, 0, 0, 0)); + netMana.add(new Mana(0, 0, 0, 0, 3, 0, 0, 0)); + netMana.add(new Mana(0, 0, 0, 1, 2, 0, 0, 0)); + netMana.add(new Mana(0, 0, 0, 2, 1, 0, 0, 0)); + netMana.add(new Mana(0, 0, 0, 3, 0, 0, 0, 0)); } public OrcishLumberjackManaEffect(final OrcishLumberjackManaEffect effect) { diff --git a/Mage.Sets/src/mage/cards/o/OrzhovBasilica.java b/Mage.Sets/src/mage/cards/o/OrzhovBasilica.java index b75370a49f4..77269d94d04 100644 --- a/Mage.Sets/src/mage/cards/o/OrzhovBasilica.java +++ b/Mage.Sets/src/mage/cards/o/OrzhovBasilica.java @@ -33,7 +33,7 @@ public final class OrzhovBasilica extends CardImpl { this.addAbility(new EntersBattlefieldTriggeredAbility(new ReturnToHandChosenControlledPermanentEffect(filter), false)); // {T}: Add {W}{B}. - this.addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 0, 0, 1, 1, 0, 0, 0), new TapSourceCost())); + this.addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(1, 0, 1, 0, 0, 0, 0, 0), new TapSourceCost())); } public OrzhovBasilica(final OrzhovBasilica card) { diff --git a/Mage.Sets/src/mage/cards/o/OrzhovSignet.java b/Mage.Sets/src/mage/cards/o/OrzhovSignet.java index 28af4758c4b..0d8479cd12a 100644 --- a/Mage.Sets/src/mage/cards/o/OrzhovSignet.java +++ b/Mage.Sets/src/mage/cards/o/OrzhovSignet.java @@ -22,7 +22,7 @@ public final class OrzhovSignet extends CardImpl { super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{2}"); // {1}, {T}: Add {W}{B}. - Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 0, 0, 1, 1, 0, 0, 0), new GenericManaCost(1)); + Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(1, 0, 1, 0, 0, 0, 0, 0), new GenericManaCost(1)); ability.addCost(new TapSourceCost()); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/o/OutlawHolocron.java b/Mage.Sets/src/mage/cards/o/OutlawHolocron.java index 556acb5277a..9da87296d43 100644 --- a/Mage.Sets/src/mage/cards/o/OutlawHolocron.java +++ b/Mage.Sets/src/mage/cards/o/OutlawHolocron.java @@ -48,11 +48,11 @@ public final class OutlawHolocron extends CardImpl { // {T}, Remove two charge counters from Outlaw Holocron: Add BR or RG.cost = new RemoveCountersSourceCost(CounterType.CHARGE.createInstance(2)); cost = new RemoveCountersSourceCost(CounterType.CHARGE.createInstance(2)); - ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(1, 0, 0, 0, 1, 0, 0, 0), new TapSourceCost()); + ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 0, 1, 1, 0, 0, 0, 0), new TapSourceCost()); ability.addCost(cost); this.addAbility(ability); - ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(1, 1, 0, 0, 0, 0, 0, 0), new TapSourceCost()); + ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 0, 0, 1, 1, 0, 0, 0), new TapSourceCost()); ability.addCost(cost); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/p/PulseOfLlanowar.java b/Mage.Sets/src/mage/cards/p/PulseOfLlanowar.java index b622d94945d..127870c9f66 100644 --- a/Mage.Sets/src/mage/cards/p/PulseOfLlanowar.java +++ b/Mage.Sets/src/mage/cards/p/PulseOfLlanowar.java @@ -2,7 +2,7 @@ package mage.cards.p; import java.util.UUID; -import mage.MageObject; + import mage.Mana; import mage.abilities.Ability; import mage.abilities.common.SimpleStaticAbility; @@ -18,7 +18,6 @@ import mage.constants.Zone; import mage.filter.common.FilterControlledPermanent; import mage.game.Game; import mage.game.events.GameEvent; -import mage.game.events.GameEvent.EventType; import mage.game.events.ManaEvent; import mage.game.permanent.Permanent; @@ -76,7 +75,7 @@ class PulseOfLlanowarReplacementEffect extends ReplacementEffectImpl { ManaEvent manaEvent = (ManaEvent) event; Mana mana = manaEvent.getMana(); new AddManaOfAnyColorEffect(mana.count()).apply(game,source); - mana.setToMana(new Mana(0,0,0,0,0,0,0,0)); + mana.setToMana(new Mana(0, 0, 0, 0,0, 0,0,0)); return true; } diff --git a/Mage.Sets/src/mage/cards/r/RakdosCarnarium.java b/Mage.Sets/src/mage/cards/r/RakdosCarnarium.java index 848a79fd205..82a0b5939f2 100644 --- a/Mage.Sets/src/mage/cards/r/RakdosCarnarium.java +++ b/Mage.Sets/src/mage/cards/r/RakdosCarnarium.java @@ -30,7 +30,7 @@ public final class RakdosCarnarium extends CardImpl { // When Rakdos Carnarium enters the battlefield, return a land you control to its owner's hand. this.addAbility(new EntersBattlefieldTriggeredAbility(new ReturnToHandChosenControlledPermanentEffect(filter), false)); // {tap}: Add {B}{R}. - this.addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(1, 0, 0, 0, 1, 0, 0, 0), new TapSourceCost())); + this.addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 0, 1, 1, 0, 0, 0, 0), new TapSourceCost())); } public RakdosCarnarium(final RakdosCarnarium card) { diff --git a/Mage.Sets/src/mage/cards/r/RakdosSignet.java b/Mage.Sets/src/mage/cards/r/RakdosSignet.java index f4c29cad000..2f10f594d09 100644 --- a/Mage.Sets/src/mage/cards/r/RakdosSignet.java +++ b/Mage.Sets/src/mage/cards/r/RakdosSignet.java @@ -22,7 +22,7 @@ public final class RakdosSignet extends CardImpl { super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{2}"); // {1}, {tap}: Add {B}{R}. - Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(1, 0, 0, 0, 1, 0, 0, 0), new GenericManaCost(1)); + Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 0, 1, 1, 0, 0, 0, 0), new GenericManaCost(1)); ability.addCost(new TapSourceCost()); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/r/RattleclawMystic.java b/Mage.Sets/src/mage/cards/r/RattleclawMystic.java index 75dac04df6a..1236b39f708 100644 --- a/Mage.Sets/src/mage/cards/r/RattleclawMystic.java +++ b/Mage.Sets/src/mage/cards/r/RattleclawMystic.java @@ -39,7 +39,7 @@ public final class RattleclawMystic extends CardImpl { this.addAbility(new MorphAbility(this, new ManaCostsImpl("{2}"))); // When Rattleclaw Mystic is turned face up, add {G}{U}{R}. - this.addAbility(new TurnedFaceUpSourceTriggeredAbility(new AddManaToManaPoolSourceControllerEffect(new Mana(1,1,1,0,0,0,0, 0)))); + this.addAbility(new TurnedFaceUpSourceTriggeredAbility(new AddManaToManaPoolSourceControllerEffect(new Mana(0, 1, 0, 1,1, 0,0, 0)))); } diff --git a/Mage.Sets/src/mage/cards/r/RithsAttendant.java b/Mage.Sets/src/mage/cards/r/RithsAttendant.java index 88393528ffb..f632653f916 100644 --- a/Mage.Sets/src/mage/cards/r/RithsAttendant.java +++ b/Mage.Sets/src/mage/cards/r/RithsAttendant.java @@ -28,7 +28,7 @@ public final class RithsAttendant extends CardImpl { this.toughness = new MageInt(3); // {1}, Sacrifice Rith's Attendant: Add {R}{G}{W}. - Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(1, 1, 0, 1, 0, 0, 0, 0), new ManaCostsImpl("{1}")); + Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(1, 0, 0, 1, 1, 0, 0, 0), new ManaCostsImpl("{1}")); ability.addCost(new SacrificeSourceCost()); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/r/RoilingVortex.java b/Mage.Sets/src/mage/cards/r/RoilingVortex.java index 4d846a7ffce..1fa4d5aae86 100644 --- a/Mage.Sets/src/mage/cards/r/RoilingVortex.java +++ b/Mage.Sets/src/mage/cards/r/RoilingVortex.java @@ -64,6 +64,6 @@ enum RoilingVortexPredicate implements Predicate { @Override public boolean apply(StackObject input, Game game) { - return input.getStackAbility().getManaCostsToPay().getPayment().count() == 0; + return input.getStackAbility().getManaCostsToPay().getUsedManaToPay().count() == 0; } } diff --git a/Mage.Sets/src/mage/cards/s/SavageVentmaw.java b/Mage.Sets/src/mage/cards/s/SavageVentmaw.java index 096619bebb2..39bac72779b 100644 --- a/Mage.Sets/src/mage/cards/s/SavageVentmaw.java +++ b/Mage.Sets/src/mage/cards/s/SavageVentmaw.java @@ -51,7 +51,7 @@ class SavageVentmawManaEffect extends ManaEffect { public SavageVentmawManaEffect() { super(); - this.mana = new Mana(3, 3, 0, 0, 0, 0, 0, 0); + this.mana = new Mana(0, 0, 0, 3, 3, 0, 0, 0); this.staticText = "add " + mana.toString() + ". Until end of turn, you don't lose this mana as steps and phases end"; } diff --git a/Mage.Sets/src/mage/cards/s/SearchForGlory.java b/Mage.Sets/src/mage/cards/s/SearchForGlory.java new file mode 100644 index 00000000000..c96a3f90696 --- /dev/null +++ b/Mage.Sets/src/mage/cards/s/SearchForGlory.java @@ -0,0 +1,67 @@ +package mage.cards.s; + +import mage.abilities.dynamicvalue.common.SnowManaSpentValue; +import mage.abilities.effects.common.GainLifeEffect; +import mage.abilities.effects.common.search.SearchLibraryPutInHandEffect; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.SubType; +import mage.constants.SuperType; +import mage.filter.FilterCard; +import mage.filter.predicate.Predicate; +import mage.game.Game; +import mage.target.common.TargetCardInLibrary; +import mage.watchers.common.ManaSpentToCastWatcher; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class SearchForGlory extends CardImpl { + + private static final FilterCard filter = new FilterCard( + "a snow permanent card, a legendary card, or a Saga card" + ); + + static { + filter.add(SearchForGloryPredicate.instance); + } + + public SearchForGlory(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{W}"); + + this.addSuperType(SuperType.SNOW); + + // Search your library for a snow permanent card, a legendary card, or a Saga card, reveal it, put it into your hand, then shuffle your library. You gain 1 life for each {S} spent to cast this spell. + this.getSpellAbility().addEffect(new SearchLibraryPutInHandEffect( + new TargetCardInLibrary(filter), true + )); + this.getSpellAbility().addEffect(new GainLifeEffect( + SnowManaSpentValue.instance + ).setText("You gain 1 life for each {S} spent to cast this spell")); + this.getSpellAbility().addWatcher(new ManaSpentToCastWatcher()); + } + + private SearchForGlory(final SearchForGlory card) { + super(card); + } + + @Override + public SearchForGlory copy() { + return new SearchForGlory(this); + } +} + +enum SearchForGloryPredicate implements Predicate { + instance; + + @Override + public boolean apply(Card input, Game game) { + return (input.isPermanent() && input.isSnow()) + || input.isLegendary() + || input.hasSubtype(SubType.SAGA, game); + } +} diff --git a/Mage.Sets/src/mage/cards/s/SelesnyaSanctuary.java b/Mage.Sets/src/mage/cards/s/SelesnyaSanctuary.java index dba3306e51d..7d6d33afb3d 100644 --- a/Mage.Sets/src/mage/cards/s/SelesnyaSanctuary.java +++ b/Mage.Sets/src/mage/cards/s/SelesnyaSanctuary.java @@ -32,7 +32,7 @@ public final class SelesnyaSanctuary extends CardImpl { // When Selesnya Sanctuary enters the battlefield, return a land you control to its owner's hand. this.addAbility(new EntersBattlefieldTriggeredAbility(new ReturnToHandChosenControlledPermanentEffect(filter), false)); // {tap}: Add {G}{W}. - this.addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 1, 0, 1, 0, 0, 0, 0), new TapSourceCost())); + this.addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(1, 0, 0, 0, 1, 0, 0, 0), new TapSourceCost())); } public SelesnyaSanctuary(final SelesnyaSanctuary card) { diff --git a/Mage.Sets/src/mage/cards/s/SelesnyaSignet.java b/Mage.Sets/src/mage/cards/s/SelesnyaSignet.java index 96a53df300d..02e457c9a2e 100644 --- a/Mage.Sets/src/mage/cards/s/SelesnyaSignet.java +++ b/Mage.Sets/src/mage/cards/s/SelesnyaSignet.java @@ -21,7 +21,7 @@ public final class SelesnyaSignet extends CardImpl { public SelesnyaSignet (UUID ownerId, CardSetInfo setInfo) { super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{2}"); - Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 1, 0, 1, 0, 0, 0, 0), new GenericManaCost(1)); + Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(1, 0, 0, 0, 1, 0, 0, 0), new GenericManaCost(1)); ability.addCost(new TapSourceCost()); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/s/ShadowbloodEgg.java b/Mage.Sets/src/mage/cards/s/ShadowbloodEgg.java index 79accc23ad0..9dbf1ffec57 100644 --- a/Mage.Sets/src/mage/cards/s/ShadowbloodEgg.java +++ b/Mage.Sets/src/mage/cards/s/ShadowbloodEgg.java @@ -24,7 +24,7 @@ public final class ShadowbloodEgg extends CardImpl { super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{1}"); // {2}, {tap}, Sacrifice Shadowblood Egg: Add {B}{R}. Draw a card. - ActivatedManaAbilityImpl ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(1, 0, 0, 0, 1, 0, 0, 0), new ManaCostsImpl("{2}")); + ActivatedManaAbilityImpl ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 0, 1, 1, 0, 0, 0, 0), new ManaCostsImpl("{2}")); ability.addCost(new TapSourceCost()); ability.addCost(new SacrificeSourceCost()); ability.addEffect(new DrawCardSourceControllerEffect(1)); diff --git a/Mage.Sets/src/mage/cards/s/ShadowbloodRidge.java b/Mage.Sets/src/mage/cards/s/ShadowbloodRidge.java index 62505262371..e7022186fca 100644 --- a/Mage.Sets/src/mage/cards/s/ShadowbloodRidge.java +++ b/Mage.Sets/src/mage/cards/s/ShadowbloodRidge.java @@ -22,7 +22,7 @@ public final class ShadowbloodRidge extends CardImpl { super(ownerId,setInfo,new CardType[]{CardType.LAND},""); // {1}, {tap}: Add {B}{R}. - Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(1, 0, 0, 0, 1, 0, 0, 0), new ManaCostsImpl("{1}")); + Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 0, 1, 1, 0, 0, 0, 0), new ManaCostsImpl("{1}")); ability.addCost(new TapSourceCost()); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/s/SimicGrowthChamber.java b/Mage.Sets/src/mage/cards/s/SimicGrowthChamber.java index 8b877308a67..ab0e33eb9d5 100644 --- a/Mage.Sets/src/mage/cards/s/SimicGrowthChamber.java +++ b/Mage.Sets/src/mage/cards/s/SimicGrowthChamber.java @@ -31,7 +31,7 @@ public final class SimicGrowthChamber extends CardImpl { // When Simic Growth Chamber enters the battlefield, return a land you control to its owner's hand. this.addAbility(new EntersBattlefieldTriggeredAbility(new ReturnToHandChosenControlledPermanentEffect(filter), false)); // {tap}: Add {G}{U}. - this.addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 1, 1, 0, 0, 0, 0, 0), new TapSourceCost())); + this.addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 1, 0, 0, 1, 0, 0, 0), new TapSourceCost())); } public SimicGrowthChamber(final SimicGrowthChamber card) { diff --git a/Mage.Sets/src/mage/cards/s/SimicSignet.java b/Mage.Sets/src/mage/cards/s/SimicSignet.java index fa17af41ae3..8fcfbe0e0ff 100644 --- a/Mage.Sets/src/mage/cards/s/SimicSignet.java +++ b/Mage.Sets/src/mage/cards/s/SimicSignet.java @@ -22,7 +22,7 @@ public final class SimicSignet extends CardImpl { super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{2}"); // {1}, {tap}: Add {G}{U}. - Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 1, 1, 0, 0, 0, 0, 0), new GenericManaCost(1)); + Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 1, 0, 0, 1, 0, 0, 0), new GenericManaCost(1)); ability.addCost(new TapSourceCost()); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/s/SithHolocron.java b/Mage.Sets/src/mage/cards/s/SithHolocron.java index abff4be7148..f9ba021fa73 100644 --- a/Mage.Sets/src/mage/cards/s/SithHolocron.java +++ b/Mage.Sets/src/mage/cards/s/SithHolocron.java @@ -48,11 +48,11 @@ public final class SithHolocron extends CardImpl { // {T}, Remove two charge counters from Sith Holocron: Add UB or BR. cost = new RemoveCountersSourceCost(CounterType.CHARGE.createInstance(2)); - ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 0, 1, 0, 1, 0, 0, 0), new TapSourceCost()); + ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 1, 1, 0, 0, 0, 0, 0), new TapSourceCost()); ability.addCost(cost); this.addAbility(ability); - ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(1, 0, 0, 0, 1, 0, 0, 0), new TapSourceCost()); + ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 0, 1, 1, 0, 0, 0, 0), new TapSourceCost()); ability.addCost(cost); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/s/SkycloudEgg.java b/Mage.Sets/src/mage/cards/s/SkycloudEgg.java index 0407f53a13d..d186efe1fc1 100644 --- a/Mage.Sets/src/mage/cards/s/SkycloudEgg.java +++ b/Mage.Sets/src/mage/cards/s/SkycloudEgg.java @@ -24,7 +24,7 @@ public final class SkycloudEgg extends CardImpl { super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{1}"); // {2}, {tap}, Sacrifice Skycloud Egg: Add {W}{U}. Draw a card. - ActivatedManaAbilityImpl ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 0, 1, 1, 0, 0, 0, 0), new ManaCostsImpl("{2}")); + ActivatedManaAbilityImpl ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(1, 1, 0, 0, 0, 0, 0, 0), new ManaCostsImpl("{2}")); ability.addCost(new TapSourceCost()); ability.addCost(new SacrificeSourceCost()); ability.addEffect(new DrawCardSourceControllerEffect(1)); diff --git a/Mage.Sets/src/mage/cards/s/SkycloudExpanse.java b/Mage.Sets/src/mage/cards/s/SkycloudExpanse.java index a5294fda17b..9eeecb99a1b 100644 --- a/Mage.Sets/src/mage/cards/s/SkycloudExpanse.java +++ b/Mage.Sets/src/mage/cards/s/SkycloudExpanse.java @@ -22,7 +22,7 @@ public final class SkycloudExpanse extends CardImpl { super(ownerId,setInfo,new CardType[]{CardType.LAND},""); // {1}, {tap}: Add {W}{U}. - Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 0, 1, 1, 0, 0, 0, 0), new ManaCostsImpl("{1}")); + Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(1, 1, 0, 0, 0, 0, 0, 0), new ManaCostsImpl("{1}")); ability.addCost(new TapSourceCost()); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/s/SoldeviExcavations.java b/Mage.Sets/src/mage/cards/s/SoldeviExcavations.java index d784f3bd72e..7ce1f198151 100644 --- a/Mage.Sets/src/mage/cards/s/SoldeviExcavations.java +++ b/Mage.Sets/src/mage/cards/s/SoldeviExcavations.java @@ -42,7 +42,7 @@ public final class SoldeviExcavations extends CardImpl { this.addAbility(new SimpleStaticAbility(Zone.ALL, new EnterBattlefieldPayCostOrPutGraveyardEffect(new SacrificeTargetCost(new TargetControlledPermanent(filter))))); // {tap}: Add {C}{U}. - this.addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 0, 1, 0, 0, 0, 0, 1), new TapSourceCost())); + this.addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 1, 0, 0, 0, 0, 0, 1), new TapSourceCost())); // {1}, {tap}: Scry 1. Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ScryEffect(1), new GenericManaCost(1)); diff --git a/Mage.Sets/src/mage/cards/s/SoulBurn.java b/Mage.Sets/src/mage/cards/s/SoulBurn.java index fe1c77260bd..5c85a3286f4 100644 --- a/Mage.Sets/src/mage/cards/s/SoulBurn.java +++ b/Mage.Sets/src/mage/cards/s/SoulBurn.java @@ -81,14 +81,14 @@ class SoulBurnEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { // Get the colors we care about. (This isn't racist, honestly.) - int amountBlack = source.getManaCostsToPay().getPayment().getBlack(); - int amountRed = source.getManaCostsToPay().getPayment().getRed(); + int amountBlack = source.getManaCostsToPay().getUsedManaToPay().getBlack(); + int amountRed = source.getManaCostsToPay().getUsedManaToPay().getRed(); // Get the colors we don't really care about. (See note above.) - int amountWhite = source.getManaCostsToPay().getPayment().getWhite(); - int amountGreen = source.getManaCostsToPay().getPayment().getGreen(); - int amountBlue = source.getManaCostsToPay().getPayment().getBlue(); - int amountColorless = source.getManaCostsToPay().getPayment().getColorless(); + int amountWhite = source.getManaCostsToPay().getUsedManaToPay().getWhite(); + int amountGreen = source.getManaCostsToPay().getUsedManaToPay().getGreen(); + int amountBlue = source.getManaCostsToPay().getUsedManaToPay().getBlue(); + int amountColorless = source.getManaCostsToPay().getUsedManaToPay().getColorless(); // Figure out what was spent on the spell in total, determine proper values for // black and red, minus initial casting cost. diff --git a/Mage.Sets/src/mage/cards/s/SpringjackPasture.java b/Mage.Sets/src/mage/cards/s/SpringjackPasture.java index c4fe8a16fb0..de0e8e91bee 100644 --- a/Mage.Sets/src/mage/cards/s/SpringjackPasture.java +++ b/Mage.Sets/src/mage/cards/s/SpringjackPasture.java @@ -47,7 +47,7 @@ public final class SpringjackPasture extends CardImpl { // {tap}, Sacrifice X Goats: Add X mana of any one color. You gain X life. ability = new DynamicManaAbility( - new Mana(0,0,0,0,0,0,1,0), + new Mana(0, 0, 0, 0,0, 0,1,0), GetXValue.instance, new TapSourceCost(), "Add X mana of any one color", diff --git a/Mage.Sets/src/mage/cards/s/SulfurVent.java b/Mage.Sets/src/mage/cards/s/SulfurVent.java index 243f4869aea..2676c9185da 100644 --- a/Mage.Sets/src/mage/cards/s/SulfurVent.java +++ b/Mage.Sets/src/mage/cards/s/SulfurVent.java @@ -28,7 +28,7 @@ public final class SulfurVent extends CardImpl { // {tap}: Add {B}. this.addAbility(new BlackManaAbility()); // {tap}, Sacrifice Sulfur Vent: Add {U}{R}. - Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(1, 0, 1, 0, 0, 0, 0, 0), new TapSourceCost()); + Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 1, 0, 1, 0, 0, 0, 0), new TapSourceCost()); ability.addCost(new SacrificeSourceCost()); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/s/SunderingStroke.java b/Mage.Sets/src/mage/cards/s/SunderingStroke.java index da329bc2995..17fde8221a9 100644 --- a/Mage.Sets/src/mage/cards/s/SunderingStroke.java +++ b/Mage.Sets/src/mage/cards/s/SunderingStroke.java @@ -51,6 +51,6 @@ enum SunderingStrokeCondtition implements Condition { @Override public boolean apply(Game game, Ability source) { - return source.getManaCostsToPay().getPayment().getColor(ColoredManaSymbol.R) >= 6; + return source.getManaCostsToPay().getUsedManaToPay().getColor(ColoredManaSymbol.R) >= 6; } } \ No newline at end of file diff --git a/Mage.Sets/src/mage/cards/s/SungrassEgg.java b/Mage.Sets/src/mage/cards/s/SungrassEgg.java index d895c1d49e5..dca7f0baef9 100644 --- a/Mage.Sets/src/mage/cards/s/SungrassEgg.java +++ b/Mage.Sets/src/mage/cards/s/SungrassEgg.java @@ -24,7 +24,7 @@ public final class SungrassEgg extends CardImpl { super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{1}"); // {2}, {tap}, Sacrifice Sungrass Egg: Add {G}{W}. Draw a card. - ActivatedManaAbilityImpl ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 1, 0, 1, 0, 0, 0, 0), new ManaCostsImpl("{2}")); + ActivatedManaAbilityImpl ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(1, 0, 0, 0, 1, 0, 0, 0), new ManaCostsImpl("{2}")); ability.addCost(new TapSourceCost()); ability.addCost(new SacrificeSourceCost()); ability.addEffect(new DrawCardSourceControllerEffect(1)); diff --git a/Mage.Sets/src/mage/cards/s/SungrassPrairie.java b/Mage.Sets/src/mage/cards/s/SungrassPrairie.java index 56daea2ba25..b86a46ffb42 100644 --- a/Mage.Sets/src/mage/cards/s/SungrassPrairie.java +++ b/Mage.Sets/src/mage/cards/s/SungrassPrairie.java @@ -22,7 +22,7 @@ public final class SungrassPrairie extends CardImpl { super(ownerId,setInfo,new CardType[]{CardType.LAND},""); // {1}, {tap}: Add {G}{W}. - Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 1, 0, 1, 0, 0, 0, 0), new ManaCostsImpl("{1}")); + Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(1, 0, 0, 0, 1, 0, 0, 0), new ManaCostsImpl("{1}")); ability.addCost(new TapSourceCost()); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/s/SunkenRuins.java b/Mage.Sets/src/mage/cards/s/SunkenRuins.java index a806eaeb099..af74881faf2 100644 --- a/Mage.Sets/src/mage/cards/s/SunkenRuins.java +++ b/Mage.Sets/src/mage/cards/s/SunkenRuins.java @@ -28,7 +28,7 @@ public final class SunkenRuins extends CardImpl { ability.addCost(new TapSourceCost()); this.addAbility(ability); - ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 0, 1, 0, 1, 0, 0, 0), new ManaCostsImpl("{U/B}")); + ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 1, 1, 0, 0, 0, 0, 0), new ManaCostsImpl("{U/B}")); ability.addCost(new TapSourceCost()); this.addAbility(ability); diff --git a/Mage.Sets/src/mage/cards/t/TrevasAttendant.java b/Mage.Sets/src/mage/cards/t/TrevasAttendant.java index 1894a1b5b9d..729c5d24983 100644 --- a/Mage.Sets/src/mage/cards/t/TrevasAttendant.java +++ b/Mage.Sets/src/mage/cards/t/TrevasAttendant.java @@ -28,7 +28,7 @@ public final class TrevasAttendant extends CardImpl { this.toughness = new MageInt(3); // {1}, Sacrifice Treva's Attendant: Add {G}{W}{U}. - Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 1, 1, 1, 0, 0, 0, 0), new ManaCostsImpl("{1}")); + Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(1, 1, 0, 0, 1, 0, 0, 0), new ManaCostsImpl("{1}")); ability.addCost(new SacrificeSourceCost()); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/t/TwilightMire.java b/Mage.Sets/src/mage/cards/t/TwilightMire.java index 4c231d4cb25..38f5fe6e4b0 100644 --- a/Mage.Sets/src/mage/cards/t/TwilightMire.java +++ b/Mage.Sets/src/mage/cards/t/TwilightMire.java @@ -30,7 +30,7 @@ public final class TwilightMire extends CardImpl { ability.addCost(new TapSourceCost()); this.addAbility(ability); - ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 1, 0, 0, 1, 0, 0, 0), new ManaCostsImpl("{B/G}")); + ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 0, 1, 0, 1, 0, 0, 0), new ManaCostsImpl("{B/G}")); ability.addCost(new TapSourceCost()); this.addAbility(ability); diff --git a/Mage.Sets/src/mage/cards/w/WildHolocron.java b/Mage.Sets/src/mage/cards/w/WildHolocron.java index 7e29f42cb1c..fa5ae2995f6 100644 --- a/Mage.Sets/src/mage/cards/w/WildHolocron.java +++ b/Mage.Sets/src/mage/cards/w/WildHolocron.java @@ -48,11 +48,11 @@ public final class WildHolocron extends CardImpl { // {T}, Remove two charge counters from Wild Holocron: Add RG or GW. cost = new RemoveCountersSourceCost(CounterType.CHARGE.createInstance(2)); - ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(1, 1, 0, 0, 0, 0, 0, 0), new TapSourceCost()); + ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 0, 0, 1, 1, 0, 0, 0), new TapSourceCost()); ability.addCost(cost); this.addAbility(ability); - ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 1, 0, 1, 0, 0, 0, 0), new TapSourceCost()); + ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(1, 0, 0, 0, 1, 0, 0, 0), new TapSourceCost()); ability.addCost(cost); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/w/WirewoodChanneler.java b/Mage.Sets/src/mage/cards/w/WirewoodChanneler.java index 6d6b91aa230..8c883100775 100644 --- a/Mage.Sets/src/mage/cards/w/WirewoodChanneler.java +++ b/Mage.Sets/src/mage/cards/w/WirewoodChanneler.java @@ -34,7 +34,7 @@ public final class WirewoodChanneler extends CardImpl { this.toughness = new MageInt(2); // {T}: Add X mana of any one color, where X is the number of Elves on the battlefield. - DynamicManaAbility ability = new DynamicManaAbility(new Mana(0,0,0,0,0,0,1, 0), new PermanentsOnBattlefieldCount(filter), new TapSourceCost(), + DynamicManaAbility ability = new DynamicManaAbility(new Mana(0, 0, 0, 0,0, 0,1, 0), new PermanentsOnBattlefieldCount(filter), new TapSourceCost(), "Add X mana of any one color, where X is the number of Elves on the battlefield", true); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/w/WoodedBastion.java b/Mage.Sets/src/mage/cards/w/WoodedBastion.java index ba46664b141..5cd289b52b0 100644 --- a/Mage.Sets/src/mage/cards/w/WoodedBastion.java +++ b/Mage.Sets/src/mage/cards/w/WoodedBastion.java @@ -28,7 +28,7 @@ public final class WoodedBastion extends CardImpl { ability.addCost(new TapSourceCost()); this.addAbility(ability); - ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(0, 1, 0, 1, 0, 0, 0, 0), new ManaCostsImpl("{G/W}")); + ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(1, 0, 0, 0, 1, 0, 0, 0), new ManaCostsImpl("{G/W}")); ability.addCost(new TapSourceCost()); this.addAbility(ability); diff --git a/Mage.Sets/src/mage/cards/y/YurlokOfScorchThrash.java b/Mage.Sets/src/mage/cards/y/YurlokOfScorchThrash.java index 7fb3153c38e..7cfe487f155 100644 --- a/Mage.Sets/src/mage/cards/y/YurlokOfScorchThrash.java +++ b/Mage.Sets/src/mage/cards/y/YurlokOfScorchThrash.java @@ -127,12 +127,12 @@ class YurlokOfScorchThrashManaEffect extends ManaEffect { @Override public List getNetMana(Game game, Ability source) { List netMana = new ArrayList<>(); - netMana.add(new Mana(1, 1, 0, 0, 1, 0, 0, 0)); + netMana.add(new Mana(0, 0, 1, 1, 1, 0, 0, 0)); return netMana; } @Override public Mana produceMana(Game game, Ability source) { - return new Mana(1, 1, 0, 0, 1, 0, 0, 0); + return new Mana(0, 0, 1, 1, 1, 0, 0, 0); } } diff --git a/Mage.Sets/src/mage/sets/Kaldheim.java b/Mage.Sets/src/mage/sets/Kaldheim.java index b6d9b23b3ed..75a0e9d0680 100644 --- a/Mage.Sets/src/mage/sets/Kaldheim.java +++ b/Mage.Sets/src/mage/sets/Kaldheim.java @@ -272,6 +272,7 @@ public final class Kaldheim extends ExpansionSet { cards.add(new SetCardInfo("Saw It Coming", 76, Rarity.UNCOMMON, mage.cards.s.SawItComing.class)); cards.add(new SetCardInfo("Scorn Effigy", 246, Rarity.COMMON, mage.cards.s.ScornEffigy.class)); cards.add(new SetCardInfo("Sculptor of Winter", 193, Rarity.COMMON, mage.cards.s.SculptorOfWinter.class)); + cards.add(new SetCardInfo("Search for Glory", 27, Rarity.RARE, mage.cards.s.SearchForGlory.class)); cards.add(new SetCardInfo("Seize the Spoils", 149, Rarity.COMMON, mage.cards.s.SeizeTheSpoils.class)); cards.add(new SetCardInfo("Shackles of Treachery", 150, Rarity.COMMON, mage.cards.s.ShacklesOfTreachery.class)); cards.add(new SetCardInfo("Shepherd of the Cosmos", 28, Rarity.UNCOMMON, mage.cards.s.ShepherdOfTheCosmos.class)); diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/conditional/ManaWasSpentToCastTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/conditional/ManaWasSpentToCastTest.java index 3217e379cfe..320bf28ffa9 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/conditional/ManaWasSpentToCastTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/conditional/ManaWasSpentToCastTest.java @@ -7,12 +7,11 @@ import org.junit.Test; import org.mage.test.serverside.base.CardTestPlayerBase; /** - * * @author LevelX2 */ public class ManaWasSpentToCastTest extends CardTestPlayerBase { - + @Test public void testArtifactWillBeDestroyed() { // Tin Street Hooligan - Creature 2/1 {1}{R} @@ -20,9 +19,9 @@ public class ManaWasSpentToCastTest extends CardTestPlayerBase { addCard(Zone.HAND, playerA, "Tin Street Hooligan"); addCard(Zone.BATTLEFIELD, playerA, "Forest", 1); addCard(Zone.BATTLEFIELD, playerA, "Mountain", 1); - + addCard(Zone.BATTLEFIELD, playerB, "Abzan Banner"); - + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Tin Street Hooligan"); addTarget(playerA, "Abzan Banner"); setStopAt(1, PhaseStep.BEGIN_COMBAT); @@ -38,9 +37,9 @@ public class ManaWasSpentToCastTest extends CardTestPlayerBase { // When Tin Street Hooligan enters the battlefield, if {G} was spent to cast Tin Street Hooligan, destroy target artifact. addCard(Zone.HAND, playerA, "Tin Street Hooligan"); addCard(Zone.BATTLEFIELD, playerA, "Mountain", 2); - + addCard(Zone.BATTLEFIELD, playerB, "Abzan Banner"); - + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Tin Street Hooligan"); addTarget(playerA, "Abzan Banner"); setStopAt(1, PhaseStep.BEGIN_COMBAT); @@ -49,5 +48,42 @@ public class ManaWasSpentToCastTest extends CardTestPlayerBase { assertPermanentCount(playerA, "Tin Street Hooligan", 1); assertPermanentCount(playerB, "Abzan Banner", 1); } - -} \ No newline at end of file + + @Test + public void testSnowMana() { + addCard(Zone.BATTLEFIELD, playerA, "Snow-Covered Plains"); + addCard(Zone.BATTLEFIELD, playerA, "Boreal Druid"); + addCard(Zone.BATTLEFIELD, playerA, "Plains"); + addCard(Zone.HAND, playerA, "Search for Glory"); + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Search for Glory"); + + setStopAt(1, PhaseStep.END_TURN); + execute(); + + assertGraveyardCount(playerA, "Search for Glory", 1); + assertLife(playerA, 22); + } + + @Test + public void testSnowMana2() { + addCard(Zone.BATTLEFIELD, playerA, "Plains"); + addCard(Zone.BATTLEFIELD, playerA, "Island"); + addCard(Zone.BATTLEFIELD, playerA, "Swamp"); + addCard(Zone.BATTLEFIELD, playerA, "Snow-Covered Mountain"); + addCard(Zone.BATTLEFIELD, playerA, "Vodalian Arcanist"); + addCard(Zone.BATTLEFIELD, playerA, "Rimefeather Owl"); + addCard(Zone.HAND, playerA, "Search for Glory"); + + activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {U}"); + activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {R}"); + activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{1}{S}", "Vodalian Arcanist"); + castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Search for Glory"); + + setStopAt(1, PhaseStep.END_TURN); + execute(); + + assertGraveyardCount(playerA, "Search for Glory", 1); + assertLife(playerA, 21); + } +} diff --git a/Mage/src/main/java/mage/ConditionalMana.java b/Mage/src/main/java/mage/ConditionalMana.java index c5b36cf4022..4c51a6cbcb0 100644 --- a/Mage/src/main/java/mage/ConditionalMana.java +++ b/Mage/src/main/java/mage/ConditionalMana.java @@ -113,25 +113,25 @@ public class ConditionalMana extends Mana implements Serializable { return; } if (filter.isBlack()) { - black = 0; + black.clear(); } if (filter.isBlue()) { - blue = 0; + blue.clear(); } if (filter.isWhite()) { - white = 0; + white.clear(); } if (filter.isGreen()) { - green = 0; + green.clear(); } if (filter.isRed()) { - red = 0; + red.clear(); } if (filter.isColorless()) { - colorless = 0; + colorless.clear(); } if (filter.isGeneric()) { - generic = 0; + generic.clear(); } } @@ -154,25 +154,25 @@ public class ConditionalMana extends Mana implements Serializable { public void clear(ManaType manaType) { switch (manaType) { case BLACK: - black = 0; + black.clear(); break; case BLUE: - blue = 0; + blue.clear(); break; case GREEN: - green = 0; + green.clear(); break; case RED: - red = 0; + red.clear(); break; case WHITE: - white = 0; + white.clear(); break; case GENERIC: - generic = 0; + generic.clear(); break; case COLORLESS: - colorless = 0; + colorless.clear(); break; } } @@ -186,7 +186,7 @@ public class ConditionalMana extends Mana implements Serializable { } super.add(mana); } - + public String getConditionString() { String condStr = "["; for (Condition condition : conditions) { @@ -198,25 +198,25 @@ public class ConditionalMana extends Mana implements Serializable { public void add(ManaType manaType, int amount) { switch (manaType) { case BLACK: - black += amount; + black.incrementAmount(amount, false); break; case BLUE: - blue += amount; + blue.incrementAmount(amount, false); break; case GREEN: - green += amount; + green.incrementAmount(amount, false); break; case RED: - red += amount; + red.incrementAmount(amount, false); break; case WHITE: - white += amount; + white.incrementAmount(amount, false); break; case COLORLESS: - colorless += amount; + colorless.incrementAmount(amount, false); break; case GENERIC: - generic += amount; + generic.incrementAmount(amount, false); break; } } diff --git a/Mage/src/main/java/mage/Mana.java b/Mage/src/main/java/mage/Mana.java index 3f8e0207f4e..ef0b40bc13d 100644 --- a/Mage/src/main/java/mage/Mana.java +++ b/Mage/src/main/java/mage/Mana.java @@ -1,41 +1,121 @@ package mage; -import java.io.Serializable; -import java.util.Objects; import mage.constants.ColoredManaSymbol; import mage.constants.ManaType; import mage.filter.FilterMana; import mage.util.Copyable; import org.apache.log4j.Logger; +import java.io.Serializable; +import java.util.Objects; + /** * @author BetaSteward_at_googlemail.com */ public class Mana implements Comparable, Serializable, Copyable { + protected static final class ManaColor implements Serializable { + private int amount = 0; + private int snowAmount = 0; + + private ManaColor() { + } + + private ManaColor(int amount) { + this.amount = amount; + } + + protected int getAmount() { + return amount; + } + + protected int getSnowAmount() { + return snowAmount; + } + + protected void incrementAmount() { + incrementAmount(1, false); + } + + protected void incrementAmount(ManaColor manaColor) { + this.amount += manaColor.amount; + this.snowAmount += manaColor.snowAmount; + } + + protected void incrementAmount(int amount, boolean snow) { + this.amount += amount; + if (snow) { + this.snowAmount += amount; + } + } + + protected void removeAmount(ManaColor manaColor) { + this.amount -= manaColor.amount; + this.snowAmount -= manaColor.snowAmount; + } + + protected void clear() { + amount = 0; + snowAmount = 0; + } + + protected boolean removeOne(ManaColor manaColor) { + if (manaColor.getAmount() < 1) { + return false; + } + if (manaColor.getSnowAmount() > 0) { + manaColor.snowAmount -= 1; + snowAmount += 1; + } + manaColor.amount -= 1; + amount += 1; + return true; + } + + protected ManaColor copy() { + ManaColor copy = new ManaColor(); + copy.incrementAmount(this); + return copy; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + ManaColor manaColor = (ManaColor) o; + return amount == manaColor.amount && snowAmount == manaColor.snowAmount; + } + + @Override + public int hashCode() { + return Objects.hash(amount, snowAmount); + } + } + private static final transient Logger logger = Logger.getLogger(Mana.class); - protected int red; - protected int green; - protected int blue; - protected int white; - protected int black; - protected int generic; - protected int colorless; - protected int any; + protected ManaColor white; + protected ManaColor blue; + protected ManaColor black; + protected ManaColor red; + protected ManaColor green; + protected ManaColor generic; + protected ManaColor colorless; + protected ManaColor any; protected boolean flag; /** * Default constructor. Creates a {@link Mana} object with 0 values. */ public Mana() { - red = 0; - green = 0; - blue = 0; - white = 0; - black = 0; - generic = 0; - colorless = 0; + white = new ManaColor(); + blue = new ManaColor(); + black = new ManaColor(); + red = new ManaColor(); + green = new ManaColor(); + generic = new ManaColor(); + colorless = new ManaColor(); + any = new ManaColor(); flag = false; } @@ -43,24 +123,24 @@ public class Mana implements Comparable, Serializable, Copyable { * Creates a {@link Mana} object with the passed in values. Values can not * be less than 0. Any values less than 0 will be logged and set to 0. * + * @param white total White mana to have. + * @param blue total Blue mana to have. + * @param black total Black mana to have. * @param red total Red mana to have. * @param green total Green mana to have. - * @param blue total Blue mana to have. - * @param white total White mana to have. - * @param black total Black mana to have. * @param generic total Generic mana to have. * @param any total Any mana to have. * @param colorless total Colorless mana to have. */ - public Mana(final int red, final int green, final int blue, final int white, final int black, final int generic, final int any, final int colorless) { - this.red = notNegative(red, "Red"); - this.green = notNegative(green, "Green"); - this.blue = notNegative(blue, "Blue"); - this.white = notNegative(white, "White"); - this.black = notNegative(black, "Black"); - this.generic = notNegative(generic, "Generic"); - this.colorless = notNegative(colorless, "Colorless"); - this.any = notNegative(any, "Any"); + public Mana(final int white, final int blue, final int black, final int red, final int green, final int generic, final int any, final int colorless) { + this.white = new ManaColor(notNegative(white, "White")); + this.blue = new ManaColor(notNegative(blue, "Blue")); + this.black = new ManaColor(notNegative(black, "Black")); + this.red = new ManaColor(notNegative(red, "Red")); + this.green = new ManaColor(notNegative(green, "Green")); + this.generic = new ManaColor(notNegative(generic, "Generic")); + this.colorless = new ManaColor(notNegative(colorless, "Colorless")); + this.any = new ManaColor(notNegative(any, "Any")); this.flag = false; } @@ -72,14 +152,14 @@ public class Mana implements Comparable, Serializable, Copyable { */ public Mana(final Mana mana) { Objects.requireNonNull(mana, "The passed in mana can not be null"); - this.red = mana.red; - this.green = mana.green; - this.blue = mana.blue; - this.white = mana.white; - this.black = mana.black; - this.generic = mana.generic; - this.colorless = mana.colorless; - this.any = mana.any; + this.white = mana.white.copy(); + this.blue = mana.blue.copy(); + this.black = mana.black.copy(); + this.red = mana.red.copy(); + this.green = mana.green.copy(); + this.generic = mana.generic.copy(); + this.colorless = mana.colorless.copy(); + this.any = mana.any.copy(); this.flag = mana.flag; } @@ -91,22 +171,23 @@ public class Mana implements Comparable, Serializable, Copyable { * @param color The color to create the {@link Mana} object with. */ public Mana(final ColoredManaSymbol color) { + this(); Objects.requireNonNull(color, "The passed in ColoredManaSymbol can not be null"); switch (color) { - case G: - green = 1; - break; - case R: - red = 1; - break; - case B: - black = 1; + case W: + white.incrementAmount(); break; case U: - blue = 1; + blue.incrementAmount(); break; - case W: - white = 1; + case B: + black.incrementAmount(); + break; + case R: + red.incrementAmount(); + break; + case G: + green.incrementAmount(); break; default: throw new IllegalArgumentException("Unknown mana color: " + color); @@ -114,28 +195,29 @@ public class Mana implements Comparable, Serializable, Copyable { } public Mana(final ManaType manaType) { + this(); Objects.requireNonNull(manaType, "The passed in ManaType can not be null"); switch (manaType) { - case GREEN: - green = 1; - break; - case RED: - red = 1; - break; - case BLACK: - black = 1; + case WHITE: + white.incrementAmount(); break; case BLUE: - blue = 1; + blue.incrementAmount(); break; - case WHITE: - white = 1; + case BLACK: + black.incrementAmount(); + break; + case RED: + red.incrementAmount(); + break; + case GREEN: + green.incrementAmount(); break; case COLORLESS: - colorless = 1; + colorless.incrementAmount(); break; case GENERIC: - generic = 1; + generic.incrementAmount(); break; default: throw new IllegalArgumentException("Unknown manaType: " + manaType); @@ -143,34 +225,74 @@ public class Mana implements Comparable, Serializable, Copyable { } public Mana(final ManaType manaType, int num) { + this(); Objects.requireNonNull(manaType, "The passed in ManaType can not be null"); switch (manaType) { - case GREEN: - green = num; - break; - case RED: - red = num; - break; - case BLACK: - black = num; + case WHITE: + white.incrementAmount(num, false); break; case BLUE: - blue = num; + blue.incrementAmount(num, false); break; - case WHITE: - white = num; + case BLACK: + black.incrementAmount(num, false); + break; + case RED: + red.incrementAmount(num, false); + break; + case GREEN: + green.incrementAmount(num, false); break; case COLORLESS: - colorless = num; + colorless.incrementAmount(num, false); break; case GENERIC: - generic = num; + generic.incrementAmount(num, false); break; default: throw new IllegalArgumentException("Unknown manaType: " + manaType); } } + /** + * Creates a {@link Mana} object with the passed in {@code num} of White + * mana. {@code num} can not be a negative value. Negative values will be + * logged and set to 0. + * + * @param num value of White mana to create. + * @return a {@link Mana} object with the passed in {@code num} of White + * mana. + */ + public static Mana WhiteMana(int num) { + return new Mana(notNegative(num, "White"), 0, 0, 0, 0, 0, 0, 0); + } + + /** + * Creates a {@link Mana} object with the passed in {@code num} of Blue + * mana. {@code num} can not be a negative value. Negative values will be + * logged and set to 0. + * + * @param num value of Blue mana to create. + * @return a {@link Mana} object with the passed in {@code num} of Blue + * mana. + */ + public static Mana BlueMana(int num) { + return new Mana(0, notNegative(num, "Blue"), 0, 0, 0, 0, 0, 0); + } + + /** + * Creates a {@link Mana} object with the passed in {@code num} of Black + * mana. {@code num} can not be a negative value. Negative values will be + * logged and set to 0. + * + * @param num value of Black mana to create. + * @return a {@link Mana} object with the passed in {@code num} of Black + * mana. + */ + public static Mana BlackMana(int num) { + return new Mana(0, 0, notNegative(num, "Black"), 0, 0, 0, 0, 0); + } + /** * Creates a {@link Mana} object with the passed in {@code num} of Red mana. * {@code num} can not be a negative value. Negative values will be logged @@ -180,7 +302,7 @@ public class Mana implements Comparable, Serializable, Copyable { * @return a {@link Mana} object with the passed in {@code num} of Red mana. */ public static Mana RedMana(int num) { - return new Mana(notNegative(num, "Red"), 0, 0, 0, 0, 0, 0, 0); + return new Mana(0, 0, 0, notNegative(num, "Red"), 0, 0, 0, 0); } /** @@ -190,49 +312,10 @@ public class Mana implements Comparable, Serializable, Copyable { * * @param num value of Green mana to create. * @return a {@link Mana} object with the passed in {@code num} of Green - * mana. + * mana. */ public static Mana GreenMana(int num) { - return new Mana(0, notNegative(num, "Green"), 0, 0, 0, 0, 0, 0); - } - - /** - * Creates a {@link Mana} object with the passed in {@code num} of Blue - * mana. {@code num} can not be a negative value. Negative values will be - * logged and set to 0. - * - * @param num value of Blue mana to create. - * @return a {@link Mana} object with the passed in {@code num} of Blue - * mana. - */ - public static Mana BlueMana(int num) { - return new Mana(0, 0, notNegative(num, "Blue"), 0, 0, 0, 0, 0); - } - - /** - * Creates a {@link Mana} object with the passed in {@code num} of White - * mana. {@code num} can not be a negative value. Negative values will be - * logged and set to 0. - * - * @param num value of White mana to create. - * @return a {@link Mana} object with the passed in {@code num} of White - * mana. - */ - public static Mana WhiteMana(int num) { - return new Mana(0, 0, 0, notNegative(num, "White"), 0, 0, 0, 0); - } - - /** - * Creates a {@link Mana} object with the passed in {@code num} of Black - * mana. {@code num} can not be a negative value. Negative values will be - * logged and set to 0. - * - * @param num value of Black mana to create. - * @return a {@link Mana} object with the passed in {@code num} of Black - * mana. - */ - public static Mana BlackMana(int num) { - return new Mana(0, 0, 0, 0, notNegative(num, "Black"), 0, 0, 0); + return new Mana(0, 0, 0, 0, notNegative(num, "Green"), 0, 0, 0); } /** @@ -242,7 +325,7 @@ public class Mana implements Comparable, Serializable, Copyable { * * @param num value of Generic mana to create. * @return a {@link Mana} object with the passed in {@code num} of Generic - * mana. + * mana. */ public static Mana GenericMana(int num) { return new Mana(0, 0, 0, 0, 0, notNegative(num, "Generic"), 0, 0); @@ -255,7 +338,7 @@ public class Mana implements Comparable, Serializable, Copyable { * * @param num value of Colorless mana to create. * @return a {@link Mana} object with the passed in {@code num} of Colorless - * mana. + * mana. */ public static Mana ColorlessMana(int num) { return new Mana(0, 0, 0, 0, 0, 0, 0, notNegative(num, "Colorless")); @@ -280,14 +363,14 @@ public class Mana implements Comparable, Serializable, Copyable { * @param mana mana to add to this object. */ public void add(final Mana mana) { - red += mana.getRed(); - green += mana.getGreen(); - blue += mana.getBlue(); - white += mana.getWhite(); - black += mana.getBlack(); - generic += mana.getGeneric(); - colorless += mana.getColorless(); - any += mana.getAny(); + white.incrementAmount(mana.white); + blue.incrementAmount(mana.blue); + black.incrementAmount(mana.black); + red.incrementAmount(mana.red); + green.incrementAmount(mana.green); + generic.incrementAmount(mana.generic); + colorless.incrementAmount(mana.colorless); + any.incrementAmount(mana.any); } /** @@ -296,79 +379,110 @@ public class Mana implements Comparable, Serializable, Copyable { * @param manaType */ public void increase(ManaType manaType) { + increase(manaType, false); + } + + public void increase(ManaType manaType, boolean isSnow) { switch (manaType) { - case BLACK: - black++; + case WHITE: + white.incrementAmount(1, isSnow); break; case BLUE: - blue++; + blue.incrementAmount(1, isSnow); break; - case COLORLESS: - colorless++; - break; - case GENERIC: - generic++; - break; - case GREEN: - green++; + case BLACK: + black.incrementAmount(1, isSnow); break; case RED: - red++; + red.incrementAmount(1, isSnow); break; - case WHITE: - white++; + case GREEN: + green.incrementAmount(1, isSnow); + break; + case COLORLESS: + colorless.incrementAmount(1, isSnow); + break; + case GENERIC: + generic.incrementAmount(1, isSnow); break; } - - } - - /** - * Increases the Red mana by one. - */ - public void increaseRed() { - red++; - } - - /** - * Increases the Green mana by one. - */ - public void increaseGreen() { - green++; - } - - /** - * Increases the Blue mana by one. - */ - public void increaseBlue() { - blue++; } /** * Increases the White mana by one. */ public void increaseWhite() { - white++; + increaseWhite(1, false); + } + + public void increaseWhite(int amount, boolean snow) { + white.incrementAmount(amount, snow); + } + + /** + * Increases the Blue mana by one. + */ + public void increaseBlue() { + increaseBlue(1, false); + } + + public void increaseBlue(int amount, boolean snow) { + blue.incrementAmount(amount, snow); } /** * Increases the Black mana by one. */ public void increaseBlack() { - black++; + increaseBlack(1, false); + } + + public void increaseBlack(int amount, boolean snow) { + black.incrementAmount(amount, snow); + } + + /** + * Increases the Red mana by one. + */ + public void increaseRed() { + increaseRed(1, false); + } + + public void increaseRed(int amount, boolean snow) { + red.incrementAmount(amount, snow); + } + + /** + * Increases the Green mana by one. + */ + public void increaseGreen() { + increaseGreen(1, false); + } + + public void increaseGreen(int amount, boolean snow) { + green.incrementAmount(amount, snow); } /** * Increases the Generic mana by one. */ public void increaseGeneric() { - generic++; + increaseGeneric(1, false); + } + + public void increaseGeneric(int amount, boolean snow) { + generic.incrementAmount(amount, snow); } /** * Increases the Colorless mana by one. */ public void increaseColorless() { - colorless++; + increaseColorless(1, false); + } + + public void increaseColorless(int amount, boolean snow) { + colorless.incrementAmount(amount, snow); } /** @@ -377,14 +491,14 @@ public class Mana implements Comparable, Serializable, Copyable { * @param mana mana values to subtract */ public void subtract(final Mana mana) { - red -= mana.red; - green -= mana.green; - blue -= mana.blue; - white -= mana.white; - black -= mana.black; - generic -= mana.generic; - colorless -= mana.colorless; - any -= mana.any; + white.removeAmount(mana.white); + blue.removeAmount(mana.blue); + black.removeAmount(mana.black); + red.removeAmount(mana.red); + green.removeAmount(mana.green); + generic.removeAmount(mana.generic); + colorless.removeAmount(mana.colorless); + any.removeAmount(mana.any); } /** @@ -394,56 +508,42 @@ public class Mana implements Comparable, Serializable, Copyable { * * @param mana mana values to subtract * @throws ArithmeticException thrown if there is not enough available - * colored mana to pay the generic cost + * colored mana to pay the generic cost */ public void subtractCost(final Mana mana) throws ArithmeticException { - red -= mana.red; - green -= mana.green; - blue -= mana.blue; - white -= mana.white; - black -= mana.black; - any -= mana.any; - generic -= mana.generic; - colorless -= mana.colorless; + white.removeAmount(mana.white); + blue.removeAmount(mana.blue); + black.removeAmount(mana.black); + red.removeAmount(mana.red); + green.removeAmount(mana.green); + generic.removeAmount(mana.generic); + colorless.removeAmount(mana.colorless); + any.removeAmount(mana.any); - while (generic < 0) { - int oldColorless = generic; - if (red > 0) { - red--; - generic++; + while (generic.getAmount() < 0) { + ManaColor oldColorless = generic.copy(); + if (generic.removeOne(white)) { continue; } - if (green > 0) { - green--; - generic++; + if (generic.removeOne(blue)) { continue; } - if (blue > 0) { - blue--; - generic++; + if (generic.removeOne(black)) { continue; } - if (white > 0) { - white--; - generic++; + if (generic.removeOne(red)) { continue; } - if (black > 0) { - black--; - generic++; + if (generic.removeOne(green)) { continue; } - if (colorless > 0) { - colorless--; - generic++; + if (generic.removeOne(colorless)) { continue; } - if (any > 0) { - any--; - generic++; + if (generic.removeOne(any)) { continue; } - if (oldColorless == generic) { + if (oldColorless.getAmount() == generic.getAmount()) { throw new ArithmeticException("Not enough mana to pay colorless"); } } @@ -455,7 +555,14 @@ public class Mana implements Comparable, Serializable, Copyable { * @return the total count of all combined mana. */ public int count() { - return red + green + blue + white + black + generic + colorless + any; + return white.getAmount() + + blue.getAmount() + + black.getAmount() + + red.getAmount() + + green.getAmount() + + generic.getAmount() + + colorless.getAmount() + + any.getAmount(); } /** @@ -464,7 +571,12 @@ public class Mana implements Comparable, Serializable, Copyable { * @return the total count of all colored mana. */ public int countColored() { - return red + green + blue + white + black + any; + return white.getAmount() + + blue.getAmount() + + black.getAmount() + + red.getAmount() + + green.getAmount() + + any.getAmount(); } /** @@ -474,33 +586,33 @@ public class Mana implements Comparable, Serializable, Copyable { * * @param filter the colors of mana to return the count for. * @return the count of filtered mana provided by the passed in - * {@link FilterMana}. + * {@link FilterMana}. */ public int count(final FilterMana filter) { if (filter == null) { return count(); } int count = 0; - if (filter.isBlack()) { - count += black; + if (filter.isWhite()) { + count += white.getAmount(); } if (filter.isBlue()) { - count += blue; + count += blue.getAmount(); } - if (filter.isWhite()) { - count += white; - } - if (filter.isGreen()) { - count += green; + if (filter.isBlack()) { + count += black.getAmount(); } if (filter.isRed()) { - count += red; + count += red.getAmount(); + } + if (filter.isGreen()) { + count += green.getAmount(); } if (filter.isGeneric()) { - count += generic; + count += generic.getAmount(); } if (filter.isColorless()) { - count += colorless; + count += colorless.getAmount(); } return count; } @@ -509,14 +621,14 @@ public class Mana implements Comparable, Serializable, Copyable { * Sets all mana to 0. */ public void clear() { - red = 0; - green = 0; - blue = 0; - white = 0; - black = 0; - generic = 0; - colorless = 0; - any = 0; + white.clear(); + blue.clear(); + black.clear(); + red.clear(); + green.clear(); + generic.clear(); + colorless.clear(); + any.clear(); } /** @@ -527,49 +639,49 @@ public class Mana implements Comparable, Serializable, Copyable { @Override public String toString() { StringBuilder sbMana = new StringBuilder(); - if (generic > 0) { - sbMana.append('{').append(Integer.toString(generic)).append('}'); + if (generic.getAmount() > 0) { + sbMana.append('{').append(Integer.toString(generic.getAmount())).append('}'); } - if (colorless >= 20) { - sbMana.append(Integer.toString(colorless)).append("{C}"); + if (colorless.getAmount() >= 20) { + sbMana.append(Integer.toString(colorless.getAmount())).append("{C}"); } - if (white >= 20) { - sbMana.append(Integer.toString(white)).append("{W}"); + if (white.getAmount() >= 20) { + sbMana.append(Integer.toString(white.getAmount())).append("{W}"); } - if (blue >= 20) { - sbMana.append(Integer.toString(blue)).append("{U}"); + if (blue.getAmount() >= 20) { + sbMana.append(Integer.toString(blue.getAmount())).append("{U}"); } - if (black >= 20) { - sbMana.append(Integer.toString(black)).append("{B}"); + if (black.getAmount() >= 20) { + sbMana.append(Integer.toString(black.getAmount())).append("{B}"); } - if (red >= 20) { - sbMana.append(Integer.toString(red)).append("{R}"); + if (red.getAmount() >= 20) { + sbMana.append(Integer.toString(red.getAmount())).append("{R}"); } - if (green >= 20) { - sbMana.append(Integer.toString(green)).append("{G}"); + if (green.getAmount() >= 20) { + sbMana.append(Integer.toString(green.getAmount())).append("{G}"); } - if (any >= 20) { - sbMana.append(Integer.toString(any)).append("{Any}"); + if (any.getAmount() >= 20) { + sbMana.append(Integer.toString(any.getAmount())).append("{Any}"); } - for (int i = 0; i < colorless && colorless < 20; i++) { + for (int i = 0; i < colorless.getAmount() && colorless.getAmount() < 20; i++) { sbMana.append("{C}"); } - for (int i = 0; i < white && white < 20; i++) { + for (int i = 0; i < white.getAmount() && white.getAmount() < 20; i++) { sbMana.append("{W}"); } - for (int i = 0; i < blue && blue < 20; i++) { + for (int i = 0; i < blue.getAmount() && blue.getAmount() < 20; i++) { sbMana.append("{U}"); } - for (int i = 0; i < black && black < 20; i++) { + for (int i = 0; i < black.getAmount() && black.getAmount() < 20; i++) { sbMana.append("{B}"); } - for (int i = 0; i < red && red < 20; i++) { + for (int i = 0; i < red.getAmount() && red.getAmount() < 20; i++) { sbMana.append("{R}"); } - for (int i = 0; i < green && green < 20; i++) { + for (int i = 0; i < green.getAmount() && green.getAmount() < 20; i++) { sbMana.append("{G}"); } - for (int i = 0; i < any && any < 20; i++) { + for (int i = 0; i < any.getAmount() && any.getAmount() < 20; i++) { sbMana.append("{Any}"); } return sbMana.toString(); @@ -595,51 +707,57 @@ public class Mana implements Comparable, Serializable, Copyable { public boolean enough(final Mana cost) { Mana compare = cost.copy(); compare.subtract(this); - if (compare.red < 0) { - compare.any = compare.getAny() + compare.getRed(); - if (compare.any < 0) { + if (compare.white.getAmount() < 0) { + compare.any.incrementAmount(compare.white); + if (compare.any.getAmount() < 0) { return false; } - compare.red = 0; + compare.white.clear(); } - if (compare.green < 0) { - compare.any = compare.getAny() + compare.getGreen(); - if (compare.any < 0) { + if (compare.blue.getAmount() < 0) { + compare.any.incrementAmount(compare.blue); + if (compare.any.getAmount() < 0) { return false; } - compare.green = 0; + compare.blue.clear(); } - if (compare.blue < 0) { - compare.any = compare.getAny() + compare.getBlue(); - if (compare.any < 0) { + if (compare.black.getAmount() < 0) { + compare.any.incrementAmount(compare.black); + if (compare.any.getAmount() < 0) { return false; } - compare.blue = 0; + compare.black.clear(); } - if (compare.black < 0) { - compare.any = compare.getAny() + compare.getBlack(); - if (compare.any < 0) { + if (compare.red.getAmount() < 0) { + compare.any.incrementAmount(compare.red); + if (compare.any.getAmount() < 0) { return false; } - compare.black = 0; + compare.red.clear(); } - if (compare.white < 0) { - compare.any = compare.getAny() + compare.getWhite(); - if (compare.any < 0) { + if (compare.green.getAmount() < 0) { + compare.any.incrementAmount(compare.green); + if (compare.any.getAmount() < 0) { return false; } - compare.white = 0; + compare.green.clear(); } - if (compare.colorless < 0) { - compare.any = compare.getAny() + compare.getColorless(); - if (compare.any < 0) { + if (compare.colorless.getAmount() < 0) { + compare.any.incrementAmount(compare.colorless); + if (compare.any.getAmount() < 0) { return false; } - compare.colorless = 0; + compare.colorless.clear(); } - if (compare.generic < 0) { - int remaining = compare.red + compare.green + compare.black + compare.blue + compare.white + compare.colorless + compare.any; - if (compare.generic + remaining < 0) { + if (compare.generic.getAmount() < 0) { + compare.generic.incrementAmount(compare.white); + compare.generic.incrementAmount(compare.blue); + compare.generic.incrementAmount(compare.black); + compare.generic.incrementAmount(compare.red); + compare.generic.incrementAmount(compare.green); + compare.generic.incrementAmount(compare.colorless); + compare.generic.incrementAmount(compare.any); + if (compare.generic.getAmount() < 0) { return false; } } @@ -655,139 +773,82 @@ public class Mana implements Comparable, Serializable, Copyable { public Mana needed(final Mana cost) { Mana compare = cost.copy(); compare.subtract(this); - if (compare.red < 0 && compare.any > 0) { - int diff = Math.min(compare.any, Math.abs(compare.red)); - compare.any = compare.getAny() - diff; - compare.red = compare.getRed() + diff; + if (compare.white.getAmount() < 0 && compare.any.getAmount() > 0) { + int diff = Math.min(compare.any.getAmount(), Math.abs(compare.white.getAmount())); + compare.any.incrementAmount(-diff, false); + compare.white.incrementAmount(diff, false); } - if (compare.green < 0 && compare.any > 0) { - int diff = Math.min(compare.any, Math.abs(compare.green)); - compare.any = compare.any - diff; - compare.green = compare.green + diff; + if (compare.blue.getAmount() < 0 && compare.any.getAmount() > 0) { + int diff = Math.min(compare.any.getAmount(), Math.abs(compare.blue.getAmount())); + compare.any.incrementAmount(-diff, false); + compare.blue.incrementAmount(diff, false); } - if (compare.blue < 0 && compare.any > 0) { - int diff = Math.min(compare.any, Math.abs(compare.blue)); - compare.any = compare.any - diff; - compare.blue = compare.blue + diff; + if (compare.black.getAmount() < 0 && compare.any.getAmount() > 0) { + int diff = Math.min(compare.any.getAmount(), Math.abs(compare.black.getAmount())); + compare.any.incrementAmount(-diff, false); + compare.black.incrementAmount(diff, false); } - if (compare.black < 0 && compare.any > 0) { - int diff = Math.min(compare.any, Math.abs(compare.black)); - compare.any = compare.any - diff; - compare.black = compare.getBlack() + diff; + if (compare.red.getAmount() < 0 && compare.any.getAmount() > 0) { + int diff = Math.min(compare.any.getAmount(), Math.abs(compare.red.getAmount())); + compare.any.incrementAmount(-diff, false); + compare.red.incrementAmount(diff, false); } - if (compare.white < 0 && compare.any > 0) { - int diff = Math.min(compare.any, Math.abs(compare.white)); - compare.any = compare.any - diff; - compare.white = compare.white + diff; + if (compare.green.getAmount() < 0 && compare.any.getAmount() > 0) { + int diff = Math.min(compare.any.getAmount(), Math.abs(compare.green.getAmount())); + compare.any.incrementAmount(-diff, false); + compare.green.incrementAmount(diff, false); } - if (compare.colorless < 0 && compare.any > 0) { - int diff = Math.min(compare.any, Math.abs(compare.colorless)); - compare.any = compare.any - diff; - compare.colorless = compare.colorless + diff; + if (compare.colorless.getAmount() < 0 && compare.any.getAmount() > 0) { + int diff = Math.min(compare.any.getAmount(), Math.abs(compare.colorless.getAmount())); + compare.any.incrementAmount(-diff, false); + compare.colorless.incrementAmount(diff, false); } - if (compare.generic < 0) { + if (compare.generic.getAmount() < 0) { int remaining = 0; - remaining += Math.min(0, compare.red); - remaining += Math.min(0, compare.white); - remaining += Math.min(0, compare.green); - remaining += Math.min(0, compare.black); - remaining += Math.min(0, compare.blue); - remaining += Math.min(0, compare.colorless); - remaining += Math.min(0, compare.any); + remaining += Math.min(0, compare.white.getAmount()); + remaining += Math.min(0, compare.blue.getAmount()); + remaining += Math.min(0, compare.black.getAmount()); + remaining += Math.min(0, compare.red.getAmount()); + remaining += Math.min(0, compare.green.getAmount()); + remaining += Math.min(0, compare.colorless.getAmount()); + remaining += Math.min(0, compare.any.getAmount()); if (remaining > 0) { - int diff = Math.min(remaining, Math.abs(compare.generic)); - compare.generic = compare.generic + diff; + int diff = Math.min(remaining, Math.abs(compare.generic.getAmount())); + compare.generic.incrementAmount(diff, false); } } Mana needed = new Mana(); - if (compare.red < 0) { - needed.red = Math.abs(compare.red); + if (compare.white.getAmount() < 0) { + needed.white.removeAmount(compare.white); } - if (compare.white < 0) { - needed.white = Math.abs(compare.white); + if (compare.blue.getAmount() < 0) { + needed.blue.removeAmount(compare.blue); } - if (compare.green < 0) { - needed.green = Math.abs(compare.green); + if (compare.black.getAmount() < 0) { + needed.black.removeAmount(compare.black); } - if (compare.black < 0) { - needed.black = Math.abs(compare.black); + if (compare.red.getAmount() < 0) { + needed.red.removeAmount(compare.red); } - if (compare.blue < 0) { - needed.blue = Math.abs(compare.blue); + if (compare.green.getAmount() < 0) { + needed.green.removeAmount(compare.green); } - if (compare.colorless < 0) { - needed.colorless = Math.abs(compare.colorless); + if (compare.colorless.getAmount() < 0) { + needed.colorless.removeAmount(compare.colorless); } - if (compare.generic < 0) { - needed.generic = Math.abs(compare.generic); + if (compare.generic.getAmount() < 0) { + needed.generic.removeAmount(compare.generic); } return needed; } - /** - * Returns total Red mana. - * - * @return total Red mana. - */ - public int getRed() { - return red; - } - - /** - * Sets the total Red mana. Can not be negative. Negative values will be - * logged and set to 0. - * - * @param red total Red mana. - */ - public void setRed(int red) { - this.red = notNegative(red, "Red"); - } - - /** - * Returns total Green mana. - * - * @return total Green mana. - */ - public int getGreen() { - return green; - } - - /** - * Sets the total Green mana. Can not be negative. Negative values will be - * logged and set to 0. - * - * @param green total Green mana. - */ - public void setGreen(int green) { - this.green = notNegative(green, "Green"); - } - - /** - * Returns total Blue mana. - * - * @return total Blue mana. - */ - public int getBlue() { - return blue; - } - - /** - * Sets the total Blue mana. Can not be negative. Negative values will be - * logged and set to 0. - * - * @param blue total Blue mana. - */ - public void setBlue(int blue) { - this.blue = notNegative(blue, "Blue"); - } - /** * Returns total White mana. * * @return total White mana. */ public int getWhite() { - return white; + return white.getAmount(); } /** @@ -797,7 +858,28 @@ public class Mana implements Comparable, Serializable, Copyable { * @param white total White mana. */ public void setWhite(int white) { - this.white = notNegative(white, "White"); + this.white.clear(); + this.white.incrementAmount(notNegative(white, "White"), false); + } + + /** + * Returns total Blue mana. + * + * @return total Blue mana. + */ + public int getBlue() { + return blue.getAmount(); + } + + /** + * Sets the total Blue mana. Can not be negative. Negative values will be + * logged and set to 0. + * + * @param blue total Blue mana. + */ + public void setBlue(int blue) { + this.blue.clear(); + this.blue.incrementAmount(notNegative(blue, "Blue"), false); } /** @@ -806,7 +888,7 @@ public class Mana implements Comparable, Serializable, Copyable { * @return total Black mana. */ public int getBlack() { - return black; + return black.getAmount(); } /** @@ -816,7 +898,48 @@ public class Mana implements Comparable, Serializable, Copyable { * @param black total Black mana. */ public void setBlack(int black) { - this.black = notNegative(black, "Black"); + this.black.clear(); + this.black.incrementAmount(notNegative(black, "Black"), false); + } + + /** + * Returns total Red mana. + * + * @return total Red mana. + */ + public int getRed() { + return red.getAmount(); + } + + /** + * Sets the total Red mana. Can not be negative. Negative values will be + * logged and set to 0. + * + * @param red total Red mana. + */ + public void setRed(int red) { + this.red.clear(); + this.red.incrementAmount(notNegative(red, "Red"), false); + } + + /** + * Returns total Green mana. + * + * @return total Green mana. + */ + public int getGreen() { + return green.getAmount(); + } + + /** + * Sets the total Green mana. Can not be negative. Negative values will be + * logged and set to 0. + * + * @param green total Green mana. + */ + public void setGreen(int green) { + this.green.clear(); + this.green.incrementAmount(notNegative(green, "Green"), false); } /** @@ -825,7 +948,7 @@ public class Mana implements Comparable, Serializable, Copyable { * @return total Generic mana. */ public int getGeneric() { - return generic; + return generic.getAmount(); } /** @@ -835,7 +958,8 @@ public class Mana implements Comparable, Serializable, Copyable { * @param generic total Generic mana. */ public void setGeneric(int generic) { - this.generic = notNegative(generic, "Generic"); + this.generic.clear(); + this.generic.incrementAmount(notNegative(generic, "Generic"), false); } /** @@ -844,7 +968,7 @@ public class Mana implements Comparable, Serializable, Copyable { * @return total Colorless mana. */ public int getColorless() { - return colorless; + return colorless.getAmount(); } /** @@ -854,7 +978,8 @@ public class Mana implements Comparable, Serializable, Copyable { * @param colorless total Colorless mana. */ public void setColorless(int colorless) { - this.colorless = notNegative(colorless, "Colorless"); + this.colorless.clear(); + this.colorless.incrementAmount(notNegative(colorless, "Colorless"), false); } /** @@ -863,7 +988,7 @@ public class Mana implements Comparable, Serializable, Copyable { * @return total Any mana. */ public int getAny() { - return any; + return any.getAmount(); } /** @@ -873,7 +998,19 @@ public class Mana implements Comparable, Serializable, Copyable { * @param any total Any mana. */ public void setAny(int any) { - this.any = notNegative(any, "Any"); + this.any.clear(); + this.any.incrementAmount(notNegative(any, "Any"), false); + } + + public int getSnow() { + return white.getSnowAmount() + + blue.getSnowAmount() + + black.getSnowAmount() + + red.getSnowAmount() + + green.getSnowAmount() + + colorless.getSnowAmount() + + generic.getSnowAmount() + + any.getSnowAmount(); } /** @@ -895,25 +1032,25 @@ public class Mana implements Comparable, Serializable, Copyable { * @return true if this contains any values that mana has */ public boolean contains(final Mana mana) { - if (mana.black > 0 && this.black > 0) { + if (mana.white.getAmount() > 0 && this.white.getAmount() > 0) { return true; } - if (mana.blue > 0 && this.blue > 0) { + if (mana.blue.getAmount() > 0 && this.blue.getAmount() > 0) { return true; } - if (mana.red > 0 && this.red > 0) { + if (mana.black.getAmount() > 0 && this.black.getAmount() > 0) { return true; } - if (mana.white > 0 && this.white > 0) { + if (mana.red.getAmount() > 0 && this.red.getAmount() > 0) { return true; } - if (mana.green > 0 && this.green > 0) { + if (mana.green.getAmount() > 0 && this.green.getAmount() > 0) { return true; } - if (mana.colorless > 0 && this.colorless > 0) { + if (mana.colorless.getAmount() > 0 && this.colorless.getAmount() > 0) { return true; } - if (mana.generic > 0 && this.count() > 0) { + if (mana.generic.getAmount() > 0 && this.count() > 0) { return true; } @@ -931,22 +1068,22 @@ public class Mana implements Comparable, Serializable, Copyable { * @param mana the mana to check for * @param includeColorless also check for colorless * @return true if this contains any of the same type of coloured mana that - * this has + * this has */ public boolean containsAny(final Mana mana, boolean includeColorless) { - if (mana.black > 0 && this.black > 0) { + if (mana.white.getAmount() > 0 && this.white.getAmount() > 0) { return true; - } else if (mana.blue > 0 && this.blue > 0) { + } else if (mana.blue.getAmount() > 0 && this.blue.getAmount() > 0) { return true; - } else if (mana.red > 0 && this.red > 0) { + } else if (mana.black.getAmount() > 0 && this.black.getAmount() > 0) { return true; - } else if (mana.white > 0 && this.white > 0) { + } else if (mana.red.getAmount() > 0 && this.red.getAmount() > 0) { return true; - } else if (mana.green > 0 && this.green > 0) { + } else if (mana.green.getAmount() > 0 && this.green.getAmount() > 0) { return true; - } else if (mana.colorless > 0 && this.colorless > 0 && includeColorless) { + } else if (mana.colorless.getAmount() > 0 && this.colorless.getAmount() > 0 && includeColorless) { return true; - } else if (mana.any > 0 && this.count() > 0) { + } else if (mana.any.getAmount() > 0 && this.count() > 0) { return true; } @@ -959,23 +1096,23 @@ public class Mana implements Comparable, Serializable, Copyable { * * @param color the color to return the count for. * @return the total count of mana in this object as specified by the passed - * in {@link ColoredManaSymbol}. + * in {@link ColoredManaSymbol}. */ public int getColor(final ColoredManaSymbol color) { - if (color == ColoredManaSymbol.G) { - return green; - } - if (color == ColoredManaSymbol.R) { - return red; - } - if (color == ColoredManaSymbol.B) { - return black; + if (color == ColoredManaSymbol.W) { + return white.getAmount(); } if (color == ColoredManaSymbol.U) { - return blue; + return blue.getAmount(); } - if (color == ColoredManaSymbol.W) { - return white; + if (color == ColoredManaSymbol.B) { + return black.getAmount(); + } + if (color == ColoredManaSymbol.R) { + return red.getAmount(); + } + if (color == ColoredManaSymbol.G) { + return green.getAmount(); } return 0; } @@ -986,22 +1123,22 @@ public class Mana implements Comparable, Serializable, Copyable { * * @param manaType the type to return the count for. * @return the total count of mana in this object as specified by the passed - * in {@link ManaType}. + * in {@link ManaType}. */ public int get(final ManaType manaType) { switch (manaType) { - case BLACK: - return black; - case BLUE: - return blue; - case GREEN: - return green; - case RED: - return red; case WHITE: - return white; + return white.getAmount(); + case BLUE: + return blue.getAmount(); + case BLACK: + return black.getAmount(); + case RED: + return red.getAmount(); + case GREEN: + return green.getAmount(); case COLORLESS: - return generic + colorless; + return generic.getAmount() + colorless.getAmount(); } return 0; } @@ -1015,23 +1152,23 @@ public class Mana implements Comparable, Serializable, Copyable { */ public void set(final ManaType manaType, final int amount) { switch (manaType) { - case BLACK: - black = amount; + case WHITE: + setWhite(amount); break; case BLUE: - blue = amount; + setBlue(amount); break; - case GREEN: - green = amount; + case BLACK: + setBlack(amount); break; case RED: - red = amount; + setRed(amount); break; - case WHITE: - white = amount; + case GREEN: + setGreen(amount); break; case COLORLESS: - colorless = amount; + setColorless(amount); break; default: throw new IllegalArgumentException("Unknown color: " + manaType); @@ -1052,14 +1189,14 @@ public class Mana implements Comparable, Serializable, Copyable { * @param mana the mana to set this object to. */ public void setToMana(final Mana mana) { - this.any = mana.any; - this.red = mana.red; - this.green = mana.green; - this.white = mana.white; - this.blue = mana.blue; - this.black = mana.black; - this.colorless = mana.colorless; - this.generic = mana.generic; + this.any = mana.any.copy(); + this.white = mana.white.copy(); + this.blue = mana.blue.copy(); + this.black = mana.black.copy(); + this.red = mana.red.copy(); + this.green = mana.green.copy(); + this.colorless = mana.colorless.copy(); + this.generic = mana.generic.copy(); } /** @@ -1069,14 +1206,14 @@ public class Mana implements Comparable, Serializable, Copyable { * @return if the passed in {@link Mana} values are equal to this object. */ public boolean equalManaValue(final Mana mana) { - return this.any == mana.any - && this.red == mana.red - && this.green == mana.green - && this.white == mana.white - && this.blue == mana.blue - && this.black == mana.black - && this.colorless == mana.colorless - && this.generic == mana.generic; + return this.any.equals(mana.any) + && this.white.equals(mana.white) + && this.blue.equals(mana.blue) + && this.black.equals(mana.black) + && this.red.equals(mana.red) + && this.green.equals(mana.green) + && this.colorless.equals(mana.colorless) + && this.generic.equals(mana.generic); } /** @@ -1086,17 +1223,17 @@ public class Mana implements Comparable, Serializable, Copyable { * * @param mana the mana to compare with * @return if this object has more than or equal mana to the passed in - * {@link Mana}. + * {@link Mana}. */ public boolean includesMana(Mana mana) { - return this.green >= mana.green - && this.blue >= mana.blue - && this.white >= mana.white - && this.black >= mana.black - && this.red >= mana.red - && this.colorless >= mana.colorless - && (this.generic >= mana.generic - || this.countColored() + this.colorless >= mana.count()); + return this.white.getAmount() >= mana.white.getAmount() + && this.blue.getAmount() >= mana.blue.getAmount() + && this.black.getAmount() >= mana.black.getAmount() + && this.red.getAmount() >= mana.red.getAmount() + && this.green.getAmount() >= mana.green.getAmount() + && this.colorless.getAmount() >= mana.colorless.getAmount() + && (this.generic.getAmount() >= mana.generic.getAmount() + || this.countColored() + this.colorless.getAmount() >= mana.count()); } @@ -1114,11 +1251,11 @@ public class Mana implements Comparable, Serializable, Copyable { public static Mana getMoreValuableMana(final Mana mana1, final Mana mana2) { String conditionString1 = ""; String conditionString2 = ""; - if (mana1 instanceof ConditionalMana){ - conditionString1 = ((ConditionalMana)mana1).getConditionString(); + if (mana1 instanceof ConditionalMana) { + conditionString1 = ((ConditionalMana) mana1).getConditionString(); } - if (mana2 instanceof ConditionalMana){ - conditionString2 = ((ConditionalMana)mana2).getConditionString(); + if (mana2 instanceof ConditionalMana) { + conditionString2 = ((ConditionalMana) mana2).getConditionString(); } if (!conditionString1.equals(conditionString2)) { return null; @@ -1179,19 +1316,19 @@ public class Mana implements Comparable, Serializable, Copyable { */ public int getDifferentColors() { int count = 0; - if (blue > 0) { + if (white.getAmount() > 0) { count++; } - if (black > 0) { + if (blue.getAmount() > 0) { count++; } - if (green > 0) { + if (black.getAmount() > 0) { count++; } - if (white > 0) { + if (red.getAmount() > 0) { count++; } - if (red > 0) { + if (green.getAmount() > 0) { count++; } return count; @@ -1199,55 +1336,25 @@ public class Mana implements Comparable, Serializable, Copyable { @Override public boolean equals(Object o) { - if (this == o) { - return true; - } + if (this == o) return true; if (o == null || getClass() != o.getClass()) { return false; } - Mana mana = (Mana) o; - - if (red != mana.red) { - return false; - } - if (green != mana.green) { - return false; - } - if (blue != mana.blue) { - return false; - } - if (white != mana.white) { - return false; - } - if (black != mana.black) { - return false; - } - if (colorless != mana.colorless) { - return false; - } - if (generic != mana.generic) { - return false; - } - if (any != mana.any) { - return false; - } - return flag == mana.flag; - + return flag == mana.flag + && Objects.equals(white, mana.white) + && Objects.equals(blue, mana.blue) + && Objects.equals(black, mana.black) + && Objects.equals(red, mana.red) + && Objects.equals(green, mana.green) + && Objects.equals(generic, mana.generic) + && Objects.equals(colorless, mana.colorless) + && Objects.equals(any, mana.any); } @Override public int hashCode() { - int result = red; - result = 31 * result + green; - result = 31 * result + blue; - result = 31 * result + white; - result = 31 * result + black; - result = 31 * result + generic; - result = 31 * result + colorless; - result = 31 * result + any; - result = 31 * result + (flag ? 1 : 0); - return result; + return Objects.hash(white, blue, black, red, green, generic, colorless, any, flag); } /** @@ -1258,7 +1365,7 @@ public class Mana implements Comparable, Serializable, Copyable { * @param name the name of the value to check. Used to make logging of the * {@code value} easier * @return the {@code value} passed in, unless it is minus, in which case 0 - * is returned. + * is returned. */ private static int notNegative(int value, final String name) { if (value < 0) { diff --git a/Mage/src/main/java/mage/abilities/condition/common/AdamantCondition.java b/Mage/src/main/java/mage/abilities/condition/common/AdamantCondition.java index 4e45cdf04f2..b09deedcb5a 100644 --- a/Mage/src/main/java/mage/abilities/condition/common/AdamantCondition.java +++ b/Mage/src/main/java/mage/abilities/condition/common/AdamantCondition.java @@ -33,10 +33,10 @@ public enum AdamantCondition implements Condition { if (coloredManaSymbol == null) { return Arrays .stream(ColoredManaSymbol.values()) - .map(source.getManaCostsToPay().getPayment()::getColor) + .map(source.getManaCostsToPay().getUsedManaToPay()::getColor) .anyMatch(i -> i > 2); } - return source.getManaCostsToPay().getPayment().getColor(coloredManaSymbol) > 2; + return source.getManaCostsToPay().getUsedManaToPay().getColor(coloredManaSymbol) > 2; } ManaSpentToCastWatcher watcher = game.getState().getWatcher(ManaSpentToCastWatcher.class, source.getSourceId()); if (watcher == null) { diff --git a/Mage/src/main/java/mage/abilities/condition/common/ManaWasSpentCondition.java b/Mage/src/main/java/mage/abilities/condition/common/ManaWasSpentCondition.java index d512e91716a..fcf1e06da54 100644 --- a/Mage/src/main/java/mage/abilities/condition/common/ManaWasSpentCondition.java +++ b/Mage/src/main/java/mage/abilities/condition/common/ManaWasSpentCondition.java @@ -28,7 +28,7 @@ public class ManaWasSpentCondition implements Condition { @Override public boolean apply(Game game, Ability source) { if (source.getAbilityType() == AbilityType.SPELL) { - return (source.getManaCostsToPay().getPayment().getColor(coloredManaSymbol) > 0); + return (source.getManaCostsToPay().getUsedManaToPay().getColor(coloredManaSymbol) > 0); } ManaSpentToCastWatcher watcher = game.getState().getWatcher(ManaSpentToCastWatcher.class, source.getSourceId()); if (watcher != null) { diff --git a/Mage/src/main/java/mage/abilities/costs/mana/ManaCostImpl.java b/Mage/src/main/java/mage/abilities/costs/mana/ManaCostImpl.java index 36b0ccceccc..056480b9a6f 100644 --- a/Mage/src/main/java/mage/abilities/costs/mana/ManaCostImpl.java +++ b/Mage/src/main/java/mage/abilities/costs/mana/ManaCostImpl.java @@ -73,6 +73,7 @@ public abstract class ManaCostImpl extends CostImpl implements ManaCost { @Override public void clearPaid() { payment.clear(); + usedManaToPay.clear(); super.clearPaid(); } @@ -100,33 +101,33 @@ public abstract class ManaCostImpl extends CostImpl implements ManaCost { protected boolean assignColored(Ability ability, Game game, ManaPool pool, ColoredManaSymbol mana, Cost costToPay) { // first check special mana switch (mana) { - case B: - if (pool.pay(ManaType.BLACK, ability, sourceFilter, game, costToPay, usedManaToPay)) { - this.payment.increaseBlack(); + case W: + if (pool.pay(ManaType.WHITE, ability, sourceFilter, game, costToPay, usedManaToPay)) { + this.payment.increaseWhite(1, pool.getLastPaymentWasSnow()); return true; } break; case U: if (pool.pay(ManaType.BLUE, ability, sourceFilter, game, costToPay, usedManaToPay)) { - this.payment.increaseBlue(); + this.payment.increaseBlue(1, pool.getLastPaymentWasSnow()); return true; } break; - case W: - if (pool.pay(ManaType.WHITE, ability, sourceFilter, game, costToPay, usedManaToPay)) { - this.payment.increaseWhite(); - return true; - } - break; - case G: - if (pool.pay(ManaType.GREEN, ability, sourceFilter, game, costToPay, usedManaToPay)) { - this.payment.increaseGreen(); + case B: + if (pool.pay(ManaType.BLACK, ability, sourceFilter, game, costToPay, usedManaToPay)) { + this.payment.increaseBlack(1, pool.getLastPaymentWasSnow()); return true; } break; case R: if (pool.pay(ManaType.RED, ability, sourceFilter, game, costToPay, usedManaToPay)) { - this.payment.increaseRed(); + this.payment.increaseRed(1, pool.getLastPaymentWasSnow()); + return true; + } + break; + case G: + if (pool.pay(ManaType.GREEN, ability, sourceFilter, game, costToPay, usedManaToPay)) { + this.payment.increaseGreen(1, pool.getLastPaymentWasSnow()); return true; } break; @@ -138,7 +139,7 @@ public abstract class ManaCostImpl extends CostImpl implements ManaCost { int conditionalCount = pool.getConditionalCount(ability, game, null, costToPay); while (mana > payment.count() && (pool.count() > 0 || conditionalCount > 0)) { if (pool.pay(ManaType.COLORLESS, ability, sourceFilter, game, costToPay, usedManaToPay)) { - this.payment.increaseColorless(); + this.payment.increaseColorless(1, pool.getLastPaymentWasSnow()); } break; } @@ -151,38 +152,50 @@ public abstract class ManaCostImpl extends CostImpl implements ManaCost { // filterMana can be null, uses for spells like "spend only black mana on X" // {C} - if ((filterMana == null || filterMana.isColorless()) && pool.pay(ManaType.COLORLESS, ability, sourceFilter, game, costToPay, usedManaToPay)) { - this.payment.increaseColorless(); + if ((filterMana == null || filterMana.isColorless()) && pool.pay( + ManaType.COLORLESS, ability, sourceFilter, game, costToPay, usedManaToPay + )) { + this.payment.increaseColorless(1, pool.getLastPaymentWasSnow()); continue; } // {B} - if ((filterMana == null || filterMana.isBlack()) && pool.pay(ManaType.BLACK, ability, sourceFilter, game, costToPay, usedManaToPay)) { - this.payment.increaseBlack(); + if ((filterMana == null || filterMana.isBlack()) && pool.pay( + ManaType.BLACK, ability, sourceFilter, game, costToPay, usedManaToPay + )) { + this.payment.increaseBlack(1, pool.getLastPaymentWasSnow()); continue; } // {U} - if ((filterMana == null || filterMana.isBlue()) && pool.pay(ManaType.BLUE, ability, sourceFilter, game, costToPay, usedManaToPay)) { - this.payment.increaseBlue(); + if ((filterMana == null || filterMana.isBlue()) && pool.pay( + ManaType.BLUE, ability, sourceFilter, game, costToPay, usedManaToPay + )) { + this.payment.increaseBlue(1, pool.getLastPaymentWasSnow()); continue; } // {W} - if ((filterMana == null || filterMana.isWhite()) && pool.pay(ManaType.WHITE, ability, sourceFilter, game, costToPay, usedManaToPay)) { - this.payment.increaseWhite(); + if ((filterMana == null || filterMana.isWhite()) && pool.pay( + ManaType.WHITE, ability, sourceFilter, game, costToPay, usedManaToPay + )) { + this.payment.increaseWhite(1, pool.getLastPaymentWasSnow()); continue; } // {G} - if ((filterMana == null || filterMana.isGreen()) && pool.pay(ManaType.GREEN, ability, sourceFilter, game, costToPay, usedManaToPay)) { - this.payment.increaseGreen(); + if ((filterMana == null || filterMana.isGreen()) && pool.pay( + ManaType.GREEN, ability, sourceFilter, game, costToPay, usedManaToPay + )) { + this.payment.increaseGreen(1, pool.getLastPaymentWasSnow()); continue; } // {R} - if ((filterMana == null || filterMana.isRed()) && pool.pay(ManaType.RED, ability, sourceFilter, game, costToPay, usedManaToPay)) { - this.payment.increaseRed(); + if ((filterMana == null || filterMana.isRed()) && pool.pay( + ManaType.RED, ability, sourceFilter, game, costToPay, usedManaToPay + )) { + this.payment.increaseRed(1, pool.getLastPaymentWasSnow()); continue; } diff --git a/Mage/src/main/java/mage/abilities/dynamicvalue/common/SnowManaSpentValue.java b/Mage/src/main/java/mage/abilities/dynamicvalue/common/SnowManaSpentValue.java new file mode 100644 index 00000000000..01237aab2a3 --- /dev/null +++ b/Mage/src/main/java/mage/abilities/dynamicvalue/common/SnowManaSpentValue.java @@ -0,0 +1,49 @@ +package mage.abilities.dynamicvalue.common; + +import mage.Mana; +import mage.abilities.Ability; +import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.Effect; +import mage.constants.AbilityType; +import mage.game.Game; +import mage.watchers.common.ManaSpentToCastWatcher; + +/** + * @author TheElk801 + */ +public enum SnowManaSpentValue implements DynamicValue { + instance; + + @Override + public int calculate(Game game, Ability sourceAbility, Effect effect) { + if (sourceAbility.getAbilityType() == AbilityType.SPELL) { + return sourceAbility.getManaCostsToPay().getUsedManaToPay().getSnow(); + } + ManaSpentToCastWatcher watcher = game.getState().getWatcher( + ManaSpentToCastWatcher.class, sourceAbility.getSourceId() + ); + if (watcher == null) { + return 0; + } + Mana payment = watcher.getAndResetLastPayment(); + if (payment == null) { + return 0; + } + return payment.getSnow(); + } + + @Override + public SnowManaSpentValue copy() { + return instance; + } + + @Override + public String toString() { + return "1"; + } + + @Override + public String getMessage() { + return "{S} spent to cast this spell"; + } +} diff --git a/Mage/src/main/java/mage/abilities/dynamicvalue/common/SunburstCount.java b/Mage/src/main/java/mage/abilities/dynamicvalue/common/SunburstCount.java index c27b7de7ff7..db83fe6837e 100644 --- a/Mage/src/main/java/mage/abilities/dynamicvalue/common/SunburstCount.java +++ b/Mage/src/main/java/mage/abilities/dynamicvalue/common/SunburstCount.java @@ -21,7 +21,7 @@ public enum SunburstCount implements DynamicValue { if (!game.getStack().isEmpty()) { StackObject spell = game.getStack().getFirst(); if (spell instanceof Spell && ((Spell) spell).getSourceId().equals(sourceAbility.getSourceId())) { - Mana mana = ((Spell) spell).getSpellAbility().getManaCostsToPay().getPayment(); + Mana mana = ((Spell) spell).getSpellAbility().getManaCostsToPay().getUsedManaToPay(); if (mana.getBlack() > 0) { count++; } diff --git a/Mage/src/main/java/mage/players/ManaPool.java b/Mage/src/main/java/mage/players/ManaPool.java index 5f0f1381a14..c2f2fd8da2b 100644 --- a/Mage/src/main/java/mage/players/ManaPool.java +++ b/Mage/src/main/java/mage/players/ManaPool.java @@ -1,8 +1,7 @@ package mage.players; -import java.io.Serializable; -import java.util.*; import mage.ConditionalMana; +import mage.MageObject; import mage.Mana; import mage.abilities.Ability; import mage.abilities.costs.Cost; @@ -18,6 +17,9 @@ import mage.game.events.ManaEvent; import mage.game.events.ManaPaidEvent; import mage.game.stack.Spell; +import java.io.Serializable; +import java.util.*; + /** * @author BetaSteward_at_googlemail.com */ @@ -35,12 +37,25 @@ public class ManaPool implements Serializable { private final Set doNotEmptyManaTypes = new HashSet<>(); + private static final class ConditionalManaInfo { + private final ManaType manaType; + private final MageObject sourceObject; + + private ConditionalManaInfo(ManaType conditionalMana, MageObject sourceObject) { + this.manaType = conditionalMana; + this.sourceObject = sourceObject; + } + } + + private boolean lastPaymentWasSnow; + public ManaPool(UUID playerId) { this.playerId = playerId; autoPayment = true; autoPaymentRestricted = true; unlockedManaType = null; forcedToPay = false; + lastPaymentWasSnow = false; } public ManaPool(final ManaPool pool) { @@ -56,6 +71,7 @@ public class ManaPool implements Serializable { poolBookmark.add(item.copy()); } this.doNotEmptyManaTypes.addAll(pool.doNotEmptyManaTypes); + this.lastPaymentWasSnow = pool.lastPaymentWasSnow; } public int getRed() { @@ -89,6 +105,7 @@ public class ManaPool implements Serializable { * @return */ public boolean pay(ManaType manaType, Ability ability, Filter filter, Game game, Cost costToPay, Mana usedManaToPay) { + lastPaymentWasSnow = false; if (!isAutoPayment() && manaType != unlockedManaType) { // if manual payment and the needed mana type was not unlocked, nothing will be paid return false; @@ -112,12 +129,13 @@ public class ManaPool implements Serializable { } } // first try to pay from conditional mana (the returned manaType can be changed if AsThoughEffects are active) - ManaType conditionalManaType = getConditional(manaType, ability, filter, game, costToPay, possibleAsThoughPoolManaType); - if (conditionalManaType != null) { - removeConditional(conditionalManaType, ability, game, costToPay, usedManaToPay); + ConditionalManaInfo manaInfo = getConditional(manaType, ability, filter, game, costToPay, possibleAsThoughPoolManaType); + if (manaInfo != null) { + removeConditional(manaInfo, ability, game, costToPay, usedManaToPay); lockManaType(); // pay only one mana if mana payment is set to manually return true; } + lastPaymentWasSnow = false; for (ManaPoolItem mana : manaItems) { if (filter != null) { @@ -144,8 +162,9 @@ public class ManaPool implements Serializable { if (mana.get(usableManaType) > 0) { GameEvent event = new ManaPaidEvent(ability, mana.getSourceId(), mana.getFlag(), mana.getOriginalId()); game.fireEvent(event); - usedManaToPay.increase(usableManaType); + usedManaToPay.increase(usableManaType, mana.getSourceObject().isSnow()); mana.remove(usableManaType); + lastPaymentWasSnow |= mana.getSourceObject().isSnow(); if (mana.count() == 0) { // so no items with count 0 stay in list manaItems.remove(mana); } @@ -160,7 +179,7 @@ public class ManaPool implements Serializable { return getMana().get(manaType); } - private ManaType getConditional(ManaType manaType, Ability ability, Filter filter, Game game, Cost costToPay, ManaType possibleAsThoughPoolManaType) { + private ConditionalManaInfo getConditional(ManaType manaType, Ability ability, Filter filter, Game game, Cost costToPay, ManaType possibleAsThoughPoolManaType) { if (ability == null || getConditionalMana().isEmpty()) { return null; } @@ -180,7 +199,7 @@ public class ManaPool implements Serializable { if (manaTypeToUse != null && mana.getConditionalMana().apply(ability, game, mana.getSourceId(), costToPay)) { if (filter == null || filter.match(mana.getSourceObject(), game)) { - return manaTypeToUse; + return new ConditionalManaInfo(manaTypeToUse, mana.getSourceObject()); } } } @@ -313,7 +332,7 @@ public class ManaPool implements Serializable { if (mana instanceof ConditionalMana) { ManaPoolItem item = new ManaPoolItem((ConditionalMana) mana, source.getSourceObject(game), ((ConditionalMana) mana).getManaProducerOriginalId() != null - ? ((ConditionalMana) mana).getManaProducerOriginalId() : source.getOriginalId()); + ? ((ConditionalMana) mana).getManaProducerOriginalId() : source.getOriginalId()); if (emptyOnTurnsEnd) { item.setDuration(Duration.EndOfTurn); } @@ -365,11 +384,11 @@ public class ManaPool implements Serializable { return new ManaPool(this); } - private void removeConditional(ManaType manaType, Ability ability, Game game, Cost costToPay, Mana usedManaToPay) { + private void removeConditional(ConditionalManaInfo manaInfo, Ability ability, Game game, Cost costToPay, Mana usedManaToPay) { for (ConditionalMana mana : getConditionalMana()) { - if (mana.get(manaType) > 0 && mana.apply(ability, game, mana.getManaProducerId(), costToPay)) { - mana.set(manaType, mana.get(manaType) - 1); - usedManaToPay.increase(manaType); + if (mana.get(manaInfo.manaType) > 0 && mana.apply(ability, game, mana.getManaProducerId(), costToPay)) { + mana.set(manaInfo.manaType, mana.get(manaInfo.manaType) - 1); + usedManaToPay.increase(manaInfo.manaType, manaInfo.sourceObject.isSnow()); GameEvent event = new ManaPaidEvent(ability, mana.getManaProducerId(), mana.getFlag(), mana.getManaProducerOriginalId()); game.fireEvent(event); break; @@ -486,4 +505,8 @@ public class ManaPool implements Serializable { throw new IllegalArgumentException("Wrong mana type " + manaType); } } + + public boolean getLastPaymentWasSnow() { + return lastPaymentWasSnow; + } } diff --git a/Mage/src/main/java/mage/players/ManaPoolItem.java b/Mage/src/main/java/mage/players/ManaPoolItem.java index b694bbe852e..ba75b8798e9 100644 --- a/Mage/src/main/java/mage/players/ManaPoolItem.java +++ b/Mage/src/main/java/mage/players/ManaPoolItem.java @@ -162,7 +162,7 @@ public class ManaPoolItem implements Serializable { } public Mana getMana() { - return new Mana(red, green, blue, white, black, 0, 0, colorless); + return new Mana(white, blue, black, red, green, 0, 0, colorless); } public int count() { diff --git a/Mage/src/main/java/mage/watchers/common/ManaSpentToCastWatcher.java b/Mage/src/main/java/mage/watchers/common/ManaSpentToCastWatcher.java index d3245b586ae..b9da35f1235 100644 --- a/Mage/src/main/java/mage/watchers/common/ManaSpentToCastWatcher.java +++ b/Mage/src/main/java/mage/watchers/common/ManaSpentToCastWatcher.java @@ -28,7 +28,7 @@ public class ManaSpentToCastWatcher extends Watcher { if (event.getType() == GameEvent.EventType.SPELL_CAST) { Spell spell = (Spell) game.getObject(event.getTargetId()); if (spell != null && this.getSourceId().equals(spell.getSourceId())) { - payment = spell.getSpellAbility().getManaCostsToPay().getPayment(); + payment = spell.getSpellAbility().getManaCostsToPay().getUsedManaToPay(); } } if (event.getType() == GameEvent.EventType.ZONE_CHANGE diff --git a/Mage/src/test/java/mage/ManaTest.java b/Mage/src/test/java/mage/ManaTest.java index 9f971bddc4c..853ba45c9b4 100644 --- a/Mage/src/test/java/mage/ManaTest.java +++ b/Mage/src/test/java/mage/ManaTest.java @@ -3,13 +3,12 @@ package mage; import mage.constants.ColoredManaSymbol; import mage.constants.ManaType; import mage.filter.FilterMana; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.assertNotSame; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; +import static org.junit.Assert.*; + /** * Custom unit tests for {link Mana}. @@ -145,7 +144,7 @@ public class ManaTest { public void shouldCreateManaFromIntegers() { // when - Mana mana = new Mana(1, 2, 3, 4, 5, 6, 7, 8); + Mana mana = new Mana(4, 3, 5, 1, 2, 6, 7, 8); // then assertEquals(1, mana.getRed()); @@ -163,7 +162,7 @@ public class ManaTest { // given // when - Mana mana = new Mana(-1, 2, 3, 4, 5, 6, 7, 0); + Mana mana = new Mana(4, 3, 5, -1, 2, 6, 7, 0); // then assertEquals(0, mana.getRed()); @@ -315,11 +314,11 @@ public class ManaTest { thisMana.add(thatMana); // then - assertEquals(2, thisMana.getRed()); - assertEquals(4, thisMana.getGreen()); - assertEquals(6, thisMana.getBlue()); - assertEquals(8, thisMana.getWhite()); - assertEquals(10, thisMana.getBlack()); + assertEquals(2, thisMana.getWhite()); + assertEquals(4, thisMana.getBlue()); + assertEquals(6, thisMana.getBlack()); + assertEquals(8, thisMana.getRed()); + assertEquals(10, thisMana.getGreen()); assertEquals(12, thisMana.getGeneric()); assertEquals(14, thisMana.getAny()); } @@ -420,7 +419,7 @@ public class ManaTest { public void shouldSubtractCost() { // given Mana thisMana = new Mana(2, 2, 2, 2, 2, 2, 2, 0); - Mana thatMana = new Mana(10, 1, 1, 1, 10, 1, 1, 0); + Mana thatMana = new Mana(1, 1, 10, 10, 1, 1, 1, 0); // when thisMana.subtractCost(thatMana); @@ -471,7 +470,7 @@ public class ManaTest { @Test public void shouldReturnCount() { // given - Mana mana = new Mana(1, 2, 3, 4, 5, 6, 7, 0); + Mana mana = new Mana(4, 3, 5, 1, 2, 6, 7, 0); FilterMana filter = new FilterMana(); filter.setBlack(true); @@ -489,7 +488,7 @@ public class ManaTest { @Test public void shouldReturnString() { // given - Mana mana = new Mana(1, 2, 3, 0, 3, 6, 2, 0); + Mana mana = new Mana(0, 3, 3, 1, 2, 6, 2, 0); // when String ret = mana.toString();