From c8f82b49ff29cf80f7fed9e1830c02e2b56b1e4f Mon Sep 17 00:00:00 2001 From: LevelX2 <ludwig.hirth@online.de> Date: Sun, 10 Jan 2016 12:01:58 +0100 Subject: [PATCH] Added possibility to check kind of cost to pay for conditional mana use. --- .../java/mage/player/ai/ComputerPlayer.java | 2 +- .../src/mage/player/human/HumanPlayer.java | 2 +- .../sets/alarareborn/VectisDominator.java | 2 +- .../sets/alliances/ElvishSpiritGuide.java | 3 +- .../sets/alliances/PhyrexianDevourer.java | 2 +- .../sets/avacynrestored/CavernOfSouls.java | 3 +- .../battleforzendikar/GrovetenderDruids.java | 2 +- .../betrayersofkamigawa/BlindingPowder.java | 3 +- .../betrayersofkamigawa/OgreMarauder.java | 2 +- .../sets/betrayersofkamigawa/Shuriken.java | 2 +- .../sets/bornofthegods/FloodtideSerpent.java | 2 +- .../sets/bornofthegods/HeroOfLeinaTower.java | 2 +- .../bornofthegods/MogisGodOfSlaughter.java | 2 +- .../championsofkamigawa/CutTheTethers.java | 2 +- .../mage/sets/championsofkamigawa/Hankyu.java | 3 +- .../HisokaMinamoSensei.java | 3 +- .../UntaidakeTheCloudKeeper.java | 9 +- .../src/mage/sets/coldsnap/BraidOfFire.java | 3 +- .../src/mage/sets/coldsnap/JotunGrunt.java | 3 +- .../mage/sets/coldsnap/ShelteringAncient.java | 3 +- .../mage/sets/commander/AllianceOfArms.java | 2 +- .../sets/commander/ChorusOfTheConclave.java | 2 +- .../mage/sets/commander/CollectiveVoyage.java | 2 +- .../sets/commander/ManaChargedDragon.java | 2 +- .../src/mage/sets/commander/MindsAglow.java | 2 +- .../src/mage/sets/commander/SharedTrauma.java | 2 +- .../sets/commander/VishKalBloodArbiter.java | 2 +- .../commander2013/MarathWillOfTheWild.java | 3 +- .../src/mage/sets/conspiracy/Victimize.java | 2 +- .../sets/darkascension/JarOfEyeballs.java | 2 +- .../src/mage/sets/darksteel/LeoninBola.java | 3 +- .../sets/darksteel/SurestrikeTrident.java | 3 +- .../HavenOfTheSpiritDragon.java | 3 +- .../dragonsoftarkir/MysticMeditation.java | 2 +- .../src/mage/sets/eventide/HatchetBully.java | 3 +- .../src/mage/sets/eventide/ImpelledGiant.java | 3 +- .../sets/eventide/RiseOfTheHobgoblins.java | 2 +- .../src/mage/sets/exodus/ErraticPortal.java | 2 +- .../sets/fallenempires/TidalInfluence.java | 3 +- .../mage/sets/fifthdawn/DisruptionAura.java | 2 +- .../sets/fifthdawn/PlungeIntoDarkness.java | 2 +- .../mage/sets/fifthdawn/PossessedPortal.java | 4 +- .../sets/fourthedition/ForceOfNature.java | 2 +- .../src/mage/sets/futuresight/NimbusMaze.java | 3 +- .../sets/guildpact/LeylineOfLightning.java | 2 +- .../src/mage/sets/iceage/MysticRemora.java | 2 +- Mage.Sets/src/mage/sets/iceage/Seizures.java | 2 +- .../mage/sets/innistrad/BackFromTheBrink.java | 3 +- .../sets/innistrad/FrightfulDelusion.java | 2 +- .../mage/sets/innistrad/ScreechingBat.java | 2 +- .../journeyintonyx/AthreosGodOfPassage.java | 2 +- .../sets/journeyintonyx/DiscipleOfDeceit.java | 2 +- .../mage/sets/journeyintonyx/SageOfHours.java | 2 +- .../src/mage/sets/judgment/WormfangDrake.java | 3 +- .../src/mage/sets/legends/ChainLightning.java | 2 +- .../src/mage/sets/legends/CosmicHorror.java | 2 +- .../legends/TheTabernacleAtPendrellVale.java | 2 +- .../mage/sets/limitedalpha/DemonicHordes.java | 2 +- .../src/mage/sets/lorwyn/BrokenAmbitions.java | 2 +- .../mage/sets/lorwyn/RingsOfBrighthearth.java | 2 +- .../src/mage/sets/lorwyn/SilvergillAdept.java | 3 +- .../mage/sets/magic2011/AncientHellkite.java | 3 +- .../sets/magic2015/IndulgentTormentor.java | 4 +- .../sets/magic2015/NecromancersStockpile.java | 3 +- .../src/mage/sets/magic2015/SliverHive.java | 4 +- .../sets/masterseditionii/ForgottenLore.java | 2 +- .../sets/masterseditioniii/ManaVortex.java | 2 +- .../sets/masterseditioniii/WanderingMage.java | 3 +- .../sets/masterseditioniv/HasranOgress.java | 2 +- .../masterseditioniv/SoldeviMachinist.java | 3 +- .../sets/mercadianmasques/HornOfPlenty.java | 2 +- .../mage/sets/mercadianmasques/LandGrant.java | 3 +- Mage.Sets/src/mage/sets/mirage/Flash.java | 2 +- .../sets/mirage/PhyrexianDreadnought.java | 3 +- .../src/mage/sets/mirage/VaporousDjinn.java | 2 +- .../src/mage/sets/mirrodin/CrystalShard.java | 2 +- .../mage/sets/mirrodin/TajNarSwordsmith.java | 2 +- .../sets/modernmasters/RiftElemental.java | 3 +- .../src/mage/sets/nemesis/RootwaterThief.java | 2 +- .../sets/newphyrexia/GreenhiltTrainee.java | 3 +- .../oathofthegatewatch/GravityNegator.java | 10 ++- .../KozilekTheGreatDistortion.java | 3 +- .../src/mage/sets/odyssey/DecayingSoil.java | 2 +- .../src/mage/sets/odyssey/DelayingShield.java | 2 +- Mage.Sets/src/mage/sets/odyssey/Divert.java | 2 +- .../src/mage/sets/odyssey/UnifyingTheory.java | 2 +- .../mage/sets/planarchaos/BrainGorgers.java | 2 +- .../src/mage/sets/planarchaos/DashHopes.java | 2 +- .../sets/planarchaos/Phantasmagorian.java | 2 +- .../mage/sets/planarchaos/ShivanWumpus.java | 2 +- .../mage/sets/planarchaos/ShroudedLore.java | 2 +- .../sets/planarchaos/SimianSpiritGuide.java | 3 +- .../sets/planechase/ThirstForKnowledge.java | 2 +- .../sets/planeshift/PhyrexianTyranny.java | 2 +- .../src/mage/sets/prophecy/RhysticStudy.java | 2 +- .../src/mage/sets/ravnica/Sunforger.java | 3 +- .../mage/sets/returntoravnica/SoulTithe.java | 2 +- .../sets/saviorsofkamigawa/TombOfUrami.java | 3 +- .../scarsofmirrodin/BloodshotTrainee.java | 3 +- .../mage/sets/scarsofmirrodin/Embersmith.java | 2 +- .../mage/sets/scarsofmirrodin/Lifesmith.java | 2 +- .../mage/sets/scarsofmirrodin/Myrsmith.java | 2 +- .../sets/scarsofmirrodin/NimDeathmantle.java | 2 +- .../sets/scarsofmirrodin/PainfulQuandary.java | 2 +- .../mage/sets/shadowmoor/MossbridgeTroll.java | 3 +- .../mage/sets/shadowmoor/ScarscaleRitual.java | 3 +- .../src/mage/sets/shadowmoor/Tyrannize.java | 2 +- .../sets/shardsofalara/FlameblastDragon.java | 2 +- .../sets/shardsofalara/PrinceOfThralls.java | 2 +- .../src/mage/sets/tempest/EssenceBottle.java | 2 +- .../src/mage/sets/tempest/TortureChamber.java | 2 +- .../mage/sets/timeshifted/WallOfRoots.java | 3 +- .../mage/sets/urzaslegacy/MoltenHydra.java | 2 +- .../src/mage/sets/urzaslegacy/SlowMotion.java | 2 +- .../mage/sets/urzassaga/ArgothianWurm.java | 2 +- .../src/mage/sets/urzassaga/LurkingEvil.java | 3 +- .../sets/vintagemasters/DecreeOfJustice.java | 2 +- .../sets/weatherlight/LlanowarSentinel.java | 2 +- .../mage/sets/weatherlight/PsychicVortex.java | 3 +- .../sets/weatherlight/SpinningDarkness.java | 3 +- .../src/mage/sets/weatherlight/Tariff.java | 2 +- .../worldwake/KazuulTyrantOfTheCliffs.java | 2 +- .../mage/sets/worldwake/RazorBoomerang.java | 3 +- .../src/mage/sets/worldwake/TectonicEdge.java | 3 +- .../mage/sets/worldwake/VastwoodAnimist.java | 8 +- .../src/mage/sets/zendikar/BlazingTorch.java | 3 +- .../mage/sets/zendikar/Electropotence.java | 2 +- .../src/mage/sets/zendikar/FeastOfBlood.java | 3 +- .../mage/sets/zendikar/HellkiteCharger.java | 2 +- .../sets/zendikar/LorthosTheTidemaker.java | 2 +- .../sets/zendikar/LuminarchAscension.java | 3 +- .../test/cards/mana/ConditionalManaTest.java | 61 +++++++++++++ Mage/src/main/java/mage/ConditionalMana.java | 90 ++++++++++--------- .../main/java/mage/abilities/AbilityImpl.java | 8 +- .../common/GemstoneCavernsAbility.java | 2 +- .../delayed/PactDelayedTriggeredAbility.java | 2 +- .../mage/abilities/costs/CompositeCost.java | 8 +- .../main/java/mage/abilities/costs/Cost.java | 2 + .../java/mage/abilities/costs/CostImpl.java | 7 ++ .../java/mage/abilities/costs/CostsImpl.java | 7 +- .../java/mage/abilities/costs/OrCost.java | 7 +- .../abilities/costs/VariableCostImpl.java | 7 +- .../costs/common/ControlPermanentCost.java | 3 +- .../costs/common/DiscardHandCost.java | 3 +- .../costs/common/DiscardSourceCost.java | 3 +- .../costs/common/DiscardTargetCost.java | 3 +- .../costs/common/ExileFromGraveCost.java | 3 +- .../costs/common/ExileFromHandCost.java | 3 +- .../costs/common/ExileFromStackCost.java | 3 +- .../common/ExileFromTopOfLibraryCost.java | 3 +- ...OpponentsCardFromExileToGraveyardCost.java | 3 +- .../costs/common/ExileSourceCost.java | 3 +- .../common/ExileSourceFromGraveCost.java | 3 +- .../costs/common/ExileTargetCost.java | 3 +- .../common/ExileTopCardOfGraveyardCost.java | 3 +- .../ExileTopCreatureCardOfGraveyardCost.java | 3 +- .../costs/common/GainLifeOpponentCost.java | 3 +- .../costs/common/GainLifePlayersCost.java | 3 +- .../abilities/costs/common/PayLifeCost.java | 3 +- .../costs/common/PayLoyaltyCost.java | 3 +- .../costs/common/PutCountersSourceCost.java | 3 +- ...utTopCardOfYourLibraryToGraveyardCost.java | 3 +- .../costs/common/RemoveCounterCost.java | 3 +- .../common/RemoveCountersSourceCost.java | 3 +- .../RemoveVariableCountersTargetCost.java | 2 +- ...rnToHandChosenControlledPermanentCost.java | 3 +- ...ReturnToHandFromBattlefieldSourceCost.java | 3 +- .../common/ReturnToHandFromGraveyardCost.java | 3 +- .../RevealHandSourceControllerCost.java | 3 +- .../common/RevealSourceFromYourHandCost.java | 3 +- .../common/RevealTargetFromHandCost.java | 3 +- .../costs/common/SacrificeAllCost.java | 3 +- .../costs/common/SacrificeSourceCost.java | 59 ++++++------ .../costs/common/SacrificeTargetCost.java | 3 +- .../abilities/costs/common/TapSourceCost.java | 3 +- .../abilities/costs/common/TapTargetCost.java | 3 +- .../costs/common/UntapSourceCost.java | 3 +- .../costs/common/UntapTargetCost.java | 3 +- .../abilities/costs/mana/ColoredManaCost.java | 60 ++++++------- .../costs/mana/ColorlessManaCost.java | 5 +- .../abilities/costs/mana/GenericManaCost.java | 59 ++++++------ .../abilities/costs/mana/HybridManaCost.java | 7 +- .../mage/abilities/costs/mana/ManaCost.java | 2 +- .../abilities/costs/mana/ManaCostImpl.java | 35 ++++---- .../abilities/costs/mana/ManaCostsImpl.java | 30 ++++--- .../costs/mana/MonoHybridManaCost.java | 7 +- .../costs/mana/PhyrexianManaCost.java | 66 +++++++------- .../abilities/costs/mana/SnowManaCost.java | 64 ++++++------- .../costs/mana/VariableManaCost.java | 62 +++++++------ .../PayCostToAttackBlockEffectImpl.java | 2 +- .../common/CounterUnlessPaysEffect.java | 2 +- .../common/DoUnlessAnyPlayerPaysEffect.java | 2 +- ...attlefieldPayCostOrPutGraveyardEffect.java | 2 +- .../common/ExileSourceUnlessPaysEffect.java | 2 +- .../SacrificeSourceUnlessPaysEffect.java | 2 +- .../common/TapSourceUnlessPaysEffect.java | 2 +- ...DuringEachOtherPlayersUntapStepEffect.java | 6 +- .../abilities/keyword/ChampionAbility.java | 3 +- .../keyword/CumulativeUpkeepAbility.java | 2 +- .../mage/abilities/keyword/EchoAbility.java | 2 +- .../mage/abilities/keyword/ExtortAbility.java | 2 +- .../abilities/keyword/NinjutsuAbility.java | 4 +- .../abilities/keyword/RecoverAbility.java | 2 +- .../ArtifactCastManaCondition.java | 60 ++++++------- .../ConditionalSpellManaBuilder.java | 3 +- .../CreatureCastManaCondition.java | 61 ++++++------- .../mana/conditional/ManaCondition.java | 61 ++++++------- Mage/src/main/java/mage/players/ManaPool.java | 28 +++--- 208 files changed, 770 insertions(+), 571 deletions(-) diff --git a/Mage.Server.Plugins/Mage.Player.AI/src/main/java/mage/player/ai/ComputerPlayer.java b/Mage.Server.Plugins/Mage.Player.AI/src/main/java/mage/player/ai/ComputerPlayer.java index c80e52560b..187c043895 100644 --- a/Mage.Server.Plugins/Mage.Player.AI/src/main/java/mage/player/ai/ComputerPlayer.java +++ b/Mage.Server.Plugins/Mage.Player.AI/src/main/java/mage/player/ai/ComputerPlayer.java @@ -1195,7 +1195,7 @@ public class ComputerPlayer extends PlayerImpl implements Player { } // pay phyrexian life costs if (cost instanceof PhyrexianManaCost) { - if (cost.pay(null, game, null, playerId, false) || spendAnyMana) { + if (cost.pay(null, game, null, playerId, false, null) || spendAnyMana) { return true; } } diff --git a/Mage.Server.Plugins/Mage.Player.Human/src/mage/player/human/HumanPlayer.java b/Mage.Server.Plugins/Mage.Player.Human/src/mage/player/human/HumanPlayer.java index ee62a58f33..48895f9e72 100644 --- a/Mage.Server.Plugins/Mage.Player.Human/src/mage/player/human/HumanPlayer.java +++ b/Mage.Server.Plugins/Mage.Player.Human/src/mage/player/human/HumanPlayer.java @@ -805,7 +805,7 @@ public class HumanPlayer extends PlayerImpl { if (cost instanceof PhyrexianManaCost) { PhyrexianManaCost ph = (PhyrexianManaCost) cost; if (ph.canPay(null, null, playerId, game)) { - ((PhyrexianManaCost) cost).pay(null, game, null, playerId, false); + ((PhyrexianManaCost) cost).pay(null, game, null, playerId, false, null); } break; } diff --git a/Mage.Sets/src/mage/sets/alarareborn/VectisDominator.java b/Mage.Sets/src/mage/sets/alarareborn/VectisDominator.java index 6c3e4d6f24..118f2f7bae 100644 --- a/Mage.Sets/src/mage/sets/alarareborn/VectisDominator.java +++ b/Mage.Sets/src/mage/sets/alarareborn/VectisDominator.java @@ -105,7 +105,7 @@ class VectisDominatorEffect extends OneShotEffect { cost.clearPaid(); final StringBuilder sb = new StringBuilder("Pay 2 life? (Otherwise ").append(targetCreature.getName()).append(" will be tapped)"); if (player.chooseUse(Outcome.Benefit, sb.toString(), source, game)) { - cost.pay(source, game, targetCreature.getControllerId(), targetCreature.getControllerId(), true); + cost.pay(source, game, targetCreature.getControllerId(), targetCreature.getControllerId(), true, null); } if (!cost.isPaid()) { return targetCreature.tap(game); diff --git a/Mage.Sets/src/mage/sets/alliances/ElvishSpiritGuide.java b/Mage.Sets/src/mage/sets/alliances/ElvishSpiritGuide.java index c8edfd7de7..cd9ab9e056 100644 --- a/Mage.Sets/src/mage/sets/alliances/ElvishSpiritGuide.java +++ b/Mage.Sets/src/mage/sets/alliances/ElvishSpiritGuide.java @@ -31,6 +31,7 @@ import java.util.UUID; import mage.MageInt; import mage.Mana; import mage.abilities.Ability; +import mage.abilities.costs.Cost; import mage.abilities.costs.CostImpl; import mage.abilities.effects.common.BasicManaEffect; import mage.abilities.mana.SimpleManaAbility; @@ -83,7 +84,7 @@ class ExileSourceFromHandCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { + public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { Card card = game.getCard(sourceId); Player player = game.getPlayer(controllerId); if (player != null && player.getHand().contains(sourceId) && card != null) { diff --git a/Mage.Sets/src/mage/sets/alliances/PhyrexianDevourer.java b/Mage.Sets/src/mage/sets/alliances/PhyrexianDevourer.java index 36a4e5d6da..9c61a9cf52 100644 --- a/Mage.Sets/src/mage/sets/alliances/PhyrexianDevourer.java +++ b/Mage.Sets/src/mage/sets/alliances/PhyrexianDevourer.java @@ -160,7 +160,7 @@ class ExileTopCardLibraryCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { + public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { Player controller = game.getPlayer(controllerId); if (controller != null) { card = controller.getLibrary().getFromTop(game); diff --git a/Mage.Sets/src/mage/sets/avacynrestored/CavernOfSouls.java b/Mage.Sets/src/mage/sets/avacynrestored/CavernOfSouls.java index f84dff7fc5..747c9bb6b9 100644 --- a/Mage.Sets/src/mage/sets/avacynrestored/CavernOfSouls.java +++ b/Mage.Sets/src/mage/sets/avacynrestored/CavernOfSouls.java @@ -36,6 +36,7 @@ import mage.Mana; import mage.abilities.Ability; import mage.abilities.common.AsEntersBattlefieldAbility; import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.costs.Cost; import mage.abilities.costs.common.TapSourceCost; import mage.abilities.effects.ContinuousRuleModifyingEffectImpl; import mage.abilities.effects.common.ChooseCreatureTypeEffect; @@ -136,7 +137,7 @@ class CavernOfSoulsManaCondition extends CreatureCastManaCondition { } @Override - public boolean apply(Game game, Ability source, UUID manaProducer) { + public boolean apply(Game game, Ability source, UUID originalId, Cost costToPay) { // check: ... to cast a creature spell if (super.apply(game, source)) { // check: ... of the chosen type diff --git a/Mage.Sets/src/mage/sets/battleforzendikar/GrovetenderDruids.java b/Mage.Sets/src/mage/sets/battleforzendikar/GrovetenderDruids.java index fa502b0d48..1aac726490 100644 --- a/Mage.Sets/src/mage/sets/battleforzendikar/GrovetenderDruids.java +++ b/Mage.Sets/src/mage/sets/battleforzendikar/GrovetenderDruids.java @@ -95,7 +95,7 @@ class GrovetenderDruidsEffect extends OneShotEffect { if(player != null) { if(player.chooseUse(Outcome.BoostCreature, "Do you want to to pay {1}?", source, game)) { Cost cost = new ManaCostsImpl("{1}"); - if(cost.pay(source, game, source.getSourceId(), source.getControllerId(), false)) { + if(cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) { new CreateTokenEffect(new GrovetenderDruidsPlantToken()).apply(game, source); } return true; diff --git a/Mage.Sets/src/mage/sets/betrayersofkamigawa/BlindingPowder.java b/Mage.Sets/src/mage/sets/betrayersofkamigawa/BlindingPowder.java index 727a67b0c6..81eb750bfc 100644 --- a/Mage.Sets/src/mage/sets/betrayersofkamigawa/BlindingPowder.java +++ b/Mage.Sets/src/mage/sets/betrayersofkamigawa/BlindingPowder.java @@ -31,6 +31,7 @@ import java.util.UUID; import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.costs.Cost; import mage.abilities.costs.CostImpl; import mage.abilities.costs.mana.GenericManaCost; import mage.abilities.effects.Effect; @@ -92,7 +93,7 @@ class BlindingPowderUnattachCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { + public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { Permanent permanent = game.getPermanent(sourceId); if (permanent != null) { for (UUID attachmentId : permanent.getAttachments()) { diff --git a/Mage.Sets/src/mage/sets/betrayersofkamigawa/OgreMarauder.java b/Mage.Sets/src/mage/sets/betrayersofkamigawa/OgreMarauder.java index cc0ed1bcf5..133834c0a3 100644 --- a/Mage.Sets/src/mage/sets/betrayersofkamigawa/OgreMarauder.java +++ b/Mage.Sets/src/mage/sets/betrayersofkamigawa/OgreMarauder.java @@ -100,7 +100,7 @@ class OgreMarauderEffect extends OneShotEffect { Cost cost = new SacrificeTargetCost(new TargetControlledCreaturePermanent()); if (cost.canPay(source, source.getSourceId(), defendingPlayerId, game) && defender.chooseUse(Outcome.LoseAbility, "Sacrifice a creature to prevent that " + sourceObject.getLogName() + " can't be blocked?", source, game)) { - if (!cost.pay(source, game, source.getSourceId(), defendingPlayerId, false)) { + if (!cost.pay(source, game, source.getSourceId(), defendingPlayerId, false, null)) { // cost was not payed - so source can't be blocked ContinuousEffect effect = new CantBeBlockedSourceEffect(Duration.EndOfTurn); game.addEffect(effect, source); diff --git a/Mage.Sets/src/mage/sets/betrayersofkamigawa/Shuriken.java b/Mage.Sets/src/mage/sets/betrayersofkamigawa/Shuriken.java index 3ba3e2f811..32d4148405 100644 --- a/Mage.Sets/src/mage/sets/betrayersofkamigawa/Shuriken.java +++ b/Mage.Sets/src/mage/sets/betrayersofkamigawa/Shuriken.java @@ -138,7 +138,7 @@ class ShurikenUnattachCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { + public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { Permanent permanent = game.getPermanent(sourceId); if (permanent != null) { for (UUID attachmentId :permanent.getAttachments()) { diff --git a/Mage.Sets/src/mage/sets/bornofthegods/FloodtideSerpent.java b/Mage.Sets/src/mage/sets/bornofthegods/FloodtideSerpent.java index 16e5cd9183..c0924fe1e9 100644 --- a/Mage.Sets/src/mage/sets/bornofthegods/FloodtideSerpent.java +++ b/Mage.Sets/src/mage/sets/bornofthegods/FloodtideSerpent.java @@ -109,7 +109,7 @@ class FloodtideSerpentReplacementEffect extends ReplacementEffectImpl { ReturnToHandChosenControlledPermanentCost attackCost = new ReturnToHandChosenControlledPermanentCost(new TargetControlledPermanent(filter)); if (attackCost.canPay(source, source.getSourceId(), event.getPlayerId(), game) && player.chooseUse(Outcome.Neutral, "Return an enchantment you control to hand to attack?", source, game)) { - if (attackCost.pay(source, game, source.getSourceId(), event.getPlayerId(), true)) { + if (attackCost.pay(source, game, source.getSourceId(), event.getPlayerId(), true, null)) { return false; } } diff --git a/Mage.Sets/src/mage/sets/bornofthegods/HeroOfLeinaTower.java b/Mage.Sets/src/mage/sets/bornofthegods/HeroOfLeinaTower.java index 7611a10855..b458d1b7ae 100644 --- a/Mage.Sets/src/mage/sets/bornofthegods/HeroOfLeinaTower.java +++ b/Mage.Sets/src/mage/sets/bornofthegods/HeroOfLeinaTower.java @@ -98,7 +98,7 @@ class HeroOfLeinaTowerEffect extends OneShotEffect { if (you != null && you.chooseUse(Outcome.BoostCreature, "Do you want to to pay {X}?", source, game)) { int costX = you.announceXMana(0, Integer.MAX_VALUE, "Announce the value for {X}", game, source); cost.add(new GenericManaCost(costX)); - if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false)) { + if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) { Permanent sourcePermanent = game.getPermanent(source.getSourceId()); if (sourcePermanent != null) { return new AddCountersSourceEffect(CounterType.P1P1.createInstance(costX), true).apply(game, source); diff --git a/Mage.Sets/src/mage/sets/bornofthegods/MogisGodOfSlaughter.java b/Mage.Sets/src/mage/sets/bornofthegods/MogisGodOfSlaughter.java index d5bd22552a..62207a504f 100644 --- a/Mage.Sets/src/mage/sets/bornofthegods/MogisGodOfSlaughter.java +++ b/Mage.Sets/src/mage/sets/bornofthegods/MogisGodOfSlaughter.java @@ -130,7 +130,7 @@ class DoUnlessTargetPaysCost extends OneShotEffect { message = CardUtil.replaceSourceName(message, mageObject.getLogName()); cost.clearPaid(); if (cost.canPay(source, source.getSourceId(), player.getId(), game) && player.chooseUse(executingEffect.getOutcome(), message, source, game)) { - cost.pay(source, game, source.getSourceId(), player.getId(), false); + cost.pay(source, game, source.getSourceId(), player.getId(), false, null); } if (!cost.isPaid()) { executingEffect.setTargetPointer(this.targetPointer); diff --git a/Mage.Sets/src/mage/sets/championsofkamigawa/CutTheTethers.java b/Mage.Sets/src/mage/sets/championsofkamigawa/CutTheTethers.java index 8b8bfd29f6..a731607f13 100644 --- a/Mage.Sets/src/mage/sets/championsofkamigawa/CutTheTethers.java +++ b/Mage.Sets/src/mage/sets/championsofkamigawa/CutTheTethers.java @@ -98,7 +98,7 @@ class CutTheTethersEffect extends OneShotEffect { boolean paid = false; if (player.chooseUse(outcome, new StringBuilder("Pay {3} to keep ").append(creature.getName()).append(" on the battlefield?").toString(), source, game)) { Cost cost = new GenericManaCost(3); - if (!cost.pay(source, game, source.getSourceId(), creature.getControllerId(), false)) { + if (!cost.pay(source, game, source.getSourceId(), creature.getControllerId(), false, null)) { paid = true; } if (!paid) { diff --git a/Mage.Sets/src/mage/sets/championsofkamigawa/Hankyu.java b/Mage.Sets/src/mage/sets/championsofkamigawa/Hankyu.java index 37053638d2..cc32185da8 100644 --- a/Mage.Sets/src/mage/sets/championsofkamigawa/Hankyu.java +++ b/Mage.Sets/src/mage/sets/championsofkamigawa/Hankyu.java @@ -36,6 +36,7 @@ import mage.constants.Zone; import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.costs.Cost; import mage.abilities.costs.CostImpl; import mage.abilities.costs.common.TapSourceCost; import mage.abilities.costs.mana.GenericManaCost; @@ -184,7 +185,7 @@ class HankyuCountersSourceCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { + public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { Permanent equipment = game.getPermanent(this.effectGivingEquipmentId); if (equipment != null ) { this.removedCounters = equipment.getCounters().getCount(CounterType.AIM); diff --git a/Mage.Sets/src/mage/sets/championsofkamigawa/HisokaMinamoSensei.java b/Mage.Sets/src/mage/sets/championsofkamigawa/HisokaMinamoSensei.java index 9871ad87fe..0ff4bdfb5c 100644 --- a/Mage.Sets/src/mage/sets/championsofkamigawa/HisokaMinamoSensei.java +++ b/Mage.Sets/src/mage/sets/championsofkamigawa/HisokaMinamoSensei.java @@ -36,6 +36,7 @@ import mage.constants.Rarity; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.Cost; import mage.abilities.costs.CostImpl; import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.effects.OneShotEffect; @@ -98,7 +99,7 @@ class HisokaMinamoSenseiDiscardTargetCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { + public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { if (targets.choose(Outcome.Discard, controllerId, sourceId, game)) { Player player = game.getPlayer(controllerId); for (UUID targetId: targets.get(0).getTargets()) { diff --git a/Mage.Sets/src/mage/sets/championsofkamigawa/UntaidakeTheCloudKeeper.java b/Mage.Sets/src/mage/sets/championsofkamigawa/UntaidakeTheCloudKeeper.java index 368d39bd17..7b5f5a4d82 100644 --- a/Mage.Sets/src/mage/sets/championsofkamigawa/UntaidakeTheCloudKeeper.java +++ b/Mage.Sets/src/mage/sets/championsofkamigawa/UntaidakeTheCloudKeeper.java @@ -35,6 +35,7 @@ import mage.abilities.Ability; import mage.abilities.SpellAbility; import mage.abilities.common.EntersBattlefieldTappedAbility; import mage.abilities.condition.Condition; +import mage.abilities.costs.Cost; import mage.abilities.costs.common.PayLifeCost; import mage.abilities.costs.common.TapSourceCost; import mage.abilities.mana.ConditionalColorlessManaAbility; @@ -62,7 +63,7 @@ public class UntaidakeTheCloudKeeper extends CardImpl { Ability ability = new ConditionalColorlessManaAbility(new TapSourceCost(), 2, new LegendarySpellManaBuilder()); ability.addCost(new PayLifeCost(2)); this.addAbility(ability); - + } public UntaidakeTheCloudKeeper(final UntaidakeTheCloudKeeper card) { @@ -76,6 +77,7 @@ public class UntaidakeTheCloudKeeper extends CardImpl { } class LegendarySpellManaBuilder extends ConditionalManaBuilder { + @Override public ConditionalMana build(Object... options) { return new LegendaryCastConditionalMana(this.mana); @@ -97,6 +99,7 @@ class LegendaryCastConditionalMana extends ConditionalMana { } class LegendaryCastManaCondition extends ManaCondition implements Condition { + @Override public boolean apply(Game game, Ability source) { if (source instanceof SpellAbility) { @@ -109,7 +112,7 @@ class LegendaryCastManaCondition extends ManaCondition implements Condition { } @Override - public boolean apply(Game game, Ability source, UUID originalId) { + public boolean apply(Game game, Ability source, UUID originalId, Cost costsToPay) { return apply(game, source); } -} \ No newline at end of file +} diff --git a/Mage.Sets/src/mage/sets/coldsnap/BraidOfFire.java b/Mage.Sets/src/mage/sets/coldsnap/BraidOfFire.java index 7cd6701a5b..126bb83dec 100644 --- a/Mage.Sets/src/mage/sets/coldsnap/BraidOfFire.java +++ b/Mage.Sets/src/mage/sets/coldsnap/BraidOfFire.java @@ -30,6 +30,7 @@ package mage.sets.coldsnap; import java.util.UUID; import mage.Mana; import mage.abilities.Ability; +import mage.abilities.costs.Cost; import mage.abilities.costs.CostImpl; import mage.abilities.keyword.CumulativeUpkeepAbility; import mage.cards.CardImpl; @@ -73,7 +74,7 @@ class BraidOfFireCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { + public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { Player player = game.getPlayer(controllerId); player.getManaPool().addMana(Mana.RedMana(1), game, ability); paid = true; diff --git a/Mage.Sets/src/mage/sets/coldsnap/JotunGrunt.java b/Mage.Sets/src/mage/sets/coldsnap/JotunGrunt.java index ca95f1ef5f..26e3e435bd 100644 --- a/Mage.Sets/src/mage/sets/coldsnap/JotunGrunt.java +++ b/Mage.Sets/src/mage/sets/coldsnap/JotunGrunt.java @@ -30,6 +30,7 @@ package mage.sets.coldsnap; import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; +import mage.abilities.costs.Cost; import mage.abilities.costs.CostImpl; import mage.abilities.keyword.CumulativeUpkeepAbility; import mage.cards.Card; @@ -84,7 +85,7 @@ class JotunGruntCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { + public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { Player controller = game.getPlayer(controllerId); if (controller != null) { if (targets.choose(Outcome.Removal, controllerId, sourceId, game)) { diff --git a/Mage.Sets/src/mage/sets/coldsnap/ShelteringAncient.java b/Mage.Sets/src/mage/sets/coldsnap/ShelteringAncient.java index bd90329ff4..51c59336e9 100644 --- a/Mage.Sets/src/mage/sets/coldsnap/ShelteringAncient.java +++ b/Mage.Sets/src/mage/sets/coldsnap/ShelteringAncient.java @@ -30,6 +30,7 @@ package mage.sets.coldsnap; import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; +import mage.abilities.costs.Cost; import mage.abilities.costs.CostImpl; import mage.abilities.keyword.CumulativeUpkeepAbility; import mage.abilities.keyword.TrampleAbility; @@ -89,7 +90,7 @@ class ShelteringAncientCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { + public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { Player controller = game.getPlayer(controllerId); if (controller != null) { Target target = new TargetCreaturePermanent(1, 1, filter, true); diff --git a/Mage.Sets/src/mage/sets/commander/AllianceOfArms.java b/Mage.Sets/src/mage/sets/commander/AllianceOfArms.java index a9a20017a4..107b3b3d4b 100644 --- a/Mage.Sets/src/mage/sets/commander/AllianceOfArms.java +++ b/Mage.Sets/src/mage/sets/commander/AllianceOfArms.java @@ -121,7 +121,7 @@ class AllianceOfArmsEffect extends OneShotEffect { xValue = player.announceXMana(0, Integer.MAX_VALUE, "How much mana will you pay?", game, source); if (xValue > 0) { Cost cost = new GenericManaCost(xValue); - payed = cost.pay(source, game, source.getSourceId(), player.getId(), false); + payed = cost.pay(source, game, source.getSourceId(), player.getId(), false, null); } else { payed = true; } diff --git a/Mage.Sets/src/mage/sets/commander/ChorusOfTheConclave.java b/Mage.Sets/src/mage/sets/commander/ChorusOfTheConclave.java index 4875d2aca7..cf9c47623f 100644 --- a/Mage.Sets/src/mage/sets/commander/ChorusOfTheConclave.java +++ b/Mage.Sets/src/mage/sets/commander/ChorusOfTheConclave.java @@ -147,7 +147,7 @@ class ChorusOfTheConclaveReplacementEffect extends ReplacementEffectImpl { xValue = player.announceXMana(0, Integer.MAX_VALUE, "How much mana will you pay?", game, source); if (xValue > 0) { Cost cost = new GenericManaCost(xValue); - payed = cost.pay(source, game, source.getSourceId(), player.getId(), false); + payed = cost.pay(source, game, source.getSourceId(), player.getId(), false, null); } else { payed = true; } diff --git a/Mage.Sets/src/mage/sets/commander/CollectiveVoyage.java b/Mage.Sets/src/mage/sets/commander/CollectiveVoyage.java index 4c90f57ebc..b0a485f4df 100644 --- a/Mage.Sets/src/mage/sets/commander/CollectiveVoyage.java +++ b/Mage.Sets/src/mage/sets/commander/CollectiveVoyage.java @@ -130,7 +130,7 @@ class CollectiveVoyageEffect extends OneShotEffect { xValue = player.announceXMana(0, Integer.MAX_VALUE, "How much mana will you pay?", game, source); if (xValue > 0) { Cost cost = new GenericManaCost(xValue); - payed = cost.pay(source, game, source.getSourceId(), player.getId(), false); + payed = cost.pay(source, game, source.getSourceId(), player.getId(), false, null); } else { payed = true; } diff --git a/Mage.Sets/src/mage/sets/commander/ManaChargedDragon.java b/Mage.Sets/src/mage/sets/commander/ManaChargedDragon.java index e12f2e8cbc..81a21388da 100644 --- a/Mage.Sets/src/mage/sets/commander/ManaChargedDragon.java +++ b/Mage.Sets/src/mage/sets/commander/ManaChargedDragon.java @@ -100,7 +100,7 @@ class ManaChargedDragonEffect extends OneShotEffect { xValue = player.announceXMana(0, Integer.MAX_VALUE, "How much mana will you pay?", game, source); if (xValue > 0) { Cost cost = new GenericManaCost(xValue); - payed = cost.pay(source, game, source.getSourceId(), player.getId(), false); + payed = cost.pay(source, game, source.getSourceId(), player.getId(), false, null); } else { payed = true; } diff --git a/Mage.Sets/src/mage/sets/commander/MindsAglow.java b/Mage.Sets/src/mage/sets/commander/MindsAglow.java index 5ba8d8bf43..70fb1b3259 100644 --- a/Mage.Sets/src/mage/sets/commander/MindsAglow.java +++ b/Mage.Sets/src/mage/sets/commander/MindsAglow.java @@ -119,7 +119,7 @@ class MindsAglowEffect extends OneShotEffect { xValue = player.announceXMana(0, Integer.MAX_VALUE, "How much mana will you pay?", game, source); if (xValue > 0) { Cost cost = new GenericManaCost(xValue); - payed = cost.pay(source, game, source.getSourceId(), player.getId(), false); + payed = cost.pay(source, game, source.getSourceId(), player.getId(), false, null); } else { payed = true; } diff --git a/Mage.Sets/src/mage/sets/commander/SharedTrauma.java b/Mage.Sets/src/mage/sets/commander/SharedTrauma.java index 79656863cf..b26fa0f05a 100644 --- a/Mage.Sets/src/mage/sets/commander/SharedTrauma.java +++ b/Mage.Sets/src/mage/sets/commander/SharedTrauma.java @@ -120,7 +120,7 @@ class SharedTraumaEffect extends OneShotEffect { xValue = player.announceXMana(0, Integer.MAX_VALUE, "How much mana will you pay?", game, source); if (xValue > 0) { Cost cost = new GenericManaCost(xValue); - payed = cost.pay(source, game, source.getSourceId(), player.getId(), false); + payed = cost.pay(source, game, source.getSourceId(), player.getId(), false, null); } else { payed = true; } diff --git a/Mage.Sets/src/mage/sets/commander/VishKalBloodArbiter.java b/Mage.Sets/src/mage/sets/commander/VishKalBloodArbiter.java index 6e99419780..521799d7d4 100644 --- a/Mage.Sets/src/mage/sets/commander/VishKalBloodArbiter.java +++ b/Mage.Sets/src/mage/sets/commander/VishKalBloodArbiter.java @@ -120,7 +120,7 @@ class VishKalBloodArbiterCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { + public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { Permanent permanent = game.getPermanent(sourceId); if (permanent != null) { this.amount = permanent.getCounters().getCount(name); diff --git a/Mage.Sets/src/mage/sets/commander2013/MarathWillOfTheWild.java b/Mage.Sets/src/mage/sets/commander2013/MarathWillOfTheWild.java index 0b2662bd6c..8d5f011877 100644 --- a/Mage.Sets/src/mage/sets/commander2013/MarathWillOfTheWild.java +++ b/Mage.Sets/src/mage/sets/commander2013/MarathWillOfTheWild.java @@ -57,6 +57,7 @@ import mage.target.common.TargetCreatureOrPlayer; import mage.target.common.TargetCreaturePermanent; import java.util.UUID; +import mage.abilities.costs.Cost; /** * @@ -200,7 +201,7 @@ class MarathWillOfTheWildRemoveCountersCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { + public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { int amount = new ManacostVariableValue().calculate(game, ability, null); Permanent permanent = game.getPermanent(sourceId); if (permanent != null && permanent.getCounters().getCount(CounterType.P1P1) >= amount) { diff --git a/Mage.Sets/src/mage/sets/conspiracy/Victimize.java b/Mage.Sets/src/mage/sets/conspiracy/Victimize.java index a49a512c2d..07083fb2f4 100644 --- a/Mage.Sets/src/mage/sets/conspiracy/Victimize.java +++ b/Mage.Sets/src/mage/sets/conspiracy/Victimize.java @@ -90,7 +90,7 @@ class VictimizeEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { SacrificeTargetCost cost = new SacrificeTargetCost(new TargetControlledCreaturePermanent(new FilterControlledCreaturePermanent("a creature"))); - if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false)) { + if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) { controller.moveCards(new CardsImpl(getTargetPointer().getTargets(game, source)).getCards(game), Zone.BATTLEFIELD, source, game, true, false, false, null); } diff --git a/Mage.Sets/src/mage/sets/darkascension/JarOfEyeballs.java b/Mage.Sets/src/mage/sets/darkascension/JarOfEyeballs.java index d8a5d62eb2..bdb72be952 100644 --- a/Mage.Sets/src/mage/sets/darkascension/JarOfEyeballs.java +++ b/Mage.Sets/src/mage/sets/darkascension/JarOfEyeballs.java @@ -145,7 +145,7 @@ class JarOfEyeballsCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { + public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { Permanent permanent = game.getPermanent(ability.getSourceId()); if (permanent != null) { this.removedCounters = permanent.getCounters().getCount(CounterType.EYEBALL); diff --git a/Mage.Sets/src/mage/sets/darksteel/LeoninBola.java b/Mage.Sets/src/mage/sets/darksteel/LeoninBola.java index 8b3367d725..8cb3ac1ddf 100644 --- a/Mage.Sets/src/mage/sets/darksteel/LeoninBola.java +++ b/Mage.Sets/src/mage/sets/darksteel/LeoninBola.java @@ -33,6 +33,7 @@ import mage.constants.*; import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.costs.Cost; import mage.abilities.costs.CostImpl; import mage.abilities.costs.common.TapSourceCost; import mage.abilities.costs.mana.GenericManaCost; @@ -90,7 +91,7 @@ class UnattachCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { + public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { Permanent permanent = game.getPermanent(sourceId); if (permanent != null) { Permanent attachment = game.getPermanent(attachmentid); diff --git a/Mage.Sets/src/mage/sets/darksteel/SurestrikeTrident.java b/Mage.Sets/src/mage/sets/darksteel/SurestrikeTrident.java index b3606a11a0..c03fad1ba9 100644 --- a/Mage.Sets/src/mage/sets/darksteel/SurestrikeTrident.java +++ b/Mage.Sets/src/mage/sets/darksteel/SurestrikeTrident.java @@ -31,6 +31,7 @@ import java.util.UUID; import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.costs.Cost; import mage.abilities.costs.CostImpl; import mage.abilities.costs.common.TapSourceCost; import mage.abilities.costs.mana.GenericManaCost; @@ -104,7 +105,7 @@ class SurestrikeTridentUnattachCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { + public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { Permanent permanent = game.getPermanent(sourceId); if (permanent != null) { for (UUID attachmentId : permanent.getAttachments()) { diff --git a/Mage.Sets/src/mage/sets/dragonsoftarkir/HavenOfTheSpiritDragon.java b/Mage.Sets/src/mage/sets/dragonsoftarkir/HavenOfTheSpiritDragon.java index d426f75a33..8e7a0c3a87 100644 --- a/Mage.Sets/src/mage/sets/dragonsoftarkir/HavenOfTheSpiritDragon.java +++ b/Mage.Sets/src/mage/sets/dragonsoftarkir/HavenOfTheSpiritDragon.java @@ -33,6 +33,7 @@ import mage.MageObject; import mage.Mana; import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.Cost; import mage.abilities.costs.common.SacrificeSourceCost; import mage.abilities.costs.common.TapSourceCost; import mage.abilities.costs.mana.ManaCostsImpl; @@ -120,7 +121,7 @@ class HavenOfTheSpiritConditionalMana extends ConditionalMana { class HavenOfTheSpiritManaCondition extends CreatureCastManaCondition { @Override - public boolean apply(Game game, Ability source, UUID manaProducer) { + public boolean apply(Game game, Ability source, UUID manaProducer, Cost costToPay) { if (super.apply(game, source)) { MageObject object = game.getObject(source.getSourceId()); if (object.hasSubtype("Dragon") diff --git a/Mage.Sets/src/mage/sets/dragonsoftarkir/MysticMeditation.java b/Mage.Sets/src/mage/sets/dragonsoftarkir/MysticMeditation.java index 46b1afc78a..21791062e7 100644 --- a/Mage.Sets/src/mage/sets/dragonsoftarkir/MysticMeditation.java +++ b/Mage.Sets/src/mage/sets/dragonsoftarkir/MysticMeditation.java @@ -95,7 +95,7 @@ class MysticMeditationEffect extends OneShotEffect { && controller.chooseUse(Outcome.Discard, "Do you want to discard a creature card? If you don't, you must discard 2 cards", source, game)) { Cost cost = new DiscardTargetCost(new TargetCardInHand(filter)); if (cost.canPay(source, source.getSourceId(), controller.getId(), game)) { - if (cost.pay(source, game, source.getSourceId(), controller.getId(), false)) { + if (cost.pay(source, game, source.getSourceId(), controller.getId(), false, null)) { return true; } } diff --git a/Mage.Sets/src/mage/sets/eventide/HatchetBully.java b/Mage.Sets/src/mage/sets/eventide/HatchetBully.java index 5f8404c6bd..93f9b9f86f 100644 --- a/Mage.Sets/src/mage/sets/eventide/HatchetBully.java +++ b/Mage.Sets/src/mage/sets/eventide/HatchetBully.java @@ -31,6 +31,7 @@ import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.Cost; import mage.abilities.costs.CostImpl; import mage.abilities.costs.common.TapSourceCost; import mage.abilities.costs.mana.ManaCostsImpl; @@ -101,7 +102,7 @@ class HatchetBullyCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { + public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { Permanent permanent = game.getPermanent(ability.getTargets().get(1).getFirstTarget()); if (permanent != null) { permanent.addCounters(CounterType.M1M1.createInstance(), game); diff --git a/Mage.Sets/src/mage/sets/eventide/ImpelledGiant.java b/Mage.Sets/src/mage/sets/eventide/ImpelledGiant.java index ceb04da236..8f901fc0f4 100644 --- a/Mage.Sets/src/mage/sets/eventide/ImpelledGiant.java +++ b/Mage.Sets/src/mage/sets/eventide/ImpelledGiant.java @@ -34,6 +34,7 @@ import mage.ObjectColor; import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.costs.Cost; import mage.abilities.costs.CostImpl; import mage.abilities.effects.Effect; import mage.abilities.effects.OneShotEffect; @@ -111,7 +112,7 @@ class ImpelledGiantCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { + public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { if (target.choose(Outcome.Tap, controllerId, sourceId, game)) { for (UUID targetId: (List<UUID>)target.getTargets()) { Permanent permanent = game.getPermanent(targetId); diff --git a/Mage.Sets/src/mage/sets/eventide/RiseOfTheHobgoblins.java b/Mage.Sets/src/mage/sets/eventide/RiseOfTheHobgoblins.java index a168f00104..4b33b497b2 100644 --- a/Mage.Sets/src/mage/sets/eventide/RiseOfTheHobgoblins.java +++ b/Mage.Sets/src/mage/sets/eventide/RiseOfTheHobgoblins.java @@ -119,7 +119,7 @@ class RiseOfTheHobgoblinsEffect extends OneShotEffect { if (you != null && you.chooseUse(Outcome.Neutral, "Do you want to to pay {X}?", source, game)) { int costX = you.announceXMana(0, Integer.MAX_VALUE, "Announce the value for {X}", game, source); cost.add(new GenericManaCost(costX)); - if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false)) { + if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) { Token token = new GoblinSoldierToken(); return token.putOntoBattlefield(costX, game, source.getSourceId(), source.getControllerId()); } diff --git a/Mage.Sets/src/mage/sets/exodus/ErraticPortal.java b/Mage.Sets/src/mage/sets/exodus/ErraticPortal.java index 66f16ccb7c..0447546e4f 100644 --- a/Mage.Sets/src/mage/sets/exodus/ErraticPortal.java +++ b/Mage.Sets/src/mage/sets/exodus/ErraticPortal.java @@ -103,7 +103,7 @@ class ErraticPortalEffect extends OneShotEffect { if (player != null) { cost.clearPaid(); if (player.chooseUse(Outcome.Benefit, "Pay {1}? (Otherwise " + targetCreature.getLogName() +" will be returned to its owner's hand)", source, game)) { - cost.pay(source, game, targetCreature.getControllerId(), targetCreature.getControllerId(), false); + cost.pay(source, game, targetCreature.getControllerId(), targetCreature.getControllerId(), false, null); } if (!cost.isPaid()) { controller.moveCards(targetCreature, Zone.BATTLEFIELD, Zone.HAND, source, game); diff --git a/Mage.Sets/src/mage/sets/fallenempires/TidalInfluence.java b/Mage.Sets/src/mage/sets/fallenempires/TidalInfluence.java index 5de52d6b93..5f92d4ced1 100644 --- a/Mage.Sets/src/mage/sets/fallenempires/TidalInfluence.java +++ b/Mage.Sets/src/mage/sets/fallenempires/TidalInfluence.java @@ -35,6 +35,7 @@ import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; import mage.abilities.common.EntersBattlefieldAbility; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.condition.common.SourceHasCounterCondition; +import mage.abilities.costs.Cost; import mage.abilities.costs.CostImpl; import mage.abilities.decorator.ConditionalContinuousEffect; import mage.abilities.dynamicvalue.common.CountersCount; @@ -127,7 +128,7 @@ class TidalInfluenceCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { + public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { this.paid = true; return paid; } diff --git a/Mage.Sets/src/mage/sets/fifthdawn/DisruptionAura.java b/Mage.Sets/src/mage/sets/fifthdawn/DisruptionAura.java index 9cb5e3fcf4..a9515adb19 100644 --- a/Mage.Sets/src/mage/sets/fifthdawn/DisruptionAura.java +++ b/Mage.Sets/src/mage/sets/fifthdawn/DisruptionAura.java @@ -112,7 +112,7 @@ class DisruptionAuraEffect extends OneShotEffect { Cost cost = permanent.getManaCost().copy(); if (player.chooseUse(Outcome.Benefit, message, source, game)) { cost.clearPaid(); - if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false)) { + if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) { return true; } } diff --git a/Mage.Sets/src/mage/sets/fifthdawn/PlungeIntoDarkness.java b/Mage.Sets/src/mage/sets/fifthdawn/PlungeIntoDarkness.java index f43581055a..a0f0ecbc3b 100644 --- a/Mage.Sets/src/mage/sets/fifthdawn/PlungeIntoDarkness.java +++ b/Mage.Sets/src/mage/sets/fifthdawn/PlungeIntoDarkness.java @@ -148,7 +148,7 @@ class PlungeIntoDarknessSearchEffect extends OneShotEffect { if (player != null) { VariableCost cost = new PayVariableLifeCost(); int xValue = cost.announceXValue(source, game); - cost.getFixedCostsFromAnnouncedValue(xValue).pay(source, game, source.getSourceId(), source.getControllerId(), false); + cost.getFixedCostsFromAnnouncedValue(xValue).pay(source, game, source.getSourceId(), source.getControllerId(), false, null); Cards cards = new CardsImpl(); int count = Math.min(player.getLibrary().size(), xValue); diff --git a/Mage.Sets/src/mage/sets/fifthdawn/PossessedPortal.java b/Mage.Sets/src/mage/sets/fifthdawn/PossessedPortal.java index 246be1f759..fe1db00019 100644 --- a/Mage.Sets/src/mage/sets/fifthdawn/PossessedPortal.java +++ b/Mage.Sets/src/mage/sets/fifthdawn/PossessedPortal.java @@ -130,11 +130,11 @@ class PossessedPortalEffect extends OneShotEffect { Cost discardCost = new DiscardCardCost(); if (discardCost.canPay(source, source.getSourceId(), playerId, game) && player.chooseUse(Outcome.Discard, "Discard a card? (Otherwise sacrifice a permanent)", source, game)) { - discardCost.pay(source, game, source.getSourceId(), playerId, true); + discardCost.pay(source, game, source.getSourceId(), playerId, true, null); } else { Cost sacrificeCost = new SacrificeTargetCost(new TargetControlledPermanent()); - sacrificeCost.pay(source, game, source.getSourceId(), playerId, true); + sacrificeCost.pay(source, game, source.getSourceId(), playerId, true, null); } } return true; diff --git a/Mage.Sets/src/mage/sets/fourthedition/ForceOfNature.java b/Mage.Sets/src/mage/sets/fourthedition/ForceOfNature.java index 49ae48923a..a16192b11f 100644 --- a/Mage.Sets/src/mage/sets/fourthedition/ForceOfNature.java +++ b/Mage.Sets/src/mage/sets/fourthedition/ForceOfNature.java @@ -97,7 +97,7 @@ class ForceOfNatureEffect extends OneShotEffect { Cost cost = new ManaCostsImpl("{G}{G}{G}{G}"); String message = "Would you like to pay {G}{G}{G}{G} to prevent taking 8 damage from {this}?"; if (!(controller.chooseUse(Outcome.Benefit, message, source, game) - && cost.pay(source, game, source.getSourceId(), controller.getId(), false))) { + && cost.pay(source, game, source.getSourceId(), controller.getId(), false, null))) { controller.damage(8, source.getSourceId(), game, false, true); } return true; diff --git a/Mage.Sets/src/mage/sets/futuresight/NimbusMaze.java b/Mage.Sets/src/mage/sets/futuresight/NimbusMaze.java index c842eee593..9c5bc771a6 100644 --- a/Mage.Sets/src/mage/sets/futuresight/NimbusMaze.java +++ b/Mage.Sets/src/mage/sets/futuresight/NimbusMaze.java @@ -31,6 +31,7 @@ import java.util.UUID; import mage.Mana; import mage.abilities.Ability; import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; +import mage.abilities.costs.Cost; import mage.abilities.costs.CostImpl; import mage.abilities.costs.common.TapSourceCost; import mage.abilities.effects.common.BasicManaEffect; @@ -114,7 +115,7 @@ class FilterPermanentCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { + public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { this.paid = true; return paid; } diff --git a/Mage.Sets/src/mage/sets/guildpact/LeylineOfLightning.java b/Mage.Sets/src/mage/sets/guildpact/LeylineOfLightning.java index 7a32bf2d73..ceecd7a6fe 100644 --- a/Mage.Sets/src/mage/sets/guildpact/LeylineOfLightning.java +++ b/Mage.Sets/src/mage/sets/guildpact/LeylineOfLightning.java @@ -92,7 +92,7 @@ class LeylineOfLightningEffect extends DamageTargetEffect { Player player = game.getPlayer(source.getControllerId()); if (player != null) { Cost cost = new GenericManaCost(1); - if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false)) { + if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) { super.apply(game, source); } return true; diff --git a/Mage.Sets/src/mage/sets/iceage/MysticRemora.java b/Mage.Sets/src/mage/sets/iceage/MysticRemora.java index c3db898671..79a08d7a1c 100644 --- a/Mage.Sets/src/mage/sets/iceage/MysticRemora.java +++ b/Mage.Sets/src/mage/sets/iceage/MysticRemora.java @@ -145,7 +145,7 @@ class MysticRemoraTriggeredAbility extends TriggeredAbilityImpl { if (controller != null && opponent != null && sourceObject != null) { Cost cost = new GenericManaCost(4); String message = "Would you like to pay {4} to prevent the opponent to draw a card?"; - if (!(opponent.chooseUse(Outcome.Benefit, message, source, game) && cost.pay(source, game, source.getSourceId(), opponent.getId(), false))) { + if (!(opponent.chooseUse(Outcome.Benefit, message, source, game) && cost.pay(source, game, source.getSourceId(), opponent.getId(), false, null))) { if(controller.chooseUse(Outcome.DrawCard, "Draw a card (" + sourceObject.getLogName() +")", source, game)) { controller.drawCards(1, game); } diff --git a/Mage.Sets/src/mage/sets/iceage/Seizures.java b/Mage.Sets/src/mage/sets/iceage/Seizures.java index df24823b79..7d2cb8b989 100644 --- a/Mage.Sets/src/mage/sets/iceage/Seizures.java +++ b/Mage.Sets/src/mage/sets/iceage/Seizures.java @@ -109,7 +109,7 @@ class SeizuresEffect extends OneShotEffect { if(cost.canPay(source, source.getSourceId(), player.getId(), game) && player.chooseUse(Outcome.Benefit, "Pay " + cost.getText() + " to avoid damage?", source, game)) { cost.clearPaid(); - if(cost.pay(source, game, source.getSourceId(), player.getId(), false)) { + if(cost.pay(source, game, source.getSourceId(), player.getId(), false, null)) { return true; } } diff --git a/Mage.Sets/src/mage/sets/innistrad/BackFromTheBrink.java b/Mage.Sets/src/mage/sets/innistrad/BackFromTheBrink.java index 4565580087..d78a21eb10 100644 --- a/Mage.Sets/src/mage/sets/innistrad/BackFromTheBrink.java +++ b/Mage.Sets/src/mage/sets/innistrad/BackFromTheBrink.java @@ -30,6 +30,7 @@ package mage.sets.innistrad; import java.util.UUID; import mage.abilities.Ability; import mage.abilities.common.ActivateAsSorceryActivatedAbility; +import mage.abilities.costs.Cost; import mage.abilities.costs.CostImpl; import mage.abilities.effects.Effect; import mage.abilities.effects.common.PutTokenOntoBattlefieldCopyTargetEffect; @@ -97,7 +98,7 @@ class BackFromTheBrinkCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { + public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { if (targets.choose(Outcome.Exile, controllerId, sourceId, game)) { Player controller = game.getPlayer(controllerId); if (controller != null) { diff --git a/Mage.Sets/src/mage/sets/innistrad/FrightfulDelusion.java b/Mage.Sets/src/mage/sets/innistrad/FrightfulDelusion.java index 12077bfd75..11c88ba652 100644 --- a/Mage.Sets/src/mage/sets/innistrad/FrightfulDelusion.java +++ b/Mage.Sets/src/mage/sets/innistrad/FrightfulDelusion.java @@ -95,7 +95,7 @@ class FrightfulDelusionEffect extends OneShotEffect { game.getPlayer(spell.getControllerId()).discard( 1, false, source, game); if (!cost.pay(source, game, spell.getControllerId(), - spell.getControllerId(), false)) { + spell.getControllerId(), false, null)) { return game.getStack().counter(source.getFirstTarget(), source.getSourceId(), game); } diff --git a/Mage.Sets/src/mage/sets/innistrad/ScreechingBat.java b/Mage.Sets/src/mage/sets/innistrad/ScreechingBat.java index b3453bcd2e..6ee01fb9ce 100644 --- a/Mage.Sets/src/mage/sets/innistrad/ScreechingBat.java +++ b/Mage.Sets/src/mage/sets/innistrad/ScreechingBat.java @@ -133,7 +133,7 @@ class ScreechingBatTransformSourceEffect extends OneShotEffect { Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null) { Cost cost = new ManaCostsImpl("{2}{B}{B}"); - if (cost.pay(source, game, permanent.getControllerId(), permanent.getControllerId(), false)) { + if (cost.pay(source, game, permanent.getControllerId(), permanent.getControllerId(), false, null)) { if (permanent.canTransform()) { permanent.setTransformed(!permanent.isTransformed()); } diff --git a/Mage.Sets/src/mage/sets/journeyintonyx/AthreosGodOfPassage.java b/Mage.Sets/src/mage/sets/journeyintonyx/AthreosGodOfPassage.java index 788102604e..b700e7276e 100644 --- a/Mage.Sets/src/mage/sets/journeyintonyx/AthreosGodOfPassage.java +++ b/Mage.Sets/src/mage/sets/journeyintonyx/AthreosGodOfPassage.java @@ -131,7 +131,7 @@ class AthreosGodOfPassageReturnEffect extends OneShotEffect { Cost cost = new PayLifeCost(3); if (cost.canPay(source, source.getSourceId(), opponent.getId(), game) && opponent.chooseUse(outcome, new StringBuilder("Pay 3 live to prevent that ").append(creature.getLogName()).append(" returns to ").append(controller.getLogName()).append("'s hand?").toString(), source, game)) { - if (cost.pay(source, game, source.getSourceId(), opponent.getId(), false)) { + if (cost.pay(source, game, source.getSourceId(), opponent.getId(), false, null)) { paid = true; } } diff --git a/Mage.Sets/src/mage/sets/journeyintonyx/DiscipleOfDeceit.java b/Mage.Sets/src/mage/sets/journeyintonyx/DiscipleOfDeceit.java index e5e87c1bbc..49c62307c6 100644 --- a/Mage.Sets/src/mage/sets/journeyintonyx/DiscipleOfDeceit.java +++ b/Mage.Sets/src/mage/sets/journeyintonyx/DiscipleOfDeceit.java @@ -105,7 +105,7 @@ class DiscipleOfDeceitEffect extends OneShotEffect { String message = "Discard a nonland card to search your library?"; if (cost.canPay(source, source.getSourceId(), source.getControllerId(), game) && player.chooseUse(Outcome.Detriment, message, source, game)) { - if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false)) { + if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) { Card card = game.getCard(cost.getTargets().getFirstTarget()); if (card == null) { return false; diff --git a/Mage.Sets/src/mage/sets/journeyintonyx/SageOfHours.java b/Mage.Sets/src/mage/sets/journeyintonyx/SageOfHours.java index 533f233b82..d29765a575 100644 --- a/Mage.Sets/src/mage/sets/journeyintonyx/SageOfHours.java +++ b/Mage.Sets/src/mage/sets/journeyintonyx/SageOfHours.java @@ -101,7 +101,7 @@ class SageOfHoursCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { + public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { Permanent permanent = game.getPermanent(ability.getSourceId()); if (permanent != null) { this.removedCounters = permanent.getCounters().getCount(CounterType.P1P1); diff --git a/Mage.Sets/src/mage/sets/judgment/WormfangDrake.java b/Mage.Sets/src/mage/sets/judgment/WormfangDrake.java index 15d030afde..bc7b385611 100644 --- a/Mage.Sets/src/mage/sets/judgment/WormfangDrake.java +++ b/Mage.Sets/src/mage/sets/judgment/WormfangDrake.java @@ -33,6 +33,7 @@ import mage.MageObject; import mage.abilities.Ability; import mage.abilities.common.EntersBattlefieldTriggeredAbility; import mage.abilities.common.LeavesBattlefieldTriggeredAbility; +import mage.abilities.costs.Cost; import mage.abilities.costs.CostImpl; import mage.abilities.effects.common.ReturnFromExileForSourceEffect; import mage.abilities.effects.common.SacrificeSourceUnlessPaysEffect; @@ -103,7 +104,7 @@ class WormfangDrakeExileCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { + public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { Player controller = game.getPlayer(controllerId); MageObject sourceObject = ability.getSourceObject(game); if (controller != null && sourceObject != null) { diff --git a/Mage.Sets/src/mage/sets/legends/ChainLightning.java b/Mage.Sets/src/mage/sets/legends/ChainLightning.java index 21f95b8718..f1e1227f65 100644 --- a/Mage.Sets/src/mage/sets/legends/ChainLightning.java +++ b/Mage.Sets/src/mage/sets/legends/ChainLightning.java @@ -105,7 +105,7 @@ class ChainLightningEffect extends OneShotEffect { if (affectedPlayer != null) { if (affectedPlayer.chooseUse(Outcome.Copy, "Pay {R}{R} to copy the spell?", source, game)) { Cost cost = new ManaCostsImpl("{R}{R}"); - if (cost.pay(source, game, source.getSourceId(), affectedPlayer.getId(), false)) { + if (cost.pay(source, game, source.getSourceId(), affectedPlayer.getId(), false, null)) { Spell spell = game.getStack().getSpell(source.getSourceId()); if (spell != null) { Spell copy = spell.copySpell(); diff --git a/Mage.Sets/src/mage/sets/legends/CosmicHorror.java b/Mage.Sets/src/mage/sets/legends/CosmicHorror.java index 0f0e6273f2..9e65ce2b95 100644 --- a/Mage.Sets/src/mage/sets/legends/CosmicHorror.java +++ b/Mage.Sets/src/mage/sets/legends/CosmicHorror.java @@ -100,7 +100,7 @@ class CosmicHorrorEffect extends OneShotEffect { } if (controller.chooseUse(Outcome.Benefit, sb.toString(), source, game)) { cost.clearPaid(); - if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false)) { + if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) { return true; } } diff --git a/Mage.Sets/src/mage/sets/legends/TheTabernacleAtPendrellVale.java b/Mage.Sets/src/mage/sets/legends/TheTabernacleAtPendrellVale.java index c938ac247c..65012e33c2 100644 --- a/Mage.Sets/src/mage/sets/legends/TheTabernacleAtPendrellVale.java +++ b/Mage.Sets/src/mage/sets/legends/TheTabernacleAtPendrellVale.java @@ -91,7 +91,7 @@ class DestroySourceUnlessPaysEffect extends OneShotEffect { if (player != null && permanent != null) { if (player.chooseUse(Outcome.Benefit, "Pay " + cost.getText() + "?", source, game)) { cost.clearPaid(); - if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false)) { + if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) { return true; } } diff --git a/Mage.Sets/src/mage/sets/limitedalpha/DemonicHordes.java b/Mage.Sets/src/mage/sets/limitedalpha/DemonicHordes.java index b0b6516f12..7e00ef02ce 100644 --- a/Mage.Sets/src/mage/sets/limitedalpha/DemonicHordes.java +++ b/Mage.Sets/src/mage/sets/limitedalpha/DemonicHordes.java @@ -111,7 +111,7 @@ class DemonicHordesEffect extends OneShotEffect { } if (controller.chooseUse(Outcome.Benefit, sb.toString(), source, game)) { cost.clearPaid(); - if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false)) { + if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) { return true; } } diff --git a/Mage.Sets/src/mage/sets/lorwyn/BrokenAmbitions.java b/Mage.Sets/src/mage/sets/lorwyn/BrokenAmbitions.java index b4168bb613..cfa6b0f536 100644 --- a/Mage.Sets/src/mage/sets/lorwyn/BrokenAmbitions.java +++ b/Mage.Sets/src/mage/sets/lorwyn/BrokenAmbitions.java @@ -120,7 +120,7 @@ class BrokenAmbitionsEffect extends OneShotEffect { message = costToPay.getText() + " to prevent counter effect?"; } costToPay.clearPaid(); - if (!(controller.chooseUse(Outcome.Benefit, message, source, game) && costToPay.pay(source, game, spell.getSourceId(), spell.getControllerId(), false))) { + if (!(controller.chooseUse(Outcome.Benefit, message, source, game) && costToPay.pay(source, game, spell.getSourceId(), spell.getControllerId(), false, null))) { game.getStack().counter(spell.getId(), source.getSourceId(), game); } if (ClashEffect.getInstance().apply(game, source)) { diff --git a/Mage.Sets/src/mage/sets/lorwyn/RingsOfBrighthearth.java b/Mage.Sets/src/mage/sets/lorwyn/RingsOfBrighthearth.java index 8793c91e92..720ad9ed00 100644 --- a/Mage.Sets/src/mage/sets/lorwyn/RingsOfBrighthearth.java +++ b/Mage.Sets/src/mage/sets/lorwyn/RingsOfBrighthearth.java @@ -131,7 +131,7 @@ class RingsOfBrighthearthEffect extends OneShotEffect { ManaCostsImpl cost = new ManaCostsImpl("{2}"); if (player != null) { if (player.chooseUse(Outcome.Benefit, "Pay " + cost.getText() + "? If you do, copy that ability. You may choose new targets for the copy.", source, game)) { - if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false)) { + if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) { Ability ability = (Ability) getValue("stackAbility"); Player controller = game.getPlayer(source.getControllerId()); Permanent sourcePermanent = game.getPermanent(source.getSourceId()); diff --git a/Mage.Sets/src/mage/sets/lorwyn/SilvergillAdept.java b/Mage.Sets/src/mage/sets/lorwyn/SilvergillAdept.java index 9ec52f20fd..4740bbd5e2 100644 --- a/Mage.Sets/src/mage/sets/lorwyn/SilvergillAdept.java +++ b/Mage.Sets/src/mage/sets/lorwyn/SilvergillAdept.java @@ -31,6 +31,7 @@ import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.costs.Cost; import mage.abilities.costs.CostImpl; import mage.abilities.costs.mana.GenericManaCost; import mage.abilities.effects.common.DrawCardSourceControllerEffect; @@ -96,7 +97,7 @@ class SilvergillAdeptCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { + public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { Player player = game.getPlayer(controllerId); if (player == null) { diff --git a/Mage.Sets/src/mage/sets/magic2011/AncientHellkite.java b/Mage.Sets/src/mage/sets/magic2011/AncientHellkite.java index 0d85a1a63c..4d42818e8e 100644 --- a/Mage.Sets/src/mage/sets/magic2011/AncientHellkite.java +++ b/Mage.Sets/src/mage/sets/magic2011/AncientHellkite.java @@ -36,6 +36,7 @@ import mage.constants.Zone; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.ActivatedAbilityImpl; +import mage.abilities.costs.Cost; import mage.abilities.costs.CostImpl; import mage.abilities.costs.mana.ColoredManaCost; import mage.abilities.effects.common.DamageTargetEffect; @@ -137,7 +138,7 @@ class AncientHellkiteCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { + public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { this.paid = true; return paid; } diff --git a/Mage.Sets/src/mage/sets/magic2015/IndulgentTormentor.java b/Mage.Sets/src/mage/sets/magic2015/IndulgentTormentor.java index 5918480369..63ae6f133b 100644 --- a/Mage.Sets/src/mage/sets/magic2015/IndulgentTormentor.java +++ b/Mage.Sets/src/mage/sets/magic2015/IndulgentTormentor.java @@ -102,14 +102,14 @@ class IndulgentTormentorEffect extends OneShotEffect { Cost cost = new SacrificeTargetCost(new TargetControlledCreaturePermanent()); if (cost.canPay(source, source.getSourceId(), opponent.getId(), game) && opponent.chooseUse(outcome, "Sacrifice a creature to prevent the card draw?", source, game)) { - if (cost.pay(source, game, source.getSourceId(), opponent.getId(), false)) { + if (cost.pay(source, game, source.getSourceId(), opponent.getId(), false, null)) { return true; } } cost = new PayLifeCost(3); if (cost.canPay(source, source.getSourceId(), opponent.getId(), game) && opponent.chooseUse(outcome, "Pay 3 life to prevent the card draw?", source, game)) { - if (cost.pay(source, game, source.getSourceId(), opponent.getId(), false)) { + if (cost.pay(source, game, source.getSourceId(), opponent.getId(), false, null)) { return true; } } diff --git a/Mage.Sets/src/mage/sets/magic2015/NecromancersStockpile.java b/Mage.Sets/src/mage/sets/magic2015/NecromancersStockpile.java index 51af6f7ded..575766661b 100644 --- a/Mage.Sets/src/mage/sets/magic2015/NecromancersStockpile.java +++ b/Mage.Sets/src/mage/sets/magic2015/NecromancersStockpile.java @@ -30,6 +30,7 @@ package mage.sets.magic2015; import java.util.UUID; import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.Cost; import mage.abilities.costs.CostImpl; import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.effects.OneShotEffect; @@ -92,7 +93,7 @@ class NecromancersStockpileDiscardTargetCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { + public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { if (targets.choose(Outcome.Discard, controllerId, sourceId, game)) { Player player = game.getPlayer(controllerId); for (UUID targetId : targets.get(0).getTargets()) { diff --git a/Mage.Sets/src/mage/sets/magic2015/SliverHive.java b/Mage.Sets/src/mage/sets/magic2015/SliverHive.java index 5ec2056da0..1e3e3f9028 100644 --- a/Mage.Sets/src/mage/sets/magic2015/SliverHive.java +++ b/Mage.Sets/src/mage/sets/magic2015/SliverHive.java @@ -29,11 +29,11 @@ package mage.sets.magic2015; import java.util.UUID; import mage.ConditionalMana; -import mage.MageInt; import mage.MageObject; import mage.Mana; import mage.abilities.Ability; import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; +import mage.abilities.costs.Cost; import mage.abilities.costs.common.TapSourceCost; import mage.abilities.costs.mana.GenericManaCost; import mage.abilities.decorator.ConditionalActivatedAbility; @@ -124,7 +124,7 @@ class SliverHiveConditionalMana extends ConditionalMana { class SliverHiveManaCondition extends CreatureCastManaCondition { @Override - public boolean apply(Game game, Ability source, UUID manaProducer) { + public boolean apply(Game game, Ability source, UUID manaProducer, Cost costToPay) { if (super.apply(game, source)) { MageObject object = game.getObject(source.getSourceId()); if (object.hasSubtype("Sliver")) { diff --git a/Mage.Sets/src/mage/sets/masterseditionii/ForgottenLore.java b/Mage.Sets/src/mage/sets/masterseditionii/ForgottenLore.java index 3fc2f88f87..4dad895194 100644 --- a/Mage.Sets/src/mage/sets/masterseditionii/ForgottenLore.java +++ b/Mage.Sets/src/mage/sets/masterseditionii/ForgottenLore.java @@ -117,7 +117,7 @@ class ForgottenLoreEffect extends OneShotEffect { if(!done) { if(cost.canPay(source, source.getSourceId(), you.getId(), game) && you.chooseUse(Outcome.Benefit, "Pay {G} to choose a different card ?", source, game)) { cost.clearPaid(); - if(!cost.pay(source, game, source.getSourceId(), you.getId(), false)) { + if(!cost.pay(source, game, source.getSourceId(), you.getId(), false, null)) { done = true; } } diff --git a/Mage.Sets/src/mage/sets/masterseditioniii/ManaVortex.java b/Mage.Sets/src/mage/sets/masterseditioniii/ManaVortex.java index 6cf19b12be..a42dc2577f 100644 --- a/Mage.Sets/src/mage/sets/masterseditioniii/ManaVortex.java +++ b/Mage.Sets/src/mage/sets/masterseditioniii/ManaVortex.java @@ -113,7 +113,7 @@ class CounterSourceEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); if(controller.chooseUse(Outcome.Detriment, "Sacrifice a land to not counter " + spell.getName() + "?", source, game)){ SacrificeTargetCost cost = new SacrificeTargetCost(new TargetControlledPermanent(new FilterControlledLandPermanent())); - if(cost.pay(source, game, source.getSourceId(), source.getControllerId(), false)){ + if(cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)){ game.informPlayers(controller.getLogName() + " sacrifices a land to not counter " + spell.getName() + "."); return true; } diff --git a/Mage.Sets/src/mage/sets/masterseditioniii/WanderingMage.java b/Mage.Sets/src/mage/sets/masterseditioniii/WanderingMage.java index a09c453c49..cda82b37cb 100644 --- a/Mage.Sets/src/mage/sets/masterseditioniii/WanderingMage.java +++ b/Mage.Sets/src/mage/sets/masterseditioniii/WanderingMage.java @@ -31,6 +31,7 @@ import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.Cost; import mage.abilities.costs.CostImpl; import mage.abilities.costs.common.PayLifeCost; import mage.abilities.costs.mana.ManaCostsImpl; @@ -124,7 +125,7 @@ class WanderingMageCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { + public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { Permanent permanent = game.getPermanent(ability.getTargets().get(1).getFirstTarget()); if (permanent != null) { permanent.addCounters(CounterType.M1M1.createInstance(), game); diff --git a/Mage.Sets/src/mage/sets/masterseditioniv/HasranOgress.java b/Mage.Sets/src/mage/sets/masterseditioniv/HasranOgress.java index ecaabd7409..b321e1e625 100644 --- a/Mage.Sets/src/mage/sets/masterseditioniv/HasranOgress.java +++ b/Mage.Sets/src/mage/sets/masterseditioniv/HasranOgress.java @@ -92,7 +92,7 @@ class HasranOgressEffect extends OneShotEffect { Cost cost = new ManaCostsImpl("{2}"); String message = "Would you like to pay {2} to prevent taking 3 damage from Hasran Ogress?"; if (!(controller.chooseUse(Outcome.Benefit, message, source, game) - && cost.pay(source, game, source.getSourceId(), controller.getId(), false))) { + && cost.pay(source, game, source.getSourceId(), controller.getId(), false, null))) { controller.damage(3, source.getSourceId(), game, false, true); } return true; diff --git a/Mage.Sets/src/mage/sets/masterseditioniv/SoldeviMachinist.java b/Mage.Sets/src/mage/sets/masterseditioniv/SoldeviMachinist.java index ba2b128d29..afd305d590 100644 --- a/Mage.Sets/src/mage/sets/masterseditioniv/SoldeviMachinist.java +++ b/Mage.Sets/src/mage/sets/masterseditioniv/SoldeviMachinist.java @@ -34,6 +34,7 @@ import mage.MageObject; import mage.Mana; import mage.abilities.Ability; import mage.abilities.condition.Condition; +import mage.abilities.costs.Cost; import mage.abilities.costs.common.TapSourceCost; import mage.abilities.mana.ConditionalColorlessManaAbility; import mage.abilities.mana.builder.ConditionalManaBuilder; @@ -109,7 +110,7 @@ class ArtifactAbilityManaCondition extends ManaCondition implements Condition { } @Override - public boolean apply(Game game, Ability source, UUID originalId) { + public boolean apply(Game game, Ability source, UUID originalId, Cost costsToPay) { return apply(game, source); } } diff --git a/Mage.Sets/src/mage/sets/mercadianmasques/HornOfPlenty.java b/Mage.Sets/src/mage/sets/mercadianmasques/HornOfPlenty.java index 7348c1d5b8..a9c6619197 100644 --- a/Mage.Sets/src/mage/sets/mercadianmasques/HornOfPlenty.java +++ b/Mage.Sets/src/mage/sets/mercadianmasques/HornOfPlenty.java @@ -94,7 +94,7 @@ class HornOfPlentyEffect extends OneShotEffect { if (caster != null) { if (caster.chooseUse(Outcome.DrawCard, "Pay {1} to draw a card at the beginning of the next end step?", source, game)) { Cost cost = new ManaCostsImpl("{1}"); - if (cost.pay(source, game, source.getSourceId(), caster.getId(), false)) { + if (cost.pay(source, game, source.getSourceId(), caster.getId(), false, null)) { Effect effect = new DrawCardTargetEffect(1); effect.setTargetPointer(new FixedTarget(caster.getId())); return new CreateDelayedTriggeredAbilityEffect(new AtTheBeginOfNextEndStepDelayedTriggeredAbility(effect, TargetController.ANY)).apply(game, source); diff --git a/Mage.Sets/src/mage/sets/mercadianmasques/LandGrant.java b/Mage.Sets/src/mage/sets/mercadianmasques/LandGrant.java index 5f369b7827..5898314299 100644 --- a/Mage.Sets/src/mage/sets/mercadianmasques/LandGrant.java +++ b/Mage.Sets/src/mage/sets/mercadianmasques/LandGrant.java @@ -31,6 +31,7 @@ import java.util.UUID; import mage.abilities.Ability; import mage.abilities.condition.Condition; import mage.abilities.costs.AlternativeCostSourceAbility; +import mage.abilities.costs.Cost; import mage.abilities.costs.CostImpl; import mage.abilities.effects.common.search.SearchLibraryPutInHandEffect; import mage.cards.CardImpl; @@ -105,7 +106,7 @@ class LandGrantReavealCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { + public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { Player player = game.getPlayer(controllerId); if (player != null) { player.revealCards("Land Grant", player.getHand(), game); diff --git a/Mage.Sets/src/mage/sets/mirage/Flash.java b/Mage.Sets/src/mage/sets/mirage/Flash.java index 02a8f7a074..c1ed840589 100644 --- a/Mage.Sets/src/mage/sets/mirage/Flash.java +++ b/Mage.Sets/src/mage/sets/mirage/Flash.java @@ -105,7 +105,7 @@ class FlashEffect extends OneShotEffect { StringBuilder sb = new StringBuilder("Pay ").append(reducedCost.getText()).append("?"); if (player.chooseUse(Outcome.Benefit, sb.toString(), source, game)) { reducedCost.clearPaid(); - if (reducedCost.pay(source, game, source.getSourceId(), source.getControllerId(), false)) { + if (reducedCost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) { return true; } } diff --git a/Mage.Sets/src/mage/sets/mirage/PhyrexianDreadnought.java b/Mage.Sets/src/mage/sets/mirage/PhyrexianDreadnought.java index 62b549deee..3ad96e7b13 100644 --- a/Mage.Sets/src/mage/sets/mirage/PhyrexianDreadnought.java +++ b/Mage.Sets/src/mage/sets/mirage/PhyrexianDreadnought.java @@ -31,6 +31,7 @@ import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.costs.Cost; import mage.abilities.costs.CostImpl; import mage.abilities.effects.common.SacrificeSourceUnlessPaysEffect; import mage.abilities.keyword.TrampleAbility; @@ -94,7 +95,7 @@ class PhyrexianDreadnoughtSacrificeCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { + public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { int sumPower = 0; if (targets.choose(Outcome.Sacrifice, controllerId, sourceId, game)) { for (UUID targetId: targets.get(0).getTargets()) { diff --git a/Mage.Sets/src/mage/sets/mirage/VaporousDjinn.java b/Mage.Sets/src/mage/sets/mirage/VaporousDjinn.java index 5d26403579..6cf3d2a505 100644 --- a/Mage.Sets/src/mage/sets/mirage/VaporousDjinn.java +++ b/Mage.Sets/src/mage/sets/mirage/VaporousDjinn.java @@ -98,7 +98,7 @@ class VaporousDjinnEffect extends OneShotEffect { Cost cost = new ManaCostsImpl("{U}{U}"); String message = "Would you like to pay {U}{U} to prevent {this} from phasing out?"; if (!(controller.chooseUse(Outcome.Benefit, message, source, game) - && cost.pay(source, game, source.getSourceId(), controller.getId(), false))) { + && cost.pay(source, game, source.getSourceId(), controller.getId(), false, null))) { permanent.phaseOut(game); } return true; diff --git a/Mage.Sets/src/mage/sets/mirrodin/CrystalShard.java b/Mage.Sets/src/mage/sets/mirrodin/CrystalShard.java index 5068a42903..8d848adfe4 100644 --- a/Mage.Sets/src/mage/sets/mirrodin/CrystalShard.java +++ b/Mage.Sets/src/mage/sets/mirrodin/CrystalShard.java @@ -107,7 +107,7 @@ class CrystalShardEffect extends OneShotEffect { cost.clearPaid(); final StringBuilder sb = new StringBuilder("Pay {1}? (Otherwise ").append(targetCreature.getName()).append(" will be returned to its owner's hand)"); if (player.chooseUse(Outcome.Benefit, sb.toString(), source, game)) { - cost.pay(source, game, targetCreature.getControllerId(), targetCreature.getControllerId(), false); + cost.pay(source, game, targetCreature.getControllerId(), targetCreature.getControllerId(), false, null); } if (!cost.isPaid()) { controller.moveCards(targetCreature, Zone.BATTLEFIELD, Zone.HAND, source, game); diff --git a/Mage.Sets/src/mage/sets/mirrodin/TajNarSwordsmith.java b/Mage.Sets/src/mage/sets/mirrodin/TajNarSwordsmith.java index 884f933f93..51a8115e68 100644 --- a/Mage.Sets/src/mage/sets/mirrodin/TajNarSwordsmith.java +++ b/Mage.Sets/src/mage/sets/mirrodin/TajNarSwordsmith.java @@ -97,7 +97,7 @@ class TajNarSwordsmithEffect extends OneShotEffect { if (player != null && player.chooseUse(Outcome.BoostCreature, "Do you want to to pay {X}?", source, game)) { int costX = player.announceXMana(0, Integer.MAX_VALUE, "Announce the value for {X}", game, source); Cost cost = new GenericManaCost(costX); - if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false)) { + if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) { FilterCard filter = new FilterCard("Equipment card with converted mana cost " + costX + " or less"); filter.add(new SubtypePredicate("Equipment")); filter.add(new ConvertedManaCostPredicate(ComparisonType.LessThan, costX + 1)); diff --git a/Mage.Sets/src/mage/sets/modernmasters/RiftElemental.java b/Mage.Sets/src/mage/sets/modernmasters/RiftElemental.java index d903c91b4d..a580a6e15d 100644 --- a/Mage.Sets/src/mage/sets/modernmasters/RiftElemental.java +++ b/Mage.Sets/src/mage/sets/modernmasters/RiftElemental.java @@ -35,6 +35,7 @@ import mage.MageInt; import mage.abilities.Ability; import mage.abilities.ActivatedAbility; import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.Cost; import mage.abilities.costs.CostImpl; import mage.abilities.costs.common.RemoveCounterCost; import mage.abilities.costs.mana.ManaCostsImpl; @@ -141,7 +142,7 @@ class RemoveCounterFromCardCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { + public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { paid = false; Player controller = game.getPlayer(controllerId); if (target.choose(Outcome.UnboostCreature, controllerId, sourceId, game)) { diff --git a/Mage.Sets/src/mage/sets/nemesis/RootwaterThief.java b/Mage.Sets/src/mage/sets/nemesis/RootwaterThief.java index d745064168..3cc720fe8c 100644 --- a/Mage.Sets/src/mage/sets/nemesis/RootwaterThief.java +++ b/Mage.Sets/src/mage/sets/nemesis/RootwaterThief.java @@ -99,7 +99,7 @@ class RootwaterThiefEffect extends OneShotEffect { } String message = "Pay {2} to exile a card from damaged player's library?"; Cost cost = new ManaCostsImpl("{2}"); - if(controller.chooseUse(Outcome.Benefit, message, source, game) && cost.pay(source, game, source.getSourceId(), controller.getId(), false)) + if(controller.chooseUse(Outcome.Benefit, message, source, game) && cost.pay(source, game, source.getSourceId(), controller.getId(), false, null)) { TargetCardInLibrary target = new TargetCardInLibrary(); if (controller.searchLibrary(target, game, damagedPlayer.getId())) { diff --git a/Mage.Sets/src/mage/sets/newphyrexia/GreenhiltTrainee.java b/Mage.Sets/src/mage/sets/newphyrexia/GreenhiltTrainee.java index b207f7bddb..14202ac981 100644 --- a/Mage.Sets/src/mage/sets/newphyrexia/GreenhiltTrainee.java +++ b/Mage.Sets/src/mage/sets/newphyrexia/GreenhiltTrainee.java @@ -35,6 +35,7 @@ import mage.constants.Rarity; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.Cost; import mage.abilities.costs.CostImpl; import mage.abilities.costs.common.TapSourceCost; import mage.abilities.effects.common.continuous.BoostTargetEffect; @@ -102,7 +103,7 @@ class GreenhiltTraineeCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { + public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { this.paid = true; return paid; } diff --git a/Mage.Sets/src/mage/sets/oathofthegatewatch/GravityNegator.java b/Mage.Sets/src/mage/sets/oathofthegatewatch/GravityNegator.java index 626d55a8a3..54dc85d3e2 100644 --- a/Mage.Sets/src/mage/sets/oathofthegatewatch/GravityNegator.java +++ b/Mage.Sets/src/mage/sets/oathofthegatewatch/GravityNegator.java @@ -40,6 +40,8 @@ import mage.cards.CardImpl; import mage.constants.CardType; import mage.constants.Duration; import mage.constants.Rarity; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.permanent.AnotherPredicate; import mage.target.common.TargetCreaturePermanent; /** @@ -48,6 +50,12 @@ import mage.target.common.TargetCreaturePermanent; */ public class GravityNegator extends CardImpl { + private final static FilterCreaturePermanent filter = new FilterCreaturePermanent("another target creature"); + + static { + filter.add(new AnotherPredicate()); + } + public GravityNegator(UUID ownerId) { super(ownerId, 45, "Gravity Negator", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{3}{U}"); this.expansionSetCode = "OGW"; @@ -65,7 +73,7 @@ public class GravityNegator extends CardImpl { // Whenenever Gravity Negator attacks, you may pay {C}. If you do, another target creature gains flying until end of turn. Ability ability = new AttacksTriggeredAbility(new DoIfCostPaid(new GainAbilityTargetEffect(FlyingAbility.getInstance(), Duration.EndOfTurn), new ManaCostsImpl("{C}")), false, "Whenever {this} attacks you may pay {C}. If you do, another target creature gains flying until end of turn."); - ability.addTarget(new TargetCreaturePermanent()); + ability.addTarget(new TargetCreaturePermanent(filter)); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/sets/oathofthegatewatch/KozilekTheGreatDistortion.java b/Mage.Sets/src/mage/sets/oathofthegatewatch/KozilekTheGreatDistortion.java index 767e9f188d..b56e37457e 100644 --- a/Mage.Sets/src/mage/sets/oathofthegatewatch/KozilekTheGreatDistortion.java +++ b/Mage.Sets/src/mage/sets/oathofthegatewatch/KozilekTheGreatDistortion.java @@ -34,6 +34,7 @@ import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.condition.common.CardsInHandCondition; +import mage.abilities.costs.Cost; import mage.abilities.costs.CostImpl; import mage.abilities.decorator.ConditionalTriggeredAbility; import mage.abilities.effects.OneShotEffect; @@ -133,7 +134,7 @@ class KozilekDiscardCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { + public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { Spell targetSpell = game.getStack().getSpell(ability.getFirstTarget()); if (targetSpell == null) { return false; diff --git a/Mage.Sets/src/mage/sets/odyssey/DecayingSoil.java b/Mage.Sets/src/mage/sets/odyssey/DecayingSoil.java index 6444d52f69..9dab397a22 100644 --- a/Mage.Sets/src/mage/sets/odyssey/DecayingSoil.java +++ b/Mage.Sets/src/mage/sets/odyssey/DecayingSoil.java @@ -175,7 +175,7 @@ class DecayingSoilEffect extends OneShotEffect { if (player != null) { if (player.chooseUse(Outcome.Benefit, " - Pay " + cost.getText() + "?", source, game)) { cost.clearPaid(); - if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false)) { + if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) { UUID target = this.getTargetPointer().getFirst(game, source); if (target != null) { Card card = game.getCard(target); diff --git a/Mage.Sets/src/mage/sets/odyssey/DelayingShield.java b/Mage.Sets/src/mage/sets/odyssey/DelayingShield.java index 188a4374f4..8e83b7f06f 100644 --- a/Mage.Sets/src/mage/sets/odyssey/DelayingShield.java +++ b/Mage.Sets/src/mage/sets/odyssey/DelayingShield.java @@ -139,7 +139,7 @@ class DelayingShieldUpkeepEffect extends OneShotEffect { for (int i = numCounters; i > 0; i--) { if (controller.chooseUse(Outcome.Benefit, "Pay {1}{W}? (" + i + " counters left to pay)", source, game)) { Cost cost = new ManaCostsImpl<>("{1}{W}"); - if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false)) { + if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) { continue; } } diff --git a/Mage.Sets/src/mage/sets/odyssey/Divert.java b/Mage.Sets/src/mage/sets/odyssey/Divert.java index 0b23c2942c..077cf041e3 100644 --- a/Mage.Sets/src/mage/sets/odyssey/Divert.java +++ b/Mage.Sets/src/mage/sets/odyssey/Divert.java @@ -92,7 +92,7 @@ class DivertEffect extends OneShotEffect { if (player != null) { cost.clearPaid(); if (!cost.pay(source, game, spell.getControllerId(), - spell.getControllerId(), false)) { + spell.getControllerId(), false, null)) { return spell.chooseNewTargets(game, source.getControllerId(), true, true, null); } } diff --git a/Mage.Sets/src/mage/sets/odyssey/UnifyingTheory.java b/Mage.Sets/src/mage/sets/odyssey/UnifyingTheory.java index be4bf8d5bf..6bc6d87e0f 100644 --- a/Mage.Sets/src/mage/sets/odyssey/UnifyingTheory.java +++ b/Mage.Sets/src/mage/sets/odyssey/UnifyingTheory.java @@ -95,7 +95,7 @@ class UnifyingTheoryEffect extends OneShotEffect { if (caster != null) { if (caster.chooseUse(Outcome.DrawCard, "Pay {2} to draw a card?", source, game)) { Cost cost = new ManaCostsImpl("{2}"); - if (cost.pay(source, game, source.getSourceId(), caster.getId(), false)) { + if (cost.pay(source, game, source.getSourceId(), caster.getId(), false, null)) { caster.drawCards(1, game); } } diff --git a/Mage.Sets/src/mage/sets/planarchaos/BrainGorgers.java b/Mage.Sets/src/mage/sets/planarchaos/BrainGorgers.java index 53fd0d565b..5f397a290e 100644 --- a/Mage.Sets/src/mage/sets/planarchaos/BrainGorgers.java +++ b/Mage.Sets/src/mage/sets/planarchaos/BrainGorgers.java @@ -101,7 +101,7 @@ class BrainGorgersCounterSourceEffect extends OneShotEffect { Player player = game.getPlayer(playerId); if (cost.canPay(source, source.getSourceId(), player.getId(), game) && player.chooseUse(outcome, "Sacrifice a creature to counter " + sourceObject.getIdName() + "?", source, game)) { - if (cost.pay(source, game, source.getSourceId(), player.getId(), false)) { + if (cost.pay(source, game, source.getSourceId(), player.getId(), false, null)) { game.informPlayers(player.getLogName() + " sacrifices a creature to counter " + sourceObject.getIdName() + "."); Spell spell = game.getStack().getSpell(source.getSourceId()); if (spell != null) { diff --git a/Mage.Sets/src/mage/sets/planarchaos/DashHopes.java b/Mage.Sets/src/mage/sets/planarchaos/DashHopes.java index d061e582a9..5c4a30e37b 100644 --- a/Mage.Sets/src/mage/sets/planarchaos/DashHopes.java +++ b/Mage.Sets/src/mage/sets/planarchaos/DashHopes.java @@ -97,7 +97,7 @@ class DashHopesCounterSourceEffect extends OneShotEffect { cost.clearPaid(); if (cost.canPay(source, source.getSourceId(), player.getId(), game) && player.chooseUse(outcome, "Pay 5 life to counter " + sourceObject.getIdName() + "?", source, game)) { - if (cost.pay(source, game, source.getSourceId(), player.getId(), false)) { + if (cost.pay(source, game, source.getSourceId(), player.getId(), false, null)) { game.informPlayers(player.getLogName() + " pays 5 life to counter " + sourceObject.getIdName() + "."); Spell spell = game.getStack().getSpell(source.getSourceId()); if (spell != null) { diff --git a/Mage.Sets/src/mage/sets/planarchaos/Phantasmagorian.java b/Mage.Sets/src/mage/sets/planarchaos/Phantasmagorian.java index 31778c3669..29eae0ffc0 100644 --- a/Mage.Sets/src/mage/sets/planarchaos/Phantasmagorian.java +++ b/Mage.Sets/src/mage/sets/planarchaos/Phantasmagorian.java @@ -103,7 +103,7 @@ class CounterSourceEffect extends OneShotEffect { cost.clearPaid(); if (cost.canPay(source, source.getSourceId(), player.getId(), game) && player.chooseUse(outcome, "Discard three cards to counter " + sourceObject.getIdName() + "?", source, game)) { - if (cost.pay(source, game, source.getSourceId(), playerId, false)) { + if (cost.pay(source, game, source.getSourceId(), playerId, false, null)) { game.informPlayers(player.getLogName() + " discards 3 cards to counter " + sourceObject.getIdName() + "."); Spell spell = game.getStack().getSpell(source.getSourceId()); if (spell != null) { diff --git a/Mage.Sets/src/mage/sets/planarchaos/ShivanWumpus.java b/Mage.Sets/src/mage/sets/planarchaos/ShivanWumpus.java index 725ba9ff15..c84a23e79f 100644 --- a/Mage.Sets/src/mage/sets/planarchaos/ShivanWumpus.java +++ b/Mage.Sets/src/mage/sets/planarchaos/ShivanWumpus.java @@ -101,7 +101,7 @@ class ShivanWumpusEffect extends PutOnLibrarySourceEffect { if (player != null && cost.canPay(source, source.getSourceId(), playerId, game) && player.chooseUse(Outcome.Sacrifice, "Sacrifice a land?", source, game) - && cost.pay(source, game, source.getSourceId(), playerId, true)) { + && cost.pay(source, game, source.getSourceId(), playerId, true, null)) { costPaid = true; } } diff --git a/Mage.Sets/src/mage/sets/planarchaos/ShroudedLore.java b/Mage.Sets/src/mage/sets/planarchaos/ShroudedLore.java index a9ffdeab0b..705affbb8b 100644 --- a/Mage.Sets/src/mage/sets/planarchaos/ShroudedLore.java +++ b/Mage.Sets/src/mage/sets/planarchaos/ShroudedLore.java @@ -118,7 +118,7 @@ class ShroudedLoreEffect extends OneShotEffect { if(!done) { if(cost.canPay(source, source.getSourceId(), you.getId(), game) && you.chooseUse(Outcome.Benefit, "Pay {B} to choose a different card ?", source, game)) { cost.clearPaid(); - if(!cost.pay(source, game, source.getSourceId(), you.getId(), false)) { + if(!cost.pay(source, game, source.getSourceId(), you.getId(), false, null)) { done = true; } } diff --git a/Mage.Sets/src/mage/sets/planarchaos/SimianSpiritGuide.java b/Mage.Sets/src/mage/sets/planarchaos/SimianSpiritGuide.java index 14b3897c0e..195258ac36 100644 --- a/Mage.Sets/src/mage/sets/planarchaos/SimianSpiritGuide.java +++ b/Mage.Sets/src/mage/sets/planarchaos/SimianSpiritGuide.java @@ -34,6 +34,7 @@ import mage.constants.Rarity; import mage.MageInt; import mage.Mana; import mage.abilities.Ability; +import mage.abilities.costs.Cost; import mage.abilities.costs.CostImpl; import mage.abilities.effects.common.BasicManaEffect; import mage.abilities.mana.SimpleManaAbility; @@ -84,7 +85,7 @@ class ExileSourceFromHandCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { + public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { Card card = game.getCard(sourceId); Player player = game.getPlayer(controllerId); if (player != null && player.getHand().contains(sourceId) && card != null) { diff --git a/Mage.Sets/src/mage/sets/planechase/ThirstForKnowledge.java b/Mage.Sets/src/mage/sets/planechase/ThirstForKnowledge.java index a7106c6c67..76916dd11e 100644 --- a/Mage.Sets/src/mage/sets/planechase/ThirstForKnowledge.java +++ b/Mage.Sets/src/mage/sets/planechase/ThirstForKnowledge.java @@ -96,7 +96,7 @@ class ThirstforKnowledgeEffect extends OneShotEffect { && you.chooseUse(Outcome.Discard, "Do you want to discard an artifact? If you don't, you must discard 2 cards", source, game)) { Cost cost = new DiscardTargetCost(new TargetCardInHand(filter)); if (cost.canPay(source, source.getSourceId(), you.getId(), game)) { - if (cost.pay(source, game, source.getSourceId(), you.getId(), false)) { + if (cost.pay(source, game, source.getSourceId(), you.getId(), false, null)) { return true; } } diff --git a/Mage.Sets/src/mage/sets/planeshift/PhyrexianTyranny.java b/Mage.Sets/src/mage/sets/planeshift/PhyrexianTyranny.java index d9f60ea27f..4763d4385b 100644 --- a/Mage.Sets/src/mage/sets/planeshift/PhyrexianTyranny.java +++ b/Mage.Sets/src/mage/sets/planeshift/PhyrexianTyranny.java @@ -127,7 +127,7 @@ class PhyrexianTyrannyEffect extends OneShotEffect { Player player = game.getPlayer(targetPointer.getFirst(game, source)); if (player != null) { Cost cost = new GenericManaCost(2); - if (!cost.pay(source, game, player.getId(), player.getId(), false)) { + if (!cost.pay(source, game, player.getId(), player.getId(), false, null)) { player.damage(2, source.getSourceId(), game, false, true); } return true; diff --git a/Mage.Sets/src/mage/sets/prophecy/RhysticStudy.java b/Mage.Sets/src/mage/sets/prophecy/RhysticStudy.java index d0864c9e78..8e852eb94d 100644 --- a/Mage.Sets/src/mage/sets/prophecy/RhysticStudy.java +++ b/Mage.Sets/src/mage/sets/prophecy/RhysticStudy.java @@ -92,7 +92,7 @@ class RhysticStudyDrawEffect extends OneShotEffect { if (controller != null && opponent != null && sourceObject != null) { Cost cost = new GenericManaCost(1); String message = "Would you like to pay {1} to prevent the opponent to draw a card?"; - if (!(opponent.chooseUse(Outcome.Benefit, message, source, game) && cost.pay(source, game, source.getSourceId(), opponent.getId(), false))) { + if (!(opponent.chooseUse(Outcome.Benefit, message, source, game) && cost.pay(source, game, source.getSourceId(), opponent.getId(), false, null))) { if(controller.chooseUse(Outcome.DrawCard, "Draw a card (" + sourceObject.getLogName() +")", source, game)) { controller.drawCards(1, game); } diff --git a/Mage.Sets/src/mage/sets/ravnica/Sunforger.java b/Mage.Sets/src/mage/sets/ravnica/Sunforger.java index cd82d127e3..5c0fbb8d9e 100644 --- a/Mage.Sets/src/mage/sets/ravnica/Sunforger.java +++ b/Mage.Sets/src/mage/sets/ravnica/Sunforger.java @@ -32,6 +32,7 @@ import mage.ObjectColor; import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.costs.Cost; import mage.abilities.costs.CostImpl; import mage.abilities.costs.mana.GenericManaCost; import mage.abilities.costs.mana.ManaCostsImpl; @@ -149,7 +150,7 @@ class UnattachSourceCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { + public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { Permanent attachment = game.getPermanent(sourceId); Permanent permanent = game.getPermanent(attachment.getAttachedTo()); if (permanent != null) { diff --git a/Mage.Sets/src/mage/sets/returntoravnica/SoulTithe.java b/Mage.Sets/src/mage/sets/returntoravnica/SoulTithe.java index 3c20ab8aee..e9fef2da6f 100644 --- a/Mage.Sets/src/mage/sets/returntoravnica/SoulTithe.java +++ b/Mage.Sets/src/mage/sets/returntoravnica/SoulTithe.java @@ -111,7 +111,7 @@ class SoulTitheEffect extends OneShotEffect { int cmc = permanent.getManaCost().convertedManaCost(); if (player.chooseUse(Outcome.Benefit, "Pay {" + cmc + "} for " + permanent.getName() + "? (otherwise you sacrifice it)", source, game)) { Cost cost = new GenericManaCost(cmc); - if (cost.pay(source, game, source.getSourceId(), player.getId(), false)) { + if (cost.pay(source, game, source.getSourceId(), player.getId(), false, null)) { return true; } } diff --git a/Mage.Sets/src/mage/sets/saviorsofkamigawa/TombOfUrami.java b/Mage.Sets/src/mage/sets/saviorsofkamigawa/TombOfUrami.java index e516c80f1f..40f003719d 100644 --- a/Mage.Sets/src/mage/sets/saviorsofkamigawa/TombOfUrami.java +++ b/Mage.Sets/src/mage/sets/saviorsofkamigawa/TombOfUrami.java @@ -35,6 +35,7 @@ import mage.MageInt; import mage.ObjectColor; import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.Cost; import mage.abilities.costs.CostImpl; import mage.abilities.costs.common.TapSourceCost; import mage.abilities.costs.mana.ManaCostsImpl; @@ -93,7 +94,7 @@ class SacrificeAllLandCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { + public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { for(Permanent permanent : game.getBattlefield().getActivePermanents(new FilterControlledLandPermanent(), ability.getControllerId(), game)){ paid |= permanent.sacrifice(sourceId, game); } diff --git a/Mage.Sets/src/mage/sets/scarsofmirrodin/BloodshotTrainee.java b/Mage.Sets/src/mage/sets/scarsofmirrodin/BloodshotTrainee.java index 02296e641a..b92df5d275 100644 --- a/Mage.Sets/src/mage/sets/scarsofmirrodin/BloodshotTrainee.java +++ b/Mage.Sets/src/mage/sets/scarsofmirrodin/BloodshotTrainee.java @@ -34,6 +34,7 @@ import mage.constants.Zone; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.Cost; import mage.abilities.costs.CostImpl; import mage.abilities.costs.common.TapSourceCost; import mage.abilities.effects.common.DamageTargetEffect; @@ -100,7 +101,7 @@ class BloodshotTraineeCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { + public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { this.paid = true; return paid; } diff --git a/Mage.Sets/src/mage/sets/scarsofmirrodin/Embersmith.java b/Mage.Sets/src/mage/sets/scarsofmirrodin/Embersmith.java index 09d83f6f15..acf568e317 100644 --- a/Mage.Sets/src/mage/sets/scarsofmirrodin/Embersmith.java +++ b/Mage.Sets/src/mage/sets/scarsofmirrodin/Embersmith.java @@ -88,7 +88,7 @@ class EmbersmithEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Cost cost = new GenericManaCost(1); cost.clearPaid(); - if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false)) { + if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) { Permanent permanent = game.getPermanent(source.getFirstTarget()); if (permanent != null) { permanent.damage(1, source.getSourceId(), game, false, true); diff --git a/Mage.Sets/src/mage/sets/scarsofmirrodin/Lifesmith.java b/Mage.Sets/src/mage/sets/scarsofmirrodin/Lifesmith.java index ba2a2ca72e..1dea4714e2 100644 --- a/Mage.Sets/src/mage/sets/scarsofmirrodin/Lifesmith.java +++ b/Mage.Sets/src/mage/sets/scarsofmirrodin/Lifesmith.java @@ -85,7 +85,7 @@ class LifesmithEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Cost cost = new GenericManaCost(1); cost.clearPaid(); - if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false)) { + if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) { Player player = game.getPlayer(source.getControllerId()); if (player != null) { player.gainLife(3, game); diff --git a/Mage.Sets/src/mage/sets/scarsofmirrodin/Myrsmith.java b/Mage.Sets/src/mage/sets/scarsofmirrodin/Myrsmith.java index 845fe55962..e0f688a9b1 100644 --- a/Mage.Sets/src/mage/sets/scarsofmirrodin/Myrsmith.java +++ b/Mage.Sets/src/mage/sets/scarsofmirrodin/Myrsmith.java @@ -84,7 +84,7 @@ class MyrsmithEffect extends CreateTokenEffect { public boolean apply(Game game, Ability source) { Cost cost = new GenericManaCost(1); cost.clearPaid(); - if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false)) { + if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) { super.apply(game, source); } return true; diff --git a/Mage.Sets/src/mage/sets/scarsofmirrodin/NimDeathmantle.java b/Mage.Sets/src/mage/sets/scarsofmirrodin/NimDeathmantle.java index 0de1da1561..294fc85ba8 100644 --- a/Mage.Sets/src/mage/sets/scarsofmirrodin/NimDeathmantle.java +++ b/Mage.Sets/src/mage/sets/scarsofmirrodin/NimDeathmantle.java @@ -154,7 +154,7 @@ class NimDeathmantleEffect extends OneShotEffect { if (controller != null && equipment != null) { if (controller.chooseUse(Outcome.Benefit, equipment.getName() + " - Pay " + cost.getText() + "?", source, game)) { cost.clearPaid(); - if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false)) { + if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) { UUID target = targetPointer.getFirst(game, source); if (target != null) { Card card = game.getCard(target); diff --git a/Mage.Sets/src/mage/sets/scarsofmirrodin/PainfulQuandary.java b/Mage.Sets/src/mage/sets/scarsofmirrodin/PainfulQuandary.java index 8966440f99..f7f5bccc45 100644 --- a/Mage.Sets/src/mage/sets/scarsofmirrodin/PainfulQuandary.java +++ b/Mage.Sets/src/mage/sets/scarsofmirrodin/PainfulQuandary.java @@ -93,7 +93,7 @@ class PainfulQuandryEffect extends OneShotEffect { Cost cost = new DiscardTargetCost(new TargetCardInHand()); if (cost.canPay(source, source.getSourceId(), player.getId(), game) && player.chooseUse(Outcome.Detriment, "Discard a card (otherwise you lose 5 life)?", source, game)) { - paid = cost.pay(source, game, source.getSourceId(), player.getId(), false); + paid = cost.pay(source, game, source.getSourceId(), player.getId(), false, null); } if (!paid) { player.loseLife(5, game); diff --git a/Mage.Sets/src/mage/sets/shadowmoor/MossbridgeTroll.java b/Mage.Sets/src/mage/sets/shadowmoor/MossbridgeTroll.java index bc44a0a95d..50689961a2 100644 --- a/Mage.Sets/src/mage/sets/shadowmoor/MossbridgeTroll.java +++ b/Mage.Sets/src/mage/sets/shadowmoor/MossbridgeTroll.java @@ -32,6 +32,7 @@ import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.costs.Cost; import mage.abilities.costs.CostImpl; import mage.abilities.effects.ReplacementEffectImpl; import mage.abilities.effects.common.continuous.BoostSourceEffect; @@ -148,7 +149,7 @@ class MossbridgeTrollCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { + public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { int sumPower = 0; if (targets.choose(Outcome.Tap, controllerId, sourceId, game)) { for (UUID targetId : targets.get(0).getTargets()) { diff --git a/Mage.Sets/src/mage/sets/shadowmoor/ScarscaleRitual.java b/Mage.Sets/src/mage/sets/shadowmoor/ScarscaleRitual.java index 8e955f022f..3082728aaf 100644 --- a/Mage.Sets/src/mage/sets/shadowmoor/ScarscaleRitual.java +++ b/Mage.Sets/src/mage/sets/shadowmoor/ScarscaleRitual.java @@ -29,6 +29,7 @@ package mage.sets.shadowmoor; import java.util.UUID; import mage.abilities.Ability; +import mage.abilities.costs.Cost; import mage.abilities.costs.CostImpl; import mage.abilities.effects.common.DrawCardSourceControllerEffect; import mage.cards.CardImpl; @@ -90,7 +91,7 @@ class ScarscaleRitualCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { + public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { Player controller = game.getPlayer(ability.getControllerId()); if (controller != null) { Target target = new TargetControlledCreaturePermanent(); diff --git a/Mage.Sets/src/mage/sets/shadowmoor/Tyrannize.java b/Mage.Sets/src/mage/sets/shadowmoor/Tyrannize.java index 12451e7b89..4bac31203d 100644 --- a/Mage.Sets/src/mage/sets/shadowmoor/Tyrannize.java +++ b/Mage.Sets/src/mage/sets/shadowmoor/Tyrannize.java @@ -92,7 +92,7 @@ class TyrannizeEffect extends OneShotEffect { Cost cost = new PayLifeCost(7); if (!cost.canPay(source, source.getSourceId(), player.getId(), game) || !player.chooseUse(Outcome.LoseLife, "Pay 7 life?", source, game) - || !cost.pay(source, game, source.getSourceId(), player.getId(), false)) { + || !cost.pay(source, game, source.getSourceId(), player.getId(), false, null)) { for (Card card : player.getHand().getCards(game)) { player.discard(card, source, game); } diff --git a/Mage.Sets/src/mage/sets/shardsofalara/FlameblastDragon.java b/Mage.Sets/src/mage/sets/shardsofalara/FlameblastDragon.java index e2571f5438..5e0534f993 100644 --- a/Mage.Sets/src/mage/sets/shardsofalara/FlameblastDragon.java +++ b/Mage.Sets/src/mage/sets/shardsofalara/FlameblastDragon.java @@ -95,7 +95,7 @@ class FlameblastDragonEffect extends OneShotEffect { if (player.chooseUse(Outcome.Damage, "Pay " + cost.getText() + "? If you do, Flameblast Dragon deals X damage to target creature or player", source, game)) { int costX = player.announceXMana(0, Integer.MAX_VALUE, "Announce the value for {X}", game, source); cost.add(new GenericManaCost(costX)); - if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false)) { + if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) { Permanent permanent = game.getPermanent(source.getFirstTarget()); if (permanent != null) { permanent.damage(costX, source.getSourceId(), game, false, true); diff --git a/Mage.Sets/src/mage/sets/shardsofalara/PrinceOfThralls.java b/Mage.Sets/src/mage/sets/shardsofalara/PrinceOfThralls.java index f8643ddaf9..a9f79f6b33 100644 --- a/Mage.Sets/src/mage/sets/shardsofalara/PrinceOfThralls.java +++ b/Mage.Sets/src/mage/sets/shardsofalara/PrinceOfThralls.java @@ -146,7 +146,7 @@ class PrinceOfThrallsEffect extends OneShotEffect { PayLifeCost cost = new PayLifeCost(3); if (opponent.chooseUse(Outcome.Neutral, cost.getText() + " or " + card.getLogName() + " comes back into the battlefield under opponents control", source, game)) { cost.clearPaid(); - if (cost.pay(source, game, source.getSourceId(), opponent.getId(), true)) { + if (cost.pay(source, game, source.getSourceId(), opponent.getId(), true, null)) { return true; } } diff --git a/Mage.Sets/src/mage/sets/tempest/EssenceBottle.java b/Mage.Sets/src/mage/sets/tempest/EssenceBottle.java index faa799dd01..e1b65510d1 100644 --- a/Mage.Sets/src/mage/sets/tempest/EssenceBottle.java +++ b/Mage.Sets/src/mage/sets/tempest/EssenceBottle.java @@ -98,7 +98,7 @@ class EssenceBottleCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { + public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { Permanent permanent = game.getPermanent(ability.getSourceId()); if (permanent != null) { this.removedCounters = permanent.getCounters().getCount(CounterType.ELIXIR); diff --git a/Mage.Sets/src/mage/sets/tempest/TortureChamber.java b/Mage.Sets/src/mage/sets/tempest/TortureChamber.java index 8768d304fa..627b584672 100644 --- a/Mage.Sets/src/mage/sets/tempest/TortureChamber.java +++ b/Mage.Sets/src/mage/sets/tempest/TortureChamber.java @@ -103,7 +103,7 @@ class TortureChamberCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { + public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { Permanent permanent = game.getPermanent(ability.getSourceId()); if (permanent != null) { this.removedCounters = permanent.getCounters().getCount(CounterType.PAIN); diff --git a/Mage.Sets/src/mage/sets/timeshifted/WallOfRoots.java b/Mage.Sets/src/mage/sets/timeshifted/WallOfRoots.java index eb85758d6e..e7b6a50e64 100644 --- a/Mage.Sets/src/mage/sets/timeshifted/WallOfRoots.java +++ b/Mage.Sets/src/mage/sets/timeshifted/WallOfRoots.java @@ -34,6 +34,7 @@ import mage.constants.Zone; import mage.MageInt; import mage.Mana; import mage.abilities.Ability; +import mage.abilities.costs.Cost; import mage.abilities.costs.CostImpl; import mage.abilities.effects.common.BasicManaEffect; import mage.abilities.keyword.DefenderAbility; @@ -90,7 +91,7 @@ class WallOfRootsCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { + public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { Permanent permanent = game.getPermanent(sourceId); if (permanent != null) { permanent.addCounters(new BoostCounter(0, -1), game); diff --git a/Mage.Sets/src/mage/sets/urzaslegacy/MoltenHydra.java b/Mage.Sets/src/mage/sets/urzaslegacy/MoltenHydra.java index c98e7d98ca..3e0f9f8cc7 100644 --- a/Mage.Sets/src/mage/sets/urzaslegacy/MoltenHydra.java +++ b/Mage.Sets/src/mage/sets/urzaslegacy/MoltenHydra.java @@ -111,7 +111,7 @@ class RemoveAllCountersSourceCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { + public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { Permanent permanent = game.getPermanent(sourceId); if (permanent != null) { this.amount = permanent.getCounters().getCount(name); diff --git a/Mage.Sets/src/mage/sets/urzaslegacy/SlowMotion.java b/Mage.Sets/src/mage/sets/urzaslegacy/SlowMotion.java index ffe52f2251..20f8103195 100644 --- a/Mage.Sets/src/mage/sets/urzaslegacy/SlowMotion.java +++ b/Mage.Sets/src/mage/sets/urzaslegacy/SlowMotion.java @@ -108,7 +108,7 @@ class SacrificeEquipedUnlessPaysEffect extends OneShotEffect { if (player != null && equipped != null) { if (player.chooseUse(Outcome.Benefit, "Pay " + cost.getText() + "? (Or " + equipped.getName() + " will be sacrificed.)", source, game)) { cost.clearPaid(); - if (cost.pay(source, game, source.getSourceId(), equipped.getControllerId(), false)) { + if (cost.pay(source, game, source.getSourceId(), equipped.getControllerId(), false, null)) { return true; } } diff --git a/Mage.Sets/src/mage/sets/urzassaga/ArgothianWurm.java b/Mage.Sets/src/mage/sets/urzassaga/ArgothianWurm.java index 159db3e05a..a98359478a 100644 --- a/Mage.Sets/src/mage/sets/urzassaga/ArgothianWurm.java +++ b/Mage.Sets/src/mage/sets/urzassaga/ArgothianWurm.java @@ -101,7 +101,7 @@ class ArgothianWurmEffect extends PutOnLibrarySourceEffect { if (player != null && cost.canPay(source, source.getSourceId(), playerId, game) && player.chooseUse(Outcome.Sacrifice, "Sacrifice a land?", source, game) - && cost.pay(source, game, source.getSourceId(), playerId, true)) { + && cost.pay(source, game, source.getSourceId(), playerId, true, null)) { costPaid = true; } } diff --git a/Mage.Sets/src/mage/sets/urzassaga/LurkingEvil.java b/Mage.Sets/src/mage/sets/urzassaga/LurkingEvil.java index ce966c161d..a8b38dc6b4 100644 --- a/Mage.Sets/src/mage/sets/urzassaga/LurkingEvil.java +++ b/Mage.Sets/src/mage/sets/urzassaga/LurkingEvil.java @@ -31,6 +31,7 @@ import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.Cost; import mage.abilities.costs.CostImpl; import mage.abilities.effects.Effect; import mage.abilities.effects.common.continuous.BecomesCreatureSourceEffect; @@ -87,7 +88,7 @@ class LurkingEvilCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { + public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { Player controller = game.getPlayer(controllerId); if (controller != null) { int currentLife = controller.getLife(); diff --git a/Mage.Sets/src/mage/sets/vintagemasters/DecreeOfJustice.java b/Mage.Sets/src/mage/sets/vintagemasters/DecreeOfJustice.java index 241c2d5b49..911d21180c 100644 --- a/Mage.Sets/src/mage/sets/vintagemasters/DecreeOfJustice.java +++ b/Mage.Sets/src/mage/sets/vintagemasters/DecreeOfJustice.java @@ -103,7 +103,7 @@ class DecreeOfJusticeCycleEffect extends OneShotEffect { if (player != null) { int costX = player.announceXMana(0, Integer.MAX_VALUE, "Announce the value for {X}", game, source); cost.add(new GenericManaCost(costX)); - if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false)) { + if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) { Token token = new SoldierToken(); token.putOntoBattlefield(costX, game, source.getSourceId(), source.getControllerId()); } diff --git a/Mage.Sets/src/mage/sets/weatherlight/LlanowarSentinel.java b/Mage.Sets/src/mage/sets/weatherlight/LlanowarSentinel.java index bf5a00bb21..f297f59dab 100644 --- a/Mage.Sets/src/mage/sets/weatherlight/LlanowarSentinel.java +++ b/Mage.Sets/src/mage/sets/weatherlight/LlanowarSentinel.java @@ -94,7 +94,7 @@ class LlanowarSentinelEffect extends OneShotEffect { if(player != null) { if(player.chooseUse(Outcome.BoostCreature, "Do you want to to pay {1}{G}?", source, game)) { Cost cost = new ManaCostsImpl("{1}{G}"); - if(cost.pay(source, game, source.getSourceId(), source.getControllerId(), false)) { + if(cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) { FilterCard filter = new FilterCard("card named Llanowar Sentinel"); filter.add(new NamePredicate("Llanowar Sentinel")); new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(0, 1, filter), false, true).apply(game, source); diff --git a/Mage.Sets/src/mage/sets/weatherlight/PsychicVortex.java b/Mage.Sets/src/mage/sets/weatherlight/PsychicVortex.java index b829bd3c80..642d090f0b 100644 --- a/Mage.Sets/src/mage/sets/weatherlight/PsychicVortex.java +++ b/Mage.Sets/src/mage/sets/weatherlight/PsychicVortex.java @@ -30,6 +30,7 @@ package mage.sets.weatherlight; import java.util.UUID; import mage.abilities.Ability; import mage.abilities.common.BeginningOfEndStepTriggeredAbility; +import mage.abilities.costs.Cost; import mage.abilities.costs.CostImpl; import mage.abilities.effects.Effect; import mage.abilities.effects.common.SacrificeTargetEffect; @@ -85,7 +86,7 @@ class PsychicVortexCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { + public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { Player controller = game.getPlayer(controllerId); if (controller != null) { controller.drawCards(1, game); diff --git a/Mage.Sets/src/mage/sets/weatherlight/SpinningDarkness.java b/Mage.Sets/src/mage/sets/weatherlight/SpinningDarkness.java index 97623904f4..3adbb45eb8 100644 --- a/Mage.Sets/src/mage/sets/weatherlight/SpinningDarkness.java +++ b/Mage.Sets/src/mage/sets/weatherlight/SpinningDarkness.java @@ -33,6 +33,7 @@ import java.util.UUID; import mage.ObjectColor; import mage.abilities.Ability; import mage.abilities.costs.AlternativeCostSourceAbility; +import mage.abilities.costs.Cost; import mage.abilities.costs.CostImpl; import mage.abilities.effects.common.DamageTargetEffect; import mage.abilities.effects.common.GainLifeEffect; @@ -101,7 +102,7 @@ class SpinningDarknessCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { + public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { Player controller = game.getPlayer(controllerId); if (controller != null) { Set<Card> blackCardsInGraveyard = controller.getGraveyard().getCards(filter, game); diff --git a/Mage.Sets/src/mage/sets/weatherlight/Tariff.java b/Mage.Sets/src/mage/sets/weatherlight/Tariff.java index f3ec4cd417..12aa015027 100644 --- a/Mage.Sets/src/mage/sets/weatherlight/Tariff.java +++ b/Mage.Sets/src/mage/sets/weatherlight/Tariff.java @@ -118,7 +118,7 @@ class TariffEffect extends OneShotEffect { String message = new StringBuilder("Pay ").append(manaCost.getText()).append(" (otherwise sacrifice ") .append(creatureToPayFor.getName()).append(")?").toString(); if (player.chooseUse(Outcome.Benefit, message, source, game)) { - if (manaCost.pay(source, game, source.getSourceId(), player.getId(), false)) { + if (manaCost.pay(source, game, source.getSourceId(), player.getId(), false, null)) { game.informPlayers(new StringBuilder(sourceObject != null ? sourceObject.getName() : "") .append(": ").append(player.getLogName()).append(" has paid").toString()); return; diff --git a/Mage.Sets/src/mage/sets/worldwake/KazuulTyrantOfTheCliffs.java b/Mage.Sets/src/mage/sets/worldwake/KazuulTyrantOfTheCliffs.java index 347d2cc3cd..f3c5515c26 100644 --- a/Mage.Sets/src/mage/sets/worldwake/KazuulTyrantOfTheCliffs.java +++ b/Mage.Sets/src/mage/sets/worldwake/KazuulTyrantOfTheCliffs.java @@ -135,7 +135,7 @@ class KazuulTyrantOfTheCliffsEffect extends OneShotEffect { Player payee = game.getPlayer(targetPointer.getFirst(game, source)); if (payee != null) { cost.clearPaid(); - if (!cost.pay(source, game, source.getSourceId(), payee.getId(), false)) { + if (!cost.pay(source, game, source.getSourceId(), payee.getId(), false, null)) { return token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId()); } } diff --git a/Mage.Sets/src/mage/sets/worldwake/RazorBoomerang.java b/Mage.Sets/src/mage/sets/worldwake/RazorBoomerang.java index e91f89c492..3d40df4d00 100644 --- a/Mage.Sets/src/mage/sets/worldwake/RazorBoomerang.java +++ b/Mage.Sets/src/mage/sets/worldwake/RazorBoomerang.java @@ -33,6 +33,7 @@ import mage.constants.*; import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.costs.Cost; import mage.abilities.costs.CostImpl; import mage.abilities.costs.common.TapSourceCost; import mage.abilities.costs.mana.GenericManaCost; @@ -91,7 +92,7 @@ class UnattachCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { + public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { Permanent permanent = game.getPermanent(sourceId); if (permanent != null) { Permanent attachment = game.getPermanent(attachmentid); diff --git a/Mage.Sets/src/mage/sets/worldwake/TectonicEdge.java b/Mage.Sets/src/mage/sets/worldwake/TectonicEdge.java index a25944f4cb..f2f015fbfc 100644 --- a/Mage.Sets/src/mage/sets/worldwake/TectonicEdge.java +++ b/Mage.Sets/src/mage/sets/worldwake/TectonicEdge.java @@ -32,6 +32,7 @@ import java.util.UUID; import mage.abilities.Ability; import mage.abilities.common.ActivateIfConditionActivatedAbility; import mage.abilities.condition.common.OpponentControlsPermanentCondition; +import mage.abilities.costs.Cost; import mage.abilities.costs.CostImpl; import mage.abilities.costs.common.SacrificeSourceCost; import mage.abilities.costs.common.TapSourceCost; @@ -112,7 +113,7 @@ class TectonicEdgeCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { + public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { this.paid = true; return paid; } diff --git a/Mage.Sets/src/mage/sets/worldwake/VastwoodAnimist.java b/Mage.Sets/src/mage/sets/worldwake/VastwoodAnimist.java index 02a22a0f7e..f8c4eaf594 100644 --- a/Mage.Sets/src/mage/sets/worldwake/VastwoodAnimist.java +++ b/Mage.Sets/src/mage/sets/worldwake/VastwoodAnimist.java @@ -49,16 +49,12 @@ import mage.game.Game; import mage.game.permanent.token.Token; import mage.target.common.TargetControlledPermanent; - - /** * * @author jeffwadsworth */ public class VastwoodAnimist extends CardImpl { - private static final FilterControlledPermanent filter = new FilterControlledLandPermanent(); - public VastwoodAnimist(UUID ownerId) { super(ownerId, 116, "Vastwood Animist", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{2}{G}"); this.expansionSetCode = "WWK"; @@ -71,7 +67,7 @@ public class VastwoodAnimist extends CardImpl { // {tap}: Target land you control becomes an X/X Elemental creature until end of turn, where X is the number of Allies you control. It's still a land. Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new VastwoodAnimistEffect(), new TapSourceCost()); - ability.addTarget(new TargetControlledPermanent(filter)); + ability.addTarget(new TargetControlledPermanent(new FilterControlledLandPermanent())); this.addAbility(ability); } @@ -88,6 +84,7 @@ public class VastwoodAnimist extends CardImpl { class VastwoodAnimistEffect extends OneShotEffect { final static FilterControlledPermanent filterAllies = new FilterControlledPermanent("allies you control"); + static { filterAllies.add(new SubtypePredicate("Ally")); } @@ -118,7 +115,6 @@ class VastwoodAnimistEffect extends OneShotEffect { class VastwoodAnimistElementalToken extends Token { - VastwoodAnimistElementalToken(int amount) { super("", "X/X Elemental creature, where X is the number of Allies you control"); cardType.add(CardType.CREATURE); diff --git a/Mage.Sets/src/mage/sets/zendikar/BlazingTorch.java b/Mage.Sets/src/mage/sets/zendikar/BlazingTorch.java index b385513add..261236404a 100644 --- a/Mage.Sets/src/mage/sets/zendikar/BlazingTorch.java +++ b/Mage.Sets/src/mage/sets/zendikar/BlazingTorch.java @@ -38,6 +38,7 @@ import mage.constants.Zone; import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.costs.Cost; import mage.abilities.costs.CostImpl; import mage.abilities.costs.common.TapSourceCost; import mage.abilities.costs.mana.GenericManaCost; @@ -128,7 +129,7 @@ class BlazingTorchCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { + public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { Permanent permanent = game.getPermanent(ability.getSourceId()); List<UUID> attachments = permanent.getAttachments(); for (UUID attachmentId : attachments) { diff --git a/Mage.Sets/src/mage/sets/zendikar/Electropotence.java b/Mage.Sets/src/mage/sets/zendikar/Electropotence.java index ce2b9795af..59e0d09ee1 100644 --- a/Mage.Sets/src/mage/sets/zendikar/Electropotence.java +++ b/Mage.Sets/src/mage/sets/zendikar/Electropotence.java @@ -133,7 +133,7 @@ class ElectropotenceEffect extends OneShotEffect { if (controller.chooseUse(Outcome.Damage, "Pay {2}{R} to do the damage?", source, game)) { // if (controller.chooseUse(Outcome.Damage, "Pay {2}{R}? If you do, " + creature.getName() + " deals damage equal to its power to target creature or player.", game)) { ManaCosts manaCosts = new ManaCostsImpl("{2}{R}"); - if (manaCosts.pay(source, game, source.getSourceId(), controller.getId(), false)) { + if (manaCosts.pay(source, game, source.getSourceId(), controller.getId(), false, null)) { int amount = creature.getPower().getValue(); UUID target = source.getTargets().getFirstTarget(); Permanent targetCreature = game.getPermanent(target); diff --git a/Mage.Sets/src/mage/sets/zendikar/FeastOfBlood.java b/Mage.Sets/src/mage/sets/zendikar/FeastOfBlood.java index 24dabbcc7e..6bbfbecfd4 100644 --- a/Mage.Sets/src/mage/sets/zendikar/FeastOfBlood.java +++ b/Mage.Sets/src/mage/sets/zendikar/FeastOfBlood.java @@ -31,6 +31,7 @@ import java.util.UUID; import mage.constants.CardType; import mage.constants.Rarity; import mage.abilities.Ability; +import mage.abilities.costs.Cost; import mage.abilities.costs.CostImpl; import mage.abilities.effects.common.DestroyTargetEffect; import mage.abilities.effects.common.GainLifeEffect; @@ -91,7 +92,7 @@ class FeastOfBloodCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { + public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { this.paid = true; return paid; } diff --git a/Mage.Sets/src/mage/sets/zendikar/HellkiteCharger.java b/Mage.Sets/src/mage/sets/zendikar/HellkiteCharger.java index 9586ec1a36..da0d62db16 100644 --- a/Mage.Sets/src/mage/sets/zendikar/HellkiteCharger.java +++ b/Mage.Sets/src/mage/sets/zendikar/HellkiteCharger.java @@ -99,7 +99,7 @@ class HellkiteChargerEffect extends OneShotEffect { ManaCosts cost = new ManaCostsImpl("{5}{R}{R}"); if (player.chooseUse(Outcome.Damage, "Pay " + cost.getText() + "?", source, game)) { cost.clearPaid(); - if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false)) { + if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) { new UntapAllControllerEffect(new FilterAttackingCreature(),"").apply(game, source); game.getState().getTurnMods().add(new TurnMod(source.getControllerId(), TurnPhase.COMBAT, null, false)); return true; diff --git a/Mage.Sets/src/mage/sets/zendikar/LorthosTheTidemaker.java b/Mage.Sets/src/mage/sets/zendikar/LorthosTheTidemaker.java index d6f4e02af7..098a382196 100644 --- a/Mage.Sets/src/mage/sets/zendikar/LorthosTheTidemaker.java +++ b/Mage.Sets/src/mage/sets/zendikar/LorthosTheTidemaker.java @@ -104,7 +104,7 @@ class LorthosTheTideMakerEffect extends OneShotEffect { Cost cost = new ManaCostsImpl("{8}"); if (player.chooseUse(Outcome.Tap, "Pay " + cost.getText() + " and " + staticText, source, game)) { cost.clearPaid(); - if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false)) { + if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) { for (UUID target : this.targetPointer.getTargets(game, source)) { Permanent permanent = game.getPermanent(target); if (permanent != null) { diff --git a/Mage.Sets/src/mage/sets/zendikar/LuminarchAscension.java b/Mage.Sets/src/mage/sets/zendikar/LuminarchAscension.java index 466a68220a..58989f4468 100644 --- a/Mage.Sets/src/mage/sets/zendikar/LuminarchAscension.java +++ b/Mage.Sets/src/mage/sets/zendikar/LuminarchAscension.java @@ -32,6 +32,7 @@ import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.condition.Condition; +import mage.abilities.costs.Cost; import mage.abilities.costs.CostImpl; import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.decorator.ConditionalTriggeredAbility; @@ -128,7 +129,7 @@ class SourceHasCountersCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { + public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { this.paid = true; return paid; } diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/mana/ConditionalManaTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/mana/ConditionalManaTest.java index 6008bf7e27..c4f3ad3739 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/mana/ConditionalManaTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/mana/ConditionalManaTest.java @@ -27,6 +27,7 @@ */ package org.mage.test.cards.mana; +import mage.abilities.keyword.FlyingAbility; import mage.constants.PhaseStep; import mage.constants.Zone; import org.junit.Test; @@ -168,4 +169,64 @@ public class ConditionalManaTest extends CardTestPlayerBase { assertPermanentCount(playerA, "Kozilek, the Great Distortion", 1); } + + @Test + public void CultivatorDroneColorlessSpell() { + // Devoid + // {T}: Add {C} to your mana pool. Spend this mana only to cast a colorless spell, activate an ability of a colorless permanent, or pay a cost that contains {C}. + addCard(Zone.BATTLEFIELD, playerA, "Cultivator Drone", 1); + addCard(Zone.BATTLEFIELD, playerA, "Silvercoat Lion", 1); + addCard(Zone.BATTLEFIELD, playerA, "Plains", 1); + // Target creature gets +3/-3 until end of turn. + addCard(Zone.HAND, playerA, "Spatial Contortion", 1); // {1}{C} + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Spatial Contortion", "Silvercoat Lion"); + + setStopAt(1, PhaseStep.BEGIN_COMBAT); + execute(); + + assertGraveyardCount(playerA, "Spatial Contortion", 1); + assertGraveyardCount(playerA, "Silvercoat Lion", 1); + } + + @Test + public void CultivatorDroneColorlessAbility() { + // Devoid + // {T}: Add {C} to your mana pool. Spend this mana only to cast a colorless spell, activate an ability of a colorless permanent, or pay a cost that contains {C}. + addCard(Zone.BATTLEFIELD, playerA, "Cultivator Drone", 1); + addCard(Zone.BATTLEFIELD, playerA, "Wastes", 1); + // Untap Endbringer during each other player's untap step. + // {T}: Endbringer deals 1 damage to target creature or player. + // {C}, {T}: Target creature can't attack or block this turn. + // {C}{C}, {T}: Draw a card. + addCard(Zone.BATTLEFIELD, playerA, "Endbringer", 1); // {1}{C} + + activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{C}{C},"); + + setStopAt(1, PhaseStep.BEGIN_COMBAT); + execute(); + + assertHandCount(playerA, 1); + } + + @Test + public void CultivatorDroneColorlessCost() { + // Devoid + // {T}: Add {C} to your mana pool. Spend this mana only to cast a colorless spell, activate an ability of a colorless permanent, or pay a cost that contains {C}. + addCard(Zone.BATTLEFIELD, playerA, "Cultivator Drone", 1); + // Devoid (This card has no color.) + // Flying + // When Gravity Negator attacks, you may pay {C}. If you do, another target creature gains flying until end of turn. ({C} represents colorless mana) + addCard(Zone.BATTLEFIELD, playerA, "Gravity Negator", 1); // 2/3 + + attack(1, playerA, "Gravity Negator"); + + setStopAt(1, PhaseStep.POSTCOMBAT_MAIN); + execute(); + + assertTapped("Gravity Negator", true); + assertAbility(playerA, "Cultivator Drone", FlyingAbility.getInstance(), true); + + assertLife(playerB, 18); + } } diff --git a/Mage/src/main/java/mage/ConditionalMana.java b/Mage/src/main/java/mage/ConditionalMana.java index 46de486981..8583d71e93 100644 --- a/Mage/src/main/java/mage/ConditionalMana.java +++ b/Mage/src/main/java/mage/ConditionalMana.java @@ -1,30 +1,30 @@ /* -* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without modification, are -* permitted provided that the following conditions are met: -* -* 1. Redistributions of source code must retain the above copyright notice, this list of -* conditions and the following disclaimer. -* -* 2. Redistributions in binary form must reproduce the above copyright notice, this list -* of conditions and the following disclaimer in the documentation and/or other materials -* provided with the distribution. -* -* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED -* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND -* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR -* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -* The views and conclusions contained in the software and documentation are those of the -* authors and should not be interpreted as representing official policies, either expressed -* or implied, of BetaSteward_at_googlemail.com. -*/ + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ package mage; import java.io.Serializable; @@ -33,26 +33,27 @@ import java.util.List; import java.util.UUID; import mage.abilities.Ability; import mage.abilities.condition.Condition; +import mage.abilities.costs.Cost; import mage.abilities.mana.conditional.ManaCondition; import mage.constants.ManaType; import mage.filter.Filter; import mage.filter.FilterMana; import mage.game.Game; - /** * @author nantuko */ public class ConditionalMana extends Mana implements Serializable { /** - * Conditions that should be met (all or any depending on comparison scope) to allow spending {@link Mana} mana. + * Conditions that should be met (all or any depending on comparison scope) + * to allow spending {@link Mana} mana. */ private List<Condition> conditions = new ArrayList<>(); /** - * Text displayed as a description for conditional mana. - * Usually includes the conditions that should be met to use this mana. + * Text displayed as a description for conditional mana. Usually includes + * the conditions that should be met to use this mana. */ protected String staticText = "Conditional mana."; @@ -92,13 +93,13 @@ public class ConditionalMana extends Mana implements Serializable { this.scope = scope; } - public boolean apply(Ability ability, Game game, UUID manaProducerId) { + public boolean apply(Ability ability, Game game, UUID manaProducerId, Cost costToPay) { if (conditions.isEmpty()) { throw new IllegalStateException("Conditional mana should contain at least one Condition"); } for (Condition condition : conditions) { - boolean applied = (condition instanceof ManaCondition) ? - ((ManaCondition)condition).apply(game, ability, manaProducerId) : condition.apply(game, ability); + boolean applied = (condition instanceof ManaCondition) + ? ((ManaCondition) condition).apply(game, ability, manaProducerId, costToPay) : condition.apply(game, ability); if (!applied) { // if one condition fails, return false only if All conditions should be met @@ -168,9 +169,9 @@ public class ConditionalMana extends Mana implements Serializable { public void setManaProducerOriginalId(UUID manaProducerOriginalId) { this.manaProducerOriginalId = manaProducerOriginalId; } - + public void clear(ManaType manaType) { - switch(manaType) { + switch (manaType) { case BLACK: black = 0; break; @@ -191,26 +192,31 @@ public class ConditionalMana extends Mana implements Serializable { break; } } - + public void add(ManaType manaType, int amount) { - switch(manaType) { + switch (manaType) { case BLACK: black += amount; break; case BLUE: - blue += amount;; + blue += amount; + ; break; case GREEN: - green += amount;; + green += amount; + ; break; case RED: - red += amount;; + red += amount; + ; break; case WHITE: - white += amount;; + white += amount; + ; break; case COLORLESS: - generic += amount;; + generic += amount; + ; break; } } diff --git a/Mage/src/main/java/mage/abilities/AbilityImpl.java b/Mage/src/main/java/mage/abilities/AbilityImpl.java index 790607c356..cfd9f99555 100644 --- a/Mage/src/main/java/mage/abilities/AbilityImpl.java +++ b/Mage/src/main/java/mage/abilities/AbilityImpl.java @@ -379,7 +379,7 @@ public abstract class AbilityImpl implements Ability { } // this is a hack to prevent mana abilities with mana costs from causing endless loops - pay other costs first - if (this instanceof ManaAbility && !costs.pay(this, game, sourceId, controllerId, noMana)) { + if (this instanceof ManaAbility && !costs.pay(this, game, sourceId, controllerId, noMana, null)) { logger.debug("activate mana ability failed - non mana costs"); return false; } @@ -399,13 +399,13 @@ public abstract class AbilityImpl implements Ability { if (!useAlternativeCost(game)) { // old way still used? //20100716 - 601.2f (noMana is not used here, because mana costs were cleared for this ability before adding additional costs and applying cost modification effects) - if (!manaCostsToPay.pay(this, game, sourceId, activatorId, false)) { + if (!manaCostsToPay.pay(this, game, sourceId, activatorId, false, null)) { return false; // cancel during mana payment } } //20100716 - 601.2g - if (!costs.pay(this, game, sourceId, activatorId, noMana)) { + if (!costs.pay(this, game, sourceId, activatorId, noMana, null)) { logger.debug("activate failed - non mana costs"); return false; } @@ -596,7 +596,7 @@ public abstract class AbilityImpl implements Ability { for (AlternativeCost cost : alternativeCosts) { if (cost.isAvailable(game, this)) { if (game.getPlayer(this.controllerId).chooseUse(Outcome.Neutral, "Use alternative cost " + cost.getName(), this, game)) { - return cost.pay(this, game, sourceId, controllerId, false); + return cost.pay(this, game, sourceId, controllerId, false, null); } } } diff --git a/Mage/src/main/java/mage/abilities/common/GemstoneCavernsAbility.java b/Mage/src/main/java/mage/abilities/common/GemstoneCavernsAbility.java index 47e4057a5f..4dc853d6e1 100644 --- a/Mage/src/main/java/mage/abilities/common/GemstoneCavernsAbility.java +++ b/Mage/src/main/java/mage/abilities/common/GemstoneCavernsAbility.java @@ -93,7 +93,7 @@ class GemstoneCavernsEffect extends OneShotEffect { permanent.addCounters(CounterType.LUCK.createInstance(), game); Cost cost = new ExileFromHandCost(new TargetCardInHand()); if (cost.canPay(source, source.getSourceId(), source.getControllerId(), game)) { - cost.pay(source, game, source.getSourceId(), source.getControllerId(), true); + cost.pay(source, game, source.getSourceId(), source.getControllerId(), true, null); } } } diff --git a/Mage/src/main/java/mage/abilities/common/delayed/PactDelayedTriggeredAbility.java b/Mage/src/main/java/mage/abilities/common/delayed/PactDelayedTriggeredAbility.java index e922c99382..1545aeeda0 100644 --- a/Mage/src/main/java/mage/abilities/common/delayed/PactDelayedTriggeredAbility.java +++ b/Mage/src/main/java/mage/abilities/common/delayed/PactDelayedTriggeredAbility.java @@ -100,7 +100,7 @@ class PactEffect extends OneShotEffect { if (player != null) { if (player.chooseUse(Outcome.Benefit, "Pay " + cost.getText() + "?", source, game)) { cost.clearPaid(); - if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false)){ + if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)){ return true; } } diff --git a/Mage/src/main/java/mage/abilities/costs/CompositeCost.java b/Mage/src/main/java/mage/abilities/costs/CompositeCost.java index 1d497d4379..eed48cebd2 100644 --- a/Mage/src/main/java/mage/abilities/costs/CompositeCost.java +++ b/Mage/src/main/java/mage/abilities/costs/CompositeCost.java @@ -45,7 +45,13 @@ public class CompositeCost implements Cost { @Override public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { - return firstCost.pay(ability, game, sourceId, controllerId, noMana) && secondCost.pay(ability, game, sourceId, controllerId, noMana); + return pay(ability, game, sourceId, controllerId, noMana, this); + } + + @Override + public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { + return firstCost.pay(ability, game, sourceId, controllerId, noMana, costToPay) + && secondCost.pay(ability, game, sourceId, controllerId, noMana, costToPay); } @Override diff --git a/Mage/src/main/java/mage/abilities/costs/Cost.java b/Mage/src/main/java/mage/abilities/costs/Cost.java index 885ff8376f..d7b67ee921 100644 --- a/Mage/src/main/java/mage/abilities/costs/Cost.java +++ b/Mage/src/main/java/mage/abilities/costs/Cost.java @@ -45,6 +45,8 @@ public interface Cost extends Serializable { boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana); + boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay); + boolean isPaid(); void clearPaid(); diff --git a/Mage/src/main/java/mage/abilities/costs/CostImpl.java b/Mage/src/main/java/mage/abilities/costs/CostImpl.java index 57f6c5a747..909de0a541 100644 --- a/Mage/src/main/java/mage/abilities/costs/CostImpl.java +++ b/Mage/src/main/java/mage/abilities/costs/CostImpl.java @@ -28,6 +28,8 @@ package mage.abilities.costs; import java.util.UUID; +import mage.abilities.Ability; +import mage.game.Game; import mage.target.Target; import mage.target.Targets; @@ -51,6 +53,11 @@ public abstract class CostImpl implements Cost { this.targets = cost.targets.copy(); } + @Override + public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { + return pay(ability, game, sourceId, controllerId, noMana, this); + } + @Override public String getText() { return text; diff --git a/Mage/src/main/java/mage/abilities/costs/CostsImpl.java b/Mage/src/main/java/mage/abilities/costs/CostsImpl.java index df64087a37..2d070ac91a 100644 --- a/Mage/src/main/java/mage/abilities/costs/CostsImpl.java +++ b/Mage/src/main/java/mage/abilities/costs/CostsImpl.java @@ -99,10 +99,15 @@ public class CostsImpl<T extends Cost> extends ArrayList<T> implements Costs<T> @Override public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { + return pay(ability, game, sourceId, controllerId, noMana, this); + } + + @Override + public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { if (this.size() > 0) { while (!isPaid()) { T cost = getFirstUnpaid(); - if (!cost.pay(ability, game, sourceId, controllerId, noMana)) { + if (!cost.pay(ability, game, sourceId, controllerId, noMana, costToPay)) { return false; } } diff --git a/Mage/src/main/java/mage/abilities/costs/OrCost.java b/Mage/src/main/java/mage/abilities/costs/OrCost.java index 0707741244..07f26e2430 100644 --- a/Mage/src/main/java/mage/abilities/costs/OrCost.java +++ b/Mage/src/main/java/mage/abilities/costs/OrCost.java @@ -78,6 +78,11 @@ public class OrCost implements Cost { @Override public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { + return pay(ability, game, sourceId, controllerId, noMana, this); + } + + @Override + public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { selectedCost = null; // if only one can be paid select it if (!firstCost.canPay(ability, sourceId, controllerId, game)) { @@ -105,7 +110,7 @@ public class OrCost implements Cost { if (selectedCost == null) { return false; } - return selectedCost.pay(ability, game, sourceId, controllerId, noMana); + return selectedCost.pay(ability, game, sourceId, controllerId, noMana, costToPay); } diff --git a/Mage/src/main/java/mage/abilities/costs/VariableCostImpl.java b/Mage/src/main/java/mage/abilities/costs/VariableCostImpl.java index e1002b91eb..8290bc2d8b 100644 --- a/Mage/src/main/java/mage/abilities/costs/VariableCostImpl.java +++ b/Mage/src/main/java/mage/abilities/costs/VariableCostImpl.java @@ -124,6 +124,11 @@ public abstract class VariableCostImpl implements Cost, VariableCost { return this.id; } + @Override + public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { + return pay(ability, game, sourceId, controllerId, noMana, this); + } + @Override public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { return true; /* not used */ @@ -131,7 +136,7 @@ public abstract class VariableCostImpl implements Cost, VariableCost { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { + public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { return true; /* not used */ } diff --git a/Mage/src/main/java/mage/abilities/costs/common/ControlPermanentCost.java b/Mage/src/main/java/mage/abilities/costs/common/ControlPermanentCost.java index 6f2b4558cc..aca24a9165 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/ControlPermanentCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/ControlPermanentCost.java @@ -6,6 +6,7 @@ import mage.filter.common.FilterControlledPermanent; import mage.game.Game; import java.util.UUID; +import mage.abilities.costs.Cost; public class ControlPermanentCost extends CostImpl { private FilterControlledPermanent filter; @@ -26,7 +27,7 @@ public class ControlPermanentCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { + public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { this.paid = true; return paid; } diff --git a/Mage/src/main/java/mage/abilities/costs/common/DiscardHandCost.java b/Mage/src/main/java/mage/abilities/costs/common/DiscardHandCost.java index e3d533fc75..53943eefa1 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/DiscardHandCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/DiscardHandCost.java @@ -30,6 +30,7 @@ package mage.abilities.costs.common; import java.util.UUID; import mage.abilities.Ability; +import mage.abilities.costs.Cost; import mage.abilities.costs.CostImpl; import mage.cards.Card; import mage.game.Game; @@ -61,7 +62,7 @@ public class DiscardHandCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { + public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { Player player = game.getPlayer(controllerId); if (player != null) { for (Card card : player.getHand().getCards(game)) { diff --git a/Mage/src/main/java/mage/abilities/costs/common/DiscardSourceCost.java b/Mage/src/main/java/mage/abilities/costs/common/DiscardSourceCost.java index 88d1331d14..ecdca74662 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/DiscardSourceCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/DiscardSourceCost.java @@ -30,6 +30,7 @@ package mage.abilities.costs.common; import java.util.UUID; import mage.abilities.Ability; +import mage.abilities.costs.Cost; import mage.abilities.costs.CostImpl; import mage.cards.Card; import mage.game.Game; @@ -53,7 +54,7 @@ public class DiscardSourceCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { + public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { Player player = game.getPlayer(controllerId); if (player != null) { Card card = player.getHand().get(sourceId, game); diff --git a/Mage/src/main/java/mage/abilities/costs/common/DiscardTargetCost.java b/Mage/src/main/java/mage/abilities/costs/common/DiscardTargetCost.java index da38806096..d34f2c49c7 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/DiscardTargetCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/DiscardTargetCost.java @@ -31,6 +31,7 @@ import java.util.ArrayList; import java.util.List; import java.util.UUID; import mage.abilities.Ability; +import mage.abilities.costs.Cost; import mage.abilities.costs.CostImpl; import mage.cards.Card; import mage.constants.Outcome; @@ -64,7 +65,7 @@ public class DiscardTargetCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { + public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { this.cards.clear(); this.targets.clearChosen();; Player player = game.getPlayer(controllerId); diff --git a/Mage/src/main/java/mage/abilities/costs/common/ExileFromGraveCost.java b/Mage/src/main/java/mage/abilities/costs/common/ExileFromGraveCost.java index 7ad275dfa3..6e267bcc56 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/ExileFromGraveCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/ExileFromGraveCost.java @@ -31,6 +31,7 @@ import java.util.ArrayList; import java.util.List; import java.util.UUID; import mage.abilities.Ability; +import mage.abilities.costs.Cost; import mage.abilities.costs.CostImpl; import mage.cards.Card; import mage.cards.Cards; @@ -83,7 +84,7 @@ public class ExileFromGraveCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { + public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { Player controller = game.getPlayer(controllerId); if (controller != null) { if (targets.choose(Outcome.Exile, controllerId, sourceId, game)) { diff --git a/Mage/src/main/java/mage/abilities/costs/common/ExileFromHandCost.java b/Mage/src/main/java/mage/abilities/costs/common/ExileFromHandCost.java index 6f696804f8..c526403739 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/ExileFromHandCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/ExileFromHandCost.java @@ -31,6 +31,7 @@ import java.util.ArrayList; import java.util.List; import java.util.UUID; import mage.abilities.Ability; +import mage.abilities.costs.Cost; import mage.abilities.costs.CostImpl; import mage.abilities.costs.mana.VariableManaCost; import mage.cards.Card; @@ -76,7 +77,7 @@ public class ExileFromHandCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { + public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { if (targets.choose(Outcome.Exile, controllerId, sourceId, game)) { Player player = game.getPlayer(controllerId); int cmc = 0; diff --git a/Mage/src/main/java/mage/abilities/costs/common/ExileFromStackCost.java b/Mage/src/main/java/mage/abilities/costs/common/ExileFromStackCost.java index ec143a97e7..d104ae8545 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/ExileFromStackCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/ExileFromStackCost.java @@ -29,6 +29,7 @@ package mage.abilities.costs.common; import java.util.UUID; import mage.abilities.Ability; +import mage.abilities.costs.Cost; import mage.abilities.costs.CostImpl; import mage.constants.Outcome; import mage.game.Game; @@ -52,7 +53,7 @@ public class ExileFromStackCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { + public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { if (targets.choose(Outcome.Exile, controllerId, sourceId, game)) { Player player = game.getPlayer(controllerId); for (UUID targetId : targets.get(0).getTargets()) { diff --git a/Mage/src/main/java/mage/abilities/costs/common/ExileFromTopOfLibraryCost.java b/Mage/src/main/java/mage/abilities/costs/common/ExileFromTopOfLibraryCost.java index cee479c6fd..9a2a3c5e98 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/ExileFromTopOfLibraryCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/ExileFromTopOfLibraryCost.java @@ -29,6 +29,7 @@ package mage.abilities.costs.common; import java.util.UUID; import mage.abilities.Ability; +import mage.abilities.costs.Cost; import mage.abilities.costs.CostImpl; import mage.constants.Zone; import mage.game.Game; @@ -64,7 +65,7 @@ public class ExileFromTopOfLibraryCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { + public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { Player controller = game.getPlayer(controllerId); if (controller != null) { controller.moveCards(controller.getLibrary().getTopCards(game, amount), Zone.EXILED, ability, game); diff --git a/Mage/src/main/java/mage/abilities/costs/common/ExileOpponentsCardFromExileToGraveyardCost.java b/Mage/src/main/java/mage/abilities/costs/common/ExileOpponentsCardFromExileToGraveyardCost.java index 061767a112..8448c46939 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/ExileOpponentsCardFromExileToGraveyardCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/ExileOpponentsCardFromExileToGraveyardCost.java @@ -7,6 +7,7 @@ package mage.abilities.costs.common; import java.util.UUID; import mage.abilities.Ability; +import mage.abilities.costs.Cost; import mage.abilities.costs.CostImpl; import mage.cards.Card; import mage.constants.Outcome; @@ -38,7 +39,7 @@ public class ExileOpponentsCardFromExileToGraveyardCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { + public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { Player controller = game.getPlayer(controllerId); if (controller != null) { FilterCard filter = new FilterCard(); diff --git a/Mage/src/main/java/mage/abilities/costs/common/ExileSourceCost.java b/Mage/src/main/java/mage/abilities/costs/common/ExileSourceCost.java index 8db34d265d..9afd2fbd7b 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/ExileSourceCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/ExileSourceCost.java @@ -30,6 +30,7 @@ package mage.abilities.costs.common; import java.util.UUID; import mage.MageObject; import mage.abilities.Ability; +import mage.abilities.costs.Cost; import mage.abilities.costs.CostImpl; import mage.cards.Card; import mage.game.Game; @@ -66,7 +67,7 @@ public class ExileSourceCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { + public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { MageObject sourceObject = ability.getSourceObject(game); Player controller = game.getPlayer(controllerId); if (controller != null && sourceObject != null && (sourceObject instanceof Card)) { diff --git a/Mage/src/main/java/mage/abilities/costs/common/ExileSourceFromGraveCost.java b/Mage/src/main/java/mage/abilities/costs/common/ExileSourceFromGraveCost.java index ff72d06726..6432d08ced 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/ExileSourceFromGraveCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/ExileSourceFromGraveCost.java @@ -29,6 +29,7 @@ package mage.abilities.costs.common; import java.util.UUID; import mage.abilities.Ability; +import mage.abilities.costs.Cost; import mage.abilities.costs.CostImpl; import mage.cards.Card; import mage.constants.Zone; @@ -50,7 +51,7 @@ public class ExileSourceFromGraveCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { + public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { Player controller = game.getPlayer(controllerId); if (controller != null) { Card card = game.getCard(sourceId); diff --git a/Mage/src/main/java/mage/abilities/costs/common/ExileTargetCost.java b/Mage/src/main/java/mage/abilities/costs/common/ExileTargetCost.java index f650f47085..073c121112 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/ExileTargetCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/ExileTargetCost.java @@ -32,6 +32,7 @@ import java.util.ArrayList; import java.util.List; import java.util.UUID; import mage.abilities.Ability; +import mage.abilities.costs.Cost; import mage.abilities.costs.CostImpl; import mage.constants.Outcome; import mage.constants.Zone; @@ -64,7 +65,7 @@ public class ExileTargetCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { + public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { if (targets.choose(Outcome.Exile, controllerId, sourceId, game)) { for (UUID targetId: targets.get(0).getTargets()) { Permanent permanent = game.getPermanent(targetId); diff --git a/Mage/src/main/java/mage/abilities/costs/common/ExileTopCardOfGraveyardCost.java b/Mage/src/main/java/mage/abilities/costs/common/ExileTopCardOfGraveyardCost.java index 997753dc72..dfb871086e 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/ExileTopCardOfGraveyardCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/ExileTopCardOfGraveyardCost.java @@ -7,6 +7,7 @@ package mage.abilities.costs.common; import java.util.UUID; import mage.abilities.Ability; +import mage.abilities.costs.Cost; import mage.abilities.costs.CostImpl; import mage.cards.Card; import mage.constants.Zone; @@ -41,7 +42,7 @@ public class ExileTopCardOfGraveyardCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { + public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { Player controller = game.getPlayer(controllerId); if(controller != null) { Card topCard = null; diff --git a/Mage/src/main/java/mage/abilities/costs/common/ExileTopCreatureCardOfGraveyardCost.java b/Mage/src/main/java/mage/abilities/costs/common/ExileTopCreatureCardOfGraveyardCost.java index 00f0b18eef..3781f3e4ed 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/ExileTopCreatureCardOfGraveyardCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/ExileTopCreatureCardOfGraveyardCost.java @@ -7,6 +7,7 @@ package mage.abilities.costs.common; import java.util.UUID; import mage.abilities.Ability; +import mage.abilities.costs.Cost; import mage.abilities.costs.CostImpl; import mage.cards.Card; import mage.constants.CardType; @@ -42,7 +43,7 @@ public class ExileTopCreatureCardOfGraveyardCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { + public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { Player controller = game.getPlayer(controllerId); if(controller != null) { Card topCard = null; diff --git a/Mage/src/main/java/mage/abilities/costs/common/GainLifeOpponentCost.java b/Mage/src/main/java/mage/abilities/costs/common/GainLifeOpponentCost.java index 31e0eaf3ed..69204293dc 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/GainLifeOpponentCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/GainLifeOpponentCost.java @@ -8,6 +8,7 @@ package mage.abilities.costs.common; import java.util.UUID; import mage.abilities.Ability; +import mage.abilities.costs.Cost; import mage.abilities.costs.CostImpl; import mage.constants.Outcome; import mage.constants.TargetController; @@ -59,7 +60,7 @@ public class GainLifeOpponentCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { + public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { Player controller = game.getPlayer(controllerId); if (controller != null) { TargetPlayer target = new TargetPlayer(1, 1, true, filter); diff --git a/Mage/src/main/java/mage/abilities/costs/common/GainLifePlayersCost.java b/Mage/src/main/java/mage/abilities/costs/common/GainLifePlayersCost.java index cc58f40833..825f4f88a4 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/GainLifePlayersCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/GainLifePlayersCost.java @@ -30,6 +30,7 @@ package mage.abilities.costs.common; import java.util.UUID; import mage.abilities.Ability; +import mage.abilities.costs.Cost; import mage.abilities.costs.CostImpl; import mage.game.Game; import mage.players.Player; @@ -71,7 +72,7 @@ public class GainLifePlayersCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { + public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { Player controller = game.getPlayer(controllerId); if (controller != null) { for (UUID playerId: controller.getInRange()) { diff --git a/Mage/src/main/java/mage/abilities/costs/common/PayLifeCost.java b/Mage/src/main/java/mage/abilities/costs/common/PayLifeCost.java index 39c81213d9..cb8eb5238b 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/PayLifeCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/PayLifeCost.java @@ -35,6 +35,7 @@ import mage.abilities.dynamicvalue.common.StaticValue; import mage.game.Game; import java.util.UUID; +import mage.abilities.costs.Cost; /** * @@ -73,7 +74,7 @@ public class PayLifeCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { + public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { int lifeToPayAmount = amount.calculate(game, ability, null); this.paid = game.getPlayer(controllerId).loseLife(lifeToPayAmount, game) == lifeToPayAmount; return paid; diff --git a/Mage/src/main/java/mage/abilities/costs/common/PayLoyaltyCost.java b/Mage/src/main/java/mage/abilities/costs/common/PayLoyaltyCost.java index 16c0c4d959..04e96a416e 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/PayLoyaltyCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/PayLoyaltyCost.java @@ -31,6 +31,7 @@ package mage.abilities.costs.common; import java.util.UUID; import mage.abilities.Ability; +import mage.abilities.costs.Cost; import mage.abilities.costs.CostImpl; import mage.counters.CounterType; import mage.game.Game; @@ -64,7 +65,7 @@ public class PayLoyaltyCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { + public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { Permanent planeswalker = game.getPermanent(sourceId); if (planeswalker.getCounters().getCount(CounterType.LOYALTY) + amount >= 0 && planeswalker.canLoyaltyBeUsed(game)) { if (amount > 0) { diff --git a/Mage/src/main/java/mage/abilities/costs/common/PutCountersSourceCost.java b/Mage/src/main/java/mage/abilities/costs/common/PutCountersSourceCost.java index e715c0d69d..69385fd200 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/PutCountersSourceCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/PutCountersSourceCost.java @@ -30,6 +30,7 @@ package mage.abilities.costs.common; import java.util.UUID; import mage.abilities.Ability; +import mage.abilities.costs.Cost; import mage.abilities.costs.CostImpl; import mage.counters.Counter; import mage.game.Game; @@ -69,7 +70,7 @@ public class PutCountersSourceCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { + public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { Permanent permanent = game.getPermanent(sourceId); if (permanent != null) { permanent.addCounters(counter, game); diff --git a/Mage/src/main/java/mage/abilities/costs/common/PutTopCardOfYourLibraryToGraveyardCost.java b/Mage/src/main/java/mage/abilities/costs/common/PutTopCardOfYourLibraryToGraveyardCost.java index 2b1b4f2859..0e13530634 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/PutTopCardOfYourLibraryToGraveyardCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/PutTopCardOfYourLibraryToGraveyardCost.java @@ -29,6 +29,7 @@ package mage.abilities.costs.common; import java.util.UUID; import mage.abilities.Ability; +import mage.abilities.costs.Cost; import mage.abilities.costs.CostImpl; import mage.constants.Zone; import mage.game.Game; @@ -54,7 +55,7 @@ public class PutTopCardOfYourLibraryToGraveyardCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { + public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { Player player = game.getPlayer(controllerId); if (player != null && player.getLibrary().size() >= numberOfCards) { paid = true; diff --git a/Mage/src/main/java/mage/abilities/costs/common/RemoveCounterCost.java b/Mage/src/main/java/mage/abilities/costs/common/RemoveCounterCost.java index 0167f67807..67a6d3324e 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/RemoveCounterCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/RemoveCounterCost.java @@ -31,6 +31,7 @@ import java.util.HashSet; import java.util.Set; import java.util.UUID; import mage.abilities.Ability; +import mage.abilities.costs.Cost; import mage.abilities.costs.CostImpl; import mage.choices.Choice; import mage.choices.ChoiceImpl; @@ -79,7 +80,7 @@ public class RemoveCounterCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { + public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { paid = false; int countersRemoved = 0; Player controller = game.getPlayer(controllerId); diff --git a/Mage/src/main/java/mage/abilities/costs/common/RemoveCountersSourceCost.java b/Mage/src/main/java/mage/abilities/costs/common/RemoveCountersSourceCost.java index 4e035be625..ebf92959f4 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/RemoveCountersSourceCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/RemoveCountersSourceCost.java @@ -30,6 +30,7 @@ package mage.abilities.costs.common; import java.util.UUID; import mage.abilities.Ability; +import mage.abilities.costs.Cost; import mage.abilities.costs.CostImpl; import mage.counters.Counter; import mage.game.Game; @@ -70,7 +71,7 @@ public class RemoveCountersSourceCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { + public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { Permanent permanent = game.getPermanent(sourceId); if (permanent != null && permanent.getCounters().getCount(name) >= amount) { permanent.removeCounters(name, amount, game); diff --git a/Mage/src/main/java/mage/abilities/costs/common/RemoveVariableCountersTargetCost.java b/Mage/src/main/java/mage/abilities/costs/common/RemoveVariableCountersTargetCost.java index ff9bb65ce6..8608720389 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/RemoveVariableCountersTargetCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/RemoveVariableCountersTargetCost.java @@ -72,7 +72,7 @@ public class RemoveVariableCountersTargetCost extends VariableCostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { + public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { return paid; } diff --git a/Mage/src/main/java/mage/abilities/costs/common/ReturnToHandChosenControlledPermanentCost.java b/Mage/src/main/java/mage/abilities/costs/common/ReturnToHandChosenControlledPermanentCost.java index 2366e9d7df..7045e9dfeb 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/ReturnToHandChosenControlledPermanentCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/ReturnToHandChosenControlledPermanentCost.java @@ -31,6 +31,7 @@ import java.util.HashSet; import java.util.Set; import java.util.UUID; import mage.abilities.Ability; +import mage.abilities.costs.Cost; import mage.abilities.costs.CostImpl; import mage.cards.Card; import mage.constants.Outcome; @@ -61,7 +62,7 @@ public class ReturnToHandChosenControlledPermanentCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { + public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { Player controller = game.getPlayer(controllerId); if (controller != null) { if (targets.choose(Outcome.ReturnToHand, controllerId, sourceId, game)) { diff --git a/Mage/src/main/java/mage/abilities/costs/common/ReturnToHandFromBattlefieldSourceCost.java b/Mage/src/main/java/mage/abilities/costs/common/ReturnToHandFromBattlefieldSourceCost.java index 5f4d4c6396..4ee56c0fbf 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/ReturnToHandFromBattlefieldSourceCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/ReturnToHandFromBattlefieldSourceCost.java @@ -29,6 +29,7 @@ package mage.abilities.costs.common; import java.util.UUID; import mage.abilities.Ability; +import mage.abilities.costs.Cost; import mage.abilities.costs.CostImpl; import mage.constants.Zone; import mage.game.Game; @@ -49,7 +50,7 @@ public class ReturnToHandFromBattlefieldSourceCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { + public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { Permanent permanent = game.getPermanent(sourceId); Player controller = game.getPlayer(controllerId); if (permanent == null || controller == null) { diff --git a/Mage/src/main/java/mage/abilities/costs/common/ReturnToHandFromGraveyardCost.java b/Mage/src/main/java/mage/abilities/costs/common/ReturnToHandFromGraveyardCost.java index e12103dc96..767d60cb32 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/ReturnToHandFromGraveyardCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/ReturnToHandFromGraveyardCost.java @@ -31,6 +31,7 @@ import java.util.LinkedHashSet; import java.util.Set; import java.util.UUID; import mage.abilities.Ability; +import mage.abilities.costs.Cost; import mage.abilities.costs.CostImpl; import mage.cards.Card; import mage.constants.Outcome; @@ -59,7 +60,7 @@ public class ReturnToHandFromGraveyardCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { + public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { Player controller = game.getPlayer(controllerId); if (controller != null) { if (targets.choose(Outcome.ReturnToHand, controllerId, sourceId, game)) { diff --git a/Mage/src/main/java/mage/abilities/costs/common/RevealHandSourceControllerCost.java b/Mage/src/main/java/mage/abilities/costs/common/RevealHandSourceControllerCost.java index 3850e142e2..de88fc1354 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/RevealHandSourceControllerCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/RevealHandSourceControllerCost.java @@ -30,6 +30,7 @@ package mage.abilities.costs.common; import java.util.UUID; import mage.MageObject; import mage.abilities.Ability; +import mage.abilities.costs.Cost; import mage.abilities.costs.CostImpl; import mage.game.Game; import mage.players.Player; @@ -50,7 +51,7 @@ public class RevealHandSourceControllerCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { + public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { Player controller = game.getPlayer(controllerId); MageObject sourceObject = game.getObject(sourceId); if (controller != null && sourceObject != null) { diff --git a/Mage/src/main/java/mage/abilities/costs/common/RevealSourceFromYourHandCost.java b/Mage/src/main/java/mage/abilities/costs/common/RevealSourceFromYourHandCost.java index d48de68a1e..fb6afbbde6 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/RevealSourceFromYourHandCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/RevealSourceFromYourHandCost.java @@ -29,6 +29,7 @@ package mage.abilities.costs.common; import java.util.UUID; import mage.abilities.Ability; +import mage.abilities.costs.Cost; import mage.abilities.costs.CostImpl; import mage.cards.Card; import mage.cards.Cards; @@ -54,7 +55,7 @@ public class RevealSourceFromYourHandCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { + public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { paid = false; Player player = game.getPlayer(controllerId); if (player != null) { diff --git a/Mage/src/main/java/mage/abilities/costs/common/RevealTargetFromHandCost.java b/Mage/src/main/java/mage/abilities/costs/common/RevealTargetFromHandCost.java index a5ef7e33cb..f47c7367b3 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/RevealTargetFromHandCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/RevealTargetFromHandCost.java @@ -33,6 +33,7 @@ import java.util.List; import java.util.UUID; import mage.MageObject; import mage.abilities.Ability; +import mage.abilities.costs.Cost; import mage.abilities.costs.CostImpl; import mage.cards.Card; import mage.cards.Cards; @@ -62,7 +63,7 @@ public class RevealTargetFromHandCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { + public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { if (targets.choose(Outcome.Benefit, controllerId, sourceId, game)) { convertedManaCosts = 0; numberCardsRevealed = 0; diff --git a/Mage/src/main/java/mage/abilities/costs/common/SacrificeAllCost.java b/Mage/src/main/java/mage/abilities/costs/common/SacrificeAllCost.java index be3a652f47..de8595052e 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/SacrificeAllCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/SacrificeAllCost.java @@ -31,6 +31,7 @@ import java.util.ArrayList; import java.util.List; import java.util.UUID; import mage.abilities.Ability; +import mage.abilities.costs.Cost; import mage.abilities.costs.CostImpl; import mage.filter.FilterPermanent; import mage.game.Game; @@ -59,7 +60,7 @@ public class SacrificeAllCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { + public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { for (Permanent permanent : game.getBattlefield().getAllActivePermanents(filter, controllerId, game)) { permanents.add(permanent.copy()); permanent.sacrifice(sourceId, game); diff --git a/Mage/src/main/java/mage/abilities/costs/common/SacrificeSourceCost.java b/Mage/src/main/java/mage/abilities/costs/common/SacrificeSourceCost.java index 7db5a6d0d9..00af162be3 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/SacrificeSourceCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/SacrificeSourceCost.java @@ -1,40 +1,39 @@ /* -* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without modification, are -* permitted provided that the following conditions are met: -* -* 1. Redistributions of source code must retain the above copyright notice, this list of -* conditions and the following disclaimer. -* -* 2. Redistributions in binary form must reproduce the above copyright notice, this list -* of conditions and the following disclaimer in the documentation and/or other materials -* provided with the distribution. -* -* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED -* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND -* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR -* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -* The views and conclusions contained in the software and documentation are those of the -* authors and should not be interpreted as representing official policies, either expressed -* or implied, of BetaSteward_at_googlemail.com. -*/ - + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ package mage.abilities.costs.common; +import java.util.UUID; import mage.abilities.Ability; +import mage.abilities.costs.Cost; import mage.abilities.costs.CostImpl; import mage.game.Game; import mage.game.permanent.Permanent; -import java.util.UUID; - /** * * @author BetaSteward_at_googlemail.com @@ -50,7 +49,7 @@ public class SacrificeSourceCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { + public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { Permanent permanent = game.getPermanent(sourceId); if (permanent != null) { paid = permanent.sacrifice(sourceId, game); diff --git a/Mage/src/main/java/mage/abilities/costs/common/SacrificeTargetCost.java b/Mage/src/main/java/mage/abilities/costs/common/SacrificeTargetCost.java index be90768d5f..19f83fdb68 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/SacrificeTargetCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/SacrificeTargetCost.java @@ -32,6 +32,7 @@ import java.util.List; import java.util.UUID; import mage.abilities.Ability; import mage.abilities.ActivatedAbilityImpl; +import mage.abilities.costs.Cost; import mage.abilities.costs.CostImpl; import mage.constants.AbilityType; import mage.constants.Outcome; @@ -66,7 +67,7 @@ public class SacrificeTargetCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { + public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { UUID activator = controllerId; if (ability.getAbilityType().equals(AbilityType.ACTIVATED) || ability.getAbilityType().equals(AbilityType.SPECIAL_ACTION)) { activator = ((ActivatedAbilityImpl) ability).getActivatorId(); diff --git a/Mage/src/main/java/mage/abilities/costs/common/TapSourceCost.java b/Mage/src/main/java/mage/abilities/costs/common/TapSourceCost.java index 2faab01437..e53a75282b 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/TapSourceCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/TapSourceCost.java @@ -30,6 +30,7 @@ package mage.abilities.costs.common; import java.util.UUID; import mage.abilities.Ability; +import mage.abilities.costs.Cost; import mage.abilities.costs.CostImpl; import mage.constants.AsThoughEffectType; import mage.game.Game; @@ -50,7 +51,7 @@ public class TapSourceCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { + public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { Permanent permanent = game.getPermanent(sourceId); if (permanent != null) { paid = permanent.tap(game); diff --git a/Mage/src/main/java/mage/abilities/costs/common/TapTargetCost.java b/Mage/src/main/java/mage/abilities/costs/common/TapTargetCost.java index 8f448eaa09..38d2c5c420 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/TapTargetCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/TapTargetCost.java @@ -30,6 +30,7 @@ package mage.abilities.costs.common; import java.util.List; import java.util.UUID; import mage.abilities.Ability; +import mage.abilities.costs.Cost; import mage.abilities.costs.CostImpl; import mage.constants.Outcome; import mage.game.Game; @@ -61,7 +62,7 @@ public class TapTargetCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { + public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { if (target.choose(Outcome.Tap, controllerId, sourceId, game)) { for (UUID targetId : (List<UUID>) target.getTargets()) { Permanent permanent = game.getPermanent(targetId); diff --git a/Mage/src/main/java/mage/abilities/costs/common/UntapSourceCost.java b/Mage/src/main/java/mage/abilities/costs/common/UntapSourceCost.java index 8c28bce5b5..506de1be8f 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/UntapSourceCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/UntapSourceCost.java @@ -29,6 +29,7 @@ package mage.abilities.costs.common; import java.util.UUID; import mage.abilities.Ability; +import mage.abilities.costs.Cost; import mage.abilities.costs.CostImpl; import mage.game.Game; import mage.game.permanent.Permanent; @@ -48,7 +49,7 @@ public class UntapSourceCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { + public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { Permanent permanent = game.getPermanent(sourceId); if (permanent != null) { paid = permanent.untap(game); diff --git a/Mage/src/main/java/mage/abilities/costs/common/UntapTargetCost.java b/Mage/src/main/java/mage/abilities/costs/common/UntapTargetCost.java index 89dc66c2b2..50fae7bf7f 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/UntapTargetCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/UntapTargetCost.java @@ -37,6 +37,7 @@ import mage.target.common.TargetControlledPermanent; import java.util.List; import java.util.UUID; +import mage.abilities.costs.Cost; /** * @@ -57,7 +58,7 @@ public class UntapTargetCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { + public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { if (target.choose(Outcome.Untap, controllerId, sourceId, game)) { for (UUID targetId: (List<UUID>)target.getTargets()) { Permanent permanent = game.getPermanent(targetId); diff --git a/Mage/src/main/java/mage/abilities/costs/mana/ColoredManaCost.java b/Mage/src/main/java/mage/abilities/costs/mana/ColoredManaCost.java index 2ab6f139f2..1bec6f7149 100644 --- a/Mage/src/main/java/mage/abilities/costs/mana/ColoredManaCost.java +++ b/Mage/src/main/java/mage/abilities/costs/mana/ColoredManaCost.java @@ -1,35 +1,35 @@ /* -* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without modification, are -* permitted provided that the following conditions are met: -* -* 1. Redistributions of source code must retain the above copyright notice, this list of -* conditions and the following disclaimer. -* -* 2. Redistributions in binary form must reproduce the above copyright notice, this list -* of conditions and the following disclaimer in the documentation and/or other materials -* provided with the distribution. -* -* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED -* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND -* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR -* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -* The views and conclusions contained in the software and documentation are those of the -* authors and should not be interpreted as representing official policies, either expressed -* or implied, of BetaSteward_at_googlemail.com. -*/ - + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ package mage.abilities.costs.mana; import mage.Mana; import mage.abilities.Ability; +import mage.abilities.costs.Cost; import mage.constants.ColoredManaSymbol; import mage.game.Game; import mage.players.ManaPool; @@ -63,8 +63,8 @@ public class ColoredManaCost extends ManaCostImpl { } @Override - public void assignPayment(Game game, Ability ability, ManaPool pool) { - this.assignColored(ability, game, pool, mana); + public void assignPayment(Game game, Ability ability, ManaPool pool, Cost costToPay) { + this.assignColored(ability, game, pool, mana, costToPay); } @Override @@ -106,5 +106,5 @@ public class ColoredManaCost extends ManaCostImpl { public boolean containsColor(ColoredManaSymbol coloredManaSymbol) { return mana.equals(coloredManaSymbol); } - + } diff --git a/Mage/src/main/java/mage/abilities/costs/mana/ColorlessManaCost.java b/Mage/src/main/java/mage/abilities/costs/mana/ColorlessManaCost.java index 9fe8f15410..268df2c164 100644 --- a/Mage/src/main/java/mage/abilities/costs/mana/ColorlessManaCost.java +++ b/Mage/src/main/java/mage/abilities/costs/mana/ColorlessManaCost.java @@ -29,6 +29,7 @@ package mage.abilities.costs.mana; import mage.Mana; import mage.abilities.Ability; +import mage.abilities.costs.Cost; import mage.constants.ColoredManaSymbol; import mage.game.Game; import mage.players.ManaPool; @@ -70,8 +71,8 @@ public class ColorlessManaCost extends ManaCostImpl { } @Override - public void assignPayment(Game game, Ability ability, ManaPool pool) { - this.assignColorless(ability, game, pool, mana); + public void assignPayment(Game game, Ability ability, ManaPool pool, Cost costToPay) { + this.assignColorless(ability, game, pool, mana, costToPay); } @Override diff --git a/Mage/src/main/java/mage/abilities/costs/mana/GenericManaCost.java b/Mage/src/main/java/mage/abilities/costs/mana/GenericManaCost.java index d432ccd4f0..e31a2780e0 100644 --- a/Mage/src/main/java/mage/abilities/costs/mana/GenericManaCost.java +++ b/Mage/src/main/java/mage/abilities/costs/mana/GenericManaCost.java @@ -1,35 +1,35 @@ /* -* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without modification, are -* permitted provided that the following conditions are met: -* -* 1. Redistributions of source code must retain the above copyright notice, this list of -* conditions and the following disclaimer. -* -* 2. Redistributions in binary form must reproduce the above copyright notice, this list -* of conditions and the following disclaimer in the documentation and/or other materials -* provided with the distribution. -* -* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED -* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND -* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR -* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -* The views and conclusions contained in the software and documentation are those of the -* authors and should not be interpreted as representing official policies, either expressed -* or implied, of BetaSteward_at_googlemail.com. -*/ - + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ package mage.abilities.costs.mana; import mage.Mana; import mage.abilities.Ability; +import mage.abilities.costs.Cost; import mage.constants.ColoredManaSymbol; import mage.game.Game; import mage.players.ManaPool; @@ -67,8 +67,8 @@ public class GenericManaCost extends ManaCostImpl { } @Override - public void assignPayment(Game game, Ability ability, ManaPool pool) { - this.assignColorless(ability, game, pool, mana); + public void assignPayment(Game game, Ability ability, ManaPool pool, Cost costsToPay) { + this.assignColorless(ability, game, pool, mana, costsToPay); } @Override @@ -94,6 +94,7 @@ public class GenericManaCost extends ManaCostImpl { public GenericManaCost copy() { return new GenericManaCost(this); } + @Override public boolean containsColor(ColoredManaSymbol coloredManaSymbol) { return false; diff --git a/Mage/src/main/java/mage/abilities/costs/mana/HybridManaCost.java b/Mage/src/main/java/mage/abilities/costs/mana/HybridManaCost.java index b8f9cdedb9..7c8f29ce6b 100644 --- a/Mage/src/main/java/mage/abilities/costs/mana/HybridManaCost.java +++ b/Mage/src/main/java/mage/abilities/costs/mana/HybridManaCost.java @@ -31,6 +31,7 @@ import java.util.ArrayList; import java.util.List; import mage.Mana; import mage.abilities.Ability; +import mage.abilities.costs.Cost; import mage.constants.ColoredManaSymbol; import mage.game.Game; import mage.players.ManaPool; @@ -66,11 +67,11 @@ public class HybridManaCost extends ManaCostImpl { } @Override - public void assignPayment(Game game, Ability ability, ManaPool pool) { - if (assignColored(ability, game, pool, this.mana1)) { + public void assignPayment(Game game, Ability ability, ManaPool pool, Cost costToPay) { + if (assignColored(ability, game, pool, this.mana1, costToPay)) { return; } - assignColored(ability, game, pool, this.mana2); + assignColored(ability, game, pool, this.mana2, costToPay); } @Override diff --git a/Mage/src/main/java/mage/abilities/costs/mana/ManaCost.java b/Mage/src/main/java/mage/abilities/costs/mana/ManaCost.java index b1616aaa57..be6109e9b9 100644 --- a/Mage/src/main/java/mage/abilities/costs/mana/ManaCost.java +++ b/Mage/src/main/java/mage/abilities/costs/mana/ManaCost.java @@ -47,7 +47,7 @@ public interface ManaCost extends Cost { Mana getPayment(); - void assignPayment(Game game, Ability ability, ManaPool pool); + void assignPayment(Game game, Ability ability, ManaPool pool, Cost costsToPay); void setPayment(Mana mana); 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 c87f2c0be5..9946a009b2 100644 --- a/Mage/src/main/java/mage/abilities/costs/mana/ManaCostImpl.java +++ b/Mage/src/main/java/mage/abilities/costs/mana/ManaCostImpl.java @@ -32,6 +32,7 @@ import java.util.List; import java.util.UUID; import mage.Mana; import mage.abilities.Ability; +import mage.abilities.costs.Cost; import mage.abilities.costs.CostImpl; import mage.abilities.mana.ManaOptions; import mage.constants.ColoredManaSymbol; @@ -113,35 +114,35 @@ public abstract class ManaCostImpl extends CostImpl implements ManaCost { this.sourceFilter = filter; } - protected boolean assignColored(Ability ability, Game game, ManaPool pool, ColoredManaSymbol mana) { + 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)) { + if (pool.pay(ManaType.BLACK, ability, sourceFilter, game, costToPay)) { this.payment.increaseBlack(); return true; } break; case U: - if (pool.pay(ManaType.BLUE, ability, sourceFilter, game)) { + if (pool.pay(ManaType.BLUE, ability, sourceFilter, game, costToPay)) { this.payment.increaseBlue(); return true; } break; case W: - if (pool.pay(ManaType.WHITE, ability, sourceFilter, game)) { + if (pool.pay(ManaType.WHITE, ability, sourceFilter, game, costToPay)) { this.payment.increaseWhite(); return true; } break; case G: - if (pool.pay(ManaType.GREEN, ability, sourceFilter, game)) { + if (pool.pay(ManaType.GREEN, ability, sourceFilter, game, costToPay)) { this.payment.increaseGreen(); return true; } break; case R: - if (pool.pay(ManaType.RED, ability, sourceFilter, game)) { + if (pool.pay(ManaType.RED, ability, sourceFilter, game, costToPay)) { this.payment.increaseRed(); return true; } @@ -150,30 +151,30 @@ public abstract class ManaCostImpl extends CostImpl implements ManaCost { return false; } - protected boolean assignColorless(Ability ability, Game game, ManaPool pool, int mana) { - int conditionalCount = pool.getConditionalCount(ability, game, null); + protected boolean assignColorless(Ability ability, Game game, ManaPool pool, int mana, Cost costToPay) { + 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)) { + if (pool.pay(ManaType.COLORLESS, ability, sourceFilter, game, costToPay)) { this.payment.increaseColorless(); continue; } - if (pool.pay(ManaType.BLACK, ability, sourceFilter, game)) { + if (pool.pay(ManaType.BLACK, ability, sourceFilter, game, costToPay)) { this.payment.increaseBlack(); continue; } - if (pool.pay(ManaType.BLUE, ability, sourceFilter, game)) { + if (pool.pay(ManaType.BLUE, ability, sourceFilter, game, costToPay)) { this.payment.increaseBlue(); continue; } - if (pool.pay(ManaType.WHITE, ability, sourceFilter, game)) { + if (pool.pay(ManaType.WHITE, ability, sourceFilter, game, costToPay)) { this.payment.increaseWhite(); continue; } - if (pool.pay(ManaType.GREEN, ability, sourceFilter, game)) { + if (pool.pay(ManaType.GREEN, ability, sourceFilter, game, costToPay)) { this.payment.increaseGreen(); continue; } - if (pool.pay(ManaType.RED, ability, sourceFilter, game)) { + if (pool.pay(ManaType.RED, ability, sourceFilter, game, costToPay)) { this.payment.increaseRed(); continue; } @@ -208,19 +209,19 @@ public abstract class ManaCostImpl extends CostImpl implements ManaCost { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { + public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { if (noMana) { setPaid(); return true; } Player player = game.getPlayer(controllerId); - assignPayment(game, ability, player.getManaPool()); + assignPayment(game, ability, player.getManaPool(), costToPay); game.getState().getSpecialActions().removeManaActions(); while (!isPaid()) { ManaCost unpaid = this.getUnpaid(); String promptText = ManaUtil.addSpecialManaPayAbilities(ability, game, unpaid); if (player.playMana(ability, unpaid, promptText, game)) { - assignPayment(game, ability, player.getManaPool()); + assignPayment(game, ability, player.getManaPool(), costToPay); } else { return false; } diff --git a/Mage/src/main/java/mage/abilities/costs/mana/ManaCostsImpl.java b/Mage/src/main/java/mage/abilities/costs/mana/ManaCostsImpl.java index 413bcbbc3e..0de107d2e3 100644 --- a/Mage/src/main/java/mage/abilities/costs/mana/ManaCostsImpl.java +++ b/Mage/src/main/java/mage/abilities/costs/mana/ManaCostsImpl.java @@ -34,6 +34,7 @@ import java.util.Map; import java.util.UUID; import mage.Mana; import mage.abilities.Ability; +import mage.abilities.costs.Cost; import mage.abilities.costs.VariableCost; import mage.abilities.mana.ManaOptions; import mage.constants.ColoredManaSymbol; @@ -121,19 +122,24 @@ public class ManaCostsImpl<T extends ManaCost> extends ArrayList<T> implements M @Override public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { + return pay(ability, game, sourceId, controllerId, noMana, this); + } + + @Override + public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { if (this.size() == 0 || noMana) { setPaid(); return true; } Player player = game.getPlayer(controllerId); - assignPayment(game, ability, player.getManaPool()); + assignPayment(game, ability, player.getManaPool(), this); game.getState().getSpecialActions().removeManaActions(); while (!isPaid()) { ManaCost unpaid = this.getUnpaid(); String promptText = ManaUtil.addSpecialManaPayAbilities(ability, game, unpaid); if (player.playMana(ability, unpaid, promptText, game)) { - assignPayment(game, ability, player.getManaPool()); + assignPayment(game, ability, player.getManaPool(), this); } else { return false; } @@ -155,7 +161,7 @@ public class ManaCostsImpl<T extends ManaCost> extends ArrayList<T> implements M @Override public boolean payOrRollback(Ability ability, Game game, UUID sourceId, UUID payingPlayerId) { int bookmark = game.bookmarkState(); - if (pay(ability, game, sourceId, payingPlayerId, false)) { + if (pay(ability, game, sourceId, payingPlayerId, false, null)) { game.removeBookmark(bookmark); return true; } @@ -219,7 +225,7 @@ public class ManaCostsImpl<T extends ManaCost> extends ArrayList<T> implements M } @Override - public void assignPayment(Game game, Ability ability, ManaPool pool) { + public void assignPayment(Game game, Ability ability, ManaPool pool, Cost costToPay) { if (!pool.isAutoPayment() && pool.getUnlockedManaType() == null) { // if auto payment is inactive and no mana type was clicked manually - do nothing return; @@ -227,7 +233,7 @@ public class ManaCostsImpl<T extends ManaCost> extends ArrayList<T> implements M // attempt to pay colorless costs (not generic) mana costs first for (ManaCost cost : this) { if (!cost.isPaid() && cost instanceof ColorlessManaCost) { - cost.assignPayment(game, ability, pool); + cost.assignPayment(game, ability, pool, costToPay); if (pool.count() == 0) { return; } @@ -236,7 +242,7 @@ public class ManaCostsImpl<T extends ManaCost> extends ArrayList<T> implements M //attempt to pay colored costs first for (ManaCost cost : this) { if (!cost.isPaid() && cost instanceof ColoredManaCost) { - cost.assignPayment(game, ability, pool); + cost.assignPayment(game, ability, pool, costToPay); if (pool.count() == 0) { return; } @@ -245,7 +251,7 @@ public class ManaCostsImpl<T extends ManaCost> extends ArrayList<T> implements M for (ManaCost cost : this) { if (!cost.isPaid() && cost instanceof HybridManaCost) { - cost.assignPayment(game, ability, pool); + cost.assignPayment(game, ability, pool, costToPay); if (pool.count() == 0) { return; } @@ -261,7 +267,7 @@ public class ManaCostsImpl<T extends ManaCost> extends ArrayList<T> implements M || ((((MonoHybridManaCost) cost).containsColor(ColoredManaSymbol.R)) && pool.getRed() > 0) || ((((MonoHybridManaCost) cost).containsColor(ColoredManaSymbol.G)) && pool.getGreen() > 0) || ((((MonoHybridManaCost) cost).containsColor(ColoredManaSymbol.U)) && pool.getBlue() > 0)) { - cost.assignPayment(game, ability, pool); + cost.assignPayment(game, ability, pool, costToPay); if (pool.count() == 0) { return; } @@ -271,7 +277,7 @@ public class ManaCostsImpl<T extends ManaCost> extends ArrayList<T> implements M // if colored didn't fit pay colorless with the mana for (ManaCost cost : this) { if (!cost.isPaid() && cost instanceof MonoHybridManaCost) { - cost.assignPayment(game, ability, pool); + cost.assignPayment(game, ability, pool, costToPay); if (pool.count() == 0) { return; } @@ -280,7 +286,7 @@ public class ManaCostsImpl<T extends ManaCost> extends ArrayList<T> implements M for (ManaCost cost : this) { if (!cost.isPaid() && cost instanceof SnowManaCost) { - cost.assignPayment(game, ability, pool); + cost.assignPayment(game, ability, pool, costToPay); if (pool.count() == 0) { return; } @@ -289,7 +295,7 @@ public class ManaCostsImpl<T extends ManaCost> extends ArrayList<T> implements M for (ManaCost cost : this) { if (!cost.isPaid() && cost instanceof GenericManaCost) { - cost.assignPayment(game, ability, pool); + cost.assignPayment(game, ability, pool, costToPay); if (pool.count() == 0) { return; } @@ -298,7 +304,7 @@ public class ManaCostsImpl<T extends ManaCost> extends ArrayList<T> implements M for (ManaCost cost : this) { if (!cost.isPaid() && cost instanceof VariableManaCost) { - cost.assignPayment(game, ability, pool); + cost.assignPayment(game, ability, pool, costToPay); } } // stop using mana of the clicked mana type diff --git a/Mage/src/main/java/mage/abilities/costs/mana/MonoHybridManaCost.java b/Mage/src/main/java/mage/abilities/costs/mana/MonoHybridManaCost.java index f30b37745c..edb39235e1 100644 --- a/Mage/src/main/java/mage/abilities/costs/mana/MonoHybridManaCost.java +++ b/Mage/src/main/java/mage/abilities/costs/mana/MonoHybridManaCost.java @@ -31,6 +31,7 @@ import java.util.ArrayList; import java.util.List; import mage.Mana; import mage.abilities.Ability; +import mage.abilities.costs.Cost; import mage.constants.ColoredManaSymbol; import mage.game.Game; import mage.players.ManaPool; @@ -68,9 +69,9 @@ public class MonoHybridManaCost extends ManaCostImpl { } @Override - public void assignPayment(Game game, Ability ability, ManaPool pool) { - if (!assignColored(ability, game, pool, mana)) { - assignColorless(ability, game, pool, mana2); + public void assignPayment(Game game, Ability ability, ManaPool pool, Cost costToPay) { + if (!assignColored(ability, game, pool, mana, costToPay)) { + assignColorless(ability, game, pool, mana2, costToPay); } } diff --git a/Mage/src/main/java/mage/abilities/costs/mana/PhyrexianManaCost.java b/Mage/src/main/java/mage/abilities/costs/mana/PhyrexianManaCost.java index 2ee8022b8f..4ba907801d 100644 --- a/Mage/src/main/java/mage/abilities/costs/mana/PhyrexianManaCost.java +++ b/Mage/src/main/java/mage/abilities/costs/mana/PhyrexianManaCost.java @@ -1,44 +1,42 @@ /* -* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without modification, are -* permitted provided that the following conditions are met: -* -* 1. Redistributions of source code must retain the above copyright notice, this list of -* conditions and the following disclaimer. -* -* 2. Redistributions in binary form must reproduce the above copyright notice, this list -* of conditions and the following disclaimer in the documentation and/or other materials -* provided with the distribution. -* -* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED -* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND -* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR -* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -* The views and conclusions contained in the software and documentation are those of the -* authors and should not be interpreted as representing official policies, either expressed -* or implied, of BetaSteward_at_googlemail.com. -*/ - + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ package mage.abilities.costs.mana; import java.util.UUID; -import mage.constants.ColoredManaSymbol; import mage.Mana; import mage.abilities.Ability; +import mage.abilities.costs.Cost; +import mage.constants.ColoredManaSymbol; import mage.game.Game; import mage.players.ManaPool; - - /** - * + * * @author nantuko */ public class PhyrexianManaCost extends ColoredManaCost { @@ -53,8 +51,8 @@ public class PhyrexianManaCost extends ColoredManaCost { } @Override - public void assignPayment(Game game, Ability ability, ManaPool pool) { - assignColored(ability, game, pool, this.mana); + public void assignPayment(Game game, Ability ability, ManaPool pool, Cost costToPay) { + assignColored(ability, game, pool, this.mana, costToPay); } @Override @@ -76,7 +74,7 @@ public class PhyrexianManaCost extends ColoredManaCost { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { + public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { this.paid = game.getPlayer(controllerId).loseLife(2, game) == 2; return paid; } diff --git a/Mage/src/main/java/mage/abilities/costs/mana/SnowManaCost.java b/Mage/src/main/java/mage/abilities/costs/mana/SnowManaCost.java index d55489492c..52383c43fa 100644 --- a/Mage/src/main/java/mage/abilities/costs/mana/SnowManaCost.java +++ b/Mage/src/main/java/mage/abilities/costs/mana/SnowManaCost.java @@ -1,35 +1,35 @@ /* -* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without modification, are -* permitted provided that the following conditions are met: -* -* 1. Redistributions of source code must retain the above copyright notice, this list of -* conditions and the following disclaimer. -* -* 2. Redistributions in binary form must reproduce the above copyright notice, this list -* of conditions and the following disclaimer in the documentation and/or other materials -* provided with the distribution. -* -* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED -* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND -* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR -* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -* The views and conclusions contained in the software and documentation are those of the -* authors and should not be interpreted as representing official policies, either expressed -* or implied, of BetaSteward_at_googlemail.com. -*/ - + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ package mage.abilities.costs.mana; import mage.Mana; import mage.abilities.Ability; +import mage.abilities.costs.Cost; import mage.constants.ColoredManaSymbol; import mage.filter.FilterObject; import mage.filter.predicate.mageobject.SupertypePredicate; @@ -39,7 +39,8 @@ import mage.players.ManaPool; public class SnowManaCost extends ManaCostImpl { private static final FilterObject filter = new FilterObject("Snow object"); - static{ + + static { filter.add(new SupertypePredicate("Snow")); } @@ -59,10 +60,10 @@ public class SnowManaCost extends ManaCostImpl { } @Override - public void assignPayment(Game game, Ability ability, ManaPool pool) { - this.assignColorless(ability, game, pool, 1); + public void assignPayment(Game game, Ability ability, ManaPool pool, Cost costToPay) { + this.assignColorless(ability, game, pool, 1, costToPay); } - + @Override public boolean isPaid() { if (paid) { @@ -90,6 +91,7 @@ public class SnowManaCost extends ManaCostImpl { public SnowManaCost copy() { return new SnowManaCost(this); } + @Override public boolean containsColor(ColoredManaSymbol coloredManaSymbol) { return false; diff --git a/Mage/src/main/java/mage/abilities/costs/mana/VariableManaCost.java b/Mage/src/main/java/mage/abilities/costs/mana/VariableManaCost.java index 43311115e4..fb7c27268b 100644 --- a/Mage/src/main/java/mage/abilities/costs/mana/VariableManaCost.java +++ b/Mage/src/main/java/mage/abilities/costs/mana/VariableManaCost.java @@ -1,31 +1,30 @@ /* -* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without modification, are -* permitted provided that the following conditions are met: -* -* 1. Redistributions of source code must retain the above copyright notice, this list of -* conditions and the following disclaimer. -* -* 2. Redistributions in binary form must reproduce the above copyright notice, this list -* of conditions and the following disclaimer in the documentation and/or other materials -* provided with the distribution. -* -* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED -* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND -* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR -* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -* The views and conclusions contained in the software and documentation are those of the -* authors and should not be interpreted as representing official policies, either expressed -* or implied, of BetaSteward_at_googlemail.com. -*/ - + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ package mage.abilities.costs.mana; import mage.Mana; @@ -74,7 +73,7 @@ public class VariableManaCost extends ManaCostImpl implements VariableCost { } @Override - public void assignPayment(Game game, Ability ability, ManaPool pool) { + public void assignPayment(Game game, Ability ability, ManaPool pool, Cost costToPay) { payment.add(pool.getMana(filter)); payment.add(pool.getAllConditionalMana(ability, game, filter)); pool.payX(ability, game, filter); @@ -88,8 +87,7 @@ public class VariableManaCost extends ManaCostImpl implements VariableCost { symbol += "{X}"; } return symbol; - } - else { + } else { return "{X}"; } } @@ -120,11 +118,11 @@ public class VariableManaCost extends ManaCostImpl implements VariableCost { } public int getMultiplier() { - return multiplier; + return multiplier; } public int getMinX() { - return minX; + return minX; } public void setMinX(int minX) { diff --git a/Mage/src/main/java/mage/abilities/effects/PayCostToAttackBlockEffectImpl.java b/Mage/src/main/java/mage/abilities/effects/PayCostToAttackBlockEffectImpl.java index d31b8e71cf..304a9c36af 100644 --- a/Mage/src/main/java/mage/abilities/effects/PayCostToAttackBlockEffectImpl.java +++ b/Mage/src/main/java/mage/abilities/effects/PayCostToAttackBlockEffectImpl.java @@ -159,7 +159,7 @@ public abstract class PayCostToAttackBlockEffectImpl extends ReplacementEffectIm if (attackBlockOtherTax.canPay(source, source.getSourceId(), event.getPlayerId(), game) && player.chooseUse(Outcome.Neutral, attackBlockOtherTax.getText() + " to " + (event.getType().equals(EventType.DECLARE_ATTACKER) ? "attack?" : "block?"), source, game)) { - if (attackBlockOtherTax.pay(source, game, source.getSourceId(), event.getPlayerId(), false)) { + if (attackBlockOtherTax.pay(source, game, source.getSourceId(), event.getPlayerId(), false, null)) { return false; } } diff --git a/Mage/src/main/java/mage/abilities/effects/common/CounterUnlessPaysEffect.java b/Mage/src/main/java/mage/abilities/effects/common/CounterUnlessPaysEffect.java index 585d8a8118..ef7ea34b3d 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/CounterUnlessPaysEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/CounterUnlessPaysEffect.java @@ -93,7 +93,7 @@ public class CounterUnlessPaysEffect extends OneShotEffect { message = costToPay.getText() + " to prevent counter effect?"; } costToPay.clearPaid(); - if (!(player.chooseUse(Outcome.Benefit, message, source, game) && costToPay.pay(source, game, spell.getSourceId(), spell.getControllerId(), false))) { + if (!(player.chooseUse(Outcome.Benefit, message, source, game) && costToPay.pay(source, game, spell.getSourceId(), spell.getControllerId(), false, null))) { return game.getStack().counter(spell.getId(), source.getSourceId(), game); } return true; diff --git a/Mage/src/main/java/mage/abilities/effects/common/DoUnlessAnyPlayerPaysEffect.java b/Mage/src/main/java/mage/abilities/effects/common/DoUnlessAnyPlayerPaysEffect.java index c7e8ab933d..5062f78563 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/DoUnlessAnyPlayerPaysEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/DoUnlessAnyPlayerPaysEffect.java @@ -93,7 +93,7 @@ public class DoUnlessAnyPlayerPaysEffect extends OneShotEffect { Player player = game.getPlayer(playerId); if (player != null && cost.canPay(source, source.getSourceId(), player.getId(), game) && player.chooseUse(Outcome.Detriment, message, source, game)) { cost.clearPaid(); - if (cost.pay(source, game, source.getSourceId(), player.getId(), false)) { + if (cost.pay(source, game, source.getSourceId(), player.getId(), false, null)) { if (!game.isSimulation()) game.informPlayers(player.getLogName() + " pays the cost to prevent the effect"); doEffect = false; diff --git a/Mage/src/main/java/mage/abilities/effects/common/EnterBattlefieldPayCostOrPutGraveyardEffect.java b/Mage/src/main/java/mage/abilities/effects/common/EnterBattlefieldPayCostOrPutGraveyardEffect.java index e4b3e48131..5a49099c7d 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/EnterBattlefieldPayCostOrPutGraveyardEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/EnterBattlefieldPayCostOrPutGraveyardEffect.java @@ -78,7 +78,7 @@ public class EnterBattlefieldPayCostOrPutGraveyardEffect extends ReplacementEffe if (cost.canPay(source, source.getSourceId(), player.getId(), game)) { if (player.chooseUse(outcome, cost.getText() + "? (otherwise " + sourceObject.getLogName() + " is put into graveyard)", source, game)) { cost.clearPaid(); - replace = !cost.pay(source, game, source.getSourceId(), source.getControllerId(), false); + replace = !cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null); } } if (replace) { diff --git a/Mage/src/main/java/mage/abilities/effects/common/ExileSourceUnlessPaysEffect.java b/Mage/src/main/java/mage/abilities/effects/common/ExileSourceUnlessPaysEffect.java index 489de50c10..f6043e913f 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/ExileSourceUnlessPaysEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/ExileSourceUnlessPaysEffect.java @@ -68,7 +68,7 @@ public class ExileSourceUnlessPaysEffect extends OneShotEffect { message = Character.toUpperCase(message.charAt(0)) + message.substring(1); if (controller.chooseUse(Outcome.Benefit, message, source, game)) { cost.clearPaid(); - if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false)) { + if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) { return true; } } diff --git a/Mage/src/main/java/mage/abilities/effects/common/SacrificeSourceUnlessPaysEffect.java b/Mage/src/main/java/mage/abilities/effects/common/SacrificeSourceUnlessPaysEffect.java index f090427190..33e0f0b7a2 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/SacrificeSourceUnlessPaysEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/SacrificeSourceUnlessPaysEffect.java @@ -40,7 +40,7 @@ public class SacrificeSourceUnlessPaysEffect extends OneShotEffect { message = Character.toUpperCase(message.charAt(0)) + message.substring(1); if (player.chooseUse(Outcome.Benefit, message, source, game)) { cost.clearPaid(); - if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false)) { + if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) { return true; } } diff --git a/Mage/src/main/java/mage/abilities/effects/common/TapSourceUnlessPaysEffect.java b/Mage/src/main/java/mage/abilities/effects/common/TapSourceUnlessPaysEffect.java index 15fbc93dbf..ddc099db09 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/TapSourceUnlessPaysEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/TapSourceUnlessPaysEffect.java @@ -66,7 +66,7 @@ public class TapSourceUnlessPaysEffect extends OneShotEffect { if (cost.canPay(source, source.getSourceId(), source.getControllerId(), game) && player.chooseUse(Outcome.Benefit, cost.getText() + "? (otherwise " + permanent.getName() + " becomes tapped)", source, game)) { cost.clearPaid(); - if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false)) { + if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) { return true; } } diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/UntapSourceDuringEachOtherPlayersUntapStepEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/UntapSourceDuringEachOtherPlayersUntapStepEffect.java index 9cb410a024..4d7010102b 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/UntapSourceDuringEachOtherPlayersUntapStepEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/UntapSourceDuringEachOtherPlayersUntapStepEffect.java @@ -65,7 +65,9 @@ public class UntapSourceDuringEachOtherPlayersUntapStepEffect extends Continuous applied = Boolean.FALSE; } if (!applied && layer.equals(Layer.RulesEffects)) { - if (!source.getControllerId().equals(game.getActivePlayerId()) && game.getStep().getType() == PhaseStep.UNTAP) { + if (!source.getControllerId().equals(game.getActivePlayerId()) + && game.getStep() != null + && game.getStep().getType() == PhaseStep.UNTAP) { game.getState().setValue(source.getSourceId() + "applied", true); Permanent permanent = (Permanent) game.getPermanent(source.getSourceId()); if (permanent != null) { @@ -79,7 +81,7 @@ public class UntapSourceDuringEachOtherPlayersUntapStepEffect extends Continuous } } } else if (applied && layer.equals(Layer.RulesEffects)) { - if (game.getStep().getType() == PhaseStep.END_TURN) { + if (game.getStep() != null && game.getStep().getType() == PhaseStep.END_TURN) { game.getState().setValue(source.getSourceId() + "applied", false); } } diff --git a/Mage/src/main/java/mage/abilities/keyword/ChampionAbility.java b/Mage/src/main/java/mage/abilities/keyword/ChampionAbility.java index 568a1ef946..21becfa550 100644 --- a/Mage/src/main/java/mage/abilities/keyword/ChampionAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/ChampionAbility.java @@ -34,6 +34,7 @@ import mage.abilities.Ability; import mage.abilities.StaticAbility; import mage.abilities.common.EntersBattlefieldTriggeredAbility; import mage.abilities.common.LeavesBattlefieldTriggeredAbility; +import mage.abilities.costs.Cost; import mage.abilities.costs.CostImpl; import mage.abilities.effects.common.ReturnFromExileForSourceEffect; import mage.abilities.effects.common.SacrificeSourceUnlessPaysEffect; @@ -161,7 +162,7 @@ class ChampionExileCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { + public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { Player controller = game.getPlayer(controllerId); MageObject sourceObject = ability.getSourceObject(game); if (controller != null && sourceObject != null) { diff --git a/Mage/src/main/java/mage/abilities/keyword/CumulativeUpkeepAbility.java b/Mage/src/main/java/mage/abilities/keyword/CumulativeUpkeepAbility.java index 2e6c6d83fc..0526c58e20 100644 --- a/Mage/src/main/java/mage/abilities/keyword/CumulativeUpkeepAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/CumulativeUpkeepAbility.java @@ -122,7 +122,7 @@ class CumulativeUpkeepEffect extends OneShotEffect { if (player.chooseUse(Outcome.Benefit, totalCost.getText() + "?", source, game)) { totalCost.clearPaid(); int bookmark = game.bookmarkState(); - if (totalCost.pay(source, game, source.getSourceId(), source.getControllerId(), false)) { + if (totalCost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) { game.fireEvent(new GameEvent(EventType.PAID_CUMULATIVE_UPKEEP, permanent.getId(), permanent.getId(), player.getId(), ageCounter, false)); return true; } else { diff --git a/Mage/src/main/java/mage/abilities/keyword/EchoAbility.java b/Mage/src/main/java/mage/abilities/keyword/EchoAbility.java index 6b8a129a80..e3c0531073 100644 --- a/Mage/src/main/java/mage/abilities/keyword/EchoAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/EchoAbility.java @@ -147,7 +147,7 @@ class EchoEffect extends OneShotEffect { if (controller != null && source.getSourceObjectIfItStillExists(game) != null) { if (controller.chooseUse(Outcome.Benefit, "Pay " + cost.getText() /* + " or sacrifice " + permanent.getName() */ + "?", source, game)) { cost.clearPaid(); - if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false)) { + if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) { return true; } } diff --git a/Mage/src/main/java/mage/abilities/keyword/ExtortAbility.java b/Mage/src/main/java/mage/abilities/keyword/ExtortAbility.java index d700e55738..95d6e040ae 100644 --- a/Mage/src/main/java/mage/abilities/keyword/ExtortAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/ExtortAbility.java @@ -103,7 +103,7 @@ class ExtortEffect extends OneShotEffect { if (player != null && permanent != null) { if (player.chooseUse(Outcome.Damage, new StringBuilder("Extort opponents? (").append(permanent.getName()).append(")").toString(), source, game)) { Cost cost = new ManaCostsImpl("{W/B}"); - if (cost.pay(source, game, source.getSourceId(), player.getId(), false)) { + if (cost.pay(source, game, source.getSourceId(), player.getId(), false, null)) { int loseLife = 0; for (UUID opponentId : game.getOpponents(source.getControllerId())) { loseLife += game.getPlayer(opponentId).loseLife(1, game); diff --git a/Mage/src/main/java/mage/abilities/keyword/NinjutsuAbility.java b/Mage/src/main/java/mage/abilities/keyword/NinjutsuAbility.java index 8fc900bd3d..c3716f5984 100644 --- a/Mage/src/main/java/mage/abilities/keyword/NinjutsuAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/NinjutsuAbility.java @@ -157,7 +157,7 @@ class ReturnAttackerToHandTargetCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { + public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { if (targets.choose(Outcome.ReturnToHand, controllerId, sourceId, game)) { for (UUID targetId : targets.get(0).getTargets()) { Permanent permanent = game.getPermanent(targetId); @@ -197,7 +197,7 @@ class RevealNinjutsuCardCost extends CostImpl { } @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { + public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { Player player = game.getPlayer(controllerId); Card card = player.getHand().get(ability.getSourceId(), game); diff --git a/Mage/src/main/java/mage/abilities/keyword/RecoverAbility.java b/Mage/src/main/java/mage/abilities/keyword/RecoverAbility.java index bd8cbb938d..593ed80aa0 100644 --- a/Mage/src/main/java/mage/abilities/keyword/RecoverAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/RecoverAbility.java @@ -119,7 +119,7 @@ class RecoverEffect extends OneShotEffect { && game.getState().getZone(source.getSourceId()).equals(Zone.GRAVEYARD)) { if (controller.chooseUse(Outcome.Damage, "Pay " + cost.getText() + " to recover " + sourceCard.getLogName() + "? (Otherwise the card will be exiled)", source, game)) { cost.clearPaid(); - if (cost.pay(source, game, source.getSourceId(), controller.getId(), false)) { + if (cost.pay(source, game, source.getSourceId(), controller.getId(), false, null)) { return new ReturnToHandSourceEffect().apply(game, source); } } diff --git a/Mage/src/main/java/mage/abilities/mana/conditional/ArtifactCastManaCondition.java b/Mage/src/main/java/mage/abilities/mana/conditional/ArtifactCastManaCondition.java index 2125e5c7a7..1a508c2a98 100644 --- a/Mage/src/main/java/mage/abilities/mana/conditional/ArtifactCastManaCondition.java +++ b/Mage/src/main/java/mage/abilities/mana/conditional/ArtifactCastManaCondition.java @@ -1,31 +1,30 @@ /* -* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without modification, are -* permitted provided that the following conditions are met: -* -* 1. Redistributions of source code must retain the above copyright notice, this list of -* conditions and the following disclaimer. -* -* 2. Redistributions in binary form must reproduce the above copyright notice, this list -* of conditions and the following disclaimer in the documentation and/or other materials -* provided with the distribution. -* -* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED -* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND -* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR -* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -* The views and conclusions contained in the software and documentation are those of the -* authors and should not be interpreted as representing official policies, either expressed -* or implied, of BetaSteward_at_googlemail.com. -*/ - + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ package mage.abilities.mana.conditional; import java.util.UUID; @@ -33,6 +32,7 @@ import mage.MageObject; import mage.abilities.Ability; import mage.abilities.SpellAbility; import mage.abilities.condition.Condition; +import mage.abilities.costs.Cost; import mage.constants.CardType; import mage.game.Game; @@ -40,8 +40,8 @@ import mage.game.Game; * * @author LevelX2 */ - public class ArtifactCastManaCondition extends ManaCondition implements Condition { + @Override public boolean apply(Game game, Ability source) { if (source instanceof SpellAbility) { @@ -54,7 +54,7 @@ public class ArtifactCastManaCondition extends ManaCondition implements Conditio } @Override - public boolean apply(Game game, Ability source, UUID originalId) { + public boolean apply(Game game, Ability source, UUID originalId, Cost costToPay) { return apply(game, source); } -} \ No newline at end of file +} diff --git a/Mage/src/main/java/mage/abilities/mana/conditional/ConditionalSpellManaBuilder.java b/Mage/src/main/java/mage/abilities/mana/conditional/ConditionalSpellManaBuilder.java index 5dfe2f7c3a..2cfaef6a33 100644 --- a/Mage/src/main/java/mage/abilities/mana/conditional/ConditionalSpellManaBuilder.java +++ b/Mage/src/main/java/mage/abilities/mana/conditional/ConditionalSpellManaBuilder.java @@ -12,6 +12,7 @@ import mage.Mana; import mage.abilities.Ability; import mage.abilities.SpellAbility; import mage.abilities.condition.Condition; +import mage.abilities.costs.Cost; import mage.abilities.mana.builder.ConditionalManaBuilder; import mage.filter.FilterSpell; import mage.game.Game; @@ -70,7 +71,7 @@ class SpellCastManaCondition extends ManaCondition implements Condition { } @Override - public boolean apply(Game game, Ability source, UUID originalId) { + public boolean apply(Game game, Ability source, UUID originalId, Cost costToPay) { return apply(game, source); } diff --git a/Mage/src/main/java/mage/abilities/mana/conditional/CreatureCastManaCondition.java b/Mage/src/main/java/mage/abilities/mana/conditional/CreatureCastManaCondition.java index fcc999c35f..f5f29b22a3 100644 --- a/Mage/src/main/java/mage/abilities/mana/conditional/CreatureCastManaCondition.java +++ b/Mage/src/main/java/mage/abilities/mana/conditional/CreatureCastManaCondition.java @@ -1,45 +1,46 @@ /* -* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without modification, are -* permitted provided that the following conditions are met: -* -* 1. Redistributions of source code must retain the above copyright notice, this list of -* conditions and the following disclaimer. -* -* 2. Redistributions in binary form must reproduce the above copyright notice, this list -* of conditions and the following disclaimer in the documentation and/or other materials -* provided with the distribution. -* -* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED -* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND -* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR -* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -* The views and conclusions contained in the software and documentation are those of the -* authors and should not be interpreted as representing official policies, either expressed -* or implied, of BetaSteward_at_googlemail.com. -*/ + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ package mage.abilities.mana.conditional; +import java.util.UUID; import mage.MageObject; import mage.abilities.Ability; import mage.abilities.SpellAbility; import mage.abilities.condition.Condition; +import mage.abilities.costs.Cost; import mage.constants.CardType; import mage.game.Game; -import java.util.UUID; - /** * @author noxx */ public class CreatureCastManaCondition extends ManaCondition implements Condition { + @Override public boolean apply(Game game, Ability source) { if (source instanceof SpellAbility) { @@ -52,7 +53,7 @@ public class CreatureCastManaCondition extends ManaCondition implements Conditio } @Override - public boolean apply(Game game, Ability source, UUID originalId) { + public boolean apply(Game game, Ability source, UUID originalId, Cost costToPay) { return apply(game, source); } -} \ No newline at end of file +} diff --git a/Mage/src/main/java/mage/abilities/mana/conditional/ManaCondition.java b/Mage/src/main/java/mage/abilities/mana/conditional/ManaCondition.java index 468c9769a7..23eab9ef58 100644 --- a/Mage/src/main/java/mage/abilities/mana/conditional/ManaCondition.java +++ b/Mage/src/main/java/mage/abilities/mana/conditional/ManaCondition.java @@ -1,46 +1,47 @@ /* -* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without modification, are -* permitted provided that the following conditions are met: -* -* 1. Redistributions of source code must retain the above copyright notice, this list of -* conditions and the following disclaimer. -* -* 2. Redistributions in binary form must reproduce the above copyright notice, this list -* of conditions and the following disclaimer in the documentation and/or other materials -* provided with the distribution. -* -* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED -* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND -* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR -* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -* The views and conclusions contained in the software and documentation are those of the -* authors and should not be interpreted as representing official policies, either expressed -* or implied, of BetaSteward_at_googlemail.com. -*/ + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ package mage.abilities.mana.conditional; +import java.util.UUID; import mage.abilities.Ability; import mage.abilities.condition.Condition; +import mage.abilities.costs.Cost; import mage.game.Game; -import java.util.UUID; - /** * @author noxx */ public abstract class ManaCondition implements Condition { + @Override public boolean apply(Game game, Ability source) { return false; } - public abstract boolean apply(Game game, Ability source, UUID originalId); -} \ No newline at end of file + public abstract boolean apply(Game game, Ability source, UUID originalId, Cost costToPay); +} diff --git a/Mage/src/main/java/mage/players/ManaPool.java b/Mage/src/main/java/mage/players/ManaPool.java index 92c9c0039b..65c2cfa68d 100644 --- a/Mage/src/main/java/mage/players/ManaPool.java +++ b/Mage/src/main/java/mage/players/ManaPool.java @@ -38,6 +38,7 @@ import mage.ConditionalMana; import mage.MageObject; import mage.Mana; import mage.abilities.Ability; +import mage.abilities.costs.Cost; import mage.constants.Duration; import mage.constants.ManaType; import mage.constants.TurnPhase; @@ -108,9 +109,10 @@ public class ManaPool implements Serializable { * @param ability * @param filter * @param game + * @param costToPay complete costs to pay (needed to check conditional mana) * @return */ - public boolean pay(ManaType manaType, Ability ability, Filter filter, Game game) { + public boolean pay(ManaType manaType, Ability ability, Filter filter, Game game, Cost costToPay) { if (!autoPayment && !manaType.equals(unlockedManaType)) { // if manual payment and the needed mana type was not unlocked, nothing will be paid return false; @@ -121,8 +123,8 @@ public class ManaPool implements Serializable { return false; } - if (getConditional(manaType, ability, filter, game) > 0) { - removeConditional(manaType, ability, game); + if (getConditional(manaType, ability, filter, game, costToPay) > 0) { + removeConditional(manaType, ability, game, costToPay); lockManaType(); // pay only one mana if mana payment is set to manually return true; } @@ -160,12 +162,14 @@ public class ManaPool implements Serializable { return getMana().get(manaType); } - private int getConditional(ManaType manaType, Ability ability, Filter filter, Game game) { + private int getConditional(ManaType manaType, Ability ability, Filter filter, Game game, Cost costToPay) { if (ability == null || getConditionalMana().isEmpty()) { return 0; } for (ManaPoolItem mana : manaItems) { - if (mana.isConditional() && mana.getConditionalMana().get(manaType) > 0 && mana.getConditionalMana().apply(ability, game, mana.getSourceId())) { + if (mana.isConditional() + && mana.getConditionalMana().get(manaType) > 0 + && mana.getConditionalMana().apply(ability, game, mana.getSourceId(), costToPay)) { if (filter == null || filter.match(game.getObject(mana.getSourceId()), game)) { return mana.getConditionalMana().get(manaType); } @@ -174,13 +178,13 @@ public class ManaPool implements Serializable { return 0; } - public int getConditionalCount(Ability ability, Game game, FilterMana filter) { + public int getConditionalCount(Ability ability, Game game, FilterMana filter, Cost costToPay) { if (ability == null || getConditionalMana().isEmpty()) { return 0; } int count = 0; for (ConditionalMana mana : getConditionalMana()) { - if (mana.apply(ability, game, mana.getManaProducerId())) { + if (mana.apply(ability, game, mana.getManaProducerId(), costToPay)) { count += mana.count(filter); } } @@ -249,7 +253,7 @@ public class ManaPool implements Serializable { ManaPoolItem item = it.next(); if (item.isConditional()) { ConditionalMana cm = item.getConditionalMana(); - if (cm.apply(ability, game, cm.getManaProducerId())) { + if (cm.apply(ability, game, cm.getManaProducerId(), null)) { total += item.count(); it.remove(); } @@ -279,7 +283,7 @@ public class ManaPool implements Serializable { ManaPoolItem item = it.next(); if (item.isConditional()) { ConditionalMana c = item.getConditionalMana(); - if (c.apply(ability, game, c.getManaProducerId())) { + if (c.apply(ability, game, c.getManaProducerId(), null)) { int count = c.count(filter); if (count > 0) { total += count; @@ -362,7 +366,7 @@ public class ManaPool implements Serializable { public Mana getAllConditionalMana(Ability ability, Game game, FilterMana filter) { Mana m = new Mana(); - m.setGeneric(getConditionalCount(ability, game, filter)); + m.setGeneric(getConditionalCount(ability, game, filter, null)); return m; } @@ -414,9 +418,9 @@ public class ManaPool implements Serializable { return new ManaPool(this); } - private void removeConditional(ManaType manaType, Ability ability, Game game) { + private void removeConditional(ManaType manaType, Ability ability, Game game, Cost costToPay) { for (ConditionalMana mana : getConditionalMana()) { - if (mana.get(manaType) > 0 && mana.apply(ability, game, mana.getManaProducerId())) { + if (mana.get(manaType) > 0 && mana.apply(ability, game, mana.getManaProducerId(), costToPay)) { mana.set(manaType, mana.get(manaType) - 1); GameEvent event = new GameEvent(GameEvent.EventType.MANA_PAYED, ability.getId(), mana.getManaProducerId(), ability.getControllerId(), 0, mana.getFlag()); event.setData(mana.getManaProducerOriginalId().toString());