diff --git a/Mage/src/mage/abilities/dynamicvalue/IntPlusDynamicValue.java b/Mage/src/mage/abilities/dynamicvalue/IntPlusDynamicValue.java index bb787f1db5d..17b2373adee 100644 --- a/Mage/src/mage/abilities/dynamicvalue/IntPlusDynamicValue.java +++ b/Mage/src/mage/abilities/dynamicvalue/IntPlusDynamicValue.java @@ -25,7 +25,6 @@ * authors and should not be interpreted as representing official policies, either expressed * or implied, of BetaSteward_at_googlemail.com. */ - package mage.abilities.dynamicvalue; import mage.abilities.Ability; @@ -36,8 +35,8 @@ import mage.game.Game; * * @author LevelX2 */ - public class IntPlusDynamicValue implements DynamicValue { + private final DynamicValue value; private final int baseValue; @@ -57,7 +56,7 @@ public class IntPlusDynamicValue implements DynamicValue { } @Override - public DynamicValue copy() { + public IntPlusDynamicValue copy() { return new IntPlusDynamicValue(this); } diff --git a/Mage/src/mage/abilities/dynamicvalue/MultipliedValue.java b/Mage/src/mage/abilities/dynamicvalue/MultipliedValue.java index 142e4957461..66c92a0809a 100644 --- a/Mage/src/mage/abilities/dynamicvalue/MultipliedValue.java +++ b/Mage/src/mage/abilities/dynamicvalue/MultipliedValue.java @@ -25,7 +25,6 @@ * authors and should not be interpreted as representing official policies, either expressed * or implied, of BetaSteward_at_googlemail.com. */ - package mage.abilities.dynamicvalue; import mage.abilities.Ability; @@ -36,8 +35,8 @@ import mage.game.Game; * * @author LevelX2 */ - public class MultipliedValue implements DynamicValue { + private final DynamicValue value; private final int multplier; @@ -57,7 +56,7 @@ public class MultipliedValue implements DynamicValue { } @Override - public DynamicValue copy() { + public MultipliedValue copy() { return new MultipliedValue(this); } diff --git a/Mage/src/mage/abilities/dynamicvalue/common/AttackingCreatureCount.java b/Mage/src/mage/abilities/dynamicvalue/common/AttackingCreatureCount.java index cb14e541b48..085246aa33b 100644 --- a/Mage/src/mage/abilities/dynamicvalue/common/AttackingCreatureCount.java +++ b/Mage/src/mage/abilities/dynamicvalue/common/AttackingCreatureCount.java @@ -25,7 +25,6 @@ * authors and should not be interpreted as representing official policies, either expressed * or implied, of BetaSteward_at_googlemail.com. */ - package mage.abilities.dynamicvalue.common; import mage.abilities.Ability; @@ -38,8 +37,6 @@ import mage.game.combat.CombatGroup; * * @author LevelX2 */ - - public class AttackingCreatureCount implements DynamicValue { private String message; @@ -67,7 +64,7 @@ public class AttackingCreatureCount implements DynamicValue { } @Override - public DynamicValue copy() { + public AttackingCreatureCount copy() { return new AttackingCreatureCount(this); } diff --git a/Mage/src/mage/abilities/dynamicvalue/common/AuraAttachedCount.java b/Mage/src/mage/abilities/dynamicvalue/common/AuraAttachedCount.java index 373025c4383..be484456be7 100644 --- a/Mage/src/mage/abilities/dynamicvalue/common/AuraAttachedCount.java +++ b/Mage/src/mage/abilities/dynamicvalue/common/AuraAttachedCount.java @@ -27,15 +27,14 @@ */ 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 @@ -74,7 +73,7 @@ public class AuraAttachedCount implements DynamicValue { } @Override - public DynamicValue copy() { + public AuraAttachedCount copy() { return new AuraAttachedCount(this); } diff --git a/Mage/src/mage/abilities/dynamicvalue/common/CardsInAllGraveyardsCount.java b/Mage/src/mage/abilities/dynamicvalue/common/CardsInAllGraveyardsCount.java index debf69c55dc..caec5c530a7 100644 --- a/Mage/src/mage/abilities/dynamicvalue/common/CardsInAllGraveyardsCount.java +++ b/Mage/src/mage/abilities/dynamicvalue/common/CardsInAllGraveyardsCount.java @@ -25,7 +25,6 @@ * authors and should not be interpreted as representing official policies, either expressed * or implied, of BetaSteward_at_googlemail.com. */ - package mage.abilities.dynamicvalue.common; import java.util.UUID; @@ -72,7 +71,7 @@ public class CardsInAllGraveyardsCount implements DynamicValue { } @Override - public DynamicValue copy() { + public CardsInAllGraveyardsCount copy() { return new CardsInAllGraveyardsCount(this); } diff --git a/Mage/src/mage/abilities/dynamicvalue/common/CardsInControllerGraveyardCount.java b/Mage/src/mage/abilities/dynamicvalue/common/CardsInControllerGraveyardCount.java index 114bbba06d8..c69bea308f6 100644 --- a/Mage/src/mage/abilities/dynamicvalue/common/CardsInControllerGraveyardCount.java +++ b/Mage/src/mage/abilities/dynamicvalue/common/CardsInControllerGraveyardCount.java @@ -44,7 +44,7 @@ public class CardsInControllerGraveyardCount implements DynamicValue { } @Override - public DynamicValue copy() { + public CardsInControllerGraveyardCount copy() { return new CardsInControllerGraveyardCount(this); } diff --git a/Mage/src/mage/abilities/dynamicvalue/common/CardsInControllerHandCount.java b/Mage/src/mage/abilities/dynamicvalue/common/CardsInControllerHandCount.java index f94de01572e..71e9836cb8a 100644 --- a/Mage/src/mage/abilities/dynamicvalue/common/CardsInControllerHandCount.java +++ b/Mage/src/mage/abilities/dynamicvalue/common/CardsInControllerHandCount.java @@ -7,6 +7,7 @@ import mage.game.Game; import mage.players.Player; public class CardsInControllerHandCount implements DynamicValue { + @Override public int calculate(Game game, Ability sourceAbility, Effect effect) { if (sourceAbility != null) { @@ -19,7 +20,7 @@ public class CardsInControllerHandCount implements DynamicValue { } @Override - public DynamicValue copy() { + public CardsInControllerHandCount copy() { return new CardsInControllerHandCount(); } diff --git a/Mage/src/mage/abilities/dynamicvalue/common/CardsInTargetPlayerHandCount.java b/Mage/src/mage/abilities/dynamicvalue/common/CardsInTargetPlayerHandCount.java index 27bab074560..393f45db14e 100644 --- a/Mage/src/mage/abilities/dynamicvalue/common/CardsInTargetPlayerHandCount.java +++ b/Mage/src/mage/abilities/dynamicvalue/common/CardsInTargetPlayerHandCount.java @@ -22,7 +22,7 @@ public class CardsInTargetPlayerHandCount implements DynamicValue { } @Override - public DynamicValue copy() { + public CardsInTargetPlayerHandCount copy() { return new CardsInTargetPlayerHandCount(); } @@ -30,5 +30,5 @@ public class CardsInTargetPlayerHandCount implements DynamicValue { public String getMessage() { return "cards in target player's hand"; } - + } diff --git a/Mage/src/mage/abilities/dynamicvalue/common/ControllerGotLifeCount.java b/Mage/src/mage/abilities/dynamicvalue/common/ControllerGotLifeCount.java index a1df5caba3c..cb9571281a9 100644 --- a/Mage/src/mage/abilities/dynamicvalue/common/ControllerGotLifeCount.java +++ b/Mage/src/mage/abilities/dynamicvalue/common/ControllerGotLifeCount.java @@ -25,9 +25,10 @@ * authors and should not be interpreted as representing official policies, either expressed * or implied, of BetaSteward_at_googlemail.com. */ - 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; @@ -35,18 +36,14 @@ import mage.abilities.effects.Effect; 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. - * + * * @author LevelX2 */ - public class ControllerGotLifeCount implements DynamicValue, MageSingleton { - private static final ControllerGotLifeCount fINSTANCE = new ControllerGotLifeCount(); + private static final ControllerGotLifeCount fINSTANCE = new ControllerGotLifeCount(); private Object readResolve() throws ObjectStreamException { return fINSTANCE; @@ -70,7 +67,7 @@ public class ControllerGotLifeCount implements DynamicValue, MageSingleton { } @Override - public DynamicValue copy() { + public ControllerGotLifeCount copy() { return new ControllerGotLifeCount(); } diff --git a/Mage/src/mage/abilities/dynamicvalue/common/ControllerLifeCount.java b/Mage/src/mage/abilities/dynamicvalue/common/ControllerLifeCount.java index 688b28b63c9..e756e77e3e4 100644 --- a/Mage/src/mage/abilities/dynamicvalue/common/ControllerLifeCount.java +++ b/Mage/src/mage/abilities/dynamicvalue/common/ControllerLifeCount.java @@ -7,6 +7,7 @@ import mage.game.Game; import mage.players.Player; public class ControllerLifeCount implements DynamicValue { + @Override public int calculate(Game game, Ability sourceAbility, Effect effect) { Player p = game.getPlayer(sourceAbility.getControllerId()); @@ -17,7 +18,7 @@ public class ControllerLifeCount implements DynamicValue { } @Override - public DynamicValue copy() { + public ControllerLifeCount copy() { return new ControllerLifeCount(); } diff --git a/Mage/src/mage/abilities/dynamicvalue/common/CountersCount.java b/Mage/src/mage/abilities/dynamicvalue/common/CountersCount.java index 9f6a5312a62..fdf010b7045 100644 --- a/Mage/src/mage/abilities/dynamicvalue/common/CountersCount.java +++ b/Mage/src/mage/abilities/dynamicvalue/common/CountersCount.java @@ -29,7 +29,7 @@ public class CountersCount implements DynamicValue { } @Override - public DynamicValue copy() { + public CountersCount copy() { return new CountersCount(this); } diff --git a/Mage/src/mage/abilities/dynamicvalue/common/DevotionCount.java b/Mage/src/mage/abilities/dynamicvalue/common/DevotionCount.java index 439f2146e3b..fd8edb3ebe5 100644 --- a/Mage/src/mage/abilities/dynamicvalue/common/DevotionCount.java +++ b/Mage/src/mage/abilities/dynamicvalue/common/DevotionCount.java @@ -4,6 +4,8 @@ */ 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; @@ -12,11 +14,9 @@ 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. + * Each colored mana symbol (e.g. {U}) in the mana costs of permanents you + * control counts toward your devotion to that color. * * @author LevelX2 */ @@ -36,8 +36,8 @@ public class DevotionCount implements DynamicValue { 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()) { - for(ColoredManaSymbol coloredManaSymbol: devotionColors) { + for (ManaCost manaCost : permanent.getManaCost()) { + for (ColoredManaSymbol coloredManaSymbol : devotionColors) { if (manaCost.containsColor(coloredManaSymbol)) { devotion++; break; // count each manaCost maximum of one time (Hybrid don't count for multiple colors of devotion) @@ -49,7 +49,7 @@ public class DevotionCount implements DynamicValue { } @Override - public DynamicValue copy() { + public DevotionCount copy() { return new DevotionCount(this); } @@ -62,7 +62,7 @@ public class DevotionCount implements DynamicValue { public String getMessage() { StringBuilder sb = new StringBuilder("devotion to "); int count = 0; - for (ColoredManaSymbol coloredManaSymbol:devotionColors) { + for (ColoredManaSymbol coloredManaSymbol : devotionColors) { if (count > 0) { sb.append(" and "); } diff --git a/Mage/src/mage/abilities/dynamicvalue/common/DevouredCreaturesCount.java b/Mage/src/mage/abilities/dynamicvalue/common/DevouredCreaturesCount.java index 7f3084786d9..4ce7c389bd5 100644 --- a/Mage/src/mage/abilities/dynamicvalue/common/DevouredCreaturesCount.java +++ b/Mage/src/mage/abilities/dynamicvalue/common/DevouredCreaturesCount.java @@ -25,7 +25,6 @@ * authors and should not be interpreted as representing official policies, either expressed * or implied, of BetaSteward_at_googlemail.com. */ - package mage.abilities.dynamicvalue.common; import mage.abilities.Ability; @@ -40,7 +39,6 @@ import mage.game.permanent.Permanent; * * @author LevelX2 */ - public class DevouredCreaturesCount implements DynamicValue { int multiplier; @@ -65,7 +63,7 @@ public class DevouredCreaturesCount implements DynamicValue { if (sourcePermanent != null) { for (Ability ability : sourcePermanent.getAbilities()) { if (ability instanceof DevourAbility) { - for (Effect abilityEffect: ability.getEffects()) { + 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 773e73e12ed..b14708d05eb 100644 --- a/Mage/src/mage/abilities/dynamicvalue/common/DiscardCostCardConvertedMana.java +++ b/Mage/src/mage/abilities/dynamicvalue/common/DiscardCostCardConvertedMana.java @@ -15,11 +15,11 @@ public class DiscardCostCardConvertedMana implements DynamicValue { @Override public int calculate(Game game, Ability sourceAbility, Effect effect) { - for (Cost cost: sourceAbility.getCosts()) { + for (Cost cost : sourceAbility.getCosts()) { if (cost instanceof DiscardCardCost) { DiscardCardCost discardCost = (DiscardCardCost) cost; int cmc = 0; - for (Card card :discardCost.getCards()) { + for (Card card : discardCost.getCards()) { cmc += card.getManaCost().convertedManaCost(); } return cmc; @@ -29,7 +29,7 @@ public class DiscardCostCardConvertedMana implements DynamicValue { } @Override - public DynamicValue copy() { + public DiscardCostCardConvertedMana copy() { return new DiscardCostCardConvertedMana(); } @@ -38,7 +38,6 @@ public class DiscardCostCardConvertedMana implements DynamicValue { return ""; } - @Override public String getMessage() { return "the discarded card's converted mana cost"; diff --git a/Mage/src/mage/abilities/dynamicvalue/common/DomainValue.java b/Mage/src/mage/abilities/dynamicvalue/common/DomainValue.java index e61d565b90f..ca8f4f68cc9 100644 --- a/Mage/src/mage/abilities/dynamicvalue/common/DomainValue.java +++ b/Mage/src/mage/abilities/dynamicvalue/common/DomainValue.java @@ -74,7 +74,7 @@ public class DomainValue implements DynamicValue { } @Override - public DynamicValue copy() { + public DomainValue copy() { return new DomainValue(this); } diff --git a/Mage/src/mage/abilities/dynamicvalue/common/EquipmentAttachedCount.java b/Mage/src/mage/abilities/dynamicvalue/common/EquipmentAttachedCount.java index dcbba5c951a..6bc0e8c51c2 100644 --- a/Mage/src/mage/abilities/dynamicvalue/common/EquipmentAttachedCount.java +++ b/Mage/src/mage/abilities/dynamicvalue/common/EquipmentAttachedCount.java @@ -27,15 +27,14 @@ */ 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, noxx @@ -73,7 +72,7 @@ public class EquipmentAttachedCount implements DynamicValue { } @Override - public DynamicValue copy() { + public EquipmentAttachedCount copy() { return new EquipmentAttachedCount(this); } diff --git a/Mage/src/mage/abilities/dynamicvalue/common/ExileFromHandCostCardConvertedMana.java b/Mage/src/mage/abilities/dynamicvalue/common/ExileFromHandCostCardConvertedMana.java index eb24c0f60f3..29adcaf1eca 100644 --- a/Mage/src/mage/abilities/dynamicvalue/common/ExileFromHandCostCardConvertedMana.java +++ b/Mage/src/mage/abilities/dynamicvalue/common/ExileFromHandCostCardConvertedMana.java @@ -36,20 +36,18 @@ import mage.cards.Card; import mage.game.Game; /** - * Calculates the converted mana costs of a card that was - * exiled from hand as cost. - * If no card was exiled the getManaCostsToPay().getX() will - * be used as value. + * Calculates the converted mana costs of a card that was exiled from hand as + * cost. If no card was exiled the getManaCostsToPay().getX() will be used as + * value. * * * @author LevelX2 */ - public class ExileFromHandCostCardConvertedMana implements DynamicValue { @Override public int calculate(Game game, Ability sourceAbility, Effect effect) { - for (Cost cost: sourceAbility.getCosts()) { + for (Cost cost : sourceAbility.getCosts()) { if (cost.isPaid() && cost instanceof ExileFromHandCost) { int xValue = 0; for (Card card : ((ExileFromHandCost) cost).getCards()) { @@ -62,7 +60,7 @@ public class ExileFromHandCostCardConvertedMana implements DynamicValue { } @Override - public DynamicValue copy() { + public ExileFromHandCostCardConvertedMana copy() { return new ExileFromHandCostCardConvertedMana(); } diff --git a/Mage/src/mage/abilities/dynamicvalue/common/ManaSpentToCastCount.java b/Mage/src/mage/abilities/dynamicvalue/common/ManaSpentToCastCount.java index a4734cb8daa..9ee09e5ea04 100644 --- a/Mage/src/mage/abilities/dynamicvalue/common/ManaSpentToCastCount.java +++ b/Mage/src/mage/abilities/dynamicvalue/common/ManaSpentToCastCount.java @@ -39,9 +39,9 @@ import mage.game.stack.Spell; * * @author LevelX2 */ -public class ManaSpentToCastCount implements DynamicValue{ +public class ManaSpentToCastCount implements DynamicValue { - public ManaSpentToCastCount(){ + public ManaSpentToCastCount() { } @Override @@ -61,7 +61,7 @@ public class ManaSpentToCastCount implements DynamicValue{ } @Override - public DynamicValue copy() { + public ManaSpentToCastCount copy() { return new ManaSpentToCastCount(); } diff --git a/Mage/src/mage/abilities/dynamicvalue/common/ManaTypeInManaPoolCount.java b/Mage/src/mage/abilities/dynamicvalue/common/ManaTypeInManaPoolCount.java index 50275a242c2..1b0ebe8ff16 100644 --- a/Mage/src/mage/abilities/dynamicvalue/common/ManaTypeInManaPoolCount.java +++ b/Mage/src/mage/abilities/dynamicvalue/common/ManaTypeInManaPoolCount.java @@ -34,7 +34,7 @@ public class ManaTypeInManaPoolCount implements DynamicValue { } @Override - public DynamicValue copy() { + public ManaTypeInManaPoolCount copy() { return new ManaTypeInManaPoolCount(this); } diff --git a/Mage/src/mage/abilities/dynamicvalue/common/OpponentsLostLifeCount.java b/Mage/src/mage/abilities/dynamicvalue/common/OpponentsLostLifeCount.java index 3a227d20428..2603e6b02ca 100644 --- a/Mage/src/mage/abilities/dynamicvalue/common/OpponentsLostLifeCount.java +++ b/Mage/src/mage/abilities/dynamicvalue/common/OpponentsLostLifeCount.java @@ -25,22 +25,19 @@ * authors and should not be interpreted as representing official policies, either expressed * or implied, of BetaSteward_at_googlemail.com. */ - 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 */ - public class OpponentsLostLifeCount implements DynamicValue { @Override @@ -52,7 +49,7 @@ public class OpponentsLostLifeCount implements DynamicValue { PlayerLostLifeWatcher watcher = (PlayerLostLifeWatcher) game.getState().getWatchers().get("PlayerLostLifeWatcher"); if (watcher != null) { int amountLifeLost = 0; - for(UUID opponent: game.getOpponents(controllerId)){ + for (UUID opponent : game.getOpponents(controllerId)) { amountLifeLost += watcher.getLiveLost(opponent); } return amountLifeLost; @@ -61,7 +58,7 @@ public class OpponentsLostLifeCount implements DynamicValue { } @Override - public DynamicValue copy() { + public OpponentsLostLifeCount copy() { return new OpponentsLostLifeCount(); } diff --git a/Mage/src/mage/abilities/dynamicvalue/common/ParleyCount.java b/Mage/src/mage/abilities/dynamicvalue/common/ParleyCount.java index 008969e24fd..9d70b0ac258 100644 --- a/Mage/src/mage/abilities/dynamicvalue/common/ParleyCount.java +++ b/Mage/src/mage/abilities/dynamicvalue/common/ParleyCount.java @@ -81,7 +81,7 @@ public class ParleyCount implements DynamicValue, MageSingleton { } @Override - public DynamicValue copy() { + public ParleyCount copy() { return fINSTANCE; } diff --git a/Mage/src/mage/abilities/dynamicvalue/common/PermanentsOnBattlefieldCount.java b/Mage/src/mage/abilities/dynamicvalue/common/PermanentsOnBattlefieldCount.java index a1875905cb4..0e1e2cd35a0 100644 --- a/Mage/src/mage/abilities/dynamicvalue/common/PermanentsOnBattlefieldCount.java +++ b/Mage/src/mage/abilities/dynamicvalue/common/PermanentsOnBattlefieldCount.java @@ -1,3 +1,30 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ package mage.abilities.dynamicvalue.common; import mage.abilities.Ability; @@ -43,7 +70,7 @@ public class PermanentsOnBattlefieldCount implements DynamicValue { } @Override - public DynamicValue copy() { + public PermanentsOnBattlefieldCount copy() { return new PermanentsOnBattlefieldCount(this); } diff --git a/Mage/src/mage/abilities/dynamicvalue/common/PermanentsTargetOpponentControlsCount.java b/Mage/src/mage/abilities/dynamicvalue/common/PermanentsTargetOpponentControlsCount.java index 20ac6b22b9a..f53b9e1fbfb 100644 --- a/Mage/src/mage/abilities/dynamicvalue/common/PermanentsTargetOpponentControlsCount.java +++ b/Mage/src/mage/abilities/dynamicvalue/common/PermanentsTargetOpponentControlsCount.java @@ -1,3 +1,30 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ package mage.abilities.dynamicvalue.common; import mage.abilities.Ability; @@ -11,7 +38,6 @@ import mage.game.Game; * * @author LoneFox */ - public class PermanentsTargetOpponentControlsCount implements DynamicValue { private FilterPermanent filter; @@ -36,25 +62,24 @@ public class PermanentsTargetOpponentControlsCount implements DynamicValue { } @Override - public DynamicValue copy() { + public PermanentsTargetOpponentControlsCount copy() { return new PermanentsTargetOpponentControlsCount(this); } @Override public int calculate(Game game, Ability sourceAbility, Effect effect) { - if(sourceAbility.getFirstTarget() != null) { + if (sourceAbility.getFirstTarget() != null) { filter.add(new ControllerIdPredicate(sourceAbility.getFirstTarget())); int value = game.getBattlefield().count(filter, sourceAbility.getSourceId(), sourceAbility.getControllerId(), game); return multiplier * value; - } - else { + } else { return 0; } } @Override public String toString() { - if(multiplier != null) { + if (multiplier != null) { return multiplier.toString(); } return "X"; diff --git a/Mage/src/mage/abilities/dynamicvalue/common/RemovedCountersForCostValue.java b/Mage/src/mage/abilities/dynamicvalue/common/RemovedCountersForCostValue.java index 4d27f4dacac..7fce69b56c9 100644 --- a/Mage/src/mage/abilities/dynamicvalue/common/RemovedCountersForCostValue.java +++ b/Mage/src/mage/abilities/dynamicvalue/common/RemovedCountersForCostValue.java @@ -3,7 +3,6 @@ * To change this template file, choose Tools | Templates * and open the template in the editor. */ - package mage.abilities.dynamicvalue.common; import mage.abilities.Ability; @@ -21,7 +20,7 @@ public class RemovedCountersForCostValue implements DynamicValue { @Override public int calculate(Game game, Ability sourceAbility, Effect effect) { - for (Cost cost: sourceAbility.getCosts()) { + for (Cost cost : sourceAbility.getCosts()) { if (cost instanceof RemoveVariableCountersSourceCost) { return ((RemoveVariableCountersSourceCost) cost).getAmount(); } @@ -31,11 +30,11 @@ public class RemovedCountersForCostValue implements DynamicValue { @Override public String getMessage() { - return "number of removed counters"; + return "number of removed counters"; } @Override - public DynamicValue copy() { + public RemovedCountersForCostValue copy() { return new RemovedCountersForCostValue(); } diff --git a/Mage/src/mage/abilities/dynamicvalue/common/RevealTargetFromHandCostCount.java b/Mage/src/mage/abilities/dynamicvalue/common/RevealTargetFromHandCostCount.java index 373b5889e72..4e09ad6554c 100644 --- a/Mage/src/mage/abilities/dynamicvalue/common/RevealTargetFromHandCostCount.java +++ b/Mage/src/mage/abilities/dynamicvalue/common/RevealTargetFromHandCostCount.java @@ -3,7 +3,6 @@ * To change this template file, choose Tools | Templates * and open the template in the editor. */ - package mage.abilities.dynamicvalue.common; import mage.abilities.Ability; @@ -21,7 +20,7 @@ public class RevealTargetFromHandCostCount implements DynamicValue { @Override public int calculate(Game game, Ability sourceAbility, Effect effect) { - for (Cost cost: sourceAbility.getCosts()) { + for (Cost cost : sourceAbility.getCosts()) { if (cost instanceof RevealTargetFromHandCost) { return ((RevealTargetFromHandCost) cost).getNumberRevealedCards(); } @@ -31,11 +30,11 @@ public class RevealTargetFromHandCostCount implements DynamicValue { @Override public String getMessage() { - return "number of revealed cards"; + return "number of revealed cards"; } @Override - public DynamicValue copy() { + public RevealTargetFromHandCostCount copy() { return new RevealTargetFromHandCostCount(); } diff --git a/Mage/src/mage/abilities/dynamicvalue/common/SacrificeCostCreaturesPower.java b/Mage/src/mage/abilities/dynamicvalue/common/SacrificeCostCreaturesPower.java index acfb07d3a66..a563d3c93fa 100644 --- a/Mage/src/mage/abilities/dynamicvalue/common/SacrificeCostCreaturesPower.java +++ b/Mage/src/mage/abilities/dynamicvalue/common/SacrificeCostCreaturesPower.java @@ -15,11 +15,11 @@ public class SacrificeCostCreaturesPower implements DynamicValue { @Override public int calculate(Game game, Ability sourceAbility, Effect effect) { - for (Cost cost: sourceAbility.getCosts()) { + for (Cost cost : sourceAbility.getCosts()) { if (cost instanceof SacrificeTargetCost) { SacrificeTargetCost sacrificeCost = (SacrificeTargetCost) cost; int powerSum = 0; - for (Permanent permanent :sacrificeCost.getPermanents()) { + for (Permanent permanent : sacrificeCost.getPermanents()) { powerSum += permanent.getPower().getValue(); } return powerSum; @@ -29,7 +29,7 @@ public class SacrificeCostCreaturesPower implements DynamicValue { } @Override - public DynamicValue copy() { + public SacrificeCostCreaturesPower copy() { return new SacrificeCostCreaturesPower(); } @@ -38,7 +38,6 @@ public class SacrificeCostCreaturesPower implements DynamicValue { return "X"; } - @Override public String getMessage() { return "the sacrificed creature's power"; diff --git a/Mage/src/mage/abilities/dynamicvalue/common/SacrificeCostCreaturesToughness.java b/Mage/src/mage/abilities/dynamicvalue/common/SacrificeCostCreaturesToughness.java index 8df1b39c1b1..15256c9c716 100644 --- a/Mage/src/mage/abilities/dynamicvalue/common/SacrificeCostCreaturesToughness.java +++ b/Mage/src/mage/abilities/dynamicvalue/common/SacrificeCostCreaturesToughness.java @@ -15,11 +15,11 @@ public class SacrificeCostCreaturesToughness implements DynamicValue { @Override public int calculate(Game game, Ability sourceAbility, Effect effect) { - for (Cost cost: sourceAbility.getCosts()) { + for (Cost cost : sourceAbility.getCosts()) { if (cost instanceof SacrificeTargetCost) { SacrificeTargetCost sacrificeCost = (SacrificeTargetCost) cost; int toughnessSum = 0; - for (Permanent permanent :sacrificeCost.getPermanents()) { + for (Permanent permanent : sacrificeCost.getPermanents()) { toughnessSum += permanent.getToughness().getValue(); } return toughnessSum; @@ -29,7 +29,7 @@ public class SacrificeCostCreaturesToughness implements DynamicValue { } @Override - public DynamicValue copy() { + public SacrificeCostCreaturesToughness copy() { return new SacrificeCostCreaturesToughness(); } @@ -38,7 +38,6 @@ public class SacrificeCostCreaturesToughness implements DynamicValue { return "X"; } - @Override public String getMessage() { return "the sacrificed creature's toughness"; diff --git a/Mage/src/mage/abilities/dynamicvalue/common/SignInversionDynamicValue.java b/Mage/src/mage/abilities/dynamicvalue/common/SignInversionDynamicValue.java index 2b50242ec4c..d029966a6a9 100644 --- a/Mage/src/mage/abilities/dynamicvalue/common/SignInversionDynamicValue.java +++ b/Mage/src/mage/abilities/dynamicvalue/common/SignInversionDynamicValue.java @@ -6,6 +6,7 @@ import mage.abilities.effects.Effect; import mage.game.Game; public class SignInversionDynamicValue implements DynamicValue { + private final DynamicValue value; public SignInversionDynamicValue(DynamicValue value) { @@ -22,7 +23,7 @@ public class SignInversionDynamicValue implements DynamicValue { } @Override - public DynamicValue copy() { + public SignInversionDynamicValue copy() { return new SignInversionDynamicValue(this); } diff --git a/Mage/src/mage/abilities/dynamicvalue/common/SourcePermanentPowerCount.java b/Mage/src/mage/abilities/dynamicvalue/common/SourcePermanentPowerCount.java index 040973ca7d7..70c54d46ec4 100644 --- a/Mage/src/mage/abilities/dynamicvalue/common/SourcePermanentPowerCount.java +++ b/Mage/src/mage/abilities/dynamicvalue/common/SourcePermanentPowerCount.java @@ -21,7 +21,7 @@ public class SourcePermanentPowerCount implements DynamicValue { } @Override - public DynamicValue copy() { + public SourcePermanentPowerCount copy() { return new SourcePermanentPowerCount(); } diff --git a/Mage/src/mage/abilities/dynamicvalue/common/StaticValue.java b/Mage/src/mage/abilities/dynamicvalue/common/StaticValue.java index 73c981fd64c..13a1befea65 100644 --- a/Mage/src/mage/abilities/dynamicvalue/common/StaticValue.java +++ b/Mage/src/mage/abilities/dynamicvalue/common/StaticValue.java @@ -1,18 +1,19 @@ 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 { + private int value = 0; private String message; - + public StaticValue(int value) { this(value, ""); } + public StaticValue(int value, String message) { this.value = value; this.message = message; @@ -29,7 +30,7 @@ public class StaticValue implements DynamicValue { } @Override - public DynamicValue copy() { + public StaticValue copy() { return new StaticValue(this); } diff --git a/Mage/src/mage/abilities/dynamicvalue/common/SunburstCount.java b/Mage/src/mage/abilities/dynamicvalue/common/SunburstCount.java index 0fa70eb8582..8cb1fbf5cd6 100644 --- a/Mage/src/mage/abilities/dynamicvalue/common/SunburstCount.java +++ b/Mage/src/mage/abilities/dynamicvalue/common/SunburstCount.java @@ -25,7 +25,6 @@ * authors and should not be interpreted as representing official policies, either expressed * or implied, of BetaSteward_at_googlemail.com. */ - package mage.abilities.dynamicvalue.common; import mage.Mana; @@ -40,33 +39,32 @@ import mage.game.stack.StackObject; * * @author Nicolas */ +public class SunburstCount implements DynamicValue { + public SunburstCount() { -public class SunburstCount implements DynamicValue{ - public SunburstCount(){ - } - + @Override public int calculate(Game game, Ability source, Effect effect) { int count = 0; if (!game.getStack().isEmpty()) { StackObject spell = game.getStack().getFirst(); - if (spell != null && spell instanceof Spell && ((Spell)spell).getSourceId().equals(source.getSourceId())) { - Mana mana = ((Spell)spell).getSpellAbility().getManaCostsToPay().getPayment(); - if(mana.getBlack() > 0) { + if (spell != null && spell instanceof Spell && ((Spell) spell).getSourceId().equals(source.getSourceId())) { + Mana mana = ((Spell) spell).getSpellAbility().getManaCostsToPay().getPayment(); + if (mana.getBlack() > 0) { count++; } - if(mana.getBlue() > 0) { + if (mana.getBlue() > 0) { count++; } - if(mana.getGreen() > 0) { + if (mana.getGreen() > 0) { count++; } - if(mana.getRed() > 0) { + if (mana.getRed() > 0) { count++; } - if(mana.getWhite() > 0) { + if (mana.getWhite() > 0) { count++; } } @@ -75,14 +73,13 @@ public class SunburstCount implements DynamicValue{ } @Override - public DynamicValue copy() { + public SunburstCount copy() { return new SunburstCount(); } - @Override public String getMessage() { return "color of mana spent to cast it"; } - + } diff --git a/Mage/src/mage/abilities/dynamicvalue/common/TargetConvertedManaCost.java b/Mage/src/mage/abilities/dynamicvalue/common/TargetConvertedManaCost.java index 97b33f5fba9..c56b5cfce51 100644 --- a/Mage/src/mage/abilities/dynamicvalue/common/TargetConvertedManaCost.java +++ b/Mage/src/mage/abilities/dynamicvalue/common/TargetConvertedManaCost.java @@ -49,7 +49,7 @@ public class TargetConvertedManaCost implements DynamicValue { } @Override - public DynamicValue copy() { + public TargetConvertedManaCost copy() { return new TargetConvertedManaCost(); } diff --git a/Mage/src/mage/abilities/dynamicvalue/common/TargetPermanentPowerCount.java b/Mage/src/mage/abilities/dynamicvalue/common/TargetPermanentPowerCount.java index d6bc27590fb..9cf6f74447e 100644 --- a/Mage/src/mage/abilities/dynamicvalue/common/TargetPermanentPowerCount.java +++ b/Mage/src/mage/abilities/dynamicvalue/common/TargetPermanentPowerCount.java @@ -54,7 +54,7 @@ public class TargetPermanentPowerCount implements DynamicValue { } @Override - public DynamicValue copy() { + public TargetPermanentPowerCount copy() { return new TargetPermanentPowerCount(); } diff --git a/Mage/src/mage/abilities/dynamicvalue/common/UrzaTerrainValue.java b/Mage/src/mage/abilities/dynamicvalue/common/UrzaTerrainValue.java index 9ab2a9dd55c..3db1e5f9aab 100644 --- a/Mage/src/mage/abilities/dynamicvalue/common/UrzaTerrainValue.java +++ b/Mage/src/mage/abilities/dynamicvalue/common/UrzaTerrainValue.java @@ -8,6 +8,7 @@ import mage.filter.predicate.mageobject.SubtypePredicate; import mage.game.Game; public class UrzaTerrainValue implements DynamicValue { + private final int value; public UrzaTerrainValue(int value) { @@ -19,24 +20,21 @@ public class UrzaTerrainValue implements DynamicValue { FilterControlledPermanent pp = new FilterControlledPermanent("Urza's Power Plant"); pp.add(new SubtypePredicate("Urza's Power-Plant")); PermanentsOnBattlefieldCount ppP = new PermanentsOnBattlefieldCount(pp); - if (ppP.calculate(game, sourceAbility, effect) < 1) - { + if (ppP.calculate(game, sourceAbility, effect) < 1) { return 1; } FilterControlledPermanent to = new FilterControlledPermanent("Urza's Tower"); to.add(new SubtypePredicate("Urza's Tower")); PermanentsOnBattlefieldCount toP = new PermanentsOnBattlefieldCount(to); - if (toP.calculate(game, sourceAbility, effect) < 1) - { + if (toP.calculate(game, sourceAbility, effect) < 1) { return 1; } FilterControlledPermanent mi = new FilterControlledPermanent("Urza's Mine"); mi.add(new SubtypePredicate("Urza's Mine")); PermanentsOnBattlefieldCount miP = new PermanentsOnBattlefieldCount(mi); - if (miP.calculate(game, sourceAbility, effect) < 1) - { + if (miP.calculate(game, sourceAbility, effect) < 1) { return 1; } @@ -44,7 +42,7 @@ public class UrzaTerrainValue implements DynamicValue { } @Override - public DynamicValue copy() { + public UrzaTerrainValue copy() { return new UrzaTerrainValue(value); }