diff --git a/Mage.Sets/src/mage/sets/alarareborn/Anathemancer.java b/Mage.Sets/src/mage/sets/alarareborn/Anathemancer.java index b209e917ca..ededa47e51 100644 --- a/Mage.Sets/src/mage/sets/alarareborn/Anathemancer.java +++ b/Mage.Sets/src/mage/sets/alarareborn/Anathemancer.java @@ -27,17 +27,17 @@ */ package mage.sets.alarareborn; -import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Rarity; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.EntersBattlefieldTriggeredAbility; import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.Effect; import mage.abilities.effects.common.DamageTargetEffect; import mage.abilities.keyword.UnearthAbility; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; import mage.filter.common.FilterLandPermanent; import mage.filter.predicate.Predicates; import mage.filter.predicate.mageobject.SupertypePredicate; @@ -45,6 +45,8 @@ import mage.filter.predicate.permanent.ControllerIdPredicate; import mage.game.Game; import mage.target.TargetPlayer; +import java.util.UUID; + /** * * @author North @@ -83,7 +85,7 @@ public class Anathemancer extends CardImpl { class AnathemancerCount implements DynamicValue { @Override - public int calculate(Game game, Ability sourceAbility) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { if (sourceAbility.getFirstTarget() == null) { return 0; } diff --git a/Mage.Sets/src/mage/sets/alarareborn/DemonspineWhip.java b/Mage.Sets/src/mage/sets/alarareborn/DemonspineWhip.java index 8545616b0e..8548e16d90 100644 --- a/Mage.Sets/src/mage/sets/alarareborn/DemonspineWhip.java +++ b/Mage.Sets/src/mage/sets/alarareborn/DemonspineWhip.java @@ -27,20 +27,21 @@ */ package mage.sets.alarareborn; -import java.util.UUID; - -import mage.constants.*; import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.costs.mana.GenericManaCost; import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.dynamicvalue.DynamicValue; import mage.abilities.dynamicvalue.common.StaticValue; +import mage.abilities.effects.Effect; import mage.abilities.effects.common.continious.BoostEquippedEffect; import mage.abilities.keyword.EquipAbility; import mage.cards.CardImpl; +import mage.constants.*; import mage.game.Game; +import java.util.UUID; + /** * * @author jeffwadsworth @@ -75,7 +76,7 @@ public class DemonspineWhip extends CardImpl { class XPaid implements DynamicValue { @Override - public int calculate(Game game, Ability sourceAbility) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { int paid = sourceAbility.getManaCostsToPay().getX(); return paid; } diff --git a/Mage.Sets/src/mage/sets/alarareborn/Lavalanche.java b/Mage.Sets/src/mage/sets/alarareborn/Lavalanche.java index a2e11ee205..1b4ffb5016 100644 --- a/Mage.Sets/src/mage/sets/alarareborn/Lavalanche.java +++ b/Mage.Sets/src/mage/sets/alarareborn/Lavalanche.java @@ -101,13 +101,13 @@ class LavalancheEffect extends OneShotEffect { if (targetPlayer == null) { return false; } - targetPlayer.damage(amount.calculate(game, source), source.getSourceId(), game, false, true); + targetPlayer.damage(amount.calculate(game, source, this), source.getSourceId(), game, false, true); FilterPermanent filter = new FilterPermanent("and each creature he or she controls"); filter.add(new CardTypePredicate(CardType.CREATURE)); filter.add(new ControllerIdPredicate(targetPlayer.getId())); List permanents = game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game); for (Permanent permanent: permanents) { - permanent.damage(amount.calculate(game, source), source.getSourceId(), game, false, true); + permanent.damage(amount.calculate(game, source, this), source.getSourceId(), game, false, true); } return true; } diff --git a/Mage.Sets/src/mage/sets/alarareborn/LightningReaver.java b/Mage.Sets/src/mage/sets/alarareborn/LightningReaver.java index e9c4830c6c..b9c2d09d77 100644 --- a/Mage.Sets/src/mage/sets/alarareborn/LightningReaver.java +++ b/Mage.Sets/src/mage/sets/alarareborn/LightningReaver.java @@ -102,7 +102,7 @@ class DamageOpponentsEffect extends OneShotEffect { for (UUID playerId : game.getOpponents(source.getControllerId())) { Player player = game.getPlayer(playerId); if (player != null) { - player.damage(amount.calculate(game, source), source.getSourceId(), game, false, true); + player.damage(amount.calculate(game, source, this), source.getSourceId(), game, false, true); } } return true; diff --git a/Mage.Sets/src/mage/sets/alarareborn/LordOfExtinction.java b/Mage.Sets/src/mage/sets/alarareborn/LordOfExtinction.java index 6be722d282..122db23f49 100644 --- a/Mage.Sets/src/mage/sets/alarareborn/LordOfExtinction.java +++ b/Mage.Sets/src/mage/sets/alarareborn/LordOfExtinction.java @@ -27,20 +27,22 @@ */ package mage.sets.alarareborn; -import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Duration; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.Effect; import mage.abilities.effects.common.continious.SetPowerToughnessSourceEffect; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.game.Game; import mage.players.Player; +import java.util.UUID; + /** * * @author jeffwadsworth @@ -74,7 +76,7 @@ public class LordOfExtinction extends CardImpl { class LordOfExtinctionDynamicCount implements DynamicValue { @Override - public int calculate(Game game, Ability sourceAbility) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { int count = 0; for (UUID playerId : game.getPlayer(sourceAbility.getControllerId()).getInRange()) { Player player = game.getPlayer(playerId); diff --git a/Mage.Sets/src/mage/sets/alarareborn/TaintedSigil.java b/Mage.Sets/src/mage/sets/alarareborn/TaintedSigil.java index 650206b4a3..9ba43919b9 100644 --- a/Mage.Sets/src/mage/sets/alarareborn/TaintedSigil.java +++ b/Mage.Sets/src/mage/sets/alarareborn/TaintedSigil.java @@ -27,12 +27,12 @@ */ package mage.sets.alarareborn; -import java.util.UUID; import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.costs.common.SacrificeSourceCost; import mage.abilities.costs.common.TapSourceCost; import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.Effect; import mage.abilities.effects.common.GainLifeEffect; import mage.cards.CardImpl; import mage.constants.CardType; @@ -41,6 +41,8 @@ import mage.constants.Zone; import mage.game.Game; import mage.watchers.common.PlayerLostLifeWatcher; +import java.util.UUID; + /** * * @author jeffwadsworth @@ -77,7 +79,7 @@ public class TaintedSigil extends CardImpl { class AllPlayersLostLifeCount implements DynamicValue { @Override - public int calculate(Game game, Ability sourceAbility) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { return this.calculate(game, sourceAbility.getControllerId()); } @@ -107,4 +109,4 @@ class AllPlayersLostLifeCount implements DynamicValue { public String getMessage() { return "the total life lost by all players this turn"; } -} \ No newline at end of file +} diff --git a/Mage.Sets/src/mage/sets/alliances/HelmOfObedience.java b/Mage.Sets/src/mage/sets/alliances/HelmOfObedience.java index 04bb21be88..de68c7230a 100644 --- a/Mage.Sets/src/mage/sets/alliances/HelmOfObedience.java +++ b/Mage.Sets/src/mage/sets/alliances/HelmOfObedience.java @@ -99,7 +99,7 @@ class HelmOfObedienceEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player player = game.getPlayer(targetPointer.getFirst(game, source)); if (player != null) { - int max = amount.calculate(game, source); + int max = amount.calculate(game, source, this); if(max != 0){ int numberOfCard = 0; diff --git a/Mage.Sets/src/mage/sets/avacynrestored/BurnAtTheStake.java b/Mage.Sets/src/mage/sets/avacynrestored/BurnAtTheStake.java index e2842cbe33..83059812bf 100644 --- a/Mage.Sets/src/mage/sets/avacynrestored/BurnAtTheStake.java +++ b/Mage.Sets/src/mage/sets/avacynrestored/BurnAtTheStake.java @@ -97,7 +97,7 @@ class BurnAtTheStakeEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - int amount = (new GetXValue()).calculate(game, source) * 3; + int amount = (new GetXValue()).calculate(game, source, this) * 3; Permanent permanent = game.getPermanent(targetPointer.getFirst(game, source)); if (permanent != null) { diff --git a/Mage.Sets/src/mage/sets/avacynrestored/Fettergeist.java b/Mage.Sets/src/mage/sets/avacynrestored/Fettergeist.java index 4d59047579..90d93824d3 100644 --- a/Mage.Sets/src/mage/sets/avacynrestored/Fettergeist.java +++ b/Mage.Sets/src/mage/sets/avacynrestored/Fettergeist.java @@ -102,7 +102,7 @@ class FettergeistUnlessPaysEffect extends OneShotEffect { Permanent permanent = game.getPermanent(source.getSourceId()); if (player != null && permanent != null) { PermanentsOnBattlefieldCount amount = new PermanentsOnBattlefieldCount(filter, 1); - int count = amount.calculate(game, source); + int count = amount.calculate(game, source, this); if (count == 0) { return true; } diff --git a/Mage.Sets/src/mage/sets/avacynrestored/KillingWave.java b/Mage.Sets/src/mage/sets/avacynrestored/KillingWave.java index e9f4cb8991..260d356274 100644 --- a/Mage.Sets/src/mage/sets/avacynrestored/KillingWave.java +++ b/Mage.Sets/src/mage/sets/avacynrestored/KillingWave.java @@ -93,7 +93,7 @@ class KillingWaveEffect extends OneShotEffect { return false; } - int amount = (new ManacostVariableValue()).calculate(game, source); + int amount = (new ManacostVariableValue()).calculate(game, source, this); if (amount > 0) { LinkedList sacrifices = new LinkedList(); HashMap lifePaidAmounts = new HashMap(); diff --git a/Mage.Sets/src/mage/sets/avacynrestored/Malignus.java b/Mage.Sets/src/mage/sets/avacynrestored/Malignus.java index c678dc0882..4646e44144 100644 --- a/Mage.Sets/src/mage/sets/avacynrestored/Malignus.java +++ b/Mage.Sets/src/mage/sets/avacynrestored/Malignus.java @@ -27,15 +27,16 @@ */ package mage.sets.avacynrestored; -import mage.constants.*; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.dynamicvalue.DynamicValue; import mage.abilities.dynamicvalue.common.CardsInControllerHandCount; +import mage.abilities.effects.Effect; import mage.abilities.effects.ReplacementEffectImpl; import mage.abilities.effects.common.continious.SetPowerToughnessSourceEffect; import mage.cards.CardImpl; +import mage.constants.*; import mage.game.Game; import mage.game.events.GameEvent; import mage.players.Player; @@ -76,7 +77,7 @@ public class Malignus extends CardImpl { class HighestLifeTotalAmongOpponentsCount implements DynamicValue { @Override - public int calculate(Game game, Ability sourceAbility) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { if (sourceAbility != null) { Player controller = game.getPlayer(sourceAbility.getControllerId()); if (controller != null) { diff --git a/Mage.Sets/src/mage/sets/avacynrestored/TamiyoTheMoonSage.java b/Mage.Sets/src/mage/sets/avacynrestored/TamiyoTheMoonSage.java index c62c9f362c..10f417c83c 100644 --- a/Mage.Sets/src/mage/sets/avacynrestored/TamiyoTheMoonSage.java +++ b/Mage.Sets/src/mage/sets/avacynrestored/TamiyoTheMoonSage.java @@ -27,18 +27,13 @@ */ package mage.sets.avacynrestored; -import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Duration; -import mage.constants.Outcome; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.abilities.Ability; import mage.abilities.LoyaltyAbility; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.common.EntersBattlefieldAbility; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.Effect; import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.DrawCardSourceControllerEffect; import mage.abilities.effects.common.GetEmblemEffect; @@ -49,6 +44,7 @@ import mage.abilities.effects.common.continious.MaximumHandSizeControllerEffect. import mage.abilities.effects.common.counter.AddCountersSourceEffect; import mage.cards.Card; import mage.cards.CardImpl; +import mage.constants.*; import mage.counters.CounterType; import mage.filter.common.FilterCreaturePermanent; import mage.filter.predicate.permanent.TappedPredicate; @@ -61,6 +57,8 @@ import mage.target.TargetPermanent; import mage.target.TargetPlayer; import mage.target.targetpointer.FixedTarget; +import java.util.UUID; + /** * @@ -112,7 +110,7 @@ class TappedCreaturesControlledByTargetCount implements DynamicValue { } @Override - public int calculate(Game game, Ability sourceAbility) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { return game.getBattlefield().countAll(filter, sourceAbility.getFirstTarget(), game); } diff --git a/Mage.Sets/src/mage/sets/avacynrestored/TibaltTheFiendBlooded.java b/Mage.Sets/src/mage/sets/avacynrestored/TibaltTheFiendBlooded.java index 0c70d8c934..0f8a5225f6 100644 --- a/Mage.Sets/src/mage/sets/avacynrestored/TibaltTheFiendBlooded.java +++ b/Mage.Sets/src/mage/sets/avacynrestored/TibaltTheFiendBlooded.java @@ -197,7 +197,7 @@ class TibaltTheFiendBloodedControlEffect extends ContinuousEffectImpl { class CardsInTargetHandCount implements DynamicValue { @Override - public int calculate(Game game, Ability sourceAbility) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { if (sourceAbility != null) { Player player = game.getPlayer(sourceAbility.getFirstTarget()); if (player != null) { diff --git a/Mage.Sets/src/mage/sets/betrayersofkamigawa/DisruptingShoal.java b/Mage.Sets/src/mage/sets/betrayersofkamigawa/DisruptingShoal.java index 3aeb7ff558..2fc0399581 100644 --- a/Mage.Sets/src/mage/sets/betrayersofkamigawa/DisruptingShoal.java +++ b/Mage.Sets/src/mage/sets/betrayersofkamigawa/DisruptingShoal.java @@ -102,7 +102,7 @@ class DisruptingShoalCounterTargetEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { DynamicValue amount = new ExileFromHandCostCardConvertedMana(); Spell spell = game.getStack().getSpell(targetPointer.getFirst(game, source)); - if (spell != null && spell.getConvertedManaCost() == amount.calculate(game, source)) { + if (spell != null && spell.getConvertedManaCost() == amount.calculate(game, source, this)) { return game.getStack().counter(source.getFirstTarget(), source.getSourceId(), game); } return false; diff --git a/Mage.Sets/src/mage/sets/betrayersofkamigawa/ShiningShoal.java b/Mage.Sets/src/mage/sets/betrayersofkamigawa/ShiningShoal.java index 73ca853a47..3ad92a81e7 100644 --- a/Mage.Sets/src/mage/sets/betrayersofkamigawa/ShiningShoal.java +++ b/Mage.Sets/src/mage/sets/betrayersofkamigawa/ShiningShoal.java @@ -111,7 +111,7 @@ class ShiningShoalPreventDamageTargetEffect extends PreventionEffectImpl { @Override public void init(Ability source, Game game) { - this.amount = dynamicAmount.calculate(game, source); + this.amount = dynamicAmount.calculate(game, source, this); } @Override diff --git a/Mage.Sets/src/mage/sets/bornofthegods/AcolytesReward.java b/Mage.Sets/src/mage/sets/bornofthegods/AcolytesReward.java index e97d85ad84..689f255f29 100644 --- a/Mage.Sets/src/mage/sets/bornofthegods/AcolytesReward.java +++ b/Mage.Sets/src/mage/sets/bornofthegods/AcolytesReward.java @@ -93,7 +93,7 @@ class AcolytesRewardEffect extends PreventionEffectImpl { @Override public void init(Ability source, Game game) { super.init(source, game); - amount = new DevotionCount(ColoredManaSymbol.W).calculate(game, source); + amount = new DevotionCount(ColoredManaSymbol.W).calculate(game, source, this); } @Override diff --git a/Mage.Sets/src/mage/sets/bornofthegods/ChampionOfStraySouls.java b/Mage.Sets/src/mage/sets/bornofthegods/ChampionOfStraySouls.java index c61714abef..96adfc962f 100644 --- a/Mage.Sets/src/mage/sets/bornofthegods/ChampionOfStraySouls.java +++ b/Mage.Sets/src/mage/sets/bornofthegods/ChampionOfStraySouls.java @@ -27,7 +27,6 @@ */ package mage.sets.bornofthegods; -import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; @@ -48,6 +47,8 @@ import mage.filter.predicate.permanent.AnotherPredicate; import mage.game.Game; import mage.target.common.TargetCardInYourGraveyard; +import java.util.UUID; + /** * * @author LevelX2 @@ -95,7 +96,7 @@ public class ChampionOfStraySouls extends CardImpl { if (ability instanceof SimpleActivatedAbility) { for (Effect effect : ability.getEffects()) { if (effect instanceof ReturnFromGraveyardToBattlefieldTargetEffect) { - int xValue = new GetXValue().calculate(game, ability); + int xValue = new GetXValue().calculate(game, ability, null); ability.getTargets().clear(); ability.addTarget(new TargetCardInYourGraveyard(xValue,xValue, new FilterCreatureCard("creature cards from your graveyard"))); } diff --git a/Mage.Sets/src/mage/sets/bornofthegods/HeroesPodium.java b/Mage.Sets/src/mage/sets/bornofthegods/HeroesPodium.java index 54c1309762..be59cf2256 100644 --- a/Mage.Sets/src/mage/sets/bornofthegods/HeroesPodium.java +++ b/Mage.Sets/src/mage/sets/bornofthegods/HeroesPodium.java @@ -98,7 +98,7 @@ class HeroesPodiumLegendaryCount implements DynamicValue { } @Override - public int calculate(Game game, Ability sourceAbility) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { int value = game.getBattlefield().count(filter, sourceAbility.getSourceId(), sourceAbility.getControllerId(), game); if (value > 0) { value--; diff --git a/Mage.Sets/src/mage/sets/bornofthegods/KrakenOfTheStraits.java b/Mage.Sets/src/mage/sets/bornofthegods/KrakenOfTheStraits.java index 4f258a6977..f9f596b358 100644 --- a/Mage.Sets/src/mage/sets/bornofthegods/KrakenOfTheStraits.java +++ b/Mage.Sets/src/mage/sets/bornofthegods/KrakenOfTheStraits.java @@ -99,7 +99,7 @@ class CantBeBlockedByCreaturesWithLessPowerEffect extends RestrictionEffect { @Override public boolean canBeBlocked(Permanent attacker, Permanent blocker, Ability source, Game game) { - return blocker.getPower().getValue() >= dynamicValue.calculate(game, source); + return blocker.getPower().getValue() >= dynamicValue.calculate(game, source, this); } @Override diff --git a/Mage.Sets/src/mage/sets/bornofthegods/MarshmistTitan.java b/Mage.Sets/src/mage/sets/bornofthegods/MarshmistTitan.java index 2ff017cc13..0281afe98b 100644 --- a/Mage.Sets/src/mage/sets/bornofthegods/MarshmistTitan.java +++ b/Mage.Sets/src/mage/sets/bornofthegods/MarshmistTitan.java @@ -90,7 +90,7 @@ class MarshmistTitanCostReductionEffect extends CostModificationEffectImpl { SpellAbility spellAbility = (SpellAbility)abilityToModify; Mana mana = spellAbility.getManaCostsToPay().getMana(); if (mana.getColorless() > 0) { - int count = new DevotionCount(ColoredManaSymbol.B).calculate(game, source); + int count = new DevotionCount(ColoredManaSymbol.B).calculate(game, source, this); int newCount = mana.getColorless() - count; if (newCount < 0) { newCount = 0; diff --git a/Mage.Sets/src/mage/sets/championsofkamigawa/FloatingDreamZubera.java b/Mage.Sets/src/mage/sets/championsofkamigawa/FloatingDreamZubera.java index 08f9bb787f..025131fdc5 100644 --- a/Mage.Sets/src/mage/sets/championsofkamigawa/FloatingDreamZubera.java +++ b/Mage.Sets/src/mage/sets/championsofkamigawa/FloatingDreamZubera.java @@ -28,24 +28,25 @@ package mage.sets.championsofkamigawa; -import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; -import mage.constants.WatcherScope; import mage.MageInt; import mage.MageObject; import mage.abilities.Ability; import mage.abilities.common.DiesTriggeredAbility; import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.Effect; import mage.abilities.effects.common.DrawCardSourceControllerEffect; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.WatcherScope; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; import mage.game.events.ZoneChangeEvent; import mage.watchers.Watcher; +import java.util.UUID; + /** * @author Loki */ @@ -114,7 +115,7 @@ class ZuberasDiedWatcher extends Watcher { class ZuberasDiedDynamicValue implements DynamicValue { @Override - public int calculate(Game game, Ability sourceAbility) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { ZuberasDiedWatcher watcher = (ZuberasDiedWatcher) game.getState().getWatchers().get("ZuberasDied"); return watcher.zuberasDiedThisTurn; } @@ -133,4 +134,4 @@ class ZuberasDiedDynamicValue implements DynamicValue { public String getMessage() { return "Zubera that died this turn"; } -} \ No newline at end of file +} diff --git a/Mage.Sets/src/mage/sets/championsofkamigawa/KondasBanner.java b/Mage.Sets/src/mage/sets/championsofkamigawa/KondasBanner.java index 586f33b4dd..1d4790afb2 100644 --- a/Mage.Sets/src/mage/sets/championsofkamigawa/KondasBanner.java +++ b/Mage.Sets/src/mage/sets/championsofkamigawa/KondasBanner.java @@ -140,8 +140,8 @@ class KondasBannerTypeBoostEffect extends BoostAllEffect { for (Permanent perm: game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) { if (CardUtil.shareSubtypes(perm, equipedCreature) || perm.getAbilities().contains(ChangelingAbility.getInstance())) { if (!this.affectedObjectsSet || objects.contains(perm.getId())) { - perm.addPower(power.calculate(game, source)); - perm.addToughness(toughness.calculate(game, source)); + perm.addPower(power.calculate(game, source, this)); + perm.addToughness(toughness.calculate(game, source, this)); } } @@ -183,8 +183,8 @@ class KondasBannerColorBoostEffect extends BoostAllEffect { for (Permanent perm: game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) { if (equipedCreature.getColor().shares(perm.getColor())) { if (!this.affectedObjectsSet || objects.contains(perm.getId())) { - perm.addPower(power.calculate(game, source)); - perm.addToughness(toughness.calculate(game, source)); + perm.addPower(power.calculate(game, source, this)); + perm.addToughness(toughness.calculate(game, source, this)); } } @@ -199,4 +199,4 @@ class KondasBannerColorBoostEffect extends BoostAllEffect { return new KondasBannerColorBoostEffect(this); } -} \ No newline at end of file +} diff --git a/Mage.Sets/src/mage/sets/championsofkamigawa/SilentChantZubera.java b/Mage.Sets/src/mage/sets/championsofkamigawa/SilentChantZubera.java index 4445e5f94d..3fe88b5ad7 100644 --- a/Mage.Sets/src/mage/sets/championsofkamigawa/SilentChantZubera.java +++ b/Mage.Sets/src/mage/sets/championsofkamigawa/SilentChantZubera.java @@ -28,18 +28,19 @@ package mage.sets.championsofkamigawa; -import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.DiesTriggeredAbility; import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.Effect; import mage.abilities.effects.common.GainLifeEffect; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; import mage.game.Game; +import java.util.UUID; + /** * * @author Loki @@ -73,7 +74,7 @@ public class SilentChantZubera extends CardImpl { class SilentChantZuberaDynamicValue implements DynamicValue { @Override - public int calculate(Game game, Ability sourceAbility) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { ZuberasDiedWatcher watcher = (ZuberasDiedWatcher) game.getState().getWatchers().get("ZuberasDied"); return watcher.zuberasDiedThisTurn * 2; } @@ -92,4 +93,4 @@ class SilentChantZuberaDynamicValue implements DynamicValue { public String getMessage() { return "Zubera that died this turn"; } -} \ No newline at end of file +} diff --git a/Mage.Sets/src/mage/sets/championsofkamigawa/TakenoSamuraiGeneral.java b/Mage.Sets/src/mage/sets/championsofkamigawa/TakenoSamuraiGeneral.java index b73b28331e..44f31a1afd 100644 --- a/Mage.Sets/src/mage/sets/championsofkamigawa/TakenoSamuraiGeneral.java +++ b/Mage.Sets/src/mage/sets/championsofkamigawa/TakenoSamuraiGeneral.java @@ -28,25 +28,20 @@ package mage.sets.championsofkamigawa; -import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.effects.ContinuousEffectImpl; import mage.abilities.keyword.BushidoAbility; import mage.cards.CardImpl; -import mage.constants.CardType; -import mage.constants.Duration; -import mage.constants.Layer; -import mage.constants.Outcome; -import mage.constants.Rarity; -import mage.constants.SubLayer; -import mage.constants.Zone; +import mage.constants.*; import mage.filter.common.FilterControlledCreaturePermanent; import mage.filter.predicate.mageobject.SubtypePredicate; import mage.game.Game; import mage.game.permanent.Permanent; +import java.util.UUID; + /** * @author Loki */ @@ -121,7 +116,7 @@ class TakenoSamuraiGeneralEffect extends ContinuousEffectImpl { if (!perm.getId().equals(source.getSourceId())) { for (Ability ability : perm.getAbilities()) { if (ability instanceof BushidoAbility) { - int value = ((BushidoAbility) ability).getValue(source, game); + int value = ((BushidoAbility) ability).getValue(source, game, this); perm.addPower(value); perm.addToughness(value); } diff --git a/Mage.Sets/src/mage/sets/coldsnap/LightningStorm.java b/Mage.Sets/src/mage/sets/coldsnap/LightningStorm.java index 0b1081c043..7f52c68793 100644 --- a/Mage.Sets/src/mage/sets/coldsnap/LightningStorm.java +++ b/Mage.Sets/src/mage/sets/coldsnap/LightningStorm.java @@ -97,7 +97,7 @@ class LightningStormCountCondition implements DynamicValue { } @Override - public int calculate(Game game, Ability sourceAbility) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { Spell spell = game.getStack().getSpell(sourceAbility.getSourceId()); if (spell != null) { return spell.getCounters().getCount(counter) + 3; diff --git a/Mage.Sets/src/mage/sets/commander/SewerNemesis.java b/Mage.Sets/src/mage/sets/commander/SewerNemesis.java index d165d56b7e..862aa11a29 100644 --- a/Mage.Sets/src/mage/sets/commander/SewerNemesis.java +++ b/Mage.Sets/src/mage/sets/commander/SewerNemesis.java @@ -27,22 +27,18 @@ */ package mage.sets.commander; -import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Duration; -import mage.constants.Outcome; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.common.AsEntersBattlefieldAbility; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.Effect; import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.PutTopCardOfLibraryIntoGraveTargetEffect; import mage.abilities.effects.common.continious.SetPowerToughnessSourceEffect; import mage.cards.CardImpl; +import mage.constants.*; import mage.game.Game; import mage.game.events.GameEvent; import mage.game.permanent.Permanent; @@ -50,6 +46,8 @@ import mage.players.Player; import mage.target.TargetPlayer; import mage.target.targetpointer.FixedTarget; +import java.util.UUID; + /** * * @author LevelX2 @@ -121,7 +119,7 @@ class SewerNemesisChoosePlayerEffect extends OneShotEffect { class CardsInTargetOpponentsGraveyardCount implements DynamicValue { @Override - public int calculate(Game game, Ability sourceAbility) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { if (sourceAbility != null) { UUID playerId = (UUID) game.getState().getValue(sourceAbility.getSourceId() + "_player"); Player chosenPlayer = game.getPlayer(playerId); diff --git a/Mage.Sets/src/mage/sets/commander/TheMimeoplasm.java b/Mage.Sets/src/mage/sets/commander/TheMimeoplasm.java index 7b967975b8..c3d6352966 100644 --- a/Mage.Sets/src/mage/sets/commander/TheMimeoplasm.java +++ b/Mage.Sets/src/mage/sets/commander/TheMimeoplasm.java @@ -100,7 +100,7 @@ class TheMimeoplasmEffect extends OneShotEffect { Player player = game.getPlayer(source.getControllerId()); Permanent permanent = game.getPermanent(source.getSourceId()); if (player != null && permanent != null) { - if (new CardsInAllGraveyardsCount(new FilterCreatureCard()).calculate(game, source) >= 2) { + if (new CardsInAllGraveyardsCount(new FilterCreatureCard()).calculate(game, source, this) >= 2) { if (player.chooseUse(Outcome.Benefit, "Do you want to exile two creature cards from graveyards?", game)) { TargetCardInGraveyard targetCopy = new TargetCardInGraveyard(new FilterCreatureCard("creature card to become a copy of")); TargetCardInGraveyard targetCounters = new TargetCardInGraveyard(new FilterCreatureCard("creature card for additional +1/+1 counters")); @@ -125,4 +125,4 @@ class TheMimeoplasmEffect extends OneShotEffect { } return false; } -} \ No newline at end of file +} diff --git a/Mage.Sets/src/mage/sets/commander/VishKalBloodArbiter.java b/Mage.Sets/src/mage/sets/commander/VishKalBloodArbiter.java index 2037e87fc3..6498a738aa 100644 --- a/Mage.Sets/src/mage/sets/commander/VishKalBloodArbiter.java +++ b/Mage.Sets/src/mage/sets/commander/VishKalBloodArbiter.java @@ -27,17 +27,16 @@ */ package mage.sets.commander; -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.SacrificeTargetCost; -import mage.abilities.costs.common.TapSourceCost; import mage.abilities.dynamicvalue.DynamicValue; import mage.abilities.dynamicvalue.common.SacrificeCostCreaturesPower; import mage.abilities.dynamicvalue.common.SignInversionDynamicValue; +import mage.abilities.effects.Effect; import mage.abilities.effects.common.continious.BoostTargetEffect; import mage.abilities.effects.common.counter.AddCountersSourceEffect; import mage.abilities.keyword.FlyingAbility; @@ -55,6 +54,8 @@ import mage.game.permanent.Permanent; import mage.target.common.TargetControlledCreaturePermanent; import mage.target.common.TargetCreaturePermanent; +import java.util.UUID; + /** * * @author LevelX2 @@ -158,7 +159,7 @@ class VishKalBloodArbiterDynamicValue implements DynamicValue { } @Override - public int calculate(Game game, Ability source) { + public int calculate(Game game, Ability source, Effect effect) { int count = 0; for(Cost cost : source.getCosts()){ if(cost instanceof VishKalBloodArbiterCost){ diff --git a/Mage.Sets/src/mage/sets/commander2013/MarathWillOfTheWild.java b/Mage.Sets/src/mage/sets/commander2013/MarathWillOfTheWild.java index 8e8390b29c..fd239d5036 100644 --- a/Mage.Sets/src/mage/sets/commander2013/MarathWillOfTheWild.java +++ b/Mage.Sets/src/mage/sets/commander2013/MarathWillOfTheWild.java @@ -27,7 +27,6 @@ */ package mage.sets.commander2013; -import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.Mode; @@ -57,6 +56,8 @@ import mage.players.Player; import mage.target.common.TargetCreatureOrPlayer; import mage.target.common.TargetCreaturePermanent; +import java.util.UUID; + /** * * @author LevelX2 @@ -159,7 +160,7 @@ class MarathWillOfTheWildCreateTokenEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); if (player != null) { - int amount = new ManacostVariableValue().calculate(game, source); + int amount = new ManacostVariableValue().calculate(game, source, this); Token token = new MarathWillOfTheWildElementalToken(); token.getPower().initValue(amount); token.getToughness().initValue(amount); @@ -203,7 +204,7 @@ class MarathWillOfTheWildRemoveCountersCost extends CostImpl { @Override public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { - int amount = new ManacostVariableValue().calculate(game, ability); + int amount = new ManacostVariableValue().calculate(game, ability, null); Permanent permanent = game.getPermanent(sourceId); if (permanent != null && permanent.getCounters().getCount(CounterType.P1P1) >= amount) { permanent.removeCounters(CounterType.P1P1.getName(), amount, game); diff --git a/Mage.Sets/src/mage/sets/commander2013/SpringjackPasture.java b/Mage.Sets/src/mage/sets/commander2013/SpringjackPasture.java index f471a706d6..2d1069cc8b 100644 --- a/Mage.Sets/src/mage/sets/commander2013/SpringjackPasture.java +++ b/Mage.Sets/src/mage/sets/commander2013/SpringjackPasture.java @@ -113,7 +113,7 @@ class SpringjackPastureEffect extends OneShotEffect { Player you = game.getPlayer(source.getControllerId()); ChoiceColor choice = (ChoiceColor) source.getChoices().get(0); if (you != null && choice != null) { - int count = new GetXValue().calculate(game, source); + int count = new GetXValue().calculate(game, source, this); if (choice.getColor().isBlack()) { you.getManaPool().addMana(new Mana(0, 0, 0, 0, count, 0, 0), game, source); } else if (choice.getColor().isBlue()) { diff --git a/Mage.Sets/src/mage/sets/commander2013/TerraRavager.java b/Mage.Sets/src/mage/sets/commander2013/TerraRavager.java index ba31a88a23..080c900408 100644 --- a/Mage.Sets/src/mage/sets/commander2013/TerraRavager.java +++ b/Mage.Sets/src/mage/sets/commander2013/TerraRavager.java @@ -27,12 +27,12 @@ */ package mage.sets.commander2013; -import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.AttacksTriggeredAbility; import mage.abilities.dynamicvalue.DynamicValue; import mage.abilities.dynamicvalue.common.StaticValue; +import mage.abilities.effects.Effect; import mage.abilities.effects.common.continious.BoostSourceEffect; import mage.cards.CardImpl; import mage.constants.CardType; @@ -43,6 +43,8 @@ import mage.game.Game; import mage.game.combat.CombatGroup; import mage.game.permanent.Permanent; +import java.util.UUID; + /** * * @author LevelX2 @@ -76,7 +78,7 @@ public class TerraRavager extends CardImpl { class TerraRavagerLandCount implements DynamicValue { @Override - public int calculate(Game game, Ability sourceAbility) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { for (CombatGroup group :game.getCombat().getGroups()) { if (group.getAttackers().contains(sourceAbility.getSourceId())) { UUID defenderId = group.getDefenderId(); diff --git a/Mage.Sets/src/mage/sets/commander2013/WarCadence.java b/Mage.Sets/src/mage/sets/commander2013/WarCadence.java index effc1b61a9..db001195c6 100644 --- a/Mage.Sets/src/mage/sets/commander2013/WarCadence.java +++ b/Mage.Sets/src/mage/sets/commander2013/WarCadence.java @@ -93,7 +93,7 @@ class WarCadenceReplacementEffect extends ReplacementEffectImpl { public boolean replaceEvent(GameEvent event, Ability source, Game game) { Player player = game.getPlayer(event.getPlayerId()); if (player != null) { - int amount = xCosts.calculate(game, source); + int amount = xCosts.calculate(game, source, this); if (amount > 0) { String mana = new StringBuilder("{").append(amount).append("}").toString(); ManaCostsImpl cost = new ManaCostsImpl(mana); diff --git a/Mage.Sets/src/mage/sets/conflux/Banefire.java b/Mage.Sets/src/mage/sets/conflux/Banefire.java index 5dc0938717..0e1b4fbb02 100644 --- a/Mage.Sets/src/mage/sets/conflux/Banefire.java +++ b/Mage.Sets/src/mage/sets/conflux/Banefire.java @@ -27,7 +27,6 @@ */ package mage.sets.conflux; -import java.util.UUID; import mage.abilities.Ability; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.condition.Condition; @@ -37,11 +36,7 @@ import mage.abilities.effects.ContinuousRuleModifiyingEffectImpl; import mage.abilities.effects.OneShotEffect; import mage.cards.Card; import mage.cards.CardImpl; -import mage.constants.CardType; -import mage.constants.Duration; -import mage.constants.Outcome; -import mage.constants.Rarity; -import mage.constants.Zone; +import mage.constants.*; import mage.game.Game; import mage.game.events.GameEvent; import mage.game.events.GameEvent.EventType; @@ -50,6 +45,8 @@ import mage.game.stack.Spell; import mage.players.Player; import mage.target.common.TargetCreatureOrPlayer; +import java.util.UUID; + /** * * @author LevelX2 @@ -94,7 +91,7 @@ class testCondition implements Condition { public boolean apply(Game game, Ability source) { Spell spell = (Spell) game.getStack().getStackObject(source.getSourceId()); if (spell != null) { - return (xValue.calculate(game, spell.getSpellAbility()) >= limit); + return (xValue.calculate(game, spell.getSpellAbility(), null) >= limit); } return false; diff --git a/Mage.Sets/src/mage/sets/conflux/Nyxathid.java b/Mage.Sets/src/mage/sets/conflux/Nyxathid.java index 872d47b9fd..da8c1f568b 100644 --- a/Mage.Sets/src/mage/sets/conflux/Nyxathid.java +++ b/Mage.Sets/src/mage/sets/conflux/Nyxathid.java @@ -27,26 +27,24 @@ */ package mage.sets.conflux; -import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.AsEntersBattlefieldAbility; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.dynamicvalue.DynamicValue; import mage.abilities.dynamicvalue.common.SignInversionDynamicValue; +import mage.abilities.effects.Effect; import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.continious.BoostSourceEffect; import mage.cards.CardImpl; -import mage.constants.CardType; -import mage.constants.Duration; -import mage.constants.Outcome; -import mage.constants.Rarity; -import mage.constants.Zone; +import mage.constants.*; import mage.game.Game; import mage.game.permanent.Permanent; import mage.players.Player; import mage.target.common.TargetOpponent; +import java.util.UUID; + /** * * @author jeffwadsworth @@ -120,7 +118,7 @@ class ChooseOpponent extends OneShotEffect { class CardsInChosenPlayerHandCount implements DynamicValue { @Override - public int calculate(Game game, Ability sourceAbility) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { if (sourceAbility != null) { UUID playerId = (UUID) game.getState().getValue(sourceAbility.getSourceId() + "_player"); Player chosenPlayer = game.getPlayer(playerId); @@ -145,4 +143,4 @@ class CardsInChosenPlayerHandCount implements DynamicValue { public String toString() { return "1"; } -} \ No newline at end of file +} diff --git a/Mage.Sets/src/mage/sets/conflux/VoraciousDragon.java b/Mage.Sets/src/mage/sets/conflux/VoraciousDragon.java index db1a1a7645..bf7bc0cf9a 100644 --- a/Mage.Sets/src/mage/sets/conflux/VoraciousDragon.java +++ b/Mage.Sets/src/mage/sets/conflux/VoraciousDragon.java @@ -27,10 +27,6 @@ */ package mage.sets.conflux; -import java.util.ArrayList; -import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Rarity; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.EntersBattlefieldTriggeredAbility; @@ -42,10 +38,15 @@ import mage.abilities.effects.common.DevourEffect.DevourFactor; import mage.abilities.keyword.DevourAbility; import mage.abilities.keyword.FlyingAbility; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; import mage.game.Game; import mage.game.permanent.Permanent; import mage.target.common.TargetCreatureOrPlayer; +import java.util.ArrayList; +import java.util.UUID; + /** * * @author LevelX2 @@ -86,14 +87,14 @@ public class VoraciousDragon extends CardImpl { class TwiceDevouredGoblins implements DynamicValue { @Override - public int calculate(Game game, Ability sourceAbility) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { Permanent sourcePermanent = game.getPermanent(sourceAbility.getSourceId()); if (sourcePermanent != null) { for (Ability ability : sourcePermanent.getAbilities()) { if (ability instanceof DevourAbility) { - for (Effect effect: ability.getEffects()) { - if (effect instanceof DevourEffect) { - DevourEffect devourEffect = (DevourEffect) effect; + for (Effect abilityEffect: ability.getEffects()) { + if (abilityEffect instanceof DevourEffect) { + DevourEffect devourEffect = (DevourEffect) abilityEffect; int amountGoblins = 0; for (ArrayList subtypesItem :devourEffect.getSubtypes(game, sourcePermanent.getId())) { if (subtypesItem.contains("Goblin")) { diff --git a/Mage.Sets/src/mage/sets/conflux/WorldlyCounsel.java b/Mage.Sets/src/mage/sets/conflux/WorldlyCounsel.java index 88cf5b1d35..2584b064b4 100644 --- a/Mage.Sets/src/mage/sets/conflux/WorldlyCounsel.java +++ b/Mage.Sets/src/mage/sets/conflux/WorldlyCounsel.java @@ -94,7 +94,7 @@ class WorldlyCounselEffect extends OneShotEffect { } Cards cards = new CardsImpl(Zone.PICK); - int count = (new DomainValue()).calculate(game, source); + int count = (new DomainValue()).calculate(game, source, this); count = Math.min(player.getLibrary().size(), count); for (int i = 0; i < count; i++) { Card card = player.getLibrary().removeFromTop(game); diff --git a/Mage.Sets/src/mage/sets/darkascension/ArchangelsLight.java b/Mage.Sets/src/mage/sets/darkascension/ArchangelsLight.java index 7d0a8c51ae..eb6999af57 100644 --- a/Mage.Sets/src/mage/sets/darkascension/ArchangelsLight.java +++ b/Mage.Sets/src/mage/sets/darkascension/ArchangelsLight.java @@ -83,7 +83,7 @@ class ArchangelsLightEffect extends OneShotEffect { Player player = game.getPlayer(source.getControllerId()); DynamicValue value = new CardsInControllerGraveyardCount(); if (player != null) { - player.gainLife(value.calculate(game, source) * 2, game); + player.gainLife(value.calculate(game, source, this) * 2, game); player.getLibrary().addAll(player.getGraveyard().getCards(game), game); player.getGraveyard().clear(); player.shuffleLibrary(game); @@ -97,4 +97,4 @@ class ArchangelsLightEffect extends OneShotEffect { return new ArchangelsLightEffect(this); } -} \ No newline at end of file +} diff --git a/Mage.Sets/src/mage/sets/darkascension/CurseOfThirst.java b/Mage.Sets/src/mage/sets/darkascension/CurseOfThirst.java index 11b9d36b5c..4b11d76af8 100644 --- a/Mage.Sets/src/mage/sets/darkascension/CurseOfThirst.java +++ b/Mage.Sets/src/mage/sets/darkascension/CurseOfThirst.java @@ -27,18 +27,17 @@ */ package mage.sets.darkascension; -import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.Effect; import mage.abilities.effects.common.AttachEffect; import mage.abilities.effects.common.DamageTargetEffect; import mage.abilities.keyword.EnchantAbility; import mage.cards.CardImpl; +import mage.constants.CardType; import mage.constants.Outcome; +import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; @@ -47,6 +46,8 @@ import mage.players.Player; import mage.target.TargetPlayer; import mage.target.targetpointer.FixedTarget; +import java.util.UUID; + /** * * @author BetaSteward @@ -125,7 +126,7 @@ class CursesAttachedCount implements DynamicValue { } @Override - public int calculate(Game game, Ability sourceAbility) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { int count = 0; Permanent enchantment = game.getPermanent(sourceAbility.getSourceId()); if (enchantment != null && enchantment.getAttachedTo() != null) { diff --git a/Mage.Sets/src/mage/sets/dragonsmaze/SinisterPossession.java b/Mage.Sets/src/mage/sets/dragonsmaze/SinisterPossession.java index 09b8fa599f..0ae5badf51 100644 --- a/Mage.Sets/src/mage/sets/dragonsmaze/SinisterPossession.java +++ b/Mage.Sets/src/mage/sets/dragonsmaze/SinisterPossession.java @@ -27,11 +27,6 @@ */ package mage.sets.dragonsmaze; -import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Outcome; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.abilities.Ability; import mage.abilities.common.AttacksOrBlocksEnchantedTriggeredAbility; import mage.abilities.dynamicvalue.DynamicValue; @@ -40,12 +35,18 @@ import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.AttachEffect; import mage.abilities.keyword.EnchantAbility; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.game.Game; import mage.game.permanent.Permanent; import mage.players.Player; import mage.target.TargetPermanent; import mage.target.common.TargetCreaturePermanent; +import java.util.UUID; + /** * * @author LevelX2 @@ -119,7 +120,7 @@ class LoseLifeControllerAttachedEffect extends OneShotEffect { if (creature != null) { Player player = game.getPlayer(creature.getControllerId()); if (player != null) { - player.loseLife(amount.calculate(game, source), game); + player.loseLife(amount.calculate(game, source, this), game); return true; } } diff --git a/Mage.Sets/src/mage/sets/dragonsmaze/ToilTrouble.java b/Mage.Sets/src/mage/sets/dragonsmaze/ToilTrouble.java index d6cedd8b72..e9ada699a4 100644 --- a/Mage.Sets/src/mage/sets/dragonsmaze/ToilTrouble.java +++ b/Mage.Sets/src/mage/sets/dragonsmaze/ToilTrouble.java @@ -87,7 +87,7 @@ public class ToilTrouble extends SplitCard { class TargetPlayerCardsInHandCount implements DynamicValue { @Override - public int calculate(Game game, Ability sourceAbility) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { Player targetPlayer = game.getPlayer(sourceAbility.getFirstTarget()); if (targetPlayer != null) { return targetPlayer.getHand().size(); diff --git a/Mage.Sets/src/mage/sets/eventide/HeartlashCinder.java b/Mage.Sets/src/mage/sets/eventide/HeartlashCinder.java index 7d9ec6ae72..20f95e40e2 100644 --- a/Mage.Sets/src/mage/sets/eventide/HeartlashCinder.java +++ b/Mage.Sets/src/mage/sets/eventide/HeartlashCinder.java @@ -27,13 +27,13 @@ */ package mage.sets.eventide; -import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.EntersBattlefieldTriggeredAbility; import mage.abilities.dynamicvalue.DynamicValue; import mage.abilities.dynamicvalue.common.StaticValue; import mage.abilities.effects.ContinuousEffect; +import mage.abilities.effects.Effect; import mage.abilities.effects.common.continious.BoostSourceEffect; import mage.abilities.keyword.HasteAbility; import mage.cards.Card; @@ -44,6 +44,8 @@ import mage.constants.Rarity; import mage.filter.common.FilterControlledPermanent; import mage.game.Game; +import java.util.UUID; + /** * * @author jeffwadsworth @@ -86,7 +88,7 @@ class ChromaHeartlashCinderCount implements DynamicValue { private int chroma; @Override - public int calculate(Game game, Ability sourceAbility) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { chroma = 0; for (Card card : game.getBattlefield().getAllActivePermanents(new FilterControlledPermanent(), sourceAbility.getControllerId(), game)) { chroma += card.getManaCost().getMana().getRed(); @@ -108,4 +110,4 @@ class ChromaHeartlashCinderCount implements DynamicValue { public String getMessage() { return ""; } -} \ No newline at end of file +} diff --git a/Mage.Sets/src/mage/sets/eventide/LightFromWithin.java b/Mage.Sets/src/mage/sets/eventide/LightFromWithin.java index fb571b8fbb..7b943e795c 100644 --- a/Mage.Sets/src/mage/sets/eventide/LightFromWithin.java +++ b/Mage.Sets/src/mage/sets/eventide/LightFromWithin.java @@ -108,8 +108,8 @@ class LightFromWithinEffect extends ContinuousEffectImpl { if (creature != null) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { - creature.addPower(new ChromaLightFromWithinCount(creature).calculate(game, source)); - creature.addToughness(new ChromaLightFromWithinCount(creature).calculate(game, source)); + creature.addPower(new ChromaLightFromWithinCount(creature).calculate(game, source, this)); + creature.addToughness(new ChromaLightFromWithinCount(creature).calculate(game, source, this)); boosted = true; } } @@ -131,7 +131,7 @@ class ChromaLightFromWithinCount implements DynamicValue { } @Override - public int calculate(Game game, Ability sourceAbility) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { int chroma = 0; chroma += permanent.getManaCost().getMana().getWhite(); return chroma; diff --git a/Mage.Sets/src/mage/sets/eventide/NightmareIncursion.java b/Mage.Sets/src/mage/sets/eventide/NightmareIncursion.java index 87c54a18c2..1770702c8a 100644 --- a/Mage.Sets/src/mage/sets/eventide/NightmareIncursion.java +++ b/Mage.Sets/src/mage/sets/eventide/NightmareIncursion.java @@ -109,7 +109,7 @@ class NightmareIncursionEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); Player targetPlayer = game.getPlayer(source.getFirstTarget()); if (controller != null && targetPlayer != null) { - int amount = new PermanentsOnBattlefieldCount(filter).calculate(game, source); + int amount = new PermanentsOnBattlefieldCount(filter).calculate(game, source, this); TargetCardInLibrary target = new TargetCardInLibrary(0, amount, new FilterCard()); if (controller.searchLibrary(target, game, targetPlayer.getId())) { List targetId = target.getTargets(); diff --git a/Mage.Sets/src/mage/sets/eventide/OutrageShaman.java b/Mage.Sets/src/mage/sets/eventide/OutrageShaman.java index 5e01a5f872..df568b6236 100644 --- a/Mage.Sets/src/mage/sets/eventide/OutrageShaman.java +++ b/Mage.Sets/src/mage/sets/eventide/OutrageShaman.java @@ -83,7 +83,7 @@ class ChromaOutrageShamanCount implements DynamicValue { private int chroma; @Override - public int calculate(Game game, Ability sourceAbility) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { chroma = 0; for (Card card : game.getBattlefield().getAllActivePermanents(new FilterControlledPermanent(), sourceAbility.getControllerId(), game)) { chroma += card.getManaCost().getMana().getRed(); @@ -105,4 +105,4 @@ class ChromaOutrageShamanCount implements DynamicValue { public String getMessage() { return ""; } -} \ No newline at end of file +} diff --git a/Mage.Sets/src/mage/sets/eventide/Primalcrux.java b/Mage.Sets/src/mage/sets/eventide/Primalcrux.java index 7d0327c42b..54fce91f0b 100644 --- a/Mage.Sets/src/mage/sets/eventide/Primalcrux.java +++ b/Mage.Sets/src/mage/sets/eventide/Primalcrux.java @@ -84,7 +84,7 @@ class ChromaPrimalcruxCount implements DynamicValue { private int chroma; @Override - public int calculate(Game game, Ability sourceAbility) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { chroma = 0; for (Card card : game.getBattlefield().getAllActivePermanents(new FilterControlledPermanent(), sourceAbility.getControllerId(), game)) { chroma += card.getManaCost().getMana().getGreen(); diff --git a/Mage.Sets/src/mage/sets/eventide/SanityGrinding.java b/Mage.Sets/src/mage/sets/eventide/SanityGrinding.java index 0b0e9a3701..85db93084f 100644 --- a/Mage.Sets/src/mage/sets/eventide/SanityGrinding.java +++ b/Mage.Sets/src/mage/sets/eventide/SanityGrinding.java @@ -27,9 +27,9 @@ */ package mage.sets.eventide; -import java.util.UUID; import mage.abilities.Ability; import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.Effect; import mage.abilities.effects.OneShotEffect; import mage.cards.Card; import mage.cards.CardImpl; @@ -43,6 +43,8 @@ import mage.game.Game; import mage.players.Player; import mage.target.common.TargetOpponent; +import java.util.UUID; + /** * * @author jeffwadsworth @@ -98,7 +100,7 @@ class SanityGrindingEffect extends OneShotEffect { } you.revealCards("Sanity Grinding", revealed, game); if (targetOpponent != null) { - amount = (Math.min(targetOpponent.getLibrary().size(), new ChromaSanityGrindingCount(revealed).calculate(game, source))); + amount = (Math.min(targetOpponent.getLibrary().size(), new ChromaSanityGrindingCount(revealed).calculate(game, source, this))); for (int i = 0; i < amount; i++) { targetOpponent.getLibrary().removeFromTop(game).moveToZone(Zone.GRAVEYARD, source.getSourceId(), game, false); } @@ -125,7 +127,7 @@ class ChromaSanityGrindingCount implements DynamicValue { } @Override - public int calculate(Game game, Ability sourceAbility) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { int chroma = 0; for (Card card : revealed.getCards(game)) { chroma += card.getManaCost().getMana().getBlue(); diff --git a/Mage.Sets/src/mage/sets/eventide/SpringjackShepherd.java b/Mage.Sets/src/mage/sets/eventide/SpringjackShepherd.java index 3dae4e5294..31e8508e68 100644 --- a/Mage.Sets/src/mage/sets/eventide/SpringjackShepherd.java +++ b/Mage.Sets/src/mage/sets/eventide/SpringjackShepherd.java @@ -80,7 +80,7 @@ public class SpringjackShepherd extends CardImpl { class ChromaSpringjackShepherdCount implements DynamicValue { @Override - public int calculate(Game game, Ability sourceAbility) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { int chroma = 0; for (Permanent permanent : game.getBattlefield().getAllActivePermanents(new FilterPermanent(), sourceAbility.getControllerId(), game)) { chroma += permanent.getManaCost().getMana().getWhite(); @@ -114,4 +114,4 @@ class GoatToken extends Token { power = new MageInt(0); toughness = new MageInt(1); } -} \ No newline at end of file +} diff --git a/Mage.Sets/src/mage/sets/eventide/UmbraStalker.java b/Mage.Sets/src/mage/sets/eventide/UmbraStalker.java index fd31af93ed..29bff4a601 100644 --- a/Mage.Sets/src/mage/sets/eventide/UmbraStalker.java +++ b/Mage.Sets/src/mage/sets/eventide/UmbraStalker.java @@ -81,7 +81,7 @@ class ChromaUmbraStalkerCount implements DynamicValue { private int chroma; @Override - public int calculate(Game game, Ability sourceAbility) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { chroma = 0; Player you = game.getPlayer(sourceAbility.getControllerId()); if (you == null) { diff --git a/Mage.Sets/src/mage/sets/exodus/EntropicSpecter.java b/Mage.Sets/src/mage/sets/exodus/EntropicSpecter.java index 246923bbde..29c368ff9c 100644 --- a/Mage.Sets/src/mage/sets/exodus/EntropicSpecter.java +++ b/Mage.Sets/src/mage/sets/exodus/EntropicSpecter.java @@ -27,25 +27,26 @@ */ package mage.sets.exodus; -import java.util.UUID; - -import mage.constants.*; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.AsEntersBattlefieldAbility; import mage.abilities.common.DealsDamageToAPlayerTriggeredAbility; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.Effect; import mage.abilities.effects.OneShotEffect; -import mage.abilities.effects.common.discard.DiscardTargetEffect; import mage.abilities.effects.common.continious.SetPowerToughnessSourceEffect; +import mage.abilities.effects.common.discard.DiscardTargetEffect; import mage.abilities.keyword.FlyingAbility; import mage.cards.CardImpl; +import mage.constants.*; import mage.game.Game; import mage.game.permanent.Permanent; import mage.players.Player; import mage.target.common.TargetOpponent; +import java.util.UUID; + /** * * @author jeffwadsworth @@ -123,7 +124,7 @@ class ChooseOpponent extends OneShotEffect { class CardsInTargetPlayerHandCount implements DynamicValue { @Override - public int calculate(Game game, Ability sourceAbility) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { if (sourceAbility != null) { UUID playerId = (UUID) game.getState().getValue(sourceAbility.getSourceId() + "_player"); Player chosenPlayer = game.getPlayer(playerId); @@ -148,4 +149,4 @@ class CardsInTargetPlayerHandCount implements DynamicValue { public String toString() { return "1"; } -} \ No newline at end of file +} diff --git a/Mage.Sets/src/mage/sets/gatecrash/ConsumingAberration.java b/Mage.Sets/src/mage/sets/gatecrash/ConsumingAberration.java index 19432d92cd..4d0795ea7c 100644 --- a/Mage.Sets/src/mage/sets/gatecrash/ConsumingAberration.java +++ b/Mage.Sets/src/mage/sets/gatecrash/ConsumingAberration.java @@ -27,27 +27,24 @@ */ package mage.sets.gatecrash; -import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Outcome; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SpellCastControllerTriggeredAbility; import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.Effect; import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.continious.SetPowerToughnessSourceEffect; import mage.cards.Card; import mage.cards.CardImpl; import mage.cards.Cards; import mage.cards.CardsImpl; -import mage.constants.Duration; +import mage.constants.*; import mage.game.Game; import mage.players.Player; +import java.util.UUID; + /** * * @author Plopman @@ -138,7 +135,7 @@ class CardsInOpponentsGraveyardsCount implements DynamicValue { super(); } @Override - public int calculate(Game game, Ability sourceAbility) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { int amount = 0; for (UUID playerUUID : game.getOpponents(sourceAbility.getControllerId())) { Player player = game.getPlayer(playerUUID); diff --git a/Mage.Sets/src/mage/sets/gatecrash/DeathsApproach.java b/Mage.Sets/src/mage/sets/gatecrash/DeathsApproach.java index f3751adef2..3db2bab77d 100644 --- a/Mage.Sets/src/mage/sets/gatecrash/DeathsApproach.java +++ b/Mage.Sets/src/mage/sets/gatecrash/DeathsApproach.java @@ -27,20 +27,16 @@ */ package mage.sets.gatecrash; -import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Duration; -import mage.constants.Outcome; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.abilities.Ability; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.dynamicvalue.DynamicValue; import mage.abilities.dynamicvalue.common.SignInversionDynamicValue; +import mage.abilities.effects.Effect; import mage.abilities.effects.common.AttachEffect; import mage.abilities.effects.common.continious.BoostEnchantedEffect; import mage.abilities.keyword.EnchantAbility; import mage.cards.CardImpl; +import mage.constants.*; import mage.filter.FilterCard; import mage.filter.common.FilterCreatureCard; import mage.game.Game; @@ -49,6 +45,8 @@ import mage.players.Player; import mage.target.TargetPermanent; import mage.target.common.TargetCreaturePermanent; +import java.util.UUID; + /** * * @author LevelX2 @@ -99,7 +97,7 @@ class CardsInEnchantedCreaturesControllerGraveyardCount implements DynamicValue } @Override - public int calculate(Game game, Ability sourceAbility) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { Permanent attachment = game.getPermanent(sourceAbility.getSourceId()); if (attachment != null) { Permanent creature = game.getPermanent(attachment.getAttachedTo()); diff --git a/Mage.Sets/src/mage/sets/gatecrash/EnterTheInfinite.java b/Mage.Sets/src/mage/sets/gatecrash/EnterTheInfinite.java index 3f088c4991..95c9201d47 100644 --- a/Mage.Sets/src/mage/sets/gatecrash/EnterTheInfinite.java +++ b/Mage.Sets/src/mage/sets/gatecrash/EnterTheInfinite.java @@ -27,21 +27,22 @@ */ package mage.sets.gatecrash; -import java.util.UUID; - -import mage.constants.*; import mage.abilities.Ability; import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.Effect; import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.DrawCardSourceControllerEffect; import mage.abilities.effects.common.continious.MaximumHandSizeControllerEffect; import mage.cards.Card; import mage.cards.CardImpl; +import mage.constants.*; import mage.game.Game; import mage.game.turn.Step; import mage.players.Player; import mage.target.common.TargetCardInHand; +import java.util.UUID; + /** * * @author LevelX2 @@ -75,7 +76,7 @@ public class EnterTheInfinite extends CardImpl { class CardsInControllerLibraryCount implements DynamicValue { @Override - public int calculate(Game game, Ability sourceAbility) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { if (sourceAbility != null) { Player controller = game.getPlayer(sourceAbility.getControllerId()); if (controller != null) { @@ -161,4 +162,4 @@ class MaximumHandSizeEffect extends MaximumHandSizeControllerEffect{ public MaximumHandSizeEffect copy() { return new MaximumHandSizeEffect(this); } -} \ No newline at end of file +} diff --git a/Mage.Sets/src/mage/sets/gatecrash/GideonChampionOfJustice.java b/Mage.Sets/src/mage/sets/gatecrash/GideonChampionOfJustice.java index 222d44262f..6d96181a5e 100644 --- a/Mage.Sets/src/mage/sets/gatecrash/GideonChampionOfJustice.java +++ b/Mage.Sets/src/mage/sets/gatecrash/GideonChampionOfJustice.java @@ -27,9 +27,6 @@ */ package mage.sets.gatecrash; -import java.util.UUID; - -import mage.constants.*; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.LoyaltyAbility; @@ -37,6 +34,7 @@ import mage.abilities.common.EntersBattlefieldAbility; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.dynamicvalue.DynamicValue; import mage.abilities.dynamicvalue.common.CountersCount; +import mage.abilities.effects.Effect; import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.PreventAllDamageToSourceEffect; import mage.abilities.effects.common.continious.BecomesCreatureSourceEffect; @@ -44,6 +42,7 @@ import mage.abilities.effects.common.continious.SetPowerToughnessSourceEffect; import mage.abilities.effects.common.counter.AddCountersSourceEffect; import mage.abilities.keyword.IndestructibleAbility; import mage.cards.CardImpl; +import mage.constants.*; import mage.counters.CounterType; import mage.filter.common.FilterCreaturePermanent; import mage.filter.predicate.permanent.ControllerIdPredicate; @@ -52,6 +51,8 @@ import mage.game.permanent.Permanent; import mage.game.permanent.token.Token; import mage.target.common.TargetOpponent; +import java.util.UUID; + /** * * @author LevelX2 @@ -97,7 +98,7 @@ class PermanentsTargetOpponentControlsCount implements DynamicValue { } @Override - public int calculate(Game game, Ability sourceAbility) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { if (sourceAbility.getFirstTarget() != null) { FilterCreaturePermanent filter = new FilterCreaturePermanent(); filter.add(new ControllerIdPredicate(sourceAbility.getFirstTarget())); diff --git a/Mage.Sets/src/mage/sets/gatecrash/MurderInvestigation.java b/Mage.Sets/src/mage/sets/gatecrash/MurderInvestigation.java index 400b0c7411..a089d6e859 100644 --- a/Mage.Sets/src/mage/sets/gatecrash/MurderInvestigation.java +++ b/Mage.Sets/src/mage/sets/gatecrash/MurderInvestigation.java @@ -27,10 +27,10 @@ */ package mage.sets.gatecrash; -import java.util.UUID; import mage.abilities.Ability; import mage.abilities.common.DiesAttachedTriggeredAbility; import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.Effect; import mage.abilities.effects.common.AttachEffect; import mage.abilities.effects.common.CreateTokenEffect; import mage.abilities.keyword.EnchantAbility; @@ -44,6 +44,8 @@ import mage.game.permanent.Permanent; import mage.target.TargetPermanent; import mage.target.common.TargetControlledCreaturePermanent; +import java.util.UUID; + /** * * @author LevelX2 @@ -81,18 +83,17 @@ public class MurderInvestigation extends CardImpl { class AttachedPermanentPowerCount implements DynamicValue { @Override - public int calculate(Game game, Ability sourceAbility) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { Permanent attachmentPermanent = game.getPermanent(sourceAbility.getSourceId()); if (attachmentPermanent == null) { attachmentPermanent = (Permanent) game.getLastKnownInformation(sourceAbility.getSourceId(), Zone.BATTLEFIELD); } if (attachmentPermanent != null && attachmentPermanent.getAttachedTo() != null) { - Permanent attached = game.getPermanent(attachmentPermanent.getAttachedTo()); - if (attached == null) { - attached = (Permanent) game.getLastKnownInformation(attachmentPermanent.getAttachedTo(), Zone.BATTLEFIELD); - } - if (attached != null) { - return attached.getPower().getValue(); + if (effect.getValue("attachedTo") != null) { + Permanent attached = (Permanent)effect.getValue("attachedTo"); + if (attached != null) { + return attached.getPower().getValue(); + } } } return 0; diff --git a/Mage.Sets/src/mage/sets/gatecrash/PredatorsRapport.java b/Mage.Sets/src/mage/sets/gatecrash/PredatorsRapport.java index 1fd324846d..b7eea48313 100644 --- a/Mage.Sets/src/mage/sets/gatecrash/PredatorsRapport.java +++ b/Mage.Sets/src/mage/sets/gatecrash/PredatorsRapport.java @@ -71,7 +71,7 @@ public class PredatorsRapport extends CardImpl { class TargetPermanentPowerPlusToughnessCount implements DynamicValue { @Override - public int calculate(Game game, Ability sourceAbility) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { Permanent sourcePermanent = game.getPermanent(sourceAbility.getFirstTarget()); if (sourcePermanent != null) { return sourcePermanent.getPower().getValue() + sourcePermanent.getToughness().getValue(); diff --git a/Mage.Sets/src/mage/sets/gatecrash/PrimeSpeakerZegana.java b/Mage.Sets/src/mage/sets/gatecrash/PrimeSpeakerZegana.java index 1ff0f4f10a..8141bbf408 100644 --- a/Mage.Sets/src/mage/sets/gatecrash/PrimeSpeakerZegana.java +++ b/Mage.Sets/src/mage/sets/gatecrash/PrimeSpeakerZegana.java @@ -28,23 +28,25 @@ */ package mage.sets.gatecrash; -import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Rarity; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.EntersBattlefieldAbility; import mage.abilities.common.EntersBattlefieldTriggeredAbility; import mage.abilities.dynamicvalue.DynamicValue; import mage.abilities.dynamicvalue.common.SourcePermanentPowerCount; +import mage.abilities.effects.Effect; import mage.abilities.effects.common.DrawCardSourceControllerEffect; import mage.abilities.effects.common.counter.AddCountersSourceEffect; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; import mage.counters.CounterType; import mage.filter.common.FilterControlledCreaturePermanent; import mage.game.Game; import mage.game.permanent.Permanent; +import java.util.UUID; + /** * * @author Plopman @@ -84,7 +86,7 @@ class greatestPowerCount implements DynamicValue { @Override - public int calculate(Game game, Ability sourceAbility) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { int value = 0; for(Permanent creature : game.getBattlefield().getActivePermanents(new FilterControlledCreaturePermanent(), sourceAbility.getControllerId(), game)){ if(creature != null && creature.getPower().getValue() > value && !sourceAbility.getSourceId().equals(creature.getId())){ @@ -108,4 +110,4 @@ class greatestPowerCount implements DynamicValue { public String getMessage() { return "greatest power among other creatures you control"; } -} \ No newline at end of file +} diff --git a/Mage.Sets/src/mage/sets/gatecrash/SpellRupture.java b/Mage.Sets/src/mage/sets/gatecrash/SpellRupture.java index b54884d590..6b0a1b283d 100644 --- a/Mage.Sets/src/mage/sets/gatecrash/SpellRupture.java +++ b/Mage.Sets/src/mage/sets/gatecrash/SpellRupture.java @@ -27,18 +27,17 @@ */ package mage.sets.gatecrash; -import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; import mage.MageObject; import mage.abilities.Ability; import mage.abilities.Mode; import mage.abilities.costs.mana.GenericManaCost; import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.Effect; import mage.abilities.effects.OneShotEffect; import mage.cards.CardImpl; +import mage.constants.CardType; import mage.constants.Outcome; +import mage.constants.Rarity; import mage.filter.common.FilterControlledCreaturePermanent; import mage.game.Game; import mage.game.permanent.Permanent; @@ -46,6 +45,8 @@ import mage.game.stack.StackObject; import mage.players.Player; import mage.target.TargetSpell; +import java.util.UUID; + /** * * @author jeffwadsworth @@ -96,7 +97,7 @@ class SpellRuptureCounterUnlessPaysEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); MageObject sourceObject = game.getObject(source.getSourceId()); if (player != null && controller != null && sourceObject != null) { - int amount = new greatestPowerCountCreatureYouControl().calculate(game, source); + int amount = new greatestPowerCountCreatureYouControl().calculate(game, source, this); GenericManaCost cost = new GenericManaCost(amount); StringBuilder sb = new StringBuilder("Pay {").append(amount).append("}? (otherwise ").append(spell.getName()).append(" will be countered)"); if (player.chooseUse(Outcome.Benefit, sb.toString(), game)) { @@ -123,7 +124,7 @@ class SpellRuptureCounterUnlessPaysEffect extends OneShotEffect { class greatestPowerCountCreatureYouControl implements DynamicValue { @Override - public int calculate(Game game, Ability sourceAbility) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { int value = 0; for (Permanent creature : game.getBattlefield().getActivePermanents(new FilterControlledCreaturePermanent(), sourceAbility.getControllerId(), game)) { if (creature != null && creature.getPower().getValue() > value) { @@ -147,4 +148,4 @@ class greatestPowerCountCreatureYouControl implements DynamicValue { public String getMessage() { return "greatest power among creatures you control"; } -} \ No newline at end of file +} diff --git a/Mage.Sets/src/mage/sets/gatecrash/WightOfPrecinctSix.java b/Mage.Sets/src/mage/sets/gatecrash/WightOfPrecinctSix.java index 82d687ec6c..ec667a9f6d 100644 --- a/Mage.Sets/src/mage/sets/gatecrash/WightOfPrecinctSix.java +++ b/Mage.Sets/src/mage/sets/gatecrash/WightOfPrecinctSix.java @@ -27,23 +27,24 @@ */ package mage.sets.gatecrash; -import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.Effect; import mage.abilities.effects.common.continious.BoostSourceEffect; import mage.cards.CardImpl; +import mage.constants.CardType; import mage.constants.Duration; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.filter.FilterCard; import mage.filter.common.FilterCreatureCard; import mage.game.Game; import mage.players.Player; +import java.util.UUID; + /** * * @author LevelX2 @@ -93,7 +94,7 @@ class CardsInOpponentGraveyardsCount implements DynamicValue { } @Override - public int calculate(Game game, Ability sourceAbility) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { int amount = 0; for (UUID playerUUID : game.getOpponents(sourceAbility.getControllerId())) { Player player = game.getPlayer(playerUUID); diff --git a/Mage.Sets/src/mage/sets/iceage/GlacialChasm.java b/Mage.Sets/src/mage/sets/iceage/GlacialChasm.java index e46fbd10c5..1a529307de 100644 --- a/Mage.Sets/src/mage/sets/iceage/GlacialChasm.java +++ b/Mage.Sets/src/mage/sets/iceage/GlacialChasm.java @@ -27,9 +27,6 @@ */ package mage.sets.iceage; -import java.util.UUID; - -import mage.constants.*; import mage.abilities.Ability; import mage.abilities.common.EntersBattlefieldTriggeredAbility; import mage.abilities.common.SimpleStaticAbility; @@ -41,6 +38,7 @@ import mage.abilities.effects.ReplacementEffectImpl; import mage.abilities.effects.common.PreventAllDamageToControllerEffect; import mage.abilities.keyword.CumulativeUpkeepAbility; import mage.cards.CardImpl; +import mage.constants.*; import mage.filter.FilterPermanent; import mage.filter.common.FilterLandPermanent; import mage.filter.predicate.permanent.ControllerPredicate; @@ -51,6 +49,8 @@ import mage.players.Player; import mage.target.Target; import mage.target.common.TargetControlledPermanent; +import java.util.UUID; + /** * * @author Plopman @@ -112,7 +112,7 @@ class SacrificeControllerEffect extends OneShotEffect{ filter.add(new ControllerPredicate(TargetController.YOU)); - int amount = count.calculate(game, source); + int amount = count.calculate(game, source, this); int realCount = game.getBattlefield().countAll(filter, player.getId(), game); amount = Math.min(amount, realCount); diff --git a/Mage.Sets/src/mage/sets/innistrad/EndlessRanksOfTheDead.java b/Mage.Sets/src/mage/sets/innistrad/EndlessRanksOfTheDead.java index 82315fabb6..e6469191cf 100644 --- a/Mage.Sets/src/mage/sets/innistrad/EndlessRanksOfTheDead.java +++ b/Mage.Sets/src/mage/sets/innistrad/EndlessRanksOfTheDead.java @@ -27,10 +27,10 @@ */ package mage.sets.innistrad; -import java.util.UUID; import mage.abilities.Ability; import mage.abilities.common.OnEventTriggeredAbility; import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.Effect; import mage.abilities.effects.common.CreateTokenEffect; import mage.cards.CardImpl; import mage.constants.CardType; @@ -41,6 +41,8 @@ import mage.game.Game; import mage.game.events.GameEvent.EventType; import mage.game.permanent.token.ZombieToken; +import java.util.UUID; + /** * * @author BetaSteward @@ -79,7 +81,7 @@ class HalfZombiesCount implements DynamicValue { } @Override - public int calculate(Game game, Ability sourceAbility) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { int amount = game.getBattlefield().countAll(filter, sourceAbility.getControllerId(), game) / 2; return amount; } @@ -98,4 +100,4 @@ class HalfZombiesCount implements DynamicValue { public String getMessage() { return "half the number of Zombies you control, rounded down"; } -} \ No newline at end of file +} diff --git a/Mage.Sets/src/mage/sets/innistrad/GarrukTheVeilCursed.java b/Mage.Sets/src/mage/sets/innistrad/GarrukTheVeilCursed.java index d46d1551e6..ed4c7e2360 100644 --- a/Mage.Sets/src/mage/sets/innistrad/GarrukTheVeilCursed.java +++ b/Mage.Sets/src/mage/sets/innistrad/GarrukTheVeilCursed.java @@ -27,10 +27,10 @@ */ package mage.sets.innistrad; -import mage.constants.*; import mage.abilities.Ability; import mage.abilities.LoyaltyAbility; import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.Effect; import mage.abilities.effects.Effects; import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.CreateTokenEffect; @@ -41,6 +41,7 @@ import mage.cards.Card; import mage.cards.CardImpl; import mage.cards.Cards; import mage.cards.CardsImpl; +import mage.constants.*; import mage.filter.FilterPermanent; import mage.filter.common.FilterCreatureCard; import mage.filter.common.FilterCreaturePermanent; @@ -105,7 +106,7 @@ public class GarrukTheVeilCursed extends CardImpl { class GarrukTheVeilCursedValue implements DynamicValue { @Override - public int calculate(Game game, Ability sourceAbility) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { Player player = game.getPlayer(sourceAbility.getControllerId()); if (player != null) { return player.getGraveyard().getCards(new FilterCreatureCard(), game).size(); diff --git a/Mage.Sets/src/mage/sets/innistrad/GutterGrime.java b/Mage.Sets/src/mage/sets/innistrad/GutterGrime.java index bd25400ddd..9ff5de01ad 100644 --- a/Mage.Sets/src/mage/sets/innistrad/GutterGrime.java +++ b/Mage.Sets/src/mage/sets/innistrad/GutterGrime.java @@ -27,22 +27,18 @@ */ package mage.sets.innistrad; -import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Duration; -import mage.constants.Outcome; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.MageInt; import mage.MageObject; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.Effect; import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.continious.SetPowerToughnessSourceEffect; import mage.abilities.effects.common.counter.AddCountersSourceEffect; import mage.cards.CardImpl; +import mage.constants.*; import mage.counters.CounterType; import mage.game.Game; import mage.game.events.GameEvent; @@ -52,6 +48,8 @@ import mage.game.permanent.Permanent; import mage.game.permanent.PermanentToken; import mage.game.permanent.token.Token; +import java.util.UUID; + /** * * @author BetaSteward @@ -167,7 +165,7 @@ class GutterGrimeCounters implements DynamicValue { } @Override - public int calculate(Game game, Ability sourceAbility) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { Permanent p = game.getPermanent(sourceId); if (p != null) { return p.getCounters().getCount(CounterType.SLIME); diff --git a/Mage.Sets/src/mage/sets/innistrad/RunechantersPike.java b/Mage.Sets/src/mage/sets/innistrad/RunechantersPike.java index 601aee129c..88ff48c936 100644 --- a/Mage.Sets/src/mage/sets/innistrad/RunechantersPike.java +++ b/Mage.Sets/src/mage/sets/innistrad/RunechantersPike.java @@ -27,17 +27,18 @@ */ package mage.sets.innistrad; -import mage.constants.*; import mage.abilities.Ability; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.costs.mana.GenericManaCost; import mage.abilities.dynamicvalue.DynamicValue; import mage.abilities.dynamicvalue.common.StaticValue; +import mage.abilities.effects.Effect; import mage.abilities.effects.common.continious.BoostEquippedEffect; import mage.abilities.effects.common.continious.GainAbilityAttachedEffect; import mage.abilities.keyword.EquipAbility; import mage.abilities.keyword.FirstStrikeAbility; import mage.cards.CardImpl; +import mage.constants.*; import mage.filter.FilterCard; import mage.filter.predicate.Predicates; import mage.filter.predicate.mageobject.CardTypePredicate; @@ -85,7 +86,7 @@ public class RunechantersPike extends CardImpl { class RunechantersPikeValue implements DynamicValue { @Override - public int calculate(Game game, Ability sourceAbility) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { Player player = game.getPlayer(sourceAbility.getControllerId()); if (player != null) { return player.getGraveyard().getCards(RunechantersPike.filterCard, game).size(); diff --git a/Mage.Sets/src/mage/sets/invasion/VerdelothTheAncient.java b/Mage.Sets/src/mage/sets/invasion/VerdelothTheAncient.java index f465cc2d6d..8a54bc117f 100644 --- a/Mage.Sets/src/mage/sets/invasion/VerdelothTheAncient.java +++ b/Mage.Sets/src/mage/sets/invasion/VerdelothTheAncient.java @@ -27,7 +27,6 @@ */ package mage.sets.invasion; -import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.EntersBattlefieldTriggeredAbility; @@ -35,6 +34,7 @@ import mage.abilities.common.SimpleStaticAbility; import mage.abilities.condition.common.KickedCondition; import mage.abilities.decorator.ConditionalTriggeredAbility; import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.Effect; import mage.abilities.effects.common.CreateTokenEffect; import mage.abilities.effects.common.continious.BoostAllEffect; import mage.abilities.keyword.KickerAbility; @@ -51,6 +51,8 @@ import mage.filter.predicate.permanent.PermanentIdPredicate; import mage.game.Game; import mage.game.permanent.token.SaprolingToken; +import java.util.UUID; + /** * * @author LevelX2 @@ -103,7 +105,7 @@ class GetKickerXValue implements DynamicValue { } @Override - public int calculate(Game game, Ability source) { + public int calculate(Game game, Ability source, Effect effect) { int count = 0; Card card = game.getCard(source.getSourceId()); if (card != null) { diff --git a/Mage.Sets/src/mage/sets/journeyintonyx/NessianGameWarden.java b/Mage.Sets/src/mage/sets/journeyintonyx/NessianGameWarden.java index 597aeddc46..38f350bee2 100644 --- a/Mage.Sets/src/mage/sets/journeyintonyx/NessianGameWarden.java +++ b/Mage.Sets/src/mage/sets/journeyintonyx/NessianGameWarden.java @@ -110,7 +110,7 @@ class NessianGameWardenEffect extends OneShotEffect { } Cards cards = new CardsImpl(); - int count = new PermanentsOnBattlefieldCount(filter).calculate(game, source); + int count = new PermanentsOnBattlefieldCount(filter).calculate(game, source, this); count = Math.min(player.getLibrary().size(), count); for (int i = 0; i < count; i++) { Card card = player.getLibrary().removeFromTop(game); diff --git a/Mage.Sets/src/mage/sets/limitedalpha/AspectOfWolf.java b/Mage.Sets/src/mage/sets/limitedalpha/AspectOfWolf.java index fb1d218376..bbafc2e51c 100644 --- a/Mage.Sets/src/mage/sets/limitedalpha/AspectOfWolf.java +++ b/Mage.Sets/src/mage/sets/limitedalpha/AspectOfWolf.java @@ -27,11 +27,10 @@ */ package mage.sets.limitedalpha; -import java.util.UUID; - import mage.abilities.Ability; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.Effect; import mage.abilities.effects.common.AttachEffect; import mage.abilities.effects.common.continious.BoostEnchantedEffect; import mage.abilities.keyword.EnchantAbility; @@ -43,6 +42,8 @@ import mage.game.Game; import mage.target.TargetPermanent; import mage.target.common.TargetCreaturePermanent; +import java.util.UUID; + /** * * @author KholdFuzion @@ -86,7 +87,7 @@ class HalfForestsDownCount implements DynamicValue { } @Override - public int calculate(Game game, Ability sourceAbility) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { int amount = game.getBattlefield().countAll(filter, sourceAbility.getControllerId(), game) / 2; return amount; } @@ -116,7 +117,7 @@ class HalfForestsUpCount implements DynamicValue { } @Override - public int calculate(Game game, Ability sourceAbility) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { int amount = (int) Math.ceil(game.getBattlefield().countAll(filter, sourceAbility.getControllerId(), game) / 2f); return amount; } diff --git a/Mage.Sets/src/mage/sets/magic2010/ChandraNalaar.java b/Mage.Sets/src/mage/sets/magic2010/ChandraNalaar.java index a9d51fbe5a..f642dadc56 100644 --- a/Mage.Sets/src/mage/sets/magic2010/ChandraNalaar.java +++ b/Mage.Sets/src/mage/sets/magic2010/ChandraNalaar.java @@ -28,19 +28,20 @@ package mage.sets.magic2010; -import mage.constants.CardType; -import mage.constants.Rarity; import mage.abilities.Ability; import mage.abilities.LoyaltyAbility; import mage.abilities.common.EntersBattlefieldAbility; import mage.abilities.costs.Cost; import mage.abilities.costs.common.PayVariableLoyaltyCost; import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.Effect; import mage.abilities.effects.Effects; import mage.abilities.effects.common.DamageAllControlledTargetEffect; import mage.abilities.effects.common.DamageTargetEffect; import mage.abilities.effects.common.counter.AddCountersSourceEffect; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; import mage.counters.CounterType; import mage.filter.common.FilterCreaturePermanent; import mage.game.Game; @@ -94,7 +95,7 @@ class ChandraNalaarXValue implements DynamicValue { private static final ChandraNalaarXValue defaultValue = new ChandraNalaarXValue(); @Override - public int calculate(Game game, Ability sourceAbility) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { for (Cost cost : sourceAbility.getCosts()) { if (cost instanceof PayVariableLoyaltyCost) { return ((PayVariableLoyaltyCost)cost).getAmount(); diff --git a/Mage.Sets/src/mage/sets/magic2012/JaceMemoryAdept.java b/Mage.Sets/src/mage/sets/magic2012/JaceMemoryAdept.java index 8b3386f497..d2c8c90386 100644 --- a/Mage.Sets/src/mage/sets/magic2012/JaceMemoryAdept.java +++ b/Mage.Sets/src/mage/sets/magic2012/JaceMemoryAdept.java @@ -102,7 +102,7 @@ class JaceMemoryAdeptEffect extends DrawCardTargetEffect { for (UUID target : targetPointer.getTargets(game, source)) { Player player = game.getPlayer(target); if (player != null) { - player.drawCards(amount.calculate(game, source), game); + player.drawCards(amount.calculate(game, source, this), game); } } return true; diff --git a/Mage.Sets/src/mage/sets/magic2012/SuturedGhoul.java b/Mage.Sets/src/mage/sets/magic2012/SuturedGhoul.java index 200e6aa19c..2d387e8a4e 100644 --- a/Mage.Sets/src/mage/sets/magic2012/SuturedGhoul.java +++ b/Mage.Sets/src/mage/sets/magic2012/SuturedGhoul.java @@ -27,17 +27,18 @@ */ package mage.sets.magic2012; -import mage.constants.*; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.AsEntersBattlefieldAbility; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.Effect; import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.continious.BoostSourceEffect; import mage.abilities.keyword.TrampleAbility; import mage.cards.Card; import mage.cards.CardImpl; +import mage.constants.*; import mage.filter.common.FilterCreatureCard; import mage.game.Game; import mage.game.permanent.Permanent; @@ -143,7 +144,7 @@ class SuturedGhoulPowerCount implements DynamicValue { } @Override - public int calculate(Game game, Ability sourceAbility) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { int amount = 0; Permanent permanent = game.getPermanent(sourceAbility.getSourceId()); if (permanent != null) { @@ -185,7 +186,7 @@ class SuturedGhoulToughnessCount implements DynamicValue { } @Override - public int calculate(Game game, Ability sourceAbility) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { int amount = 0; Permanent permanent = game.getPermanent(sourceAbility.getSourceId()); if (permanent != null) { diff --git a/Mage.Sets/src/mage/sets/magic2013/BoundlessRealms.java b/Mage.Sets/src/mage/sets/magic2013/BoundlessRealms.java index f53f9f9ad2..c415f7089a 100644 --- a/Mage.Sets/src/mage/sets/magic2013/BoundlessRealms.java +++ b/Mage.Sets/src/mage/sets/magic2013/BoundlessRealms.java @@ -93,7 +93,7 @@ class BoundlessRealmsEffect extends OneShotEffect { FilterLandPermanent filter = new FilterLandPermanent(); filter.add(new ControllerPredicate(TargetController.YOU)); - int amount = new PermanentsOnBattlefieldCount(filter).calculate(game, source); + int amount = new PermanentsOnBattlefieldCount(filter).calculate(game, source, this); TargetCardInLibrary target = new TargetCardInLibrary(0, amount, new FilterBasicLandCard()); Player player = game.getPlayer(source.getControllerId()); diff --git a/Mage.Sets/src/mage/sets/magic2013/DiabolicRevelation.java b/Mage.Sets/src/mage/sets/magic2013/DiabolicRevelation.java index fa77a66a49..83905630b2 100644 --- a/Mage.Sets/src/mage/sets/magic2013/DiabolicRevelation.java +++ b/Mage.Sets/src/mage/sets/magic2013/DiabolicRevelation.java @@ -87,7 +87,7 @@ class DiabolicRevelationEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - int amount = new ManacostVariableValue().calculate(game, source); + int amount = new ManacostVariableValue().calculate(game, source, this); TargetCardInLibrary target = new TargetCardInLibrary(0, amount, new FilterCard()); Player player = game.getPlayer(source.getControllerId()); diff --git a/Mage.Sets/src/mage/sets/magic2015/ShieldOfTheAvatar.java b/Mage.Sets/src/mage/sets/magic2015/ShieldOfTheAvatar.java index 8a3970a036..f7b65fc30b 100644 --- a/Mage.Sets/src/mage/sets/magic2015/ShieldOfTheAvatar.java +++ b/Mage.Sets/src/mage/sets/magic2015/ShieldOfTheAvatar.java @@ -102,7 +102,7 @@ class ShieldOfTheAvatarPreventionEffect extends PreventionEffectImpl { boolean result = false; Permanent equipment = game.getPermanent(source.getSourceId()); if (equipment != null && equipment.getAttachedTo() != null) { - int numberOfCreaturesControlled = new PermanentsOnBattlefieldCount(filter).calculate(game, source); + int numberOfCreaturesControlled = new PermanentsOnBattlefieldCount(filter).calculate(game, source, this); int toPrevent = Math.min(numberOfCreaturesControlled, event.getAmount()); GameEvent preventEvent = new GameEvent(GameEvent.EventType.PREVENT_DAMAGE, equipment.getAttachedTo(), source.getSourceId(), source.getControllerId(), toPrevent, false); if (!game.replaceEvent(preventEvent)) { diff --git a/Mage.Sets/src/mage/sets/mirrodin/GolemSkinGauntlets.java b/Mage.Sets/src/mage/sets/mirrodin/GolemSkinGauntlets.java index 64838ae29d..94de4a1045 100644 --- a/Mage.Sets/src/mage/sets/mirrodin/GolemSkinGauntlets.java +++ b/Mage.Sets/src/mage/sets/mirrodin/GolemSkinGauntlets.java @@ -32,6 +32,7 @@ import mage.abilities.common.SimpleStaticAbility; import mage.abilities.costs.mana.GenericManaCost; import mage.abilities.dynamicvalue.DynamicValue; import mage.abilities.dynamicvalue.common.StaticValue; +import mage.abilities.effects.Effect; import mage.abilities.effects.common.continious.BoostEquippedEffect; import mage.abilities.keyword.EquipAbility; import mage.cards.CardImpl; @@ -78,7 +79,7 @@ class GolemSkinGauntletsAttachedCount implements DynamicValue { } @Override - public int calculate(Game game, Ability source) { + public int calculate(Game game, Ability source, Effect effect) { int count = 0; Permanent equipment = game.getPermanent(source.getSourceId()); if (equipment != null) { diff --git a/Mage.Sets/src/mage/sets/mirrodinbesieged/TezzeretAgentOfBolas.java b/Mage.Sets/src/mage/sets/mirrodinbesieged/TezzeretAgentOfBolas.java index 26e1190b5f..c66bfed275 100644 --- a/Mage.Sets/src/mage/sets/mirrodinbesieged/TezzeretAgentOfBolas.java +++ b/Mage.Sets/src/mage/sets/mirrodinbesieged/TezzeretAgentOfBolas.java @@ -27,7 +27,6 @@ */ package mage.sets.mirrodinbesieged; -import java.util.UUID; import mage.abilities.Ability; import mage.abilities.LoyaltyAbility; import mage.abilities.common.EntersBattlefieldAbility; @@ -53,6 +52,8 @@ import mage.players.Player; import mage.target.TargetPlayer; import mage.target.common.TargetArtifactPermanent; +import java.util.UUID; + /** * * @author BetaSteward_at_googlemail.com @@ -128,7 +129,7 @@ class TezzeretAgentOfBolasEffect2 extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { DynamicValue value = new PermanentsOnBattlefieldCount(filter); - int count = value.calculate(game, source) * 2; + int count = value.calculate(game, source, this) * 2; Player player = game.getPlayer(source.getFirstTarget()); if (player != null) { diff --git a/Mage.Sets/src/mage/sets/newphyrexia/FreshMeat.java b/Mage.Sets/src/mage/sets/newphyrexia/FreshMeat.java index 74e6d2732f..661d5a01f7 100644 --- a/Mage.Sets/src/mage/sets/newphyrexia/FreshMeat.java +++ b/Mage.Sets/src/mage/sets/newphyrexia/FreshMeat.java @@ -27,17 +27,17 @@ */ package mage.sets.newphyrexia; -import java.util.UUID; +import mage.MageObject; +import mage.abilities.Ability; +import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.CreateTokenEffect; +import mage.cards.Card; +import mage.cards.CardImpl; import mage.constants.CardType; import mage.constants.Rarity; import mage.constants.WatcherScope; import mage.constants.Zone; -import mage.MageObject; -import mage.abilities.Ability; -import mage.abilities.dynamicvalue.DynamicValue; -import mage.abilities.effects.common.CreateTokenEffect; -import mage.cards.Card; -import mage.cards.CardImpl; import mage.game.Game; import mage.game.events.GameEvent; import mage.game.events.GameEvent.EventType; @@ -45,6 +45,8 @@ import mage.game.events.ZoneChangeEvent; import mage.game.permanent.token.BeastToken; import mage.watchers.Watcher; +import java.util.UUID; + /** * * @author North @@ -114,7 +116,7 @@ class FreshMeatWatcher extends Watcher { class FreshMeatDynamicValue implements DynamicValue { @Override - public int calculate(Game game, Ability sourceAbility) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { FreshMeatWatcher watcher = (FreshMeatWatcher) game.getState().getWatchers().get("YourCreaturesDied", sourceAbility.getControllerId()); if (watcher != null) { return watcher.getCreaturesCount(); diff --git a/Mage.Sets/src/mage/sets/newphyrexia/IchorExplosion.java b/Mage.Sets/src/mage/sets/newphyrexia/IchorExplosion.java index d5ae15680d..355bdcdac6 100644 --- a/Mage.Sets/src/mage/sets/newphyrexia/IchorExplosion.java +++ b/Mage.Sets/src/mage/sets/newphyrexia/IchorExplosion.java @@ -27,22 +27,24 @@ */ package mage.sets.newphyrexia; -import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.costs.common.SacrificeTargetCost; +import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.continious.BoostAllEffect; +import mage.cards.Card; +import mage.cards.CardImpl; import mage.constants.CardType; import mage.constants.Duration; import mage.constants.Rarity; import mage.constants.Zone; -import mage.abilities.Ability; -import mage.abilities.costs.common.SacrificeTargetCost; -import mage.abilities.dynamicvalue.DynamicValue; -import mage.abilities.effects.common.continious.BoostAllEffect; -import mage.cards.Card; -import mage.cards.CardImpl; import mage.filter.common.FilterCreaturePermanent; import mage.game.Game; import mage.game.permanent.Permanent; import mage.target.common.TargetControlledCreaturePermanent; +import java.util.UUID; + /** * * @author Loki @@ -75,7 +77,7 @@ public class IchorExplosion extends CardImpl { class IchorExplosionDynamicValue implements DynamicValue { @Override - public int calculate(Game game, Ability sourceAbility) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { Card sourceCard = game.getCard(sourceAbility.getSourceId()); if (sourceCard != null) { for (Object cost: sourceAbility.getCosts()) { diff --git a/Mage.Sets/src/mage/sets/newphyrexia/PhyrexianSwarmlord.java b/Mage.Sets/src/mage/sets/newphyrexia/PhyrexianSwarmlord.java index 2b28bc54d2..450345eda8 100644 --- a/Mage.Sets/src/mage/sets/newphyrexia/PhyrexianSwarmlord.java +++ b/Mage.Sets/src/mage/sets/newphyrexia/PhyrexianSwarmlord.java @@ -27,23 +27,25 @@ */ package mage.sets.newphyrexia; -import java.util.Set; -import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Rarity; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.OnEventTriggeredAbility; import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.Effect; import mage.abilities.effects.common.CreateTokenEffect; import mage.abilities.keyword.InfectAbility; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; import mage.counters.CounterType; import mage.game.Game; import mage.game.events.GameEvent.EventType; import mage.game.permanent.token.InsectInfectToken; import mage.players.Player; +import java.util.Set; +import java.util.UUID; + /** * * @author North @@ -78,7 +80,7 @@ public class PhyrexianSwarmlord extends CardImpl { class OpponentsPoisonCountersCount implements DynamicValue { @Override - public int calculate(Game game, Ability sourceAbility) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { int amount = 0; Set playerList = game.getOpponents(sourceAbility.getControllerId()); for (UUID playerUUID : playerList) { diff --git a/Mage.Sets/src/mage/sets/odyssey/SkeletalScrying.java b/Mage.Sets/src/mage/sets/odyssey/SkeletalScrying.java index 17ccdb2850..76c8a65210 100644 --- a/Mage.Sets/src/mage/sets/odyssey/SkeletalScrying.java +++ b/Mage.Sets/src/mage/sets/odyssey/SkeletalScrying.java @@ -27,12 +27,10 @@ */ package mage.sets.odyssey; -import java.util.UUID; import mage.abilities.Ability; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.costs.common.ExileFromGraveCost; import mage.abilities.dynamicvalue.DynamicValue; -import mage.abilities.dynamicvalue.common.GetXValue; import mage.abilities.dynamicvalue.common.ManacostVariableValue; import mage.abilities.dynamicvalue.common.StaticValue; import mage.abilities.effects.OneShotEffect; @@ -46,6 +44,8 @@ import mage.game.Game; import mage.players.Player; import mage.target.common.TargetCardInYourGraveyard; +import java.util.UUID; + /** * * @author jeffwadsworth @@ -134,8 +134,8 @@ class SkeletalScryingEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if ( controller != null ) { - controller.drawCards(amount.calculate(game, source), game); - controller.loseLife(amount.calculate(game, source), game); + controller.drawCards(amount.calculate(game, source, this), game); + controller.loseLife(amount.calculate(game, source, this), game); return true; } return false; diff --git a/Mage.Sets/src/mage/sets/onslaught/SoullessOne.java b/Mage.Sets/src/mage/sets/onslaught/SoullessOne.java index 74a3188e15..8232d3f58b 100644 --- a/Mage.Sets/src/mage/sets/onslaught/SoullessOne.java +++ b/Mage.Sets/src/mage/sets/onslaught/SoullessOne.java @@ -27,17 +27,16 @@ */ package mage.sets.onslaught; -import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.Effect; import mage.abilities.effects.common.continious.SetPowerToughnessSourceEffect; import mage.cards.CardImpl; +import mage.constants.CardType; import mage.constants.Duration; +import mage.constants.Rarity; import mage.constants.Zone; import mage.filter.FilterCard; import mage.filter.FilterPermanent; @@ -45,6 +44,8 @@ import mage.filter.predicate.mageobject.SubtypePredicate; import mage.game.Game; import mage.players.Player; +import java.util.UUID; + /** * * @author jeffwadsworth @@ -78,7 +79,7 @@ public class SoullessOne extends CardImpl { class SoullessOneDynamicCount implements DynamicValue { @Override - public int calculate(Game game, Ability sourceAbility) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { FilterPermanent zombiesBattlefield = new FilterPermanent("Zombies on the battlefield"); FilterCard zombiesInGraveyard = new FilterCard("Zombie cards in all graveyards"); zombiesBattlefield.add(new SubtypePredicate("Zombie")); diff --git a/Mage.Sets/src/mage/sets/ravnika/CrownOfConvergence.java b/Mage.Sets/src/mage/sets/ravnika/CrownOfConvergence.java index 4717f0cfba..7a6a8717b1 100644 --- a/Mage.Sets/src/mage/sets/ravnika/CrownOfConvergence.java +++ b/Mage.Sets/src/mage/sets/ravnika/CrownOfConvergence.java @@ -27,30 +27,27 @@ */ package mage.sets.ravnika; -import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; import mage.abilities.Ability; -import mage.abilities.condition.common.TopLibraryCardTypeCondition; -import mage.abilities.decorator.ConditionalContinousEffect; -import mage.cards.Card; -import mage.constants.Duration; -import mage.constants.Outcome; -import mage.players.Player; -import mage.abilities.effects.OneShotEffect; import mage.abilities.common.SimpleActivatedAbility; -import mage.abilities.costs.mana.ManaCostsImpl; -import mage.constants.Zone; -import mage.abilities.effects.common.continious.PlayWithTheTopCardRevealedEffect; -import static mage.abilities.condition.common.TopLibraryCardTypeCondition.CheckType.*; import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.condition.common.TopLibraryCardTypeCondition; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.decorator.ConditionalContinousEffect; +import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.continious.BoostAllEffect; +import mage.abilities.effects.common.continious.PlayWithTheTopCardRevealedEffect; +import mage.cards.Card; import mage.cards.CardImpl; +import mage.constants.*; import mage.filter.common.FilterControlledCreaturePermanent; import mage.filter.common.FilterCreaturePermanent; import mage.game.Game; import mage.game.permanent.Permanent; +import mage.players.Player; + +import java.util.UUID; + +import static mage.abilities.condition.common.TopLibraryCardTypeCondition.CheckType.CREATURE; /** * @@ -108,8 +105,8 @@ class CrownOfConvergenceColorBoostEffect extends BoostAllEffect { for (Permanent permanent: game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) { if (permanent.getColor().shares(topCard.getColor()) && !permanent.getColor().isColorless()) { if (!this.affectedObjectsSet || objects.contains(permanent.getId())) { - permanent.addPower(power.calculate(game, source)); - permanent.addToughness(toughness.calculate(game, source)); + permanent.addPower(power.calculate(game, source, this)); + permanent.addToughness(toughness.calculate(game, source, this)); } } } diff --git a/Mage.Sets/src/mage/sets/returntoravnica/CivicSaber.java b/Mage.Sets/src/mage/sets/returntoravnica/CivicSaber.java index 8e61742d73..d7de0f834f 100644 --- a/Mage.Sets/src/mage/sets/returntoravnica/CivicSaber.java +++ b/Mage.Sets/src/mage/sets/returntoravnica/CivicSaber.java @@ -26,20 +26,21 @@ * or implied, of BetaSteward_at_googlemail.com. */ package mage.sets.returntoravnica; - -import java.util.UUID; import mage.abilities.Ability; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.costs.mana.GenericManaCost; import mage.abilities.dynamicvalue.DynamicValue; import mage.abilities.dynamicvalue.common.StaticValue; +import mage.abilities.effects.Effect; import mage.abilities.effects.common.continious.BoostEquippedEffect; import mage.abilities.keyword.EquipAbility; import mage.cards.CardImpl; import mage.constants.*; import mage.game.Game; import mage.game.permanent.Permanent; + +import java.util.UUID; /** * @@ -77,7 +78,7 @@ class CivicSaberColorCount implements DynamicValue { } @Override - public int calculate(Game game, Ability source) { + public int calculate(Game game, Ability source, Effect effect) { int count = 0; Permanent equipment = game.getPermanent(source.getSourceId()); if (equipment != null) { diff --git a/Mage.Sets/src/mage/sets/returntoravnica/CryptbornHorror.java b/Mage.Sets/src/mage/sets/returntoravnica/CryptbornHorror.java index eb375a2023..052a61d3e7 100644 --- a/Mage.Sets/src/mage/sets/returntoravnica/CryptbornHorror.java +++ b/Mage.Sets/src/mage/sets/returntoravnica/CryptbornHorror.java @@ -91,7 +91,7 @@ class CryptbornHorrorEffect extends OneShotEffect { if (permanent != null) { OpponentsLostLifeCount dynamicValue = new OpponentsLostLifeCount(); if (dynamicValue != null) { - int oll = dynamicValue.calculate(game, source); + int oll = dynamicValue.calculate(game, source, this); if (oll > 0) { permanent.addCounters(CounterType.P1P1.createInstance(oll), game); } @@ -105,4 +105,4 @@ class CryptbornHorrorEffect extends OneShotEffect { public CryptbornHorrorEffect copy() { return new CryptbornHorrorEffect(this); } -} \ No newline at end of file +} diff --git a/Mage.Sets/src/mage/sets/returntoravnica/RakdosLordOfRiots.java b/Mage.Sets/src/mage/sets/returntoravnica/RakdosLordOfRiots.java index bbd582e093..0f2a7bb655 100644 --- a/Mage.Sets/src/mage/sets/returntoravnica/RakdosLordOfRiots.java +++ b/Mage.Sets/src/mage/sets/returntoravnica/RakdosLordOfRiots.java @@ -113,7 +113,7 @@ class RakdosLordOfRiotsCantCastEffect extends ContinuousRuleModifiyingEffectImpl @Override public boolean applies(GameEvent event, Ability source, Game game) { if (event.getType() == EventType.CAST_SPELL && event.getSourceId().equals(source.getSourceId())) { - if (new OpponentsLostLifeCount().calculate(game, source) == 0) { + if (new OpponentsLostLifeCount().calculate(game, source, this) == 0) { return true; } } @@ -137,7 +137,7 @@ class RakdosLordOfRiotsCostReductionEffect extends CostModificationEffectImpl { Ability spellAbility = (SpellAbility) abilityToModify; if (spellAbility != null) { OpponentsLostLifeCount dynamicValue = new OpponentsLostLifeCount(); - int amount = dynamicValue.calculate(game, source); + int amount = dynamicValue.calculate(game, source, this); if (amount > 0) { CardUtil.reduceCost(spellAbility, amount); return true; diff --git a/Mage.Sets/src/mage/sets/returntoravnica/RighteousAuthority.java b/Mage.Sets/src/mage/sets/returntoravnica/RighteousAuthority.java index d9b610d862..e7e21a15b0 100644 --- a/Mage.Sets/src/mage/sets/returntoravnica/RighteousAuthority.java +++ b/Mage.Sets/src/mage/sets/returntoravnica/RighteousAuthority.java @@ -28,28 +28,25 @@ package mage.sets.returntoravnica; -import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Duration; -import mage.constants.Outcome; -import mage.constants.Rarity; -import mage.constants.TargetController; -import mage.constants.Zone; import mage.abilities.Ability; import mage.abilities.common.BeginningOfDrawTriggeredAbility; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.Effect; import mage.abilities.effects.common.AttachEffect; import mage.abilities.effects.common.DrawCardTargetEffect; import mage.abilities.effects.common.continious.BoostEnchantedEffect; import mage.abilities.keyword.EnchantAbility; import mage.cards.CardImpl; +import mage.constants.*; import mage.game.Game; import mage.game.permanent.Permanent; import mage.players.Player; import mage.target.TargetPermanent; import mage.target.common.TargetCreaturePermanent; +import java.util.UUID; + /** * * @author LevelX2 @@ -91,7 +88,7 @@ public class RighteousAuthority extends CardImpl { class CardsInEnchantedControllerHandCount implements DynamicValue { @Override - public int calculate(Game game, Ability sourceAbility) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { if (sourceAbility != null) { Permanent attachment = game.getPermanent(sourceAbility.getSourceId()); if (attachment != null && attachment.getAttachedTo() != null) { @@ -121,4 +118,4 @@ class CardsInEnchantedControllerHandCount implements DynamicValue { public String toString() { return "1"; } -} \ No newline at end of file +} diff --git a/Mage.Sets/src/mage/sets/returntoravnica/SphereOfSafety.java b/Mage.Sets/src/mage/sets/returntoravnica/SphereOfSafety.java index 0136252fee..3afcbdedd4 100644 --- a/Mage.Sets/src/mage/sets/returntoravnica/SphereOfSafety.java +++ b/Mage.Sets/src/mage/sets/returntoravnica/SphereOfSafety.java @@ -101,7 +101,7 @@ class SphereOfSafetyReplacementEffect extends ReplacementEffectImpl { if ( event.getType() == GameEvent.EventType.DECLARE_ATTACKER) { Player player = game.getPlayer(event.getPlayerId()); if ( player != null ) { - int ce = countEnchantments.calculate(game, source); + int ce = countEnchantments.calculate(game, source, this); ManaCostsImpl safetyCosts = new ManaCostsImpl("{"+ ce +"}"); if ( safetyCosts.canPay(source, source.getSourceId(), event.getPlayerId(), game) && player.chooseUse(Outcome.Benefit, "Pay {"+ ce +"} to declare attacker?", game) ) @@ -137,4 +137,4 @@ class SphereOfSafetyReplacementEffect extends ReplacementEffectImpl { return new SphereOfSafetyReplacementEffect(this); } -} \ No newline at end of file +} diff --git a/Mage.Sets/src/mage/sets/riseoftheeldrazi/DevastatingSummons.java b/Mage.Sets/src/mage/sets/riseoftheeldrazi/DevastatingSummons.java index 6f351cb8d8..174d770d88 100644 --- a/Mage.Sets/src/mage/sets/riseoftheeldrazi/DevastatingSummons.java +++ b/Mage.Sets/src/mage/sets/riseoftheeldrazi/DevastatingSummons.java @@ -85,8 +85,8 @@ class DevastatingSummonsEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { ElementalToken token = new ElementalToken(); - token.getPower().initValue(new GetXValue().calculate(game, source)); - token.getToughness().initValue(new GetXValue().calculate(game, source)); + token.getPower().initValue(new GetXValue().calculate(game, source, this)); + token.getToughness().initValue(new GetXValue().calculate(game, source, this)); token.putOntoBattlefield(2, game, source.getSourceId(), source.getControllerId()); diff --git a/Mage.Sets/src/mage/sets/scarsofmirrodin/StrataScythe.java b/Mage.Sets/src/mage/sets/scarsofmirrodin/StrataScythe.java index 942db3eade..5c3996051b 100644 --- a/Mage.Sets/src/mage/sets/scarsofmirrodin/StrataScythe.java +++ b/Mage.Sets/src/mage/sets/scarsofmirrodin/StrataScythe.java @@ -28,21 +28,20 @@ package mage.sets.scarsofmirrodin; -import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; import mage.abilities.Ability; import mage.abilities.common.EntersBattlefieldTriggeredAbility; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.costs.mana.GenericManaCost; import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.Effect; import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.continious.BoostEquippedEffect; import mage.abilities.keyword.EquipAbility; import mage.cards.Card; import mage.cards.CardImpl; +import mage.constants.CardType; import mage.constants.Outcome; +import mage.constants.Rarity; import mage.constants.Zone; import mage.filter.FilterPermanent; import mage.filter.common.FilterLandCard; @@ -52,6 +51,8 @@ import mage.game.permanent.Permanent; import mage.players.Player; import mage.target.common.TargetCardInLibrary; +import java.util.UUID; + /** * * @author Loki @@ -129,7 +130,7 @@ class SameNameAsExiledCountValue implements DynamicValue { } @Override - public int calculate(Game game, Ability sourceAbility) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { int value = 0; Permanent permanent = game.getPermanent(sourceAbility.getSourceId()); if (permanent != null && permanent.getImprinted().size() > 0) { diff --git a/Mage.Sets/src/mage/sets/scourge/AncientOoze.java b/Mage.Sets/src/mage/sets/scourge/AncientOoze.java index 901147f62e..8df842f061 100644 --- a/Mage.Sets/src/mage/sets/scourge/AncientOoze.java +++ b/Mage.Sets/src/mage/sets/scourge/AncientOoze.java @@ -28,21 +28,23 @@ */ package mage.sets.scourge; -import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Rarity; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.Effect; import mage.abilities.effects.common.continious.SetPowerToughnessSourceEffect; import mage.cards.CardImpl; +import mage.constants.CardType; import mage.constants.Duration; +import mage.constants.Rarity; import mage.constants.Zone; import mage.filter.common.FilterControlledCreaturePermanent; import mage.game.Game; import mage.game.permanent.Permanent; +import java.util.UUID; + /** * * @author Backfir3 @@ -75,7 +77,7 @@ public class AncientOoze extends CardImpl { class AncientOozePowerToughnessValue implements DynamicValue { @Override - public int calculate(Game game, Ability sourceAbility) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { int value = 0; for(Permanent creature : game.getBattlefield().getActivePermanents(new FilterControlledCreaturePermanent(), sourceAbility.getControllerId(), game)){ if(creature != null && !sourceAbility.getSourceId().equals(creature.getId())){ diff --git a/Mage.Sets/src/mage/sets/seventhedition/SuddenImpact.java b/Mage.Sets/src/mage/sets/seventhedition/SuddenImpact.java index 18494fbe3d..3a7f83a3b3 100644 --- a/Mage.Sets/src/mage/sets/seventhedition/SuddenImpact.java +++ b/Mage.Sets/src/mage/sets/seventhedition/SuddenImpact.java @@ -71,7 +71,7 @@ public class SuddenImpact extends CardImpl { class TargetPlayerCardsInHandCount implements DynamicValue { @Override - public int calculate(Game game, Ability sourceAbility) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { Player targetPlayer = game.getPlayer(sourceAbility.getFirstTarget()); if (targetPlayer != null) { return targetPlayer.getHand().size(); diff --git a/Mage.Sets/src/mage/sets/shardsofalara/ViciousShadows.java b/Mage.Sets/src/mage/sets/shardsofalara/ViciousShadows.java index 7ee8ea2cb0..2dbeb83d21 100644 --- a/Mage.Sets/src/mage/sets/shardsofalara/ViciousShadows.java +++ b/Mage.Sets/src/mage/sets/shardsofalara/ViciousShadows.java @@ -27,18 +27,20 @@ */ package mage.sets.shardsofalara; -import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Rarity; import mage.abilities.Ability; import mage.abilities.common.DiesCreatureTriggeredAbility; import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.Effect; import mage.abilities.effects.common.DamageTargetEffect; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; import mage.game.Game; import mage.players.Player; import mage.target.TargetPlayer; +import java.util.UUID; + /** * * @author Plopman @@ -70,7 +72,7 @@ public class ViciousShadows extends CardImpl { class TargetPlayerCardsInHandCount implements DynamicValue { @Override - public int calculate(Game game, Ability sourceAbility) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { Player targetPlayer = game.getPlayer(sourceAbility.getFirstTarget()); if (targetPlayer != null) { return targetPlayer.getHand().size(); @@ -93,4 +95,4 @@ class TargetPlayerCardsInHandCount implements DynamicValue { public String getMessage() { return "target player's cards in hand"; } -} \ No newline at end of file +} diff --git a/Mage.Sets/src/mage/sets/tempest/Kindle.java b/Mage.Sets/src/mage/sets/tempest/Kindle.java index ee00d2480a..4e4e405749 100644 --- a/Mage.Sets/src/mage/sets/tempest/Kindle.java +++ b/Mage.Sets/src/mage/sets/tempest/Kindle.java @@ -90,7 +90,7 @@ class KindleCardsInAllGraveyardsCount implements DynamicValue { } @Override - public int calculate(Game game, Ability sourceAbility) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { int amount = 0; PlayerList playerList = game.getPlayerList(); for (UUID playerUUID : playerList) { diff --git a/Mage.Sets/src/mage/sets/theros/DiscipleOfPhenax.java b/Mage.Sets/src/mage/sets/theros/DiscipleOfPhenax.java index 9132c574df..3b46e08e93 100644 --- a/Mage.Sets/src/mage/sets/theros/DiscipleOfPhenax.java +++ b/Mage.Sets/src/mage/sets/theros/DiscipleOfPhenax.java @@ -102,7 +102,7 @@ class DiscipleOfPhenaxEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - int devotion = new DevotionCount(ColoredManaSymbol.B).calculate(game, source); + int devotion = new DevotionCount(ColoredManaSymbol.B).calculate(game, source, this); Player targetPlayer = game.getPlayer(targetPointer.getFirst(game, source)); if (devotion > 0 && targetPlayer != null) { Cards revealedCards = new CardsImpl(Zone.PICK); diff --git a/Mage.Sets/src/mage/sets/theros/GrayMerchantOfAsphodel.java b/Mage.Sets/src/mage/sets/theros/GrayMerchantOfAsphodel.java index 369ec0a17e..38bcd012ee 100644 --- a/Mage.Sets/src/mage/sets/theros/GrayMerchantOfAsphodel.java +++ b/Mage.Sets/src/mage/sets/theros/GrayMerchantOfAsphodel.java @@ -91,7 +91,7 @@ class GrayMerchantOfAsphodelEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { int lifeLost = 0; - int damage = new DevotionCount(ColoredManaSymbol.B).calculate(game, source); + int damage = new DevotionCount(ColoredManaSymbol.B).calculate(game, source, this); if (damage > 0) { for (UUID playerId : game.getOpponents(source.getControllerId())) { Player opponent = game.getPlayer(playerId); diff --git a/Mage.Sets/src/mage/sets/theros/MogissMarauder.java b/Mage.Sets/src/mage/sets/theros/MogissMarauder.java index b0d11163a8..895dfe2041 100644 --- a/Mage.Sets/src/mage/sets/theros/MogissMarauder.java +++ b/Mage.Sets/src/mage/sets/theros/MogissMarauder.java @@ -27,7 +27,6 @@ */ package mage.sets.theros; -import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.EntersBattlefieldTriggeredAbility; @@ -43,6 +42,8 @@ import mage.constants.Rarity; import mage.game.Game; import mage.target.common.TargetCreaturePermanent; +import java.util.UUID; + /** * * @author LevelX2 @@ -73,7 +74,7 @@ public class MogissMarauder extends CardImpl { public void adjustTargets(Ability ability, Game game) { if (ability instanceof EntersBattlefieldTriggeredAbility) { ability.getTargets().clear(); - int numbTargets = new DevotionCount(ColoredManaSymbol.B).calculate(game, ability); + int numbTargets = new DevotionCount(ColoredManaSymbol.B).calculate(game, ability, null); if (numbTargets > 0) { ability.addTarget(new TargetCreaturePermanent(0,numbTargets)); } diff --git a/Mage.Sets/src/mage/sets/theros/NykthosShrineToNyx.java b/Mage.Sets/src/mage/sets/theros/NykthosShrineToNyx.java index 31df994749..d44c7df618 100644 --- a/Mage.Sets/src/mage/sets/theros/NykthosShrineToNyx.java +++ b/Mage.Sets/src/mage/sets/theros/NykthosShrineToNyx.java @@ -136,15 +136,15 @@ class NykthosDynamicManaEffect extends ManaEffect { if (choice != null && choice instanceof ChoiceColor && choice.getChoice() != null) { String color = choice.getChoice(); if (color.equals("Red")) { - computedMana.setRed(new DevotionCount(ColoredManaSymbol.R).calculate(game, source)); + computedMana.setRed(new DevotionCount(ColoredManaSymbol.R).calculate(game, source, this)); } else if (color.equals("Blue")) { - computedMana.setBlue(new DevotionCount(ColoredManaSymbol.U).calculate(game, source)); + computedMana.setBlue(new DevotionCount(ColoredManaSymbol.U).calculate(game, source, this)); } else if (color.equals("White")) { - computedMana.setWhite(new DevotionCount(ColoredManaSymbol.W).calculate(game, source)); + computedMana.setWhite(new DevotionCount(ColoredManaSymbol.W).calculate(game, source, this)); } else if (color.equals("Black")) { - computedMana.setBlack(new DevotionCount(ColoredManaSymbol.B).calculate(game, source)); + computedMana.setBlack(new DevotionCount(ColoredManaSymbol.B).calculate(game, source, this)); } else if (color.equals("Green")) { - computedMana.setGreen(new DevotionCount(ColoredManaSymbol.G).calculate(game, source)); + computedMana.setGreen(new DevotionCount(ColoredManaSymbol.G).calculate(game, source, this)); } } } diff --git a/Mage.Sets/src/mage/sets/timespiral/ChildrenOfKorlis.java b/Mage.Sets/src/mage/sets/timespiral/ChildrenOfKorlis.java index 368c99ffd1..7fe9c28c5d 100644 --- a/Mage.Sets/src/mage/sets/timespiral/ChildrenOfKorlis.java +++ b/Mage.Sets/src/mage/sets/timespiral/ChildrenOfKorlis.java @@ -27,12 +27,12 @@ */ package mage.sets.timespiral; -import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.costs.common.SacrificeSourceCost; import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.Effect; import mage.abilities.effects.common.GainLifeEffect; import mage.cards.CardImpl; import mage.constants.CardType; @@ -41,6 +41,8 @@ import mage.constants.Zone; import mage.game.Game; import mage.watchers.common.PlayerLostLifeWatcher; +import java.util.UUID; + /** * * @author LevelX2 @@ -77,7 +79,7 @@ public class ChildrenOfKorlis extends CardImpl { class SourceControllerLostLifeCount implements DynamicValue { @Override - public int calculate(Game game, Ability sourceAbility) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { PlayerLostLifeWatcher watcher = (PlayerLostLifeWatcher) game.getState().getWatchers().get("PlayerLostLifeWatcher"); if (watcher != null) { return watcher.getLiveLost(sourceAbility.getControllerId()); diff --git a/Mage.Sets/src/mage/sets/torment/NostalgicDreams.java b/Mage.Sets/src/mage/sets/torment/NostalgicDreams.java index 17d5c14296..6845c3fcce 100644 --- a/Mage.Sets/src/mage/sets/torment/NostalgicDreams.java +++ b/Mage.Sets/src/mage/sets/torment/NostalgicDreams.java @@ -27,7 +27,6 @@ */ package mage.sets.torment; -import java.util.UUID; import mage.abilities.Ability; import mage.abilities.costs.common.DiscardXTargetCost; import mage.abilities.dynamicvalue.common.GetXValue; @@ -42,6 +41,8 @@ import mage.game.Game; import mage.target.Target; import mage.target.common.TargetCardInYourGraveyard; +import java.util.UUID; + /** * * @author LevelX2 @@ -71,7 +72,7 @@ public class NostalgicDreams extends CardImpl { @Override public void adjustTargets(Ability ability, Game game) { - int xValue = new GetXValue().calculate(game, ability); + int xValue = new GetXValue().calculate(game, ability, null); // if (xValue > 0) { Target target = new TargetCardInYourGraveyard(xValue, new FilterCard("card from your graveyard")); ability.addTarget(target); diff --git a/Mage.Sets/src/mage/sets/urzaslegacy/BlessedReversal.java b/Mage.Sets/src/mage/sets/urzaslegacy/BlessedReversal.java index 846045ac2a..9ceef83205 100644 --- a/Mage.Sets/src/mage/sets/urzaslegacy/BlessedReversal.java +++ b/Mage.Sets/src/mage/sets/urzaslegacy/BlessedReversal.java @@ -27,16 +27,18 @@ */ package mage.sets.urzaslegacy; -import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Rarity; import mage.abilities.Ability; import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.Effect; import mage.abilities.effects.common.GainLifeEffect; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; import mage.game.Game; import mage.game.combat.CombatGroup; +import java.util.UUID; + /** * * @author North @@ -66,7 +68,7 @@ public class BlessedReversal extends CardImpl { class BlessedReversalCount implements DynamicValue { @Override - public int calculate(Game game, Ability sourceAbility) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { int count = 0; for (CombatGroup combatGroup : game.getCombat().getGroups()) { if (combatGroup.getDefenderId().equals(sourceAbility.getControllerId())) { diff --git a/Mage.Sets/src/mage/sets/urzaslegacy/MoltenHydra.java b/Mage.Sets/src/mage/sets/urzaslegacy/MoltenHydra.java index d76bd3481a..645eec97f7 100644 --- a/Mage.Sets/src/mage/sets/urzaslegacy/MoltenHydra.java +++ b/Mage.Sets/src/mage/sets/urzaslegacy/MoltenHydra.java @@ -27,10 +27,6 @@ */ package mage.sets.urzaslegacy; -import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; @@ -39,9 +35,12 @@ import mage.abilities.costs.CostImpl; import mage.abilities.costs.common.TapSourceCost; import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.Effect; import mage.abilities.effects.common.DamageTargetEffect; import mage.abilities.effects.common.counter.AddCountersSourceEffect; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; import mage.constants.Zone; import mage.counters.Counter; import mage.counters.CounterType; @@ -49,6 +48,8 @@ import mage.game.Game; import mage.game.permanent.Permanent; import mage.target.common.TargetCreatureOrPlayer; +import java.util.UUID; + /** * * @author Plopman @@ -148,7 +149,7 @@ class MotltenHydraDynamicValue implements DynamicValue { } @Override - public int calculate(Game game, Ability source) { + public int calculate(Game game, Ability source, Effect effect) { int count = 0; for(Cost cost : source.getCosts()){ if(cost instanceof RemoveAllCountersSourceCost){ diff --git a/Mage.Sets/src/mage/sets/urzaslegacy/MultaniMaroSorcerer.java b/Mage.Sets/src/mage/sets/urzaslegacy/MultaniMaroSorcerer.java index bba6178299..9dd29ecf2f 100644 --- a/Mage.Sets/src/mage/sets/urzaslegacy/MultaniMaroSorcerer.java +++ b/Mage.Sets/src/mage/sets/urzaslegacy/MultaniMaroSorcerer.java @@ -27,22 +27,23 @@ */ package mage.sets.urzaslegacy; -import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.Effect; import mage.abilities.effects.common.continious.SetPowerToughnessSourceEffect; import mage.abilities.keyword.ShroudAbility; import mage.cards.CardImpl; +import mage.constants.CardType; import mage.constants.Duration; +import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.players.Player; +import java.util.UUID; + /** * * @author Plopman @@ -77,7 +78,7 @@ public class MultaniMaroSorcerer extends CardImpl { class CardsInHandCount implements DynamicValue { @Override - public int calculate(Game game, Ability sourceAbility) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { int count = 0; for (UUID playerId: game.getPlayer(sourceAbility.getControllerId()).getInRange()) { Player player = game.getPlayer(playerId); diff --git a/Mage.Sets/src/mage/sets/weatherlight/Firestorm.java b/Mage.Sets/src/mage/sets/weatherlight/Firestorm.java index 3dd89dac0d..3062a9d894 100644 --- a/Mage.Sets/src/mage/sets/weatherlight/Firestorm.java +++ b/Mage.Sets/src/mage/sets/weatherlight/Firestorm.java @@ -27,7 +27,6 @@ */ package mage.sets.weatherlight; -import java.util.UUID; import mage.abilities.Ability; import mage.abilities.costs.common.DiscardXTargetCost; import mage.abilities.dynamicvalue.common.GetXValue; @@ -43,6 +42,8 @@ import mage.players.Player; import mage.target.Target; import mage.target.common.TargetCreatureOrPlayer; +import java.util.UUID; + /** * * @author jeffwadsworth @@ -67,7 +68,7 @@ public class Firestorm extends CardImpl { @Override public void adjustTargets(Ability ability, Game game) { - int xValue = new GetXValue().calculate(game, ability); + int xValue = new GetXValue().calculate(game, ability, null); if (xValue > 0) { Target target = new TargetCreatureOrPlayer(xValue); ability.addTarget(target); @@ -94,7 +95,7 @@ class FirestormEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { Player you = game.getPlayer(source.getControllerId()); - int amount = (new GetXValue()).calculate(game, source); + int amount = (new GetXValue()).calculate(game, source, this); if (you != null) { if (source.getTargets().size() > 0) { for (UUID targetId : this.getTargetPointer().getTargets(game, source)) { diff --git a/Mage.Sets/src/mage/sets/weatherlight/OrcishSettlers.java b/Mage.Sets/src/mage/sets/weatherlight/OrcishSettlers.java index c81828074d..6333690c90 100644 --- a/Mage.Sets/src/mage/sets/weatherlight/OrcishSettlers.java +++ b/Mage.Sets/src/mage/sets/weatherlight/OrcishSettlers.java @@ -99,7 +99,7 @@ class OrcishSettlersEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - int amount = new ManacostVariableValue().calculate(game, source); + int amount = new ManacostVariableValue().calculate(game, source, this); TargetLandPermanent target = new TargetLandPermanent(amount); Player player = game.getPlayer(source.getControllerId()); diff --git a/Mage.Sets/src/mage/sets/worldwake/CometStorm.java b/Mage.Sets/src/mage/sets/worldwake/CometStorm.java index ea3fdbffbf..4bcf99dbe5 100644 --- a/Mage.Sets/src/mage/sets/worldwake/CometStorm.java +++ b/Mage.Sets/src/mage/sets/worldwake/CometStorm.java @@ -27,21 +27,22 @@ */ package mage.sets.worldwake; -import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Outcome; -import mage.constants.Rarity; import mage.abilities.Ability; import mage.abilities.SpellAbility; import mage.abilities.dynamicvalue.common.MultikickerCount; import mage.abilities.effects.OneShotEffect; import mage.abilities.keyword.MultikickerAbility; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; import mage.game.Game; import mage.game.permanent.Permanent; import mage.players.Player; import mage.target.common.TargetCreatureOrPlayer; +import java.util.UUID; + /** * * @author jeffwadsworth @@ -70,7 +71,7 @@ public class CometStorm extends CardImpl { public void adjustTargets(Ability ability, Game game) { if (ability instanceof SpellAbility) { ability.getTargets().clear(); - int numbTargets = new MultikickerCount().calculate(game, ability) + 1; + int numbTargets = new MultikickerCount().calculate(game, ability, null) + 1; ability.addTarget(new TargetCreatureOrPlayer(numbTargets)); } } diff --git a/Mage.Sets/src/mage/sets/worldwake/DeathforgeShaman.java b/Mage.Sets/src/mage/sets/worldwake/DeathforgeShaman.java index 0cd93aee4c..dec3e13a14 100644 --- a/Mage.Sets/src/mage/sets/worldwake/DeathforgeShaman.java +++ b/Mage.Sets/src/mage/sets/worldwake/DeathforgeShaman.java @@ -27,10 +27,6 @@ */ package mage.sets.worldwake; -import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Outcome; -import mage.constants.Rarity; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.EntersBattlefieldTriggeredAbility; @@ -39,10 +35,15 @@ import mage.abilities.dynamicvalue.common.MultikickerCount; import mage.abilities.effects.OneShotEffect; import mage.abilities.keyword.MultikickerAbility; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; import mage.game.Game; import mage.players.Player; import mage.target.TargetPlayer; +import java.util.UUID; + /** * * @author jeffwadsworth @@ -97,7 +98,7 @@ class DeathforgeShamanEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { DynamicValue value = new MultikickerCount(); - int damage = value.calculate(game, source) * 2; + int damage = value.calculate(game, source, this) * 2; Player player = game.getPlayer(source.getFirstTarget()); if (player != null) { diff --git a/Mage.Sets/src/mage/sets/worldwake/MarshalsAnthem.java b/Mage.Sets/src/mage/sets/worldwake/MarshalsAnthem.java index f400c18e49..6db90489b1 100644 --- a/Mage.Sets/src/mage/sets/worldwake/MarshalsAnthem.java +++ b/Mage.Sets/src/mage/sets/worldwake/MarshalsAnthem.java @@ -27,7 +27,6 @@ */ package mage.sets.worldwake; -import java.util.UUID; import mage.abilities.Ability; import mage.abilities.common.EntersBattlefieldTriggeredAbility; import mage.abilities.common.SimpleStaticAbility; @@ -38,11 +37,7 @@ import mage.abilities.effects.common.ReturnFromGraveyardToBattlefieldTargetEffec import mage.abilities.effects.common.continious.BoostAllEffect; import mage.abilities.keyword.MultikickerAbility; import mage.cards.CardImpl; -import mage.constants.CardType; -import mage.constants.Duration; -import mage.constants.Rarity; -import mage.constants.TargetController; -import mage.constants.Zone; +import mage.constants.*; import mage.filter.FilterCard; import mage.filter.common.FilterCreaturePermanent; import mage.filter.predicate.mageobject.CardTypePredicate; @@ -50,6 +45,8 @@ import mage.filter.predicate.permanent.ControllerPredicate; import mage.game.Game; import mage.target.common.TargetCardInYourGraveyard; +import java.util.UUID; + /** * * @author jeffwadsworth @@ -91,7 +88,7 @@ public class MarshalsAnthem extends CardImpl { public void adjustTargets(Ability ability, Game game) { if (ability instanceof ConditionalTriggeredAbility) { ability.getTargets().clear(); - int numbTargets = new MultikickerCount().calculate(game, ability); + int numbTargets = new MultikickerCount().calculate(game, ability, null); if (numbTargets > 0) { ability.addTarget(new TargetCardInYourGraveyard(0, numbTargets, filterCard)); } diff --git a/Mage.Sets/src/mage/sets/worldwake/StrengthOfTheTajuru.java b/Mage.Sets/src/mage/sets/worldwake/StrengthOfTheTajuru.java index 40a533c60b..e6f9c458e7 100644 --- a/Mage.Sets/src/mage/sets/worldwake/StrengthOfTheTajuru.java +++ b/Mage.Sets/src/mage/sets/worldwake/StrengthOfTheTajuru.java @@ -27,22 +27,23 @@ */ package mage.sets.worldwake; -import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Outcome; -import mage.constants.Rarity; import mage.abilities.Ability; import mage.abilities.SpellAbility; import mage.abilities.dynamicvalue.common.MultikickerCount; import mage.abilities.effects.OneShotEffect; import mage.abilities.keyword.MultikickerAbility; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; import mage.counters.Counter; import mage.counters.CounterType; import mage.game.Game; import mage.game.permanent.Permanent; import mage.target.common.TargetCreaturePermanent; +import java.util.UUID; + /** * @author noxx @@ -68,7 +69,7 @@ public class StrengthOfTheTajuru extends CardImpl { public void adjustTargets(Ability ability, Game game) { if (ability instanceof SpellAbility) { ability.getTargets().clear(); - int numbTargets = new MultikickerCount().calculate(game, ability) + 1; + int numbTargets = new MultikickerCount().calculate(game, ability, null) + 1; ability.addTarget(new TargetCreaturePermanent(0, numbTargets)); } } diff --git a/Mage.Sets/src/mage/sets/worldwake/VoyagerDrake.java b/Mage.Sets/src/mage/sets/worldwake/VoyagerDrake.java index abe842ae21..6df5fec7fb 100644 --- a/Mage.Sets/src/mage/sets/worldwake/VoyagerDrake.java +++ b/Mage.Sets/src/mage/sets/worldwake/VoyagerDrake.java @@ -27,10 +27,6 @@ */ package mage.sets.worldwake; -import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.EntersBattlefieldTriggeredAbility; @@ -41,10 +37,14 @@ import mage.abilities.effects.common.continious.GainAbilityTargetEffect; import mage.abilities.keyword.FlyingAbility; import mage.abilities.keyword.MultikickerAbility; import mage.cards.CardImpl; +import mage.constants.CardType; import mage.constants.Duration; +import mage.constants.Rarity; import mage.game.Game; import mage.target.common.TargetCreaturePermanent; +import java.util.UUID; + /** * * @author jeffwadsworth @@ -78,7 +78,7 @@ public class VoyagerDrake extends CardImpl { public void adjustTargets(Ability ability, Game game) { if (ability instanceof ConditionalTriggeredAbility) { ability.getTargets().clear(); - int numbTargets = new MultikickerCount().calculate(game, ability); + int numbTargets = new MultikickerCount().calculate(game, ability, null); if (numbTargets > 0) { ability.addTarget(new TargetCreaturePermanent(0,numbTargets)); } diff --git a/Mage.Sets/src/mage/sets/zendikar/BoldDefense.java b/Mage.Sets/src/mage/sets/zendikar/BoldDefense.java index 75c2c8789f..1704d44537 100644 --- a/Mage.Sets/src/mage/sets/zendikar/BoldDefense.java +++ b/Mage.Sets/src/mage/sets/zendikar/BoldDefense.java @@ -27,7 +27,6 @@ */ package mage.sets.zendikar; -import java.util.UUID; import mage.abilities.Ability; import mage.abilities.condition.Condition; import mage.abilities.condition.LockedInCondition; @@ -35,6 +34,7 @@ import mage.abilities.condition.common.KickedCondition; import mage.abilities.decorator.ConditionalContinousEffect; import mage.abilities.dynamicvalue.DynamicValue; import mage.abilities.effects.ContinuousEffect; +import mage.abilities.effects.Effect; import mage.abilities.effects.common.continious.BoostControlledEffect; import mage.abilities.effects.common.continious.GainAbilityControlledEffect; import mage.abilities.keyword.FirstStrikeAbility; @@ -46,6 +46,8 @@ import mage.constants.Rarity; import mage.filter.common.FilterCreaturePermanent; import mage.game.Game; +import java.util.UUID; + /** * @author nantuko, Loki @@ -87,7 +89,7 @@ class BoldDefensePTCount implements DynamicValue { } @Override - public int calculate(Game game, Ability sourceAbility) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { if (condition.apply(game, sourceAbility)) { return 2; } else { @@ -114,4 +116,4 @@ class BoldDefensePTCount implements DynamicValue { public String getMessage() { return "1"; } -} +} diff --git a/Mage.Sets/src/mage/sets/zendikar/RuneflareTrap.java b/Mage.Sets/src/mage/sets/zendikar/RuneflareTrap.java index 7a8f509056..68deafa62a 100644 --- a/Mage.Sets/src/mage/sets/zendikar/RuneflareTrap.java +++ b/Mage.Sets/src/mage/sets/zendikar/RuneflareTrap.java @@ -27,15 +27,16 @@ */ package mage.sets.zendikar; -import mage.constants.CardType; -import mage.constants.Rarity; -import mage.constants.WatcherScope; import mage.abilities.Ability; import mage.abilities.costs.AlternativeCostImpl; import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.Effect; import mage.abilities.effects.common.DamageTargetEffect; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.WatcherScope; import mage.game.Game; import mage.game.events.GameEvent; import mage.players.Player; @@ -80,7 +81,7 @@ public class RuneflareTrap extends CardImpl { class TargetPlayerCardsInHandCount implements DynamicValue { @Override - public int calculate(Game game, Ability sourceAbility) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { Player targetPlayer = game.getPlayer(sourceAbility.getFirstTarget()); if (targetPlayer != null) { return targetPlayer.getHand().size(); diff --git a/Mage/src/mage/abilities/costs/common/PayLifeCost.java b/Mage/src/mage/abilities/costs/common/PayLifeCost.java index bdd36a7f3d..39c81213d9 100644 --- a/Mage/src/mage/abilities/costs/common/PayLifeCost.java +++ b/Mage/src/mage/abilities/costs/common/PayLifeCost.java @@ -30,11 +30,11 @@ package mage.abilities.costs.common; import mage.abilities.Ability; import mage.abilities.costs.CostImpl; +import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.dynamicvalue.common.StaticValue; import mage.game.Game; import java.util.UUID; -import mage.abilities.dynamicvalue.DynamicValue; -import mage.abilities.dynamicvalue.common.StaticValue; /** * @@ -65,7 +65,7 @@ public class PayLifeCost extends CostImpl { //the player may do so only if his or her life total is greater than or equal to the //amount of the payment. If a player pays life, the payment is subtracted from his or //her life total; in other words, the player loses that much life. (Players can always pay 0 life.) - int lifeToPayAmount = amount.calculate(game, ability); + int lifeToPayAmount = amount.calculate(game, ability, null); if (lifeToPayAmount > 0 && !game.getPlayer(controllerId).canPayLifeCost()) { return false; } @@ -74,7 +74,7 @@ public class PayLifeCost extends CostImpl { @Override public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { - int lifeToPayAmount = amount.calculate(game, ability); + int lifeToPayAmount = amount.calculate(game, ability, null); this.paid = game.getPlayer(controllerId).loseLife(lifeToPayAmount, game) == lifeToPayAmount; return paid; } diff --git a/Mage/src/mage/abilities/dynamicvalue/DynamicValue.java b/Mage/src/mage/abilities/dynamicvalue/DynamicValue.java index a6845a51e4..44e53b5b8b 100644 --- a/Mage/src/mage/abilities/dynamicvalue/DynamicValue.java +++ b/Mage/src/mage/abilities/dynamicvalue/DynamicValue.java @@ -1,12 +1,13 @@ package mage.abilities.dynamicvalue; import mage.abilities.Ability; +import mage.abilities.effects.Effect; import mage.game.Game; import java.io.Serializable; public interface DynamicValue extends Serializable { - int calculate(Game game, Ability sourceAbility); + int calculate(Game game, Ability sourceAbility, Effect effect); DynamicValue copy(); String getMessage(); } diff --git a/Mage/src/mage/abilities/dynamicvalue/IntPlusDynamicValue.java b/Mage/src/mage/abilities/dynamicvalue/IntPlusDynamicValue.java index ac1171721a..bb787f1db5 100644 --- a/Mage/src/mage/abilities/dynamicvalue/IntPlusDynamicValue.java +++ b/Mage/src/mage/abilities/dynamicvalue/IntPlusDynamicValue.java @@ -29,6 +29,7 @@ package mage.abilities.dynamicvalue; import mage.abilities.Ability; +import mage.abilities.effects.Effect; import mage.game.Game; /** @@ -51,8 +52,8 @@ public class IntPlusDynamicValue implements DynamicValue { } @Override - public int calculate(Game game, Ability sourceAbility) { - return baseValue + value.calculate(game, sourceAbility); + public int calculate(Game game, Ability sourceAbility, Effect effect) { + return baseValue + value.calculate(game, sourceAbility, effect); } @Override diff --git a/Mage/src/mage/abilities/dynamicvalue/MultipliedValue.java b/Mage/src/mage/abilities/dynamicvalue/MultipliedValue.java index ca0377302e..142e495746 100644 --- a/Mage/src/mage/abilities/dynamicvalue/MultipliedValue.java +++ b/Mage/src/mage/abilities/dynamicvalue/MultipliedValue.java @@ -29,6 +29,7 @@ package mage.abilities.dynamicvalue; import mage.abilities.Ability; +import mage.abilities.effects.Effect; import mage.game.Game; /** @@ -51,8 +52,8 @@ public class MultipliedValue implements DynamicValue { } @Override - public int calculate(Game game, Ability sourceAbility) { - return multplier * value.calculate(game, sourceAbility); + public int calculate(Game game, Ability sourceAbility, Effect effect) { + return multplier * value.calculate(game, sourceAbility, effect); } @Override diff --git a/Mage/src/mage/abilities/dynamicvalue/common/AttackingCreatureCount.java b/Mage/src/mage/abilities/dynamicvalue/common/AttackingCreatureCount.java index 3a276ebf5e..cb14e541b4 100644 --- a/Mage/src/mage/abilities/dynamicvalue/common/AttackingCreatureCount.java +++ b/Mage/src/mage/abilities/dynamicvalue/common/AttackingCreatureCount.java @@ -30,6 +30,7 @@ package mage.abilities.dynamicvalue.common; import mage.abilities.Ability; import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.Effect; import mage.game.Game; import mage.game.combat.CombatGroup; @@ -57,7 +58,7 @@ public class AttackingCreatureCount implements DynamicValue { } @Override - public int calculate(Game game, Ability sourceAbility) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { int count = 0; for (CombatGroup combatGroup : game.getCombat().getGroups()) { count += combatGroup.getAttackers().size(); diff --git a/Mage/src/mage/abilities/dynamicvalue/common/AuraAttachedCount.java b/Mage/src/mage/abilities/dynamicvalue/common/AuraAttachedCount.java index 97fe64af19..373025c438 100644 --- a/Mage/src/mage/abilities/dynamicvalue/common/AuraAttachedCount.java +++ b/Mage/src/mage/abilities/dynamicvalue/common/AuraAttachedCount.java @@ -27,13 +27,15 @@ */ package mage.abilities.dynamicvalue.common; -import java.util.List; -import java.util.UUID; import mage.abilities.Ability; import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.Effect; import mage.game.Game; import mage.game.permanent.Permanent; +import java.util.List; +import java.util.UUID; + /** * * @author North @@ -55,7 +57,7 @@ public class AuraAttachedCount implements DynamicValue { } @Override - public int calculate(Game game, Ability source) { + public int calculate(Game game, Ability source, Effect effect) { int count = 0; Permanent p = game.getPermanent(source.getSourceId()); if (p != null) { diff --git a/Mage/src/mage/abilities/dynamicvalue/common/CardsInAllGraveyardsCount.java b/Mage/src/mage/abilities/dynamicvalue/common/CardsInAllGraveyardsCount.java index 0e27b49cfb..51eab83954 100644 --- a/Mage/src/mage/abilities/dynamicvalue/common/CardsInAllGraveyardsCount.java +++ b/Mage/src/mage/abilities/dynamicvalue/common/CardsInAllGraveyardsCount.java @@ -4,14 +4,16 @@ */ package mage.abilities.dynamicvalue.common; -import java.util.UUID; import mage.abilities.Ability; import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.Effect; import mage.filter.FilterCard; import mage.game.Game; import mage.players.Player; import mage.players.PlayerList; +import java.util.UUID; + /** * * @author North @@ -33,7 +35,7 @@ public class CardsInAllGraveyardsCount implements DynamicValue { } @Override - public int calculate(Game game, Ability sourceAbility) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { int amount = 0; PlayerList playerList = game.getPlayerList(); for (UUID playerUUID : playerList) { diff --git a/Mage/src/mage/abilities/dynamicvalue/common/CardsInControllerGraveyardCount.java b/Mage/src/mage/abilities/dynamicvalue/common/CardsInControllerGraveyardCount.java index c1f1a066cd..114bbba06d 100644 --- a/Mage/src/mage/abilities/dynamicvalue/common/CardsInControllerGraveyardCount.java +++ b/Mage/src/mage/abilities/dynamicvalue/common/CardsInControllerGraveyardCount.java @@ -2,6 +2,7 @@ package mage.abilities.dynamicvalue.common; import mage.abilities.Ability; import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.Effect; import mage.filter.FilterCard; import mage.game.Game; import mage.players.Player; @@ -34,7 +35,7 @@ public class CardsInControllerGraveyardCount implements DynamicValue { } @Override - public int calculate(Game game, Ability sourceAbility) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { Player player = game.getPlayer(sourceAbility.getControllerId()); if (player != null) { return amount * player.getGraveyard().count(filter, game); diff --git a/Mage/src/mage/abilities/dynamicvalue/common/CardsInControllerHandCount.java b/Mage/src/mage/abilities/dynamicvalue/common/CardsInControllerHandCount.java index af833f3815..f94de01572 100644 --- a/Mage/src/mage/abilities/dynamicvalue/common/CardsInControllerHandCount.java +++ b/Mage/src/mage/abilities/dynamicvalue/common/CardsInControllerHandCount.java @@ -2,12 +2,13 @@ package mage.abilities.dynamicvalue.common; import mage.abilities.Ability; import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.Effect; import mage.game.Game; import mage.players.Player; public class CardsInControllerHandCount implements DynamicValue { @Override - public int calculate(Game game, Ability sourceAbility) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { if (sourceAbility != null) { Player controller = game.getPlayer(sourceAbility.getControllerId()); if (controller != null) { diff --git a/Mage/src/mage/abilities/dynamicvalue/common/ControllerGotLifeCount.java b/Mage/src/mage/abilities/dynamicvalue/common/ControllerGotLifeCount.java index 93a1d1ac69..3a06c8aa58 100644 --- a/Mage/src/mage/abilities/dynamicvalue/common/ControllerGotLifeCount.java +++ b/Mage/src/mage/abilities/dynamicvalue/common/ControllerGotLifeCount.java @@ -28,15 +28,17 @@ package mage.abilities.dynamicvalue.common; -import java.io.ObjectStreamException; -import java.util.UUID; import mage.abilities.Ability; import mage.abilities.MageSingleton; import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.Effect; import mage.cards.Card; import mage.game.Game; import mage.watchers.common.PlayerGainedLifeWatcher; +import java.io.ObjectStreamException; +import java.util.UUID; + /** * Amount of life the controller got this turn. * @@ -57,7 +59,7 @@ public class ControllerGotLifeCount implements DynamicValue, MageSingleton { } @Override - public int calculate(Game game, Ability sourceAbility) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { return this.calculate(game, sourceAbility.getControllerId()); } diff --git a/Mage/src/mage/abilities/dynamicvalue/common/ControllerLifeCount.java b/Mage/src/mage/abilities/dynamicvalue/common/ControllerLifeCount.java index c81113a4b2..688b28b63c 100644 --- a/Mage/src/mage/abilities/dynamicvalue/common/ControllerLifeCount.java +++ b/Mage/src/mage/abilities/dynamicvalue/common/ControllerLifeCount.java @@ -2,12 +2,13 @@ package mage.abilities.dynamicvalue.common; import mage.abilities.Ability; import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.Effect; import mage.game.Game; import mage.players.Player; public class ControllerLifeCount implements DynamicValue { @Override - public int calculate(Game game, Ability sourceAbility) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { Player p = game.getPlayer(sourceAbility.getControllerId()); if (p != null) { return p.getLife(); diff --git a/Mage/src/mage/abilities/dynamicvalue/common/CountersCount.java b/Mage/src/mage/abilities/dynamicvalue/common/CountersCount.java index 931839cc7b..a4a8dc99cf 100644 --- a/Mage/src/mage/abilities/dynamicvalue/common/CountersCount.java +++ b/Mage/src/mage/abilities/dynamicvalue/common/CountersCount.java @@ -3,6 +3,7 @@ package mage.abilities.dynamicvalue.common; import mage.MageObject; import mage.abilities.Ability; import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.Effect; import mage.constants.Zone; import mage.counters.CounterType; import mage.game.Game; @@ -20,7 +21,7 @@ public class CountersCount implements DynamicValue { } @Override - public int calculate(Game game, Ability sourceAbility) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { Permanent p = game.getPermanent(sourceAbility.getSourceId()); // if permanent already leaves the battlefield, try to find counters count via last known information if (p == null) { diff --git a/Mage/src/mage/abilities/dynamicvalue/common/DevotionCount.java b/Mage/src/mage/abilities/dynamicvalue/common/DevotionCount.java index 73b8b10ffd..439f2146e3 100644 --- a/Mage/src/mage/abilities/dynamicvalue/common/DevotionCount.java +++ b/Mage/src/mage/abilities/dynamicvalue/common/DevotionCount.java @@ -4,15 +4,17 @@ */ package mage.abilities.dynamicvalue.common; -import java.util.ArrayList; -import java.util.Arrays; import mage.abilities.Ability; import mage.abilities.costs.mana.ManaCost; import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.Effect; import mage.constants.ColoredManaSymbol; import mage.game.Game; import mage.game.permanent.Permanent; +import java.util.ArrayList; +import java.util.Arrays; + /** * Each colored mana symbol (e.g. {U}) in the mana costs of permanents you control counts toward your devotion to that color. * @@ -31,7 +33,7 @@ public class DevotionCount implements DynamicValue { } @Override - public int calculate(Game game, Ability sourceAbility) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { int devotion = 0; for (Permanent permanent : game.getBattlefield().getAllActivePermanents(sourceAbility.getControllerId())) { for(ManaCost manaCost :permanent.getManaCost()) { diff --git a/Mage/src/mage/abilities/dynamicvalue/common/DevouredCreaturesCount.java b/Mage/src/mage/abilities/dynamicvalue/common/DevouredCreaturesCount.java index 0d530d515e..7f3084786d 100644 --- a/Mage/src/mage/abilities/dynamicvalue/common/DevouredCreaturesCount.java +++ b/Mage/src/mage/abilities/dynamicvalue/common/DevouredCreaturesCount.java @@ -60,14 +60,14 @@ public class DevouredCreaturesCount implements DynamicValue { } @Override - public int calculate(Game game, Ability sourceAbility) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { Permanent sourcePermanent = game.getPermanent(sourceAbility.getSourceId()); if (sourcePermanent != null) { for (Ability ability : sourcePermanent.getAbilities()) { if (ability instanceof DevourAbility) { - for (Effect effect: ability.getEffects()) { - if (effect instanceof DevourEffect) { - DevourEffect devourEffect = (DevourEffect) effect; + for (Effect abilityEffect: ability.getEffects()) { + if (abilityEffect instanceof DevourEffect) { + DevourEffect devourEffect = (DevourEffect) abilityEffect; return devourEffect.getDevouredCreaturesAmount(game, sourcePermanent.getId()) * multiplier; } } diff --git a/Mage/src/mage/abilities/dynamicvalue/common/DiscardCostCardConvertedMana.java b/Mage/src/mage/abilities/dynamicvalue/common/DiscardCostCardConvertedMana.java index 02631fdef5..773e73e12e 100644 --- a/Mage/src/mage/abilities/dynamicvalue/common/DiscardCostCardConvertedMana.java +++ b/Mage/src/mage/abilities/dynamicvalue/common/DiscardCostCardConvertedMana.java @@ -4,6 +4,7 @@ import mage.abilities.Ability; import mage.abilities.costs.Cost; import mage.abilities.costs.common.DiscardCardCost; import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.Effect; import mage.cards.Card; import mage.game.Game; @@ -13,7 +14,7 @@ import mage.game.Game; public class DiscardCostCardConvertedMana implements DynamicValue { @Override - public int calculate(Game game, Ability sourceAbility) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { for (Cost cost: sourceAbility.getCosts()) { if (cost instanceof DiscardCardCost) { DiscardCardCost discardCost = (DiscardCardCost) cost; diff --git a/Mage/src/mage/abilities/dynamicvalue/common/DomainValue.java b/Mage/src/mage/abilities/dynamicvalue/common/DomainValue.java index 515aa62191..1e34821bb4 100644 --- a/Mage/src/mage/abilities/dynamicvalue/common/DomainValue.java +++ b/Mage/src/mage/abilities/dynamicvalue/common/DomainValue.java @@ -2,6 +2,7 @@ package mage.abilities.dynamicvalue.common; import mage.abilities.Ability; import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.Effect; import mage.constants.CardType; import mage.game.Game; import mage.game.permanent.Permanent; @@ -25,7 +26,7 @@ public class DomainValue implements DynamicValue { } @Override - public int calculate(Game game, Ability sourceAbility) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { int havePlains = 0; int haveIslands = 0; int haveMountains = 0; diff --git a/Mage/src/mage/abilities/dynamicvalue/common/EquipmentAttachedCount.java b/Mage/src/mage/abilities/dynamicvalue/common/EquipmentAttachedCount.java index 8fbfccad70..dcbba5c951 100644 --- a/Mage/src/mage/abilities/dynamicvalue/common/EquipmentAttachedCount.java +++ b/Mage/src/mage/abilities/dynamicvalue/common/EquipmentAttachedCount.java @@ -29,6 +29,7 @@ package mage.abilities.dynamicvalue.common; import mage.abilities.Ability; import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.Effect; import mage.game.Game; import mage.game.permanent.Permanent; @@ -56,7 +57,7 @@ public class EquipmentAttachedCount implements DynamicValue { } @Override - public int calculate(Game game, Ability source) { + public int calculate(Game game, Ability source, Effect effect) { int count = 0; Permanent permanent = game.getPermanent(source.getSourceId()); // don't change this - may affect other cards if (permanent != null) { diff --git a/Mage/src/mage/abilities/dynamicvalue/common/ExileFromHandCostCardConvertedMana.java b/Mage/src/mage/abilities/dynamicvalue/common/ExileFromHandCostCardConvertedMana.java index 9039ab02fd..eb24c0f60f 100644 --- a/Mage/src/mage/abilities/dynamicvalue/common/ExileFromHandCostCardConvertedMana.java +++ b/Mage/src/mage/abilities/dynamicvalue/common/ExileFromHandCostCardConvertedMana.java @@ -31,6 +31,7 @@ import mage.abilities.Ability; import mage.abilities.costs.Cost; import mage.abilities.costs.common.ExileFromHandCost; import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.Effect; import mage.cards.Card; import mage.game.Game; @@ -47,7 +48,7 @@ import mage.game.Game; public class ExileFromHandCostCardConvertedMana implements DynamicValue { @Override - public int calculate(Game game, Ability sourceAbility) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { for (Cost cost: sourceAbility.getCosts()) { if (cost.isPaid() && cost instanceof ExileFromHandCost) { int xValue = 0; diff --git a/Mage/src/mage/abilities/dynamicvalue/common/GetXValue.java b/Mage/src/mage/abilities/dynamicvalue/common/GetXValue.java index 9579e04e3d..59e11543f1 100644 --- a/Mage/src/mage/abilities/dynamicvalue/common/GetXValue.java +++ b/Mage/src/mage/abilities/dynamicvalue/common/GetXValue.java @@ -30,6 +30,7 @@ package mage.abilities.dynamicvalue.common; import mage.abilities.Ability; import mage.abilities.costs.VariableCost; import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.Effect; import mage.game.Game; /** @@ -38,7 +39,7 @@ import mage.game.Game; */ public class GetXValue implements DynamicValue { @Override - public int calculate(Game game, Ability sourceAbility) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { int amount = 0; for (VariableCost cost: sourceAbility.getCosts().getVariableCosts()) { amount += cost.getAmount(); diff --git a/Mage/src/mage/abilities/dynamicvalue/common/ManaSpentToCastCount.java b/Mage/src/mage/abilities/dynamicvalue/common/ManaSpentToCastCount.java index 33263dd6e6..6a732cb752 100644 --- a/Mage/src/mage/abilities/dynamicvalue/common/ManaSpentToCastCount.java +++ b/Mage/src/mage/abilities/dynamicvalue/common/ManaSpentToCastCount.java @@ -29,6 +29,7 @@ package mage.abilities.dynamicvalue.common; import mage.abilities.Ability; import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.Effect; import mage.game.Game; import mage.game.stack.Spell; import mage.game.stack.StackObject; @@ -43,7 +44,7 @@ public class ManaSpentToCastCount implements DynamicValue{ } @Override - public int calculate(Game game, Ability source) { + public int calculate(Game game, Ability source, Effect effect) { if (!game.getStack().isEmpty()) { for (StackObject stackObject : game.getStack()) { if (stackObject instanceof Spell && ((Spell)stackObject).getSourceId().equals(source.getSourceId())) { diff --git a/Mage/src/mage/abilities/dynamicvalue/common/ManaTypeInManaPoolCount.java b/Mage/src/mage/abilities/dynamicvalue/common/ManaTypeInManaPoolCount.java index 30e1f33874..50275a242c 100644 --- a/Mage/src/mage/abilities/dynamicvalue/common/ManaTypeInManaPoolCount.java +++ b/Mage/src/mage/abilities/dynamicvalue/common/ManaTypeInManaPoolCount.java @@ -1,8 +1,9 @@ package mage.abilities.dynamicvalue.common; -import mage.constants.ManaType; import mage.abilities.Ability; import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.Effect; +import mage.constants.ManaType; import mage.game.Game; import mage.players.Player; @@ -23,7 +24,7 @@ public class ManaTypeInManaPoolCount implements DynamicValue { } @Override - public int calculate(Game game, Ability sourceAbility) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { int amount = 0; Player player = game.getPlayer(sourceAbility.getControllerId()); if (player != null) { diff --git a/Mage/src/mage/abilities/dynamicvalue/common/ManacostVariableValue.java b/Mage/src/mage/abilities/dynamicvalue/common/ManacostVariableValue.java index ca6bdd741d..38b6968264 100644 --- a/Mage/src/mage/abilities/dynamicvalue/common/ManacostVariableValue.java +++ b/Mage/src/mage/abilities/dynamicvalue/common/ManacostVariableValue.java @@ -2,12 +2,13 @@ package mage.abilities.dynamicvalue.common; import mage.abilities.Ability; import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.Effect; import mage.game.Game; public class ManacostVariableValue implements DynamicValue { @Override - public int calculate(Game game, Ability sourceAbility) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { return sourceAbility.getManaCostsToPay().getX(); } diff --git a/Mage/src/mage/abilities/dynamicvalue/common/MultikickerCount.java b/Mage/src/mage/abilities/dynamicvalue/common/MultikickerCount.java index 5559399eb1..7ad2b93eeb 100644 --- a/Mage/src/mage/abilities/dynamicvalue/common/MultikickerCount.java +++ b/Mage/src/mage/abilities/dynamicvalue/common/MultikickerCount.java @@ -29,6 +29,7 @@ package mage.abilities.dynamicvalue.common; import mage.abilities.Ability; import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.Effect; import mage.abilities.keyword.KickerAbility; import mage.cards.Card; import mage.game.Game; @@ -43,7 +44,7 @@ public class MultikickerCount implements DynamicValue { } @Override - public int calculate(Game game, Ability source) { + public int calculate(Game game, Ability source, Effect effect) { int count = 0; Card card = game.getCard(source.getSourceId()); if (card != null) { diff --git a/Mage/src/mage/abilities/dynamicvalue/common/OpponentsLostLifeCount.java b/Mage/src/mage/abilities/dynamicvalue/common/OpponentsLostLifeCount.java index 6292f6a514..3a227d2042 100644 --- a/Mage/src/mage/abilities/dynamicvalue/common/OpponentsLostLifeCount.java +++ b/Mage/src/mage/abilities/dynamicvalue/common/OpponentsLostLifeCount.java @@ -28,12 +28,14 @@ package mage.abilities.dynamicvalue.common; -import java.util.UUID; import mage.abilities.Ability; import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.Effect; import mage.game.Game; import mage.watchers.common.PlayerLostLifeWatcher; +import java.util.UUID; + /** * * @author LevelX2 @@ -42,7 +44,7 @@ import mage.watchers.common.PlayerLostLifeWatcher; public class OpponentsLostLifeCount implements DynamicValue { @Override - public int calculate(Game game, Ability sourceAbility) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { return this.calculate(game, sourceAbility.getControllerId()); } diff --git a/Mage/src/mage/abilities/dynamicvalue/common/PermanentsOnBattlefieldCount.java b/Mage/src/mage/abilities/dynamicvalue/common/PermanentsOnBattlefieldCount.java index df5e1adefb..a1875905cb 100644 --- a/Mage/src/mage/abilities/dynamicvalue/common/PermanentsOnBattlefieldCount.java +++ b/Mage/src/mage/abilities/dynamicvalue/common/PermanentsOnBattlefieldCount.java @@ -2,6 +2,7 @@ package mage.abilities.dynamicvalue.common; import mage.abilities.Ability; import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.Effect; import mage.filter.FilterPermanent; import mage.game.Game; @@ -33,7 +34,7 @@ public class PermanentsOnBattlefieldCount implements DynamicValue { } @Override - public int calculate(Game game, Ability sourceAbility) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { int value = game.getBattlefield().count(filter, sourceAbility.getSourceId(), sourceAbility.getControllerId(), game); if (multiplier != null) { value *= multiplier; diff --git a/Mage/src/mage/abilities/dynamicvalue/common/RemovedCountersForCostValue.java b/Mage/src/mage/abilities/dynamicvalue/common/RemovedCountersForCostValue.java index d6d36c1cea..4d27f4daca 100644 --- a/Mage/src/mage/abilities/dynamicvalue/common/RemovedCountersForCostValue.java +++ b/Mage/src/mage/abilities/dynamicvalue/common/RemovedCountersForCostValue.java @@ -10,6 +10,7 @@ import mage.abilities.Ability; import mage.abilities.costs.Cost; import mage.abilities.costs.common.RemoveVariableCountersSourceCost; import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.Effect; import mage.game.Game; /** @@ -19,7 +20,7 @@ import mage.game.Game; public class RemovedCountersForCostValue implements DynamicValue { @Override - public int calculate(Game game, Ability sourceAbility) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { for (Cost cost: sourceAbility.getCosts()) { if (cost instanceof RemoveVariableCountersSourceCost) { return ((RemoveVariableCountersSourceCost) cost).getAmount(); diff --git a/Mage/src/mage/abilities/dynamicvalue/common/RevealTargetFromHandCostCount.java b/Mage/src/mage/abilities/dynamicvalue/common/RevealTargetFromHandCostCount.java index daf18f5f0c..373b5889e7 100644 --- a/Mage/src/mage/abilities/dynamicvalue/common/RevealTargetFromHandCostCount.java +++ b/Mage/src/mage/abilities/dynamicvalue/common/RevealTargetFromHandCostCount.java @@ -10,6 +10,7 @@ import mage.abilities.Ability; import mage.abilities.costs.Cost; import mage.abilities.costs.common.RevealTargetFromHandCost; import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.Effect; import mage.game.Game; /** @@ -19,7 +20,7 @@ import mage.game.Game; public class RevealTargetFromHandCostCount implements DynamicValue { @Override - public int calculate(Game game, Ability sourceAbility) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { for (Cost cost: sourceAbility.getCosts()) { if (cost instanceof RevealTargetFromHandCost) { return ((RevealTargetFromHandCost) cost).getNumberRevealedCards(); diff --git a/Mage/src/mage/abilities/dynamicvalue/common/SacrificeCostCreaturesPower.java b/Mage/src/mage/abilities/dynamicvalue/common/SacrificeCostCreaturesPower.java index b68d05bbeb..c6848a76a5 100644 --- a/Mage/src/mage/abilities/dynamicvalue/common/SacrificeCostCreaturesPower.java +++ b/Mage/src/mage/abilities/dynamicvalue/common/SacrificeCostCreaturesPower.java @@ -4,6 +4,7 @@ import mage.abilities.Ability; import mage.abilities.costs.Cost; import mage.abilities.costs.common.SacrificeTargetCost; import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.Effect; import mage.game.Game; import mage.game.permanent.Permanent; @@ -13,7 +14,7 @@ import mage.game.permanent.Permanent; public class SacrificeCostCreaturesPower implements DynamicValue { @Override - public int calculate(Game game, Ability sourceAbility) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { for (Cost cost: sourceAbility.getCosts()) { if (cost instanceof SacrificeTargetCost) { SacrificeTargetCost sacrificeCost = (SacrificeTargetCost) cost; diff --git a/Mage/src/mage/abilities/dynamicvalue/common/SacrificeCostCreaturesToughness.java b/Mage/src/mage/abilities/dynamicvalue/common/SacrificeCostCreaturesToughness.java index e97aec5905..8df1b39c1b 100644 --- a/Mage/src/mage/abilities/dynamicvalue/common/SacrificeCostCreaturesToughness.java +++ b/Mage/src/mage/abilities/dynamicvalue/common/SacrificeCostCreaturesToughness.java @@ -4,6 +4,7 @@ import mage.abilities.Ability; import mage.abilities.costs.Cost; import mage.abilities.costs.common.SacrificeTargetCost; import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.Effect; import mage.game.Game; import mage.game.permanent.Permanent; @@ -13,7 +14,7 @@ import mage.game.permanent.Permanent; public class SacrificeCostCreaturesToughness implements DynamicValue { @Override - public int calculate(Game game, Ability sourceAbility) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { for (Cost cost: sourceAbility.getCosts()) { if (cost instanceof SacrificeTargetCost) { SacrificeTargetCost sacrificeCost = (SacrificeTargetCost) cost; diff --git a/Mage/src/mage/abilities/dynamicvalue/common/SignInversionDynamicValue.java b/Mage/src/mage/abilities/dynamicvalue/common/SignInversionDynamicValue.java index 4773d7b7da..3e927496ed 100644 --- a/Mage/src/mage/abilities/dynamicvalue/common/SignInversionDynamicValue.java +++ b/Mage/src/mage/abilities/dynamicvalue/common/SignInversionDynamicValue.java @@ -2,6 +2,7 @@ package mage.abilities.dynamicvalue.common; import mage.abilities.Ability; import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.Effect; import mage.game.Game; public class SignInversionDynamicValue implements DynamicValue { @@ -16,8 +17,8 @@ public class SignInversionDynamicValue implements DynamicValue { } @Override - public int calculate(Game game, Ability sourceAbility) { - return -1 * value.calculate(game, sourceAbility); + public int calculate(Game game, Ability sourceAbility, Effect effect) { + return -1 * value.calculate(game, sourceAbility, effect); } @Override diff --git a/Mage/src/mage/abilities/dynamicvalue/common/SourcePermanentPowerCount.java b/Mage/src/mage/abilities/dynamicvalue/common/SourcePermanentPowerCount.java index d4957cf873..b0e65392d0 100644 --- a/Mage/src/mage/abilities/dynamicvalue/common/SourcePermanentPowerCount.java +++ b/Mage/src/mage/abilities/dynamicvalue/common/SourcePermanentPowerCount.java @@ -2,6 +2,7 @@ package mage.abilities.dynamicvalue.common; import mage.abilities.Ability; import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.Effect; import mage.constants.Zone; import mage.game.Game; import mage.game.permanent.Permanent; @@ -11,7 +12,7 @@ import mage.game.permanent.Permanent; */ public class SourcePermanentPowerCount implements DynamicValue { @Override - public int calculate(Game game, Ability sourceAbility) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { Permanent sourcePermanent = game.getPermanent(sourceAbility.getSourceId()); if (sourcePermanent == null) { sourcePermanent = (Permanent) game.getLastKnownInformation(sourceAbility.getSourceId(), Zone.BATTLEFIELD); diff --git a/Mage/src/mage/abilities/dynamicvalue/common/SourcePermanentToughnessValue.java b/Mage/src/mage/abilities/dynamicvalue/common/SourcePermanentToughnessValue.java index 288d737265..5eae49e66b 100644 --- a/Mage/src/mage/abilities/dynamicvalue/common/SourcePermanentToughnessValue.java +++ b/Mage/src/mage/abilities/dynamicvalue/common/SourcePermanentToughnessValue.java @@ -28,13 +28,15 @@ package mage.abilities.dynamicvalue.common; -import java.io.ObjectStreamException; import mage.abilities.Ability; import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.Effect; import mage.constants.Zone; import mage.game.Game; import mage.game.permanent.Permanent; +import java.io.ObjectStreamException; + /** * * @author LevelX2 @@ -53,7 +55,7 @@ public class SourcePermanentToughnessValue implements DynamicValue { } @Override - public int calculate(Game game, Ability sourceAbility) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { Permanent sourcePermanent = game.getPermanent(sourceAbility.getSourceId()); if (sourcePermanent == null) { sourcePermanent = (Permanent) game.getLastKnownInformation(sourceAbility.getSourceId(), Zone.BATTLEFIELD); diff --git a/Mage/src/mage/abilities/dynamicvalue/common/StaticValue.java b/Mage/src/mage/abilities/dynamicvalue/common/StaticValue.java index 3a9c3ecf20..73c981fd64 100644 --- a/Mage/src/mage/abilities/dynamicvalue/common/StaticValue.java +++ b/Mage/src/mage/abilities/dynamicvalue/common/StaticValue.java @@ -3,6 +3,7 @@ package mage.abilities.dynamicvalue.common; import mage.abilities.Ability; import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.Effect; import mage.game.Game; public class StaticValue implements DynamicValue { @@ -23,7 +24,7 @@ public class StaticValue implements DynamicValue { } @Override - public int calculate(Game game, Ability sourceAbility) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { return value; } diff --git a/Mage/src/mage/abilities/dynamicvalue/common/SunburstCount.java b/Mage/src/mage/abilities/dynamicvalue/common/SunburstCount.java index 74ec3946fa..0fa70eb858 100644 --- a/Mage/src/mage/abilities/dynamicvalue/common/SunburstCount.java +++ b/Mage/src/mage/abilities/dynamicvalue/common/SunburstCount.java @@ -31,6 +31,7 @@ package mage.abilities.dynamicvalue.common; import mage.Mana; import mage.abilities.Ability; import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.Effect; import mage.game.Game; import mage.game.stack.Spell; import mage.game.stack.StackObject; @@ -47,7 +48,7 @@ public class SunburstCount implements DynamicValue{ } @Override - public int calculate(Game game, Ability source) { + public int calculate(Game game, Ability source, Effect effect) { int count = 0; if (!game.getStack().isEmpty()) { StackObject spell = game.getStack().getFirst(); diff --git a/Mage/src/mage/abilities/dynamicvalue/common/SweepNumber.java b/Mage/src/mage/abilities/dynamicvalue/common/SweepNumber.java index 9595cebafa..27ffa7d6e4 100644 --- a/Mage/src/mage/abilities/dynamicvalue/common/SweepNumber.java +++ b/Mage/src/mage/abilities/dynamicvalue/common/SweepNumber.java @@ -29,6 +29,7 @@ package mage.abilities.dynamicvalue.common; import mage.abilities.Ability; import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.Effect; import mage.cards.Card; import mage.game.Game; @@ -48,7 +49,7 @@ public class SweepNumber implements DynamicValue { } @Override - public int calculate(Game game, Ability source) { + public int calculate(Game game, Ability source, Effect effect) { if (zoneChangeCounter == 0) { Card card = game.getCard(source.getSourceId()); if (card != null) { diff --git a/Mage/src/mage/abilities/dynamicvalue/common/TargetConvertedManaCost.java b/Mage/src/mage/abilities/dynamicvalue/common/TargetConvertedManaCost.java index f2c7fc2a9a..97b33f5fba 100644 --- a/Mage/src/mage/abilities/dynamicvalue/common/TargetConvertedManaCost.java +++ b/Mage/src/mage/abilities/dynamicvalue/common/TargetConvertedManaCost.java @@ -29,6 +29,7 @@ package mage.abilities.dynamicvalue.common; import mage.abilities.Ability; import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.Effect; import mage.cards.Card; import mage.game.Game; @@ -39,7 +40,7 @@ import mage.game.Game; public class TargetConvertedManaCost implements DynamicValue { @Override - public int calculate(Game game, Ability source) { + public int calculate(Game game, Ability source, Effect effect) { Card card = game.getCard(source.getFirstTarget()); if (card != null) { return card.getManaCost().convertedManaCost(); diff --git a/Mage/src/mage/abilities/dynamicvalue/common/TargetPermanenToughnessValue.java b/Mage/src/mage/abilities/dynamicvalue/common/TargetPermanenToughnessValue.java index 6b38f11552..e65030a5ca 100644 --- a/Mage/src/mage/abilities/dynamicvalue/common/TargetPermanenToughnessValue.java +++ b/Mage/src/mage/abilities/dynamicvalue/common/TargetPermanenToughnessValue.java @@ -28,13 +28,15 @@ package mage.abilities.dynamicvalue.common; -import java.io.ObjectStreamException; import mage.abilities.Ability; import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.Effect; import mage.constants.Zone; import mage.game.Game; import mage.game.permanent.Permanent; +import java.io.ObjectStreamException; + /** * * @author LevelX2 @@ -53,7 +55,7 @@ public class TargetPermanenToughnessValue implements DynamicValue { } @Override - public int calculate(Game game, Ability sourceAbility) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { Permanent sourcePermanent = game.getPermanent(sourceAbility.getFirstTarget()); if (sourcePermanent == null) { sourcePermanent = (Permanent) game.getLastKnownInformation(sourceAbility.getFirstTarget(), Zone.BATTLEFIELD); diff --git a/Mage/src/mage/abilities/dynamicvalue/common/TargetPermanentPowerCount.java b/Mage/src/mage/abilities/dynamicvalue/common/TargetPermanentPowerCount.java index d0749cdeab..d6bc27590f 100644 --- a/Mage/src/mage/abilities/dynamicvalue/common/TargetPermanentPowerCount.java +++ b/Mage/src/mage/abilities/dynamicvalue/common/TargetPermanentPowerCount.java @@ -27,9 +27,10 @@ */ package mage.abilities.dynamicvalue.common; -import mage.constants.Zone; import mage.abilities.Ability; import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.Effect; +import mage.constants.Zone; import mage.game.Game; import mage.game.permanent.Permanent; @@ -40,7 +41,7 @@ import mage.game.permanent.Permanent; public class TargetPermanentPowerCount implements DynamicValue { @Override - public int calculate(Game game, Ability sourceAbility) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { Permanent sourcePermanent = game.getPermanent(sourceAbility.getFirstTarget()); if (sourcePermanent == null) { sourcePermanent = (Permanent) game.getLastKnownInformation(sourceAbility.getFirstTarget(), Zone.BATTLEFIELD); diff --git a/Mage/src/mage/abilities/dynamicvalue/common/UrzaTerrainValue.java b/Mage/src/mage/abilities/dynamicvalue/common/UrzaTerrainValue.java index 950cd04a17..139008f740 100644 --- a/Mage/src/mage/abilities/dynamicvalue/common/UrzaTerrainValue.java +++ b/Mage/src/mage/abilities/dynamicvalue/common/UrzaTerrainValue.java @@ -2,6 +2,7 @@ package mage.abilities.dynamicvalue.common; import mage.abilities.Ability; import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.Effect; import mage.filter.common.FilterControlledPermanent; import mage.filter.predicate.mageobject.NamePredicate; import mage.game.Game; @@ -14,11 +15,11 @@ public class UrzaTerrainValue implements DynamicValue { } @Override - public int calculate(Game game, Ability sourceAbility) { + public int calculate(Game game, Ability sourceAbility, Effect effect) { FilterControlledPermanent pp = new FilterControlledPermanent("Urza's Power Plant"); pp.add(new NamePredicate("Urza's Power Plant")); PermanentsOnBattlefieldCount ppP = new PermanentsOnBattlefieldCount(pp); - if (ppP.calculate(game, sourceAbility) < 1) + if (ppP.calculate(game, sourceAbility, effect) < 1) { return 1; } @@ -26,7 +27,7 @@ public class UrzaTerrainValue implements DynamicValue { FilterControlledPermanent to = new FilterControlledPermanent("Urza's Tower"); to.add(new NamePredicate("Urza's Tower")); PermanentsOnBattlefieldCount toP = new PermanentsOnBattlefieldCount(to); - if (toP.calculate(game, sourceAbility) < 1) + if (toP.calculate(game, sourceAbility, effect) < 1) { return 1; } @@ -34,7 +35,7 @@ public class UrzaTerrainValue implements DynamicValue { FilterControlledPermanent mi = new FilterControlledPermanent("Urza's Mine"); mi.add(new NamePredicate("Urza's Mine")); PermanentsOnBattlefieldCount miP = new PermanentsOnBattlefieldCount(mi); - if (miP.calculate(game, sourceAbility) < 1) + if (miP.calculate(game, sourceAbility, effect) < 1) { return 1; } diff --git a/Mage/src/mage/abilities/effects/ContinuousEffectImpl.java b/Mage/src/mage/abilities/effects/ContinuousEffectImpl.java index 5b7b1a297a..e1def9e8a9 100644 --- a/Mage/src/mage/abilities/effects/ContinuousEffectImpl.java +++ b/Mage/src/mage/abilities/effects/ContinuousEffectImpl.java @@ -28,17 +28,6 @@ package mage.abilities.effects; -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; -import mage.constants.Duration; -import mage.constants.EffectType; -import mage.constants.Layer; -import mage.constants.Outcome; -import mage.constants.SubLayer; import mage.abilities.Ability; import mage.abilities.ActivatedAbility; import mage.abilities.MageSingleton; @@ -47,8 +36,11 @@ import mage.abilities.dynamicvalue.DynamicValue; import mage.abilities.dynamicvalue.common.DomainValue; import mage.abilities.dynamicvalue.common.SignInversionDynamicValue; import mage.abilities.dynamicvalue.common.StaticValue; +import mage.constants.*; import mage.game.Game; +import java.util.*; + /** * @@ -190,7 +182,7 @@ public abstract class ContinuousEffectImpl extends EffectImpl implements Continu protected static boolean isCanKill(DynamicValue toughness) { if (toughness instanceof StaticValue) { - return toughness.calculate(null, null) < 0; + return toughness.calculate(null, null, null) < 0; } if (toughness instanceof SignInversionDynamicValue) { // count this class as used for "-{something_positive}" diff --git a/Mage/src/mage/abilities/effects/common/CounterUnlessPaysEffect.java b/Mage/src/mage/abilities/effects/common/CounterUnlessPaysEffect.java index 4ad73045c3..947eae394c 100644 --- a/Mage/src/mage/abilities/effects/common/CounterUnlessPaysEffect.java +++ b/Mage/src/mage/abilities/effects/common/CounterUnlessPaysEffect.java @@ -84,7 +84,7 @@ public class CounterUnlessPaysEffect extends OneShotEffect { if (cost != null) { costToPay = cost.copy(); } else { - costToPay = new GenericManaCost(genericMana.calculate(game, source)); + costToPay = new GenericManaCost(genericMana.calculate(game, source, this)); } String message; if (costToPay instanceof ManaCost) { diff --git a/Mage/src/mage/abilities/effects/common/CreateTokenEffect.java b/Mage/src/mage/abilities/effects/common/CreateTokenEffect.java index 5b97d4dc10..18745ba851 100644 --- a/Mage/src/mage/abilities/effects/common/CreateTokenEffect.java +++ b/Mage/src/mage/abilities/effects/common/CreateTokenEffect.java @@ -91,7 +91,7 @@ public class CreateTokenEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - int value = amount.calculate(game, source); + int value = amount.calculate(game, source, this); Token tokenCopy = token.copy(); tokenCopy.getAbilities().newId(); // neccessary if token has ability like DevourAbility() tokenCopy.putOntoBattlefield(value, game, source.getSourceId(), source.getControllerId(), tapped, attacking); diff --git a/Mage/src/mage/abilities/effects/common/CreateTokenTargetEffect.java b/Mage/src/mage/abilities/effects/common/CreateTokenTargetEffect.java index 5b28dc3e8f..fe0bdd3ba6 100644 --- a/Mage/src/mage/abilities/effects/common/CreateTokenTargetEffect.java +++ b/Mage/src/mage/abilities/effects/common/CreateTokenTargetEffect.java @@ -58,7 +58,7 @@ public class CreateTokenTargetEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - int value = amount.calculate(game, source); + int value = amount.calculate(game, source, this); Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { if (value < 1) { diff --git a/Mage/src/mage/abilities/effects/common/DamageAllEffect.java b/Mage/src/mage/abilities/effects/common/DamageAllEffect.java index 750fce0745..7c2bb29618 100644 --- a/Mage/src/mage/abilities/effects/common/DamageAllEffect.java +++ b/Mage/src/mage/abilities/effects/common/DamageAllEffect.java @@ -72,7 +72,7 @@ public class DamageAllEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { List permanents = game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game); for (Permanent permanent: permanents) { - permanent.damage(amount.calculate(game, source), source.getSourceId(), game, false, true); + permanent.damage(amount.calculate(game, source, this), source.getSourceId(), game, false, true); } return true; } diff --git a/Mage/src/mage/abilities/effects/common/DamageControllerEffect.java b/Mage/src/mage/abilities/effects/common/DamageControllerEffect.java index ce160da7a9..0cf6291395 100644 --- a/Mage/src/mage/abilities/effects/common/DamageControllerEffect.java +++ b/Mage/src/mage/abilities/effects/common/DamageControllerEffect.java @@ -64,7 +64,7 @@ public class DamageControllerEffect extends OneShotEffect { public int getAmount() { if (amount instanceof StaticValue) { - return amount.calculate(null, null); + return amount.calculate(null, null, this); } else { return 0; } @@ -85,7 +85,7 @@ public class DamageControllerEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); if (player != null) { - player.damage(amount.calculate(game, source), source.getSourceId(), game, false, preventable); + player.damage(amount.calculate(game, source, this), source.getSourceId(), game, false, preventable); return true; } return false; diff --git a/Mage/src/mage/abilities/effects/common/DamageEverythingEffect.java b/Mage/src/mage/abilities/effects/common/DamageEverythingEffect.java index 81b67d09d7..dfa0633f43 100644 --- a/Mage/src/mage/abilities/effects/common/DamageEverythingEffect.java +++ b/Mage/src/mage/abilities/effects/common/DamageEverythingEffect.java @@ -80,12 +80,12 @@ public class DamageEverythingEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { List permanents = game.getBattlefield().getActivePermanents(filter, source.getControllerId(), game); for (Permanent permanent: permanents) { - permanent.damage(amount.calculate(game, source), source.getSourceId(), game, false, true); + permanent.damage(amount.calculate(game, source, this), source.getSourceId(), game, false, true); } for (UUID playerId: game.getPlayer(source.getControllerId()).getInRange()) { Player player = game.getPlayer(playerId); if (player != null) { - player.damage(amount.calculate(game, source), source.getSourceId(), game, false, true); + player.damage(amount.calculate(game, source, this), source.getSourceId(), game, false, true); } } return true; diff --git a/Mage/src/mage/abilities/effects/common/DamagePlayersEffect.java b/Mage/src/mage/abilities/effects/common/DamagePlayersEffect.java index f7c5d5e406..c1ad07a602 100644 --- a/Mage/src/mage/abilities/effects/common/DamagePlayersEffect.java +++ b/Mage/src/mage/abilities/effects/common/DamagePlayersEffect.java @@ -78,7 +78,7 @@ public class DamagePlayersEffect extends OneShotEffect { for (UUID playerId: game.getPlayer(source.getControllerId()).getInRange()) { Player player = game.getPlayer(playerId); if (player != null) { - player.damage(amount.calculate(game, source), source.getSourceId(), game, false, true); + player.damage(amount.calculate(game, source, this), source.getSourceId(), game, false, true); } } break; @@ -86,7 +86,7 @@ public class DamagePlayersEffect extends OneShotEffect { for (UUID playerId: game.getOpponents(source.getControllerId())) { Player player = game.getPlayer(playerId); if (player != null) { - player.damage(amount.calculate(game, source), source.getSourceId(), game, false, true); + player.damage(amount.calculate(game, source, this), source.getSourceId(), game, false, true); } } break; diff --git a/Mage/src/mage/abilities/effects/common/DamageTargetEffect.java b/Mage/src/mage/abilities/effects/common/DamageTargetEffect.java index 4935b7734f..9bd889e468 100644 --- a/Mage/src/mage/abilities/effects/common/DamageTargetEffect.java +++ b/Mage/src/mage/abilities/effects/common/DamageTargetEffect.java @@ -27,18 +27,19 @@ */ package mage.abilities.effects.common; -import java.util.UUID; -import mage.constants.Outcome; import mage.abilities.Ability; import mage.abilities.Mode; import mage.abilities.dynamicvalue.DynamicValue; import mage.abilities.dynamicvalue.common.StaticValue; import mage.abilities.effects.OneShotEffect; +import mage.constants.Outcome; import mage.game.Game; import mage.game.permanent.Permanent; import mage.players.Player; import mage.target.Target; +import java.util.UUID; + /** * * @author BetaSteward_at_googlemail.com @@ -79,7 +80,7 @@ public class DamageTargetEffect extends OneShotEffect { public int getAmount() { if (amount instanceof StaticValue) { - return amount.calculate(null, null); + return amount.calculate(null, null, this); } else { return 0; } @@ -108,11 +109,11 @@ public class DamageTargetEffect extends OneShotEffect { for (UUID targetId : target.getTargets()) { Permanent permanent = game.getPermanent(targetId); if (permanent != null) { - permanent.damage(amount.calculate(game, source), source.getSourceId(), game, false, preventable); + permanent.damage(amount.calculate(game, source, this), source.getSourceId(), game, false, preventable); } Player player = game.getPlayer(targetId); if (player != null) { - player.damage(amount.calculate(game, source), source.getSourceId(), game, false, preventable); + player.damage(amount.calculate(game, source, this), source.getSourceId(), game, false, preventable); } } } @@ -121,11 +122,11 @@ public class DamageTargetEffect extends OneShotEffect { for (UUID targetId :this.getTargetPointer().getTargets(game, source)) { Permanent permanent = game.getPermanent(targetId); if (permanent != null) { - permanent.damage(amount.calculate(game, source), source.getSourceId(), game, false, preventable); + permanent.damage(amount.calculate(game, source, this), source.getSourceId(), game, false, preventable); } else { Player player = game.getPlayer(targetId); if (player != null) { - player.damage(amount.calculate(game, source), source.getSourceId(), game, false, preventable); + player.damage(amount.calculate(game, source, this), source.getSourceId(), game, false, preventable); } } } diff --git a/Mage/src/mage/abilities/effects/common/DrawCardAllEffect.java b/Mage/src/mage/abilities/effects/common/DrawCardAllEffect.java index 9afcf66fcf..919c245d37 100644 --- a/Mage/src/mage/abilities/effects/common/DrawCardAllEffect.java +++ b/Mage/src/mage/abilities/effects/common/DrawCardAllEffect.java @@ -86,7 +86,7 @@ public class DrawCardAllEffect extends OneShotEffect { for (UUID playerId: sourcePlayer.getInRange()) { Player player = game.getPlayer(playerId); if (player != null) { - player.drawCards(amount.calculate(game, source), game); + player.drawCards(amount.calculate(game, source, this), game); } } break; @@ -94,7 +94,7 @@ public class DrawCardAllEffect extends OneShotEffect { for (UUID playerId: game.getOpponents(sourcePlayer.getId())) { Player player = game.getPlayer(playerId); if (player != null) { - player.drawCards(amount.calculate(game, source), game); + player.drawCards(amount.calculate(game, source, this), game); } } break; diff --git a/Mage/src/mage/abilities/effects/common/DrawCardSourceControllerEffect.java b/Mage/src/mage/abilities/effects/common/DrawCardSourceControllerEffect.java index 5ba57c2d5c..00ce366db9 100644 --- a/Mage/src/mage/abilities/effects/common/DrawCardSourceControllerEffect.java +++ b/Mage/src/mage/abilities/effects/common/DrawCardSourceControllerEffect.java @@ -69,7 +69,7 @@ public class DrawCardSourceControllerEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); if (player != null) { - player.drawCards(amount.calculate(game, source), game); + player.drawCards(amount.calculate(game, source, this), game); return true; } return false; @@ -77,7 +77,7 @@ public class DrawCardSourceControllerEffect extends OneShotEffect { private void setText() { StringBuilder sb = new StringBuilder(); - boolean oneCard = (amount instanceof StaticValue && amount.calculate(null, null) == 1) + boolean oneCard = (amount instanceof StaticValue && amount.calculate(null, null, this) == 1) || amount instanceof PermanentsOnBattlefieldCount || amount.toString().equals("1"); sb.append("draw ").append(oneCard ? "a" : CardUtil.numberToText(amount.toString())).append(" card"); if (!oneCard) { diff --git a/Mage/src/mage/abilities/effects/common/DrawCardTargetEffect.java b/Mage/src/mage/abilities/effects/common/DrawCardTargetEffect.java index cbec14b668..d6cb79f40c 100644 --- a/Mage/src/mage/abilities/effects/common/DrawCardTargetEffect.java +++ b/Mage/src/mage/abilities/effects/common/DrawCardTargetEffect.java @@ -86,7 +86,7 @@ public class DrawCardTargetEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player player = game.getPlayer(targetPointer.getFirst(game, source)); if (player != null) { - int cardsToDraw = amount.calculate(game, source); + int cardsToDraw = amount.calculate(game, source, this); if (upTo) { cardsToDraw = player.getAmount(0, cardsToDraw, "Draw how many cards?", game); } diff --git a/Mage/src/mage/abilities/effects/common/DynamicManaEffect.java b/Mage/src/mage/abilities/effects/common/DynamicManaEffect.java index e950ffd13b..5d896af598 100644 --- a/Mage/src/mage/abilities/effects/common/DynamicManaEffect.java +++ b/Mage/src/mage/abilities/effects/common/DynamicManaEffect.java @@ -85,7 +85,7 @@ public class DynamicManaEffect extends BasicManaEffect { public Mana computeMana(Game game, Ability source){ this.computedMana.clear(); - int count = amount.calculate(game, source); + int count = amount.calculate(game, source, this); if (mana.getBlack() > 0) { computedMana.setBlack(count); } else if (mana.getBlue() > 0) { diff --git a/Mage/src/mage/abilities/effects/common/GainLifeEffect.java b/Mage/src/mage/abilities/effects/common/GainLifeEffect.java index 0b32b830b8..e5d3f87107 100644 --- a/Mage/src/mage/abilities/effects/common/GainLifeEffect.java +++ b/Mage/src/mage/abilities/effects/common/GainLifeEffect.java @@ -74,7 +74,7 @@ public class GainLifeEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); if (player != null) { - player.gainLife(life.calculate(game, source), game); + player.gainLife(life.calculate(game, source, this), game); } return true; } diff --git a/Mage/src/mage/abilities/effects/common/GainLifeTargetEffect.java b/Mage/src/mage/abilities/effects/common/GainLifeTargetEffect.java index 0a987053fa..e51c820b5e 100644 --- a/Mage/src/mage/abilities/effects/common/GainLifeTargetEffect.java +++ b/Mage/src/mage/abilities/effects/common/GainLifeTargetEffect.java @@ -71,7 +71,7 @@ public class GainLifeTargetEffect extends OneShotEffect { for (UUID playerId: targetPointer.getTargets(game, source)) { Player player = game.getPlayer(playerId); if (player != null) { - player.gainLife(life.calculate(game, source), game); + player.gainLife(life.calculate(game, source, this), game); } } return true; diff --git a/Mage/src/mage/abilities/effects/common/LookLibraryAndPickControllerEffect.java b/Mage/src/mage/abilities/effects/common/LookLibraryAndPickControllerEffect.java index 27e790ab8d..5320a239ea 100644 --- a/Mage/src/mage/abilities/effects/common/LookLibraryAndPickControllerEffect.java +++ b/Mage/src/mage/abilities/effects/common/LookLibraryAndPickControllerEffect.java @@ -29,8 +29,6 @@ */ package mage.abilities.effects.common; -import java.util.List; -import java.util.UUID; import mage.abilities.Ability; import mage.abilities.Mode; import mage.abilities.dynamicvalue.DynamicValue; @@ -45,6 +43,9 @@ import mage.game.Game; import mage.players.Player; import mage.target.TargetCard; +import java.util.List; +import java.util.UUID; + /** * * @author LevelX @@ -116,7 +117,7 @@ public class LookLibraryAndPickControllerEffect extends LookLibraryControllerEff } @Override protected void cardLooked(Card card, Game game, Ability source) { - if (numberToPick.calculate(game, source) > 0 && filter.match(card, game)) { + if (numberToPick.calculate(game, source, this) > 0 && filter.match(card, game)) { ++foundCardsToPick; } } @@ -128,7 +129,7 @@ public class LookLibraryAndPickControllerEffect extends LookLibraryControllerEff if (!optional || player.chooseUse(Outcome.DrawCard, getMayText(), game)) { FilterCard pickFilter = filter.copy(); pickFilter.setMessage(getPickText()); - TargetCard target = new TargetCard((upTo ? 0:numberToPick.calculate(game, source)),numberToPick.calculate(game, source), Zone.PICK, pickFilter); + TargetCard target = new TargetCard((upTo ? 0:numberToPick.calculate(game, source, this)),numberToPick.calculate(game, source, this), Zone.PICK, pickFilter); if (player.choose(Outcome.DrawCard, cards, target, game)) { Cards reveal = new CardsImpl(); for (UUID cardId : (List)target.getTargets()) { @@ -202,7 +203,7 @@ public class LookLibraryAndPickControllerEffect extends LookLibraryControllerEff return staticText; } StringBuilder sb = new StringBuilder(); - if (numberToPick.calculate(null, null) > 0) { + if (numberToPick.calculate(null, null, this) > 0) { if (revealPickedCards) { sb.append(". You may reveal "); diff --git a/Mage/src/mage/abilities/effects/common/LookLibraryControllerEffect.java b/Mage/src/mage/abilities/effects/common/LookLibraryControllerEffect.java index e44aae7ab3..9ee38d1f53 100644 --- a/Mage/src/mage/abilities/effects/common/LookLibraryControllerEffect.java +++ b/Mage/src/mage/abilities/effects/common/LookLibraryControllerEffect.java @@ -128,7 +128,7 @@ public class LookLibraryControllerEffect extends OneShotEffect { boolean topCardRevealed = player.isTopCardRevealed(); player.setTopCardRevealed(false); Cards cards = new CardsImpl(Zone.PICK); - int count = Math.min(player.getLibrary().size(), this.numberOfCards.calculate(game, source)); + int count = Math.min(player.getLibrary().size(), this.numberOfCards.calculate(game, source, this)); for (int i = 0; i < count; i++) { Card card = player.getLibrary().removeFromTop(game); if (card != null) { diff --git a/Mage/src/mage/abilities/effects/common/LoseLifeAllPlayersEffect.java b/Mage/src/mage/abilities/effects/common/LoseLifeAllPlayersEffect.java index 48e7232766..39cf9bcc80 100644 --- a/Mage/src/mage/abilities/effects/common/LoseLifeAllPlayersEffect.java +++ b/Mage/src/mage/abilities/effects/common/LoseLifeAllPlayersEffect.java @@ -71,7 +71,7 @@ public class LoseLifeAllPlayersEffect extends OneShotEffect { for (UUID playerId: game.getPlayer(source.getControllerId()).getInRange()) { Player player = game.getPlayer(playerId); if (player != null) { - player.loseLife(amount.calculate(game, source), game); + player.loseLife(amount.calculate(game, source, this), game); } } return true; diff --git a/Mage/src/mage/abilities/effects/common/LoseLifeDefendingPlayerEffect.java b/Mage/src/mage/abilities/effects/common/LoseLifeDefendingPlayerEffect.java index df12e71b95..5d7fbbe3f2 100644 --- a/Mage/src/mage/abilities/effects/common/LoseLifeDefendingPlayerEffect.java +++ b/Mage/src/mage/abilities/effects/common/LoseLifeDefendingPlayerEffect.java @@ -70,7 +70,7 @@ public class LoseLifeDefendingPlayerEffect extends OneShotEffect { for (UUID defenderId : game.getCombat().getDefenders()) { Player defender = game.getPlayer(defenderId); if (defender != null) { - defender.loseLife(amount.calculate(game, source), game); + defender.loseLife(amount.calculate(game, source, this), game); } } return true; diff --git a/Mage/src/mage/abilities/effects/common/LoseLifeOpponentsEffect.java b/Mage/src/mage/abilities/effects/common/LoseLifeOpponentsEffect.java index 18eab7908c..7db3125e5f 100644 --- a/Mage/src/mage/abilities/effects/common/LoseLifeOpponentsEffect.java +++ b/Mage/src/mage/abilities/effects/common/LoseLifeOpponentsEffect.java @@ -66,7 +66,7 @@ public class LoseLifeOpponentsEffect extends OneShotEffect { for (UUID opponentId: game.getOpponents(source.getControllerId())) { Player player = game.getPlayer(opponentId); if (player != null) { - player.loseLife(amount.calculate(game, source), game); + player.loseLife(amount.calculate(game, source, this), game); } } return true; @@ -93,4 +93,4 @@ public class LoseLifeOpponentsEffect extends OneShotEffect { } return sb.toString(); } -} \ No newline at end of file +} diff --git a/Mage/src/mage/abilities/effects/common/LoseLifeSourceControllerEffect.java b/Mage/src/mage/abilities/effects/common/LoseLifeSourceControllerEffect.java index c32b67143f..fe5df7b4d2 100644 --- a/Mage/src/mage/abilities/effects/common/LoseLifeSourceControllerEffect.java +++ b/Mage/src/mage/abilities/effects/common/LoseLifeSourceControllerEffect.java @@ -68,7 +68,7 @@ public class LoseLifeSourceControllerEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); if (player != null) { - player.loseLife(amount.calculate(game, source), game); + player.loseLife(amount.calculate(game, source, this), game); return true; } return false; diff --git a/Mage/src/mage/abilities/effects/common/LoseLifeTargetEffect.java b/Mage/src/mage/abilities/effects/common/LoseLifeTargetEffect.java index 308805b578..89006e4ded 100644 --- a/Mage/src/mage/abilities/effects/common/LoseLifeTargetEffect.java +++ b/Mage/src/mage/abilities/effects/common/LoseLifeTargetEffect.java @@ -68,7 +68,7 @@ public class LoseLifeTargetEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player player = game.getPlayer(targetPointer.getFirst(game, source)); if (player != null) { - player.loseLife(amount.calculate(game, source), game); + player.loseLife(amount.calculate(game, source, this), game); return true; } return false; diff --git a/Mage/src/mage/abilities/effects/common/ManaInAnyCombinationEffect.java b/Mage/src/mage/abilities/effects/common/ManaInAnyCombinationEffect.java index cca9a827a8..b00b5d04ab 100644 --- a/Mage/src/mage/abilities/effects/common/ManaInAnyCombinationEffect.java +++ b/Mage/src/mage/abilities/effects/common/ManaInAnyCombinationEffect.java @@ -53,7 +53,7 @@ public class ManaInAnyCombinationEffect extends ManaEffect { Player player = game.getPlayer(source.getControllerId()); if (player != null){ Mana mana = new Mana(); - int amountOfManaLeft = amount.calculate(game, source); + int amountOfManaLeft = amount.calculate(game, source, this); while (amountOfManaLeft > 0 && player.isInGame()) { for (ColoredManaSymbol coloredManaSymbol: manaSymbols) { diff --git a/Mage/src/mage/abilities/effects/common/PutLibraryIntoGraveTargetEffect.java b/Mage/src/mage/abilities/effects/common/PutLibraryIntoGraveTargetEffect.java index 9c92e1efed..816a683d75 100644 --- a/Mage/src/mage/abilities/effects/common/PutLibraryIntoGraveTargetEffect.java +++ b/Mage/src/mage/abilities/effects/common/PutLibraryIntoGraveTargetEffect.java @@ -76,7 +76,7 @@ public class PutLibraryIntoGraveTargetEffect extends OneShotEffect { Player player = game.getPlayer(targetPointer.getFirst(game, source)); if (player != null) { // putting cards to grave shouldn't end the game, so getting minimun available - int cardsCount = Math.min(amount.calculate(game, source), player.getLibrary().size()); + int cardsCount = Math.min(amount.calculate(game, source, this), player.getLibrary().size()); for (int i = 0; i < cardsCount; i++) { Card card = player.getLibrary().getFromTop(game); if (card != null) { diff --git a/Mage/src/mage/abilities/effects/common/PutTopCardOfLibraryIntoGraveTargetEffect.java b/Mage/src/mage/abilities/effects/common/PutTopCardOfLibraryIntoGraveTargetEffect.java index b7e118a1b9..6467f1baa9 100644 --- a/Mage/src/mage/abilities/effects/common/PutTopCardOfLibraryIntoGraveTargetEffect.java +++ b/Mage/src/mage/abilities/effects/common/PutTopCardOfLibraryIntoGraveTargetEffect.java @@ -70,7 +70,7 @@ public class PutTopCardOfLibraryIntoGraveTargetEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player player = game.getPlayer(targetPointer.getFirst(game, source)); if (player != null) { - int cardsCount = Math.min(numberCards.calculate(game, source), player.getLibrary().size()); + int cardsCount = Math.min(numberCards.calculate(game, source, this), player.getLibrary().size()); for (int i = 0; i < cardsCount; i++) { Card card = player.getLibrary().removeFromTop(game); if (card != null) { diff --git a/Mage/src/mage/abilities/effects/common/SacrificeAllEffect.java b/Mage/src/mage/abilities/effects/common/SacrificeAllEffect.java index e7abef8f60..6b406eb4b9 100644 --- a/Mage/src/mage/abilities/effects/common/SacrificeAllEffect.java +++ b/Mage/src/mage/abilities/effects/common/SacrificeAllEffect.java @@ -89,7 +89,7 @@ public class SacrificeAllEffect extends OneShotEffect { for (UUID playerId : controller.getInRange()) { Player player = game.getPlayer(playerId); if (player != null) { - int numTargets = Math.min(amount.calculate(game, source), game.getBattlefield().countAll(filter, player.getId(), game)); + int numTargets = Math.min(amount.calculate(game, source, this), game.getBattlefield().countAll(filter, player.getId(), game)); TargetControlledPermanent target = new TargetControlledPermanent(numTargets, numTargets, filter, false); if (target.canChoose(player.getId(), game)) { while (!target.isChosen() && player.isInGame()) { diff --git a/Mage/src/mage/abilities/effects/common/SacrificeEffect.java b/Mage/src/mage/abilities/effects/common/SacrificeEffect.java index 7428d0e3d2..080c514851 100644 --- a/Mage/src/mage/abilities/effects/common/SacrificeEffect.java +++ b/Mage/src/mage/abilities/effects/common/SacrificeEffect.java @@ -83,7 +83,7 @@ public class SacrificeEffect extends OneShotEffect{ filter.add(new ControllerPredicate(TargetController.YOU)); - int amount = count.calculate(game, source); + int amount = count.calculate(game, source, this); int realCount = game.getBattlefield().countAll(filter, player.getId(), game); amount = Math.min(amount, realCount); diff --git a/Mage/src/mage/abilities/effects/common/SacrificeOpponentsEffect.java b/Mage/src/mage/abilities/effects/common/SacrificeOpponentsEffect.java index 2966d6749e..a99816c682 100644 --- a/Mage/src/mage/abilities/effects/common/SacrificeOpponentsEffect.java +++ b/Mage/src/mage/abilities/effects/common/SacrificeOpponentsEffect.java @@ -85,7 +85,7 @@ public class SacrificeOpponentsEffect extends OneShotEffect { for (UUID playerId : game.getOpponents(source.getControllerId())) { Player player = game.getPlayer(playerId); if (player != null) { - int numTargets = Math.min(amount.calculate(game, source), game.getBattlefield().countAll(filter, player.getId(), game)); + int numTargets = Math.min(amount.calculate(game, source, this), game.getBattlefield().countAll(filter, player.getId(), game)); TargetControlledPermanent target = new TargetControlledPermanent(numTargets, numTargets, filter, false); if (target.canChoose(player.getId(), game)) { while (!target.isChosen() && player.isInGame()) { diff --git a/Mage/src/mage/abilities/effects/common/continious/BoostAllEffect.java b/Mage/src/mage/abilities/effects/common/continious/BoostAllEffect.java index 63977d26fd..ae9bf6365f 100644 --- a/Mage/src/mage/abilities/effects/common/continious/BoostAllEffect.java +++ b/Mage/src/mage/abilities/effects/common/continious/BoostAllEffect.java @@ -116,8 +116,8 @@ public class BoostAllEffect extends ContinuousEffectImpl { } } if (lockedInPT) { - power = new StaticValue(power.calculate(game, source)); - toughness = new StaticValue(toughness.calculate(game, source)); + power = new StaticValue(power.calculate(game, source, this)); + toughness = new StaticValue(toughness.calculate(game, source, this)); } } @@ -126,8 +126,8 @@ public class BoostAllEffect extends ContinuousEffectImpl { for (Permanent perm: game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) { if (!this.affectedObjectsSet || objects.contains(perm.getId())) { if (!(excludeSource && perm.getId().equals(source.getSourceId()))) { - perm.addPower(power.calculate(game, source)); - perm.addToughness(toughness.calculate(game, source)); + perm.addPower(power.calculate(game, source, this)); + perm.addToughness(toughness.calculate(game, source, this)); } } } diff --git a/Mage/src/mage/abilities/effects/common/continious/BoostControlledEffect.java b/Mage/src/mage/abilities/effects/common/continious/BoostControlledEffect.java index 26fd98df90..242a9d8d19 100644 --- a/Mage/src/mage/abilities/effects/common/continious/BoostControlledEffect.java +++ b/Mage/src/mage/abilities/effects/common/continious/BoostControlledEffect.java @@ -119,8 +119,8 @@ public class BoostControlledEffect extends ContinuousEffectImpl { } } if (this.lockedIn) { - power = new StaticValue(power.calculate(game, source)); - toughness = new StaticValue(toughness.calculate(game, source)); + power = new StaticValue(power.calculate(game, source, this)); + toughness = new StaticValue(toughness.calculate(game, source, this)); } } @@ -129,8 +129,8 @@ public class BoostControlledEffect extends ContinuousEffectImpl { for (Permanent perm : game.getBattlefield().getAllActivePermanents(filter, source.getControllerId(), game)) { if (!this.affectedObjectsSet || objects.contains(perm.getId())) { if (!(excludeSource && perm.getId().equals(source.getSourceId()))) { - perm.addPower(power.calculate(game, source)); - perm.addToughness(toughness.calculate(game, source)); + perm.addPower(power.calculate(game, source, this)); + perm.addToughness(toughness.calculate(game, source, this)); } } } diff --git a/Mage/src/mage/abilities/effects/common/continious/BoostEnchantedEffect.java b/Mage/src/mage/abilities/effects/common/continious/BoostEnchantedEffect.java index 76dab03bd0..c822a13411 100644 --- a/Mage/src/mage/abilities/effects/common/continious/BoostEnchantedEffect.java +++ b/Mage/src/mage/abilities/effects/common/continious/BoostEnchantedEffect.java @@ -84,8 +84,8 @@ public class BoostEnchantedEffect extends ContinuousEffectImpl { if (enchantment != null && enchantment.getAttachedTo() != null) { Permanent creature = game.getPermanent(enchantment.getAttachedTo()); if (creature != null) { - creature.addPower(power.calculate(game, source)); - creature.addToughness(toughness.calculate(game, source)); + creature.addPower(power.calculate(game, source, this)); + creature.addToughness(toughness.calculate(game, source, this)); } } return true; diff --git a/Mage/src/mage/abilities/effects/common/continious/BoostEquippedEffect.java b/Mage/src/mage/abilities/effects/common/continious/BoostEquippedEffect.java index 70d313cc5a..5a26582775 100644 --- a/Mage/src/mage/abilities/effects/common/continious/BoostEquippedEffect.java +++ b/Mage/src/mage/abilities/effects/common/continious/BoostEquippedEffect.java @@ -107,8 +107,8 @@ public class BoostEquippedEffect extends ContinuousEffectImpl { } if (creature != null) { - creature.addPower(power.calculate(game, source)); - creature.addToughness(toughness.calculate(game, source)); + creature.addPower(power.calculate(game, source, this)); + creature.addToughness(toughness.calculate(game, source, this)); } return true; diff --git a/Mage/src/mage/abilities/effects/common/continious/BoostSourceEffect.java b/Mage/src/mage/abilities/effects/common/continious/BoostSourceEffect.java index dcd2c64940..f5be27e10b 100644 --- a/Mage/src/mage/abilities/effects/common/continious/BoostSourceEffect.java +++ b/Mage/src/mage/abilities/effects/common/continious/BoostSourceEffect.java @@ -87,8 +87,8 @@ public class BoostSourceEffect extends ContinuousEffectImpl implements SourceEff super.init(source, game); getAffectedObjects().add(source.getSourceId()); if (lockedIn) { - power = new StaticValue(power.calculate(game, source)); - toughness = new StaticValue(toughness.calculate(game, source)); + power = new StaticValue(power.calculate(game, source, this)); + toughness = new StaticValue(toughness.calculate(game, source, this)); } } @@ -96,8 +96,8 @@ public class BoostSourceEffect extends ContinuousEffectImpl implements SourceEff public boolean apply(Game game, Ability source) { Permanent target = game.getPermanent(source.getSourceId()); if (target != null) { - target.addPower(power.calculate(game, source)); - target.addToughness(toughness.calculate(game, source)); + target.addPower(power.calculate(game, source, this)); + target.addToughness(toughness.calculate(game, source, this)); return true; } return false; diff --git a/Mage/src/mage/abilities/effects/common/continious/BoostTargetEffect.java b/Mage/src/mage/abilities/effects/common/continious/BoostTargetEffect.java index 7cdab24b7a..ee18316ed7 100644 --- a/Mage/src/mage/abilities/effects/common/continious/BoostTargetEffect.java +++ b/Mage/src/mage/abilities/effects/common/continious/BoostTargetEffect.java @@ -89,8 +89,8 @@ public class BoostTargetEffect extends ContinuousEffectImpl { public void init(Ability source, Game game) { super.init(source, game); if (lockedIn) { - power = new StaticValue(power.calculate(game, source)); - toughness = new StaticValue(toughness.calculate(game, source)); + power = new StaticValue(power.calculate(game, source, this)); + toughness = new StaticValue(toughness.calculate(game, source, this)); } } @@ -100,8 +100,8 @@ public class BoostTargetEffect extends ContinuousEffectImpl { for (UUID permanentId : targetPointer.getTargets(game, source)) { Permanent target = game.getPermanent(permanentId); if (target != null) { - target.addPower(power.calculate(game, source)); - target.addToughness(toughness.calculate(game, source)); + target.addPower(power.calculate(game, source, this)); + target.addToughness(toughness.calculate(game, source, this)); affectedTargets++; } } diff --git a/Mage/src/mage/abilities/effects/common/continious/LoseCreatureTypeSourceEffect.java b/Mage/src/mage/abilities/effects/common/continious/LoseCreatureTypeSourceEffect.java index b81a0883a4..064711525e 100644 --- a/Mage/src/mage/abilities/effects/common/continious/LoseCreatureTypeSourceEffect.java +++ b/Mage/src/mage/abilities/effects/common/continious/LoseCreatureTypeSourceEffect.java @@ -75,7 +75,7 @@ public class LoseCreatureTypeSourceEffect extends ContinuousEffectImpl implement @Override public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) { - if (dynamicValue.calculate(game, source) >= lessThan) { + if (dynamicValue.calculate(game, source, this) >= lessThan) { return false; } Permanent permanent = game.getPermanent(source.getSourceId()); diff --git a/Mage/src/mage/abilities/effects/common/continious/SetPowerSourceEffect.java b/Mage/src/mage/abilities/effects/common/continious/SetPowerSourceEffect.java index 4bc8b681cb..a960f6bb43 100644 --- a/Mage/src/mage/abilities/effects/common/continious/SetPowerSourceEffect.java +++ b/Mage/src/mage/abilities/effects/common/continious/SetPowerSourceEffect.java @@ -67,11 +67,11 @@ public class SetPowerSourceEffect extends ContinuousEffectImpl { public boolean apply(Game game, Ability source) { MageObject mageObject = game.getObject(source.getSourceId()); if (mageObject != null) { - int value = amount.calculate(game, source); + int value = amount.calculate(game, source, this); mageObject.getPower().setValue(value); return true; } return false; } -} \ No newline at end of file +} diff --git a/Mage/src/mage/abilities/effects/common/continious/SetPowerToughnessAllEffect.java b/Mage/src/mage/abilities/effects/common/continious/SetPowerToughnessAllEffect.java index 2cf9ce8259..1958b744e5 100644 --- a/Mage/src/mage/abilities/effects/common/continious/SetPowerToughnessAllEffect.java +++ b/Mage/src/mage/abilities/effects/common/continious/SetPowerToughnessAllEffect.java @@ -93,15 +93,15 @@ public class SetPowerToughnessAllEffect extends ContinuousEffectImpl { } } if (lockedInPT) { - power = new StaticValue(power.calculate(game, source)); - toughness = new StaticValue(toughness.calculate(game, source)); + power = new StaticValue(power.calculate(game, source, this)); + toughness = new StaticValue(toughness.calculate(game, source, this)); } } @Override public boolean apply(Game game, Ability source) { - int newPower = power.calculate(game, source); - int newToughness = toughness.calculate(game, source); + int newPower = power.calculate(game, source, this); + int newToughness = toughness.calculate(game, source, this); if (affectedObjectsSet) { for (UUID permanentId :objects) { Permanent permanent = game.getPermanent(permanentId); diff --git a/Mage/src/mage/abilities/effects/common/continious/SetPowerToughnessSourceEffect.java b/Mage/src/mage/abilities/effects/common/continious/SetPowerToughnessSourceEffect.java index f69867dc7a..6233d013b7 100644 --- a/Mage/src/mage/abilities/effects/common/continious/SetPowerToughnessSourceEffect.java +++ b/Mage/src/mage/abilities/effects/common/continious/SetPowerToughnessSourceEffect.java @@ -80,7 +80,7 @@ public class SetPowerToughnessSourceEffect extends ContinuousEffectImpl { return false; } if (amount != null) { - int value = amount.calculate(game, source); + int value = amount.calculate(game, source, this); mageObject.getPower().setValue(value); mageObject.getToughness().setValue(value); return true; diff --git a/Mage/src/mage/abilities/effects/common/continious/SetPowerToughnessTargetEffect.java b/Mage/src/mage/abilities/effects/common/continious/SetPowerToughnessTargetEffect.java index b85c866f23..d67b1d1184 100644 --- a/Mage/src/mage/abilities/effects/common/continious/SetPowerToughnessTargetEffect.java +++ b/Mage/src/mage/abilities/effects/common/continious/SetPowerToughnessTargetEffect.java @@ -77,8 +77,8 @@ public class SetPowerToughnessTargetEffect extends ContinuousEffectImpl { for (UUID targetId: this.getTargetPointer().getTargets(game, source)) { Permanent target = game.getPermanent(targetId); if (target != null) { - target.getPower().setValue(power.calculate(game, source)); - target.getToughness().setValue(toughness.calculate(game, source)); + target.getPower().setValue(power.calculate(game, source, this)); + target.getToughness().setValue(toughness.calculate(game, source, this)); result = true; } } diff --git a/Mage/src/mage/abilities/effects/common/continious/SetToughnessSourceEffect.java b/Mage/src/mage/abilities/effects/common/continious/SetToughnessSourceEffect.java index ad58141e71..f171ce5d3d 100644 --- a/Mage/src/mage/abilities/effects/common/continious/SetToughnessSourceEffect.java +++ b/Mage/src/mage/abilities/effects/common/continious/SetToughnessSourceEffect.java @@ -65,7 +65,7 @@ public class SetToughnessSourceEffect extends ContinuousEffectImpl { public boolean apply(Game game, Ability source) { MageObject mageObject = game.getObject(source.getSourceId()); if (mageObject != null) { - int value = amount.calculate(game, source); + int value = amount.calculate(game, source, this); mageObject.getToughness().setValue(value); return true; } diff --git a/Mage/src/mage/abilities/effects/common/counter/AddCountersAttachedEffect.java b/Mage/src/mage/abilities/effects/common/counter/AddCountersAttachedEffect.java index 31d5a346d6..b8ccd47f4a 100644 --- a/Mage/src/mage/abilities/effects/common/counter/AddCountersAttachedEffect.java +++ b/Mage/src/mage/abilities/effects/common/counter/AddCountersAttachedEffect.java @@ -82,7 +82,7 @@ public class AddCountersAttachedEffect extends OneShotEffect { Permanent attachedTo = game.getPermanent(permanent.getAttachedTo()); if (attachedTo != null && counter != null) { Counter newCounter = counter.copy(); - newCounter.add(amount.calculate(game, source)); + newCounter.add(amount.calculate(game, source, this)); attachedTo.addCounters(newCounter, game); } return true; diff --git a/Mage/src/mage/abilities/effects/common/counter/AddCountersSourceEffect.java b/Mage/src/mage/abilities/effects/common/counter/AddCountersSourceEffect.java index 814e8bbcc7..fbc1fadead 100644 --- a/Mage/src/mage/abilities/effects/common/counter/AddCountersSourceEffect.java +++ b/Mage/src/mage/abilities/effects/common/counter/AddCountersSourceEffect.java @@ -95,7 +95,7 @@ public class AddCountersSourceEffect extends OneShotEffect { if (card != null) { if (counter != null) { Counter newCounter = counter.copy(); - int countersToAdd = amount.calculate(game, source); + int countersToAdd = amount.calculate(game, source, this); if (countersToAdd > 0 && newCounter.getCount() == 1) { countersToAdd--; } @@ -115,7 +115,7 @@ public class AddCountersSourceEffect extends OneShotEffect { if (permanent != null) { if (counter != null) { Counter newCounter = counter.copy(); - int countersToAdd = amount.calculate(game, source); + int countersToAdd = amount.calculate(game, source, this); if (countersToAdd > 0 && newCounter.getCount() == 1) { countersToAdd--; } diff --git a/Mage/src/mage/abilities/effects/common/counter/AddCountersTargetEffect.java b/Mage/src/mage/abilities/effects/common/counter/AddCountersTargetEffect.java index 46ee00e638..d37eaf8794 100644 --- a/Mage/src/mage/abilities/effects/common/counter/AddCountersTargetEffect.java +++ b/Mage/src/mage/abilities/effects/common/counter/AddCountersTargetEffect.java @@ -90,7 +90,7 @@ public class AddCountersTargetEffect extends OneShotEffect { if (permanent != null) { if (counter != null) { Counter newCounter = counter.copy(); - newCounter.add(amount.calculate(game, source)); + newCounter.add(amount.calculate(game, source, this)); permanent.addCounters(newCounter, game); affectedTargets ++; game.informPlayers(new StringBuilder(sourceObject.getLogName()).append(": ") @@ -102,7 +102,7 @@ public class AddCountersTargetEffect extends OneShotEffect { Player player = game.getPlayer(uuid); if (player != null) { Counter newCounter = counter.copy(); - newCounter.add(amount.calculate(game, source)); + newCounter.add(amount.calculate(game, source, this)); player.addCounters(newCounter, game); affectedTargets ++; game.informPlayers(new StringBuilder(sourceObject.getLogName()).append(": ") diff --git a/Mage/src/mage/abilities/effects/common/discard/DiscardCardYouChooseTargetEffect.java b/Mage/src/mage/abilities/effects/common/discard/DiscardCardYouChooseTargetEffect.java index ac10df9a9d..9f8ed201e8 100644 --- a/Mage/src/mage/abilities/effects/common/discard/DiscardCardYouChooseTargetEffect.java +++ b/Mage/src/mage/abilities/effects/common/discard/DiscardCardYouChooseTargetEffect.java @@ -129,7 +129,7 @@ public class DiscardCardYouChooseTargetEffect extends OneShotEffect { if (revealAllCards) { this.numberCardsToReveal = new StaticValue(player.getHand().size()); } - int numberToReveal = this.numberCardsToReveal.calculate(game, source); + int numberToReveal = this.numberCardsToReveal.calculate(game, source, this); if (numberToReveal > 0) { Cards revealedCards = new CardsImpl(Zone.HAND); numberToReveal = Math.min(player.getHand().size(), numberToReveal); @@ -155,7 +155,7 @@ public class DiscardCardYouChooseTargetEffect extends OneShotEffect { boolean result = true; int filteredCardsCount = revealedCards.count(filter, source.getSourceId(), source.getControllerId(), game); - int numberToDiscard = Math.min(this.numberCardsToDiscard.calculate(game, source), filteredCardsCount); + int numberToDiscard = Math.min(this.numberCardsToDiscard.calculate(game, source, this), filteredCardsCount); if (numberToDiscard > 0) { TargetCard target = new TargetCard(numberToDiscard, Zone.HAND, filter); if (controller.choose(Outcome.Benefit, revealedCards, target, game)) { diff --git a/Mage/src/mage/abilities/effects/common/discard/DiscardControllerEffect.java b/Mage/src/mage/abilities/effects/common/discard/DiscardControllerEffect.java index bfdd6b6a8d..982ed443e5 100644 --- a/Mage/src/mage/abilities/effects/common/discard/DiscardControllerEffect.java +++ b/Mage/src/mage/abilities/effects/common/discard/DiscardControllerEffect.java @@ -82,7 +82,7 @@ public class DiscardControllerEffect extends OneShotEffect { Player player = game.getPlayer(source.getControllerId()); if (player != null) { if (randomDiscard) { - int maxAmount = Math.min(amount.calculate(game, source), player.getHand().size()); + int maxAmount = Math.min(amount.calculate(game, source, this), player.getHand().size()); for (int i = 0; i < maxAmount; i++) { Card card = player.getHand().getRandom(game); if (card != null) { @@ -90,7 +90,7 @@ public class DiscardControllerEffect extends OneShotEffect { } } } else { - player.discard(amount.calculate(game, source), source, game); + player.discard(amount.calculate(game, source, this), source, game); result = true; } } diff --git a/Mage/src/mage/abilities/effects/common/discard/DiscardEachPlayerEffect.java b/Mage/src/mage/abilities/effects/common/discard/DiscardEachPlayerEffect.java index 0c1a00ebfe..e801fa4d07 100644 --- a/Mage/src/mage/abilities/effects/common/discard/DiscardEachPlayerEffect.java +++ b/Mage/src/mage/abilities/effects/common/discard/DiscardEachPlayerEffect.java @@ -79,7 +79,7 @@ public class DiscardEachPlayerEffect extends OneShotEffect { } break; } - int numberOfCardsToDiscard = Math.min(amount.calculate(game, source), player.getHand().size()); + int numberOfCardsToDiscard = Math.min(amount.calculate(game, source, this), player.getHand().size()); Cards cards = new CardsImpl(); if (randomDiscard) { while (player.isInGame() && cards.size() < numberOfCardsToDiscard) { diff --git a/Mage/src/mage/abilities/effects/common/discard/DiscardTargetEffect.java b/Mage/src/mage/abilities/effects/common/discard/DiscardTargetEffect.java index f9bdd4d481..8d80c61207 100644 --- a/Mage/src/mage/abilities/effects/common/discard/DiscardTargetEffect.java +++ b/Mage/src/mage/abilities/effects/common/discard/DiscardTargetEffect.java @@ -92,7 +92,7 @@ public class DiscardTargetEffect extends OneShotEffect { Player player = game.getPlayer(targetPointer.getFirst(game, source)); if (player != null) { if (randomDiscard) { - int maxAmount = Math.min(amount.calculate(game, source), player.getHand().size()); + int maxAmount = Math.min(amount.calculate(game, source, this), player.getHand().size()); for (int i = 0; i < maxAmount; i++) { Card card = player.getHand().getRandom(game); if (card != null) { @@ -105,7 +105,7 @@ public class DiscardTargetEffect extends OneShotEffect { } } } else { - player.discard(amount.calculate(game, source), source, game); + player.discard(amount.calculate(game, source, this), source, game); } return true; diff --git a/Mage/src/mage/abilities/keyword/BushidoAbility.java b/Mage/src/mage/abilities/keyword/BushidoAbility.java index d74b89288b..6ca43bec55 100644 --- a/Mage/src/mage/abilities/keyword/BushidoAbility.java +++ b/Mage/src/mage/abilities/keyword/BushidoAbility.java @@ -31,6 +31,7 @@ import mage.abilities.Ability; import mage.abilities.common.BlocksOrBecomesBlockedTriggeredAbility; import mage.abilities.dynamicvalue.DynamicValue; import mage.abilities.dynamicvalue.common.StaticValue; +import mage.abilities.effects.Effect; import mage.abilities.effects.common.continious.BoostSourceEffect; import mage.constants.Duration; import mage.game.Game; @@ -65,8 +66,8 @@ public class BushidoAbility extends BlocksOrBecomesBlockedTriggeredAbility { return new BushidoAbility(this); } - public int getValue(Ability source, Game game) { - return value.calculate(game, source); + public int getValue(Ability source, Game game, Effect effect) { + return value.calculate(game, source, effect); } @Override diff --git a/Mage/src/mage/abilities/keyword/SunburstAbility.java b/Mage/src/mage/abilities/keyword/SunburstAbility.java index 941603a542..77e071d7c2 100644 --- a/Mage/src/mage/abilities/keyword/SunburstAbility.java +++ b/Mage/src/mage/abilities/keyword/SunburstAbility.java @@ -98,10 +98,10 @@ class SunburstEffect extends OneShotEffect { if (permanent != null) { Counter counter; if(permanent.getCardType().contains(CardType.CREATURE)){ - counter = CounterType.P1P1.createInstance(amount.calculate(game, source)); + counter = CounterType.P1P1.createInstance(amount.calculate(game, source, this)); } else{ - counter = CounterType.CHARGE.createInstance(amount.calculate(game, source)); + counter = CounterType.CHARGE.createInstance(amount.calculate(game, source, this)); } if (counter != null) { diff --git a/Mage/src/mage/game/match/Match.java b/Mage/src/mage/game/match/Match.java index 3c3eb44989..ba5ee6d2e1 100644 --- a/Mage/src/mage/game/match/Match.java +++ b/Mage/src/mage/game/match/Match.java @@ -28,9 +28,6 @@ package mage.game.match; -import java.util.Date; -import java.util.List; -import java.util.UUID; import mage.cards.decks.Deck; import mage.game.Game; import mage.game.GameException; @@ -38,6 +35,10 @@ import mage.game.events.Listener; import mage.game.events.TableEvent; import mage.players.Player; +import java.util.Date; +import java.util.List; +import java.util.UUID; + /** * * @author BetaSteward_at_googlemail.com diff --git a/Mage/src/mage/target/TargetAmount.java b/Mage/src/mage/target/TargetAmount.java index 47d1bc36d9..e9060539e2 100644 --- a/Mage/src/mage/target/TargetAmount.java +++ b/Mage/src/mage/target/TargetAmount.java @@ -28,14 +28,15 @@ package mage.target; -import java.util.*; -import mage.constants.Outcome; import mage.abilities.Ability; import mage.abilities.dynamicvalue.DynamicValue; import mage.abilities.dynamicvalue.common.StaticValue; +import mage.constants.Outcome; import mage.game.Game; import mage.players.Player; +import java.util.*; + /** * * @author BetaSteward_at_googlemail.com @@ -95,7 +96,7 @@ public abstract class TargetAmount extends TargetImpl { } public void setAmount(Ability source, Game game) { - remainingAmount = amount.calculate(game, source); + remainingAmount = amount.calculate(game, source, null); amountWasSet = true; }