mirror of
https://github.com/magefree/mage.git
synced 2025-12-26 05:22:02 -08:00
Merge pull request #6144 from magefree/staticValueRefactor
Replaced instances StaticValue with singletons (ready to merge)
This commit is contained in:
commit
943e8dd827
318 changed files with 449 additions and 435 deletions
|
|
@ -18,7 +18,7 @@ public class PayLifeCost extends CostImpl {
|
|||
private final DynamicValue amount;
|
||||
|
||||
public PayLifeCost(int amount) {
|
||||
this.amount = new StaticValue(amount);
|
||||
this.amount = StaticValue.get(amount);
|
||||
this.text = "Pay " + Integer.toString(amount) + " life";
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,24 +5,24 @@ import mage.abilities.dynamicvalue.DynamicValue;
|
|||
import mage.abilities.effects.Effect;
|
||||
import mage.game.Game;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
public class StaticValue implements DynamicValue {
|
||||
|
||||
private static final List<StaticValue> staticValues = new ArrayList();
|
||||
|
||||
static {
|
||||
IntStream.rangeClosed(-10, 10)
|
||||
.mapToObj(StaticValue::new)
|
||||
.forEachOrdered(staticValues::add);
|
||||
}
|
||||
|
||||
private final int value;
|
||||
private final String message;
|
||||
private static final StaticValue zeroValue = new StaticValue(0);
|
||||
|
||||
public StaticValue(int value) {
|
||||
this(value, "");
|
||||
}
|
||||
|
||||
public StaticValue(int value, String message) {
|
||||
private StaticValue(int value) {
|
||||
this.value = value;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public StaticValue(final StaticValue staticValue) {
|
||||
this.value = staticValue.value;
|
||||
this.message = staticValue.message;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -32,7 +32,7 @@ public class StaticValue implements DynamicValue {
|
|||
|
||||
@Override
|
||||
public StaticValue copy() {
|
||||
return new StaticValue(this);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -42,14 +42,17 @@ public class StaticValue implements DynamicValue {
|
|||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return message;
|
||||
return "";
|
||||
}
|
||||
|
||||
public int getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public static StaticValue getZeroValue() {
|
||||
return zeroValue;
|
||||
public static StaticValue get(int value) {
|
||||
if (value < -10 || value > 10) {
|
||||
return new StaticValue(value);
|
||||
}
|
||||
return staticValues.get(value + 10);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,11 +32,11 @@ public class CreateTokenEffect extends OneShotEffect {
|
|||
private ArrayList<UUID> lastAddedTokenIds = new ArrayList<>();
|
||||
|
||||
public CreateTokenEffect(Token token) {
|
||||
this(token, new StaticValue(1));
|
||||
this(token, StaticValue.get(1));
|
||||
}
|
||||
|
||||
public CreateTokenEffect(Token token, int amount) {
|
||||
this(token, new StaticValue(amount));
|
||||
this(token, StaticValue.get(amount));
|
||||
}
|
||||
|
||||
public CreateTokenEffect(Token token, DynamicValue amount) {
|
||||
|
|
@ -44,7 +44,7 @@ public class CreateTokenEffect extends OneShotEffect {
|
|||
}
|
||||
|
||||
public CreateTokenEffect(Token token, int amount, boolean tapped, boolean attacking) {
|
||||
this(token, new StaticValue(amount), tapped, attacking);
|
||||
this(token, StaticValue.get(amount), tapped, attacking);
|
||||
}
|
||||
|
||||
public CreateTokenEffect(Token token, DynamicValue amount, boolean tapped, boolean attacking) {
|
||||
|
|
|
|||
|
|
@ -22,11 +22,11 @@ public class CreateTokenTargetEffect extends OneShotEffect {
|
|||
private boolean attacking;
|
||||
|
||||
public CreateTokenTargetEffect(Token token) {
|
||||
this(token, new StaticValue(1));
|
||||
this(token, StaticValue.get(1));
|
||||
}
|
||||
|
||||
public CreateTokenTargetEffect(Token token, int amount) {
|
||||
this(token, new StaticValue(amount));
|
||||
this(token, StaticValue.get(amount));
|
||||
}
|
||||
|
||||
public CreateTokenTargetEffect(Token token, DynamicValue amount) {
|
||||
|
|
|
|||
|
|
@ -22,11 +22,11 @@ public class DamageAllEffect extends OneShotEffect {
|
|||
private String sourceName = "{source}";
|
||||
|
||||
public DamageAllEffect(int amount, FilterPermanent filter) {
|
||||
this(new StaticValue(amount), filter);
|
||||
this(StaticValue.get(amount), filter);
|
||||
}
|
||||
|
||||
public DamageAllEffect(int amount, String whoDealDamageName, FilterPermanent filter) {
|
||||
this(new StaticValue(amount), filter);
|
||||
this(StaticValue.get(amount), filter);
|
||||
|
||||
this.sourceName = whoDealDamageName;
|
||||
setText(); // TODO: replace to @Override public String getText()
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ public class DamageAttachedControllerEffect extends OneShotEffect {
|
|||
|
||||
public DamageAttachedControllerEffect(int amount) {
|
||||
super(Outcome.Damage);
|
||||
this.amount = new StaticValue(amount);
|
||||
this.amount = StaticValue.get(amount);
|
||||
}
|
||||
|
||||
public DamageAttachedControllerEffect(DynamicValue amount) {
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ public class DamageAttachedEffect extends OneShotEffect {
|
|||
|
||||
public DamageAttachedEffect(int amount) {
|
||||
super(Outcome.Damage);
|
||||
this.amount = new StaticValue(amount);
|
||||
this.amount = StaticValue.get(amount);
|
||||
}
|
||||
|
||||
public DamageAttachedEffect(int amount, String whoDealDamageName) {
|
||||
|
|
|
|||
|
|
@ -31,14 +31,14 @@ public class DamageControllerEffect extends OneShotEffect {
|
|||
|
||||
public DamageControllerEffect(int amount, boolean preventable, String whoDealDamageName) {
|
||||
super(Outcome.Damage);
|
||||
this.amount = new StaticValue(amount);
|
||||
this.amount = StaticValue.get(amount);
|
||||
this.preventable = preventable;
|
||||
this.sourceName = whoDealDamageName;
|
||||
}
|
||||
|
||||
public DamageControllerEffect(int amount, boolean preventable) {
|
||||
super(Outcome.Damage);
|
||||
this.amount = new StaticValue(amount);
|
||||
this.amount = StaticValue.get(amount);
|
||||
this.preventable = preventable;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -27,11 +27,11 @@ public class DamageEverythingEffect extends OneShotEffect {
|
|||
private String sourceName = "{source}";
|
||||
|
||||
public DamageEverythingEffect(int amount) {
|
||||
this(new StaticValue(amount), new FilterCreaturePermanent());
|
||||
this(StaticValue.get(amount), new FilterCreaturePermanent());
|
||||
}
|
||||
|
||||
public DamageEverythingEffect(int amount, String whoDealDamageName) {
|
||||
this(new StaticValue(amount), new FilterCreaturePermanent());
|
||||
this(StaticValue.get(amount), new FilterCreaturePermanent());
|
||||
|
||||
this.sourceName = whoDealDamageName;
|
||||
setText(); // TODO: replace to @Override public String getText()
|
||||
|
|
@ -42,7 +42,7 @@ public class DamageEverythingEffect extends OneShotEffect {
|
|||
}
|
||||
|
||||
public DamageEverythingEffect(int amount, FilterPermanent filter) {
|
||||
this(new StaticValue(amount), filter);
|
||||
this(StaticValue.get(amount), filter);
|
||||
}
|
||||
|
||||
public DamageEverythingEffect(DynamicValue amount, FilterPermanent filter) {
|
||||
|
|
|
|||
|
|
@ -26,11 +26,11 @@ public class DamageMultiEffect extends OneShotEffect {
|
|||
private final Set<MageObjectReference> damagedSet = new HashSet<>();
|
||||
|
||||
public DamageMultiEffect(int amount) {
|
||||
this(new StaticValue(amount));
|
||||
this(StaticValue.get(amount));
|
||||
}
|
||||
|
||||
public DamageMultiEffect(int amount, String whoDealDamageName) {
|
||||
this(new StaticValue(amount));
|
||||
this(StaticValue.get(amount));
|
||||
this.sourceName = whoDealDamageName;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -21,15 +21,15 @@ public class DamagePlayersEffect extends OneShotEffect {
|
|||
private String sourceName = "{source}";
|
||||
|
||||
public DamagePlayersEffect(int amount) {
|
||||
this(Outcome.Damage, new StaticValue(amount));
|
||||
this(Outcome.Damage, StaticValue.get(amount));
|
||||
}
|
||||
|
||||
public DamagePlayersEffect(int amount, TargetController controller) {
|
||||
this(Outcome.Damage, new StaticValue(amount), controller);
|
||||
this(Outcome.Damage, StaticValue.get(amount), controller);
|
||||
}
|
||||
|
||||
public DamagePlayersEffect(int amount, TargetController controller, String whoDealDamageName) {
|
||||
this(Outcome.Damage, new StaticValue(amount), controller);
|
||||
this(Outcome.Damage, StaticValue.get(amount), controller);
|
||||
|
||||
this.sourceName = whoDealDamageName;
|
||||
setText(); // TODO: replace to @Override public String getText()
|
||||
|
|
|
|||
|
|
@ -21,11 +21,11 @@ public class DamageTargetControllerEffect extends OneShotEffect {
|
|||
protected boolean preventable;
|
||||
|
||||
public DamageTargetControllerEffect(int amount) {
|
||||
this(new StaticValue(amount), true);
|
||||
this(StaticValue.get(amount), true);
|
||||
}
|
||||
|
||||
public DamageTargetControllerEffect(int amount, boolean preventable) {
|
||||
this(new StaticValue(amount), preventable);
|
||||
this(StaticValue.get(amount), preventable);
|
||||
}
|
||||
|
||||
public DamageTargetControllerEffect(DynamicValue amount) {
|
||||
|
|
|
|||
|
|
@ -27,24 +27,24 @@ public class DamageTargetEffect extends OneShotEffect {
|
|||
protected String sourceName = "{source}";
|
||||
|
||||
public DamageTargetEffect(int amount) {
|
||||
this(new StaticValue(amount), true);
|
||||
this(StaticValue.get(amount), true);
|
||||
}
|
||||
|
||||
public DamageTargetEffect(int amount, String whoDealDamageName) {
|
||||
this(new StaticValue(amount), true);
|
||||
this(StaticValue.get(amount), true);
|
||||
this.sourceName = whoDealDamageName;
|
||||
}
|
||||
|
||||
public DamageTargetEffect(int amount, boolean preventable) {
|
||||
this(new StaticValue(amount), preventable);
|
||||
this(StaticValue.get(amount), preventable);
|
||||
}
|
||||
|
||||
public DamageTargetEffect(int amount, boolean preventable, String targetDescription) {
|
||||
this(new StaticValue(amount), preventable, targetDescription);
|
||||
this(StaticValue.get(amount), preventable, targetDescription);
|
||||
}
|
||||
|
||||
public DamageTargetEffect(int amount, boolean preventable, String targetDescription, String whoDealDamageName) {
|
||||
this(new StaticValue(amount), preventable, targetDescription);
|
||||
this(StaticValue.get(amount), preventable, targetDescription);
|
||||
this.sourceName = whoDealDamageName;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ public class DrawCardAllEffect extends OneShotEffect {
|
|||
}
|
||||
|
||||
public DrawCardAllEffect(int amount, TargetController targetController) {
|
||||
this(new StaticValue(amount), targetController);
|
||||
this(StaticValue.get(amount), targetController);
|
||||
}
|
||||
|
||||
public DrawCardAllEffect(DynamicValue amount, TargetController targetController) {
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ public class DrawCardSourceControllerEffect extends OneShotEffect {
|
|||
}
|
||||
|
||||
public DrawCardSourceControllerEffect(int amount, String whoDrawCard) {
|
||||
this(new StaticValue(amount), whoDrawCard);
|
||||
this(StaticValue.get(amount), whoDrawCard);
|
||||
}
|
||||
|
||||
public DrawCardSourceControllerEffect(DynamicValue amount) {
|
||||
|
|
|
|||
|
|
@ -25,11 +25,11 @@ public class DrawCardTargetEffect extends OneShotEffect {
|
|||
protected boolean upTo;
|
||||
|
||||
public DrawCardTargetEffect(int amount) {
|
||||
this(new StaticValue(amount));
|
||||
this(StaticValue.get(amount));
|
||||
}
|
||||
|
||||
public DrawCardTargetEffect(int amount, boolean optional) {
|
||||
this(new StaticValue(amount), optional);
|
||||
this(StaticValue.get(amount), optional);
|
||||
}
|
||||
|
||||
public DrawCardTargetEffect(DynamicValue amount) {
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ public class GainLifeEffect extends OneShotEffect {
|
|||
private DynamicValue life;
|
||||
|
||||
public GainLifeEffect(int life) {
|
||||
this(new StaticValue(life));
|
||||
this(StaticValue.get(life));
|
||||
}
|
||||
|
||||
public GainLifeEffect(DynamicValue life) {
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ public class GainLifeTargetEffect extends OneShotEffect {
|
|||
private DynamicValue life;
|
||||
|
||||
public GainLifeTargetEffect(int life) {
|
||||
this(new StaticValue(life));
|
||||
this(StaticValue.get(life));
|
||||
}
|
||||
|
||||
public GainLifeTargetEffect(DynamicValue life) {
|
||||
|
|
|
|||
|
|
@ -87,8 +87,8 @@ public class LookLibraryAndPickControllerEffect extends LookLibraryControllerEff
|
|||
|
||||
public LookLibraryAndPickControllerEffect(int numberOfCards,
|
||||
int numberToPick, FilterCard pickFilter, boolean upTo) {
|
||||
this(new StaticValue(numberOfCards), false,
|
||||
new StaticValue(numberToPick), pickFilter, Zone.LIBRARY, false,
|
||||
this(StaticValue.get(numberOfCards), false,
|
||||
StaticValue.get(numberToPick), pickFilter, Zone.LIBRARY, false,
|
||||
true, upTo);
|
||||
}
|
||||
|
||||
|
|
@ -104,8 +104,8 @@ public class LookLibraryAndPickControllerEffect extends LookLibraryControllerEff
|
|||
public LookLibraryAndPickControllerEffect(int numberOfCards,
|
||||
int numberToPick, FilterCard pickFilter, boolean reveal,
|
||||
boolean upTo, Zone targetZonePickedCards, boolean optional) {
|
||||
this(new StaticValue(numberOfCards), false,
|
||||
new StaticValue(numberToPick), pickFilter, Zone.LIBRARY, false,
|
||||
this(StaticValue.get(numberOfCards), false,
|
||||
StaticValue.get(numberToPick), pickFilter, Zone.LIBRARY, false,
|
||||
reveal, upTo, targetZonePickedCards, optional, true, true);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ public class LookLibraryControllerEffect extends OneShotEffect {
|
|||
}
|
||||
|
||||
public LookLibraryControllerEffect(int numberOfCards, boolean mayShuffleAfter, boolean putOnTop) {
|
||||
this(new StaticValue(numberOfCards), mayShuffleAfter, putOnTop);
|
||||
this(StaticValue.get(numberOfCards), mayShuffleAfter, putOnTop);
|
||||
}
|
||||
|
||||
public LookLibraryControllerEffect(DynamicValue numberOfCards, boolean mayShuffleAfter, boolean putOnTop) {
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ public class LoseLifeAllPlayersEffect extends OneShotEffect {
|
|||
private final DynamicValue amount;
|
||||
|
||||
public LoseLifeAllPlayersEffect(int amount) {
|
||||
this(new StaticValue(amount));
|
||||
this(StaticValue.get(amount));
|
||||
}
|
||||
|
||||
public LoseLifeAllPlayersEffect(DynamicValue amount) {
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ public class LoseLifeControllerAttachedEffect extends OneShotEffect {
|
|||
protected DynamicValue amount;
|
||||
|
||||
public LoseLifeControllerAttachedEffect(int amount) {
|
||||
this(new StaticValue(amount));
|
||||
this(StaticValue.get(amount));
|
||||
}
|
||||
|
||||
public LoseLifeControllerAttachedEffect(DynamicValue amount) {
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ public class LoseLifeDefendingPlayerEffect extends OneShotEffect {
|
|||
* attacker false if attacker has to be taken from targetPointer
|
||||
*/
|
||||
public LoseLifeDefendingPlayerEffect(int amount, boolean attackerIsSource) {
|
||||
this(new StaticValue(amount), attackerIsSource);
|
||||
this(StaticValue.get(amount), attackerIsSource);
|
||||
}
|
||||
|
||||
public LoseLifeDefendingPlayerEffect(DynamicValue amount, boolean attackerIsSource) {
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ public class LoseLifeOpponentsEffect extends OneShotEffect {
|
|||
private DynamicValue amount;
|
||||
|
||||
public LoseLifeOpponentsEffect(int amount) {
|
||||
this(new StaticValue(amount));
|
||||
this(StaticValue.get(amount));
|
||||
}
|
||||
|
||||
public LoseLifeOpponentsEffect(DynamicValue amount) {
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ public class LoseLifePermanentControllerEffect extends OneShotEffect {
|
|||
protected DynamicValue amount;
|
||||
|
||||
public LoseLifePermanentControllerEffect(int amount) {
|
||||
this(new StaticValue(amount));
|
||||
this(StaticValue.get(amount));
|
||||
}
|
||||
|
||||
public LoseLifePermanentControllerEffect(DynamicValue amount) {
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ public class LoseLifeSourceControllerEffect extends OneShotEffect {
|
|||
protected DynamicValue amount;
|
||||
|
||||
public LoseLifeSourceControllerEffect(int amount) {
|
||||
this(new StaticValue(amount));
|
||||
this(StaticValue.get(amount));
|
||||
}
|
||||
|
||||
public LoseLifeSourceControllerEffect(DynamicValue amount) {
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ public class LoseLifeTargetEffect extends OneShotEffect {
|
|||
protected DynamicValue amount;
|
||||
|
||||
public LoseLifeTargetEffect(int amount) {
|
||||
this(new StaticValue(amount));
|
||||
this(StaticValue.get(amount));
|
||||
}
|
||||
|
||||
public LoseLifeTargetEffect(DynamicValue amount) {
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ public class PutLibraryIntoGraveTargetEffect extends OneShotEffect {
|
|||
private DynamicValue amount;
|
||||
|
||||
public PutLibraryIntoGraveTargetEffect(int amount) {
|
||||
this(new StaticValue(amount));
|
||||
this(StaticValue.get(amount));
|
||||
}
|
||||
|
||||
public PutLibraryIntoGraveTargetEffect(DynamicValue amount) {
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ public class PutTopCardOfLibraryIntoGraveEachPlayerEffect extends OneShotEffect
|
|||
private final TargetController targetController;
|
||||
|
||||
public PutTopCardOfLibraryIntoGraveEachPlayerEffect(int numberCards, TargetController targetController) {
|
||||
this(new StaticValue(numberCards), targetController);
|
||||
this(StaticValue.get(numberCards), targetController);
|
||||
}
|
||||
|
||||
public PutTopCardOfLibraryIntoGraveEachPlayerEffect(DynamicValue numberCards, TargetController targetController) {
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ public class PutTopCardOfLibraryIntoGraveTargetEffect extends OneShotEffect {
|
|||
private DynamicValue numberCards;
|
||||
|
||||
public PutTopCardOfLibraryIntoGraveTargetEffect(int numberCards) {
|
||||
this(new StaticValue(numberCards));
|
||||
this(StaticValue.get(numberCards));
|
||||
}
|
||||
|
||||
public PutTopCardOfLibraryIntoGraveTargetEffect(DynamicValue numberCards) {
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ public class RevealLibraryPutIntoHandEffect extends OneShotEffect {
|
|||
}
|
||||
|
||||
public RevealLibraryPutIntoHandEffect(int amountCards, FilterCard filter, Zone zoneToPutRest, boolean anyOrder) {
|
||||
this(new StaticValue(amountCards), filter, zoneToPutRest, anyOrder);
|
||||
this(StaticValue.get(amountCards), filter, zoneToPutRest, anyOrder);
|
||||
}
|
||||
|
||||
public RevealLibraryPutIntoHandEffect(DynamicValue amountCards, FilterCard filter, Zone zoneToPutRest, boolean anyOrder) {
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ public class RevealTargetPlayerLibraryEffect extends OneShotEffect {
|
|||
private DynamicValue amountCards;
|
||||
|
||||
public RevealTargetPlayerLibraryEffect(int amountCards) {
|
||||
this(new StaticValue(amountCards));
|
||||
this(StaticValue.get(amountCards));
|
||||
}
|
||||
|
||||
public RevealTargetPlayerLibraryEffect(DynamicValue amountCards) {
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ public class SacrificeAllEffect extends OneShotEffect {
|
|||
}
|
||||
|
||||
public SacrificeAllEffect(int amount, FilterControlledPermanent filter) {
|
||||
this(new StaticValue(amount), filter);
|
||||
this(StaticValue.get(amount), filter);
|
||||
}
|
||||
|
||||
public SacrificeAllEffect(DynamicValue amount, FilterControlledPermanent filter) {
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ public class SacrificeControllerEffect extends SacrificeEffect {
|
|||
}
|
||||
|
||||
public SacrificeControllerEffect(FilterPermanent filter, int count, String preText ) {
|
||||
this(filter, new StaticValue(count), preText);
|
||||
this(filter, StaticValue.get(count), preText);
|
||||
}
|
||||
|
||||
public SacrificeControllerEffect(final SacrificeControllerEffect effect ) {
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ public class SacrificeEffect extends OneShotEffect {
|
|||
private DynamicValue count;
|
||||
|
||||
public SacrificeEffect(FilterPermanent filter, int count, String preText) {
|
||||
this(filter, new StaticValue(count), preText);
|
||||
this(filter, StaticValue.get(count), preText);
|
||||
}
|
||||
|
||||
public SacrificeEffect(FilterPermanent filter, DynamicValue count, String preText) {
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ public class SacrificeOpponentsEffect extends OneShotEffect {
|
|||
}
|
||||
|
||||
public SacrificeOpponentsEffect(int amount, FilterPermanent filter) {
|
||||
this(new StaticValue(amount), filter);
|
||||
this(StaticValue.get(amount), filter);
|
||||
}
|
||||
|
||||
public SacrificeOpponentsEffect(DynamicValue amount, FilterPermanent filter) {
|
||||
|
|
|
|||
|
|
@ -49,11 +49,11 @@ public class SacrificeOpponentsUnlessPayEffect extends OneShotEffect {
|
|||
}
|
||||
|
||||
public SacrificeOpponentsUnlessPayEffect(Cost cost, FilterPermanent filter, int amount) {
|
||||
this(cost, filter, new StaticValue(amount));
|
||||
this(cost, filter, StaticValue.get(amount));
|
||||
}
|
||||
|
||||
public SacrificeOpponentsUnlessPayEffect(int genericManaCost, FilterPermanent filter, int amount) {
|
||||
this(new GenericManaCost(genericManaCost), filter, new StaticValue(amount));
|
||||
this(new GenericManaCost(genericManaCost), filter, StaticValue.get(amount));
|
||||
}
|
||||
|
||||
public SacrificeOpponentsUnlessPayEffect(Cost cost, FilterPermanent filter, DynamicValue amount) {
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ public class SetPlayerLifeAllEffect extends OneShotEffect {
|
|||
}
|
||||
|
||||
public SetPlayerLifeAllEffect(int amount, TargetController targetController) {
|
||||
this(new StaticValue(amount), targetController);
|
||||
this(StaticValue.get(amount), targetController);
|
||||
}
|
||||
|
||||
public SetPlayerLifeAllEffect(DynamicValue amount, TargetController targetController) {
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ public class SetPlayerLifeSourceEffect extends OneShotEffect {
|
|||
protected DynamicValue amount;
|
||||
|
||||
public SetPlayerLifeSourceEffect(int amount) {
|
||||
this(new StaticValue(amount));
|
||||
this(StaticValue.get(amount));
|
||||
}
|
||||
|
||||
public SetPlayerLifeSourceEffect(DynamicValue amount) {
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ public class SetPlayerLifeTargetEffect extends OneShotEffect {
|
|||
protected DynamicValue amount;
|
||||
|
||||
public SetPlayerLifeTargetEffect(int amount) {
|
||||
this(new StaticValue(amount));
|
||||
this(StaticValue.get(amount));
|
||||
}
|
||||
|
||||
public SetPlayerLifeTargetEffect(DynamicValue amount) {
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ public class BoostAllEffect extends ContinuousEffectImpl {
|
|||
}
|
||||
|
||||
public BoostAllEffect(int power, int toughness, Duration duration, FilterCreaturePermanent filter, boolean excludeSource) {
|
||||
this(new StaticValue(power), new StaticValue(toughness), duration, filter, excludeSource);
|
||||
this(StaticValue.get(power), StaticValue.get(toughness), duration, filter, excludeSource);
|
||||
}
|
||||
|
||||
public BoostAllEffect(DynamicValue power, DynamicValue toughness, Duration duration, FilterCreaturePermanent filter, boolean excludeSource) {
|
||||
|
|
@ -92,8 +92,8 @@ public class BoostAllEffect extends ContinuousEffectImpl {
|
|||
}
|
||||
}
|
||||
if (lockedInPT) {
|
||||
power = new StaticValue(power.calculate(game, source, this));
|
||||
toughness = new StaticValue(toughness.calculate(game, source, this));
|
||||
power = StaticValue.get(power.calculate(game, source, this));
|
||||
toughness = StaticValue.get(toughness.calculate(game, source, this));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -41,11 +41,11 @@ public class BoostControlledEffect extends ContinuousEffectImpl {
|
|||
}
|
||||
|
||||
public BoostControlledEffect(int power, int toughness, Duration duration, FilterCreaturePermanent filter) {
|
||||
this(new StaticValue(power), new StaticValue(toughness), duration, filter, false);
|
||||
this(StaticValue.get(power), StaticValue.get(toughness), duration, filter, false);
|
||||
}
|
||||
|
||||
public BoostControlledEffect(int power, int toughness, Duration duration, FilterCreaturePermanent filter, boolean excludeSource) {
|
||||
this(new StaticValue(power), new StaticValue(toughness), duration, filter, excludeSource, true);
|
||||
this(StaticValue.get(power), StaticValue.get(toughness), duration, filter, excludeSource, true);
|
||||
}
|
||||
|
||||
public BoostControlledEffect(DynamicValue power, DynamicValue toughness, Duration duration, FilterCreaturePermanent filter, boolean excludeSource) {
|
||||
|
|
@ -97,8 +97,8 @@ public class BoostControlledEffect extends ContinuousEffectImpl {
|
|||
}
|
||||
}
|
||||
if (this.lockedIn) {
|
||||
power = new StaticValue(power.calculate(game, source, this));
|
||||
toughness = new StaticValue(toughness.calculate(game, source, this));
|
||||
power = StaticValue.get(power.calculate(game, source, this));
|
||||
toughness = StaticValue.get(toughness.calculate(game, source, this));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ public class BoostEnchantedEffect extends ContinuousEffectImpl {
|
|||
}
|
||||
|
||||
public BoostEnchantedEffect(int power, int toughness, Duration duration) {
|
||||
this(new StaticValue(power), new StaticValue(toughness), duration);
|
||||
this(StaticValue.get(power), StaticValue.get(toughness), duration);
|
||||
}
|
||||
|
||||
public BoostEnchantedEffect(DynamicValue power, DynamicValue toughness) {
|
||||
|
|
@ -58,8 +58,8 @@ public class BoostEnchantedEffect extends ContinuousEffectImpl {
|
|||
public void init(Ability source, Game game) {
|
||||
super.init(source, game);
|
||||
if (lockedIn) {
|
||||
power = new StaticValue(power.calculate(game, source, this));
|
||||
toughness = new StaticValue(toughness.calculate(game, source, this));
|
||||
power = StaticValue.get(power.calculate(game, source, this));
|
||||
toughness = StaticValue.get(toughness.calculate(game, source, this));
|
||||
}
|
||||
if (affectedObjectsSet) {
|
||||
// Added boosts of activated or triggered abilities exist independent from the source they are created by
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ public class BoostEquippedEffect extends ContinuousEffectImpl {
|
|||
}
|
||||
|
||||
public BoostEquippedEffect(int power, int toughness, Duration duration) {
|
||||
this(new StaticValue(power), new StaticValue(toughness), duration);
|
||||
this(StaticValue.get(power), StaticValue.get(toughness), duration);
|
||||
}
|
||||
|
||||
public BoostEquippedEffect(DynamicValue powerDynamicValue, DynamicValue toughnessDynamicValue) {
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ public class BoostSourceEffect extends ContinuousEffectImpl implements SourceEff
|
|||
private boolean lockedIn;
|
||||
|
||||
public BoostSourceEffect(int power, int toughness, Duration duration) {
|
||||
this(new StaticValue(power), new StaticValue(toughness), duration, false);
|
||||
this(StaticValue.get(power), StaticValue.get(toughness), duration, false);
|
||||
}
|
||||
|
||||
public BoostSourceEffect(DynamicValue power, DynamicValue toughness, Duration duration) {
|
||||
|
|
@ -69,8 +69,8 @@ public class BoostSourceEffect extends ContinuousEffectImpl implements SourceEff
|
|||
}
|
||||
}
|
||||
if (lockedIn) {
|
||||
power = new StaticValue(power.calculate(game, source, this));
|
||||
toughness = new StaticValue(toughness.calculate(game, source, this));
|
||||
power = StaticValue.get(power.calculate(game, source, this));
|
||||
toughness = StaticValue.get(toughness.calculate(game, source, this));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ public class BoostTargetEffect extends ContinuousEffectImpl {
|
|||
}
|
||||
|
||||
public BoostTargetEffect(int power, int toughness, Duration duration) {
|
||||
this(new StaticValue(power), new StaticValue(toughness), duration, false);
|
||||
this(StaticValue.get(power), StaticValue.get(toughness), duration, false);
|
||||
}
|
||||
|
||||
public BoostTargetEffect(DynamicValue power, DynamicValue toughness, Duration duration) {
|
||||
|
|
@ -69,8 +69,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, this));
|
||||
toughness = new StaticValue(toughness.calculate(game, source, this));
|
||||
power = StaticValue.get(power.calculate(game, source, this));
|
||||
toughness = StaticValue.get(toughness.calculate(game, source, this));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ public class MaximumHandSizeControllerEffect extends ContinuousEffectImpl {
|
|||
}
|
||||
|
||||
public MaximumHandSizeControllerEffect(int handSize, Duration duration, HandSizeModification handSizeModification, TargetController targetController) {
|
||||
this(new StaticValue(handSize), duration, handSizeModification, targetController);
|
||||
this(StaticValue.get(handSize), duration, handSizeModification, targetController);
|
||||
}
|
||||
|
||||
public MaximumHandSizeControllerEffect(DynamicValue handSize, Duration duration, HandSizeModification handSizeModification, TargetController targetController) {
|
||||
|
|
|
|||
|
|
@ -31,11 +31,11 @@ public class SetPowerToughnessAllEffect extends ContinuousEffectImpl {
|
|||
private boolean lockedInPT;
|
||||
|
||||
public SetPowerToughnessAllEffect(int power, int toughness, Duration duration) {
|
||||
this(new StaticValue(power), new StaticValue(toughness), duration, new FilterCreaturePermanent("Creatures"), true);
|
||||
this(StaticValue.get(power), StaticValue.get(toughness), duration, new FilterCreaturePermanent("Creatures"), true);
|
||||
}
|
||||
|
||||
public SetPowerToughnessAllEffect(int power, int toughness, Duration duration, FilterPermanent filter, boolean lockedInPT) {
|
||||
this(new StaticValue(power), new StaticValue(toughness), duration, filter, lockedInPT);
|
||||
this(StaticValue.get(power), StaticValue.get(toughness), duration, filter, lockedInPT);
|
||||
}
|
||||
|
||||
public SetPowerToughnessAllEffect(DynamicValue power, DynamicValue toughness, Duration duration, FilterPermanent filter, boolean lockedInPT) {
|
||||
|
|
@ -68,8 +68,8 @@ public class SetPowerToughnessAllEffect extends ContinuousEffectImpl {
|
|||
}
|
||||
}
|
||||
if (lockedInPT) {
|
||||
power = new StaticValue(power.calculate(game, source, this));
|
||||
toughness = new StaticValue(toughness.calculate(game, source, this));
|
||||
power = StaticValue.get(power.calculate(game, source, this));
|
||||
toughness = StaticValue.get(toughness.calculate(game, source, this));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ public class SetPowerToughnessTargetEffect extends ContinuousEffectImpl {
|
|||
}
|
||||
|
||||
public SetPowerToughnessTargetEffect(int power, int toughness, Duration duration) {
|
||||
this(new StaticValue(power), new StaticValue(toughness), duration);
|
||||
this(StaticValue.get(power), StaticValue.get(toughness), duration);
|
||||
}
|
||||
|
||||
public SetPowerToughnessTargetEffect(final SetPowerToughnessTargetEffect effect) {
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ public class CastWithoutPayingManaCostEffect extends OneShotEffect {
|
|||
* @param maxCost Maximum converted mana cost for this effect to apply to
|
||||
*/
|
||||
public CastWithoutPayingManaCostEffect(int maxCost) {
|
||||
this(new StaticValue(maxCost));
|
||||
this(StaticValue.get(maxCost));
|
||||
}
|
||||
|
||||
public CastWithoutPayingManaCostEffect(DynamicValue maxCost) {
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ public class AddCountersAttachedEffect extends OneShotEffect {
|
|||
private String textEnchanted;
|
||||
|
||||
public AddCountersAttachedEffect(Counter counter, String textEnchanted) {
|
||||
this(counter, new StaticValue(1), textEnchanted);
|
||||
this(counter, StaticValue.get(1), textEnchanted);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ public class AddCountersSourceEffect extends OneShotEffect {
|
|||
}
|
||||
|
||||
public AddCountersSourceEffect(Counter counter, boolean informPlayers) {
|
||||
this(counter, new StaticValue(0), informPlayers);
|
||||
this(counter, StaticValue.get(0), informPlayers);
|
||||
}
|
||||
|
||||
public AddCountersSourceEffect(Counter counter, DynamicValue amount, boolean informPlayers) {
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ public class AddCountersTargetEffect extends OneShotEffect {
|
|||
}
|
||||
|
||||
public AddCountersTargetEffect(Counter counter, Outcome outcome) {
|
||||
this(counter, new StaticValue(0), outcome);
|
||||
this(counter, StaticValue.get(0), outcome);
|
||||
}
|
||||
|
||||
public AddCountersTargetEffect(Counter counter, DynamicValue amount, Outcome outcome) {
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ public class GetEnergyCountersControllerEffect extends OneShotEffect {
|
|||
private final DynamicValue value;
|
||||
|
||||
public GetEnergyCountersControllerEffect(int value) {
|
||||
this(new StaticValue(value));
|
||||
this(StaticValue.get(value));
|
||||
}
|
||||
|
||||
public GetEnergyCountersControllerEffect(DynamicValue value) {
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ public class RemoveCountersAttachedEffect extends OneShotEffect {
|
|||
private String textEnchanted;
|
||||
|
||||
public RemoveCountersAttachedEffect(Counter counter, String textEnchanted) {
|
||||
this(counter, new StaticValue(0), textEnchanted);
|
||||
this(counter, StaticValue.get(0), textEnchanted);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import mage.constants.Outcome;
|
|||
import mage.constants.TargetController;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetCard;
|
||||
|
|
@ -31,16 +32,18 @@ public class DiscardCardYouChooseTargetEffect extends OneShotEffect {
|
|||
private final DynamicValue numberCardsToDiscard;
|
||||
private boolean revealAllCards;
|
||||
|
||||
private static final FilterCard filterOneCard = new FilterCard("one card");
|
||||
|
||||
public DiscardCardYouChooseTargetEffect() {
|
||||
this(new FilterCard("a card"));
|
||||
}
|
||||
|
||||
public DiscardCardYouChooseTargetEffect(TargetController targetController) {
|
||||
this(new FilterCard("a card"), targetController);
|
||||
this(StaticFilters.FILTER_CARD_A, targetController);
|
||||
}
|
||||
|
||||
public DiscardCardYouChooseTargetEffect(DynamicValue numberCardsToDiscard, TargetController targetController) {
|
||||
this(numberCardsToDiscard, new FilterCard("cards"), targetController);
|
||||
this(numberCardsToDiscard, StaticFilters.FILTER_CARD_CARDS, targetController);
|
||||
}
|
||||
|
||||
public DiscardCardYouChooseTargetEffect(FilterCard filter) {
|
||||
|
|
@ -48,12 +51,11 @@ public class DiscardCardYouChooseTargetEffect extends OneShotEffect {
|
|||
}
|
||||
|
||||
public DiscardCardYouChooseTargetEffect(TargetController targetController, int numberCardsToReveal) {
|
||||
this(new FilterCard("one card"), targetController,
|
||||
new StaticValue(numberCardsToReveal, new StringBuilder(CardUtil.numberToText(numberCardsToReveal)).append(" cards").toString()));
|
||||
this(filterOneCard, targetController, StaticValue.get(numberCardsToReveal));
|
||||
}
|
||||
|
||||
public DiscardCardYouChooseTargetEffect(TargetController targetController, DynamicValue numberCardsToReveal) {
|
||||
this(new FilterCard("one card"), targetController, numberCardsToReveal);
|
||||
this(filterOneCard, targetController, numberCardsToReveal);
|
||||
}
|
||||
|
||||
public DiscardCardYouChooseTargetEffect(FilterCard filter, TargetController targetController, DynamicValue numberCardsToReveal) {
|
||||
|
|
@ -63,13 +65,13 @@ public class DiscardCardYouChooseTargetEffect extends OneShotEffect {
|
|||
|
||||
this.revealAllCards = false;
|
||||
this.numberCardsToReveal = numberCardsToReveal;
|
||||
this.numberCardsToDiscard = new StaticValue(1);
|
||||
this.numberCardsToDiscard = StaticValue.get(1);
|
||||
|
||||
staticText = this.setText();
|
||||
}
|
||||
|
||||
public DiscardCardYouChooseTargetEffect(FilterCard filter, TargetController targetController) {
|
||||
this(new StaticValue(1), filter, targetController);
|
||||
this(StaticValue.get(1), filter, targetController);
|
||||
}
|
||||
|
||||
public DiscardCardYouChooseTargetEffect(DynamicValue numberCardsToDiscard, FilterCard filter, TargetController targetController) {
|
||||
|
|
@ -97,54 +99,56 @@ public class DiscardCardYouChooseTargetEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(targetPointer.getFirst(game, source));
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (player != null && controller != null) {
|
||||
if (revealAllCards) {
|
||||
this.numberCardsToReveal = new StaticValue(player.getHand().size());
|
||||
}
|
||||
int numberToReveal = this.numberCardsToReveal.calculate(game, source, this);
|
||||
if (numberToReveal > 0) {
|
||||
Cards revealedCards = new CardsImpl();
|
||||
numberToReveal = Math.min(player.getHand().size(), numberToReveal);
|
||||
if (player.getHand().size() > numberToReveal) {
|
||||
TargetCardInHand chosenCards = new TargetCardInHand(numberToReveal, numberToReveal, new FilterCard("card in " + player.getName() + "'s hand"));
|
||||
chosenCards.setNotTarget(true);
|
||||
if (chosenCards.canChoose(player.getId(), game) && player.chooseTarget(Outcome.Discard, player.getHand(), chosenCards, source, game)) {
|
||||
if (!chosenCards.getTargets().isEmpty()) {
|
||||
List<UUID> targets = chosenCards.getTargets();
|
||||
for (UUID targetid : targets) {
|
||||
Card card = game.getCard(targetid);
|
||||
if (card != null) {
|
||||
revealedCards.add(card);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
revealedCards.addAll(player.getHand());
|
||||
}
|
||||
|
||||
Card sourceCard = game.getCard(source.getSourceId());
|
||||
player.revealCards(sourceCard != null ? sourceCard.getIdName() + " (" + sourceCard.getZoneChangeCounter(game) + ')' : "Discard", revealedCards, game);
|
||||
|
||||
boolean result = true;
|
||||
int filteredCardsCount = revealedCards.count(filter, source.getSourceId(), source.getControllerId(), game);
|
||||
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)) {
|
||||
for (UUID targetId : target.getTargets()) {
|
||||
Card card = revealedCards.get(targetId, game);
|
||||
if (!player.discard(card, source, game)) {
|
||||
result = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
if (player == null || controller == null) {
|
||||
return false;
|
||||
}
|
||||
if (revealAllCards) {
|
||||
this.numberCardsToReveal = StaticValue.get(player.getHand().size());
|
||||
}
|
||||
int numberToReveal = this.numberCardsToReveal.calculate(game, source, this);
|
||||
if (numberToReveal <= 0) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
Cards revealedCards = new CardsImpl();
|
||||
numberToReveal = Math.min(player.getHand().size(), numberToReveal);
|
||||
if (player.getHand().size() > numberToReveal) {
|
||||
TargetCardInHand chosenCards = new TargetCardInHand(numberToReveal, numberToReveal, new FilterCard("card in " + player.getName() + "'s hand"));
|
||||
chosenCards.setNotTarget(true);
|
||||
if (chosenCards.canChoose(player.getId(), game) && player.chooseTarget(Outcome.Discard, player.getHand(), chosenCards, source, game)) {
|
||||
if (!chosenCards.getTargets().isEmpty()) {
|
||||
List<UUID> targets = chosenCards.getTargets();
|
||||
for (UUID targetid : targets) {
|
||||
Card card = game.getCard(targetid);
|
||||
if (card != null) {
|
||||
revealedCards.add(card);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
revealedCards.addAll(player.getHand());
|
||||
}
|
||||
|
||||
Card sourceCard = game.getCard(source.getSourceId());
|
||||
player.revealCards(sourceCard != null ? sourceCard.getIdName() + " (" + sourceCard.getZoneChangeCounter(game) + ')' : "Discard", revealedCards, game);
|
||||
|
||||
boolean result = true;
|
||||
int filteredCardsCount = revealedCards.count(filter, source.getSourceId(), source.getControllerId(), game);
|
||||
int numberToDiscard = Math.min(this.numberCardsToDiscard.calculate(game, source, this), filteredCardsCount);
|
||||
if (numberToDiscard <= 0) {
|
||||
return result;
|
||||
}
|
||||
TargetCard target = new TargetCard(numberToDiscard, Zone.HAND, filter);
|
||||
if (!controller.choose(Outcome.Benefit, revealedCards, target, game)) {
|
||||
return result;
|
||||
}
|
||||
for (UUID targetId : target.getTargets()) {
|
||||
Card card = revealedCards.get(targetId, game);
|
||||
if (!player.discard(card, source, game)) {
|
||||
result = false;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -169,7 +173,7 @@ public class DiscardCardYouChooseTargetEffect extends OneShotEffect {
|
|||
} else {
|
||||
if (numberCardsToReveal instanceof StaticValue) {
|
||||
sb.append(" reveals ");
|
||||
sb.append(numberCardsToReveal.getMessage());
|
||||
sb.append(CardUtil.numberToText(((StaticValue) numberCardsToReveal).getValue()) + " cards");
|
||||
sb.append(" from their hand");
|
||||
} else {
|
||||
sb.append(" reveals a number of cards from their hand equal to ");
|
||||
|
|
|
|||
|
|
@ -20,11 +20,11 @@ public class DiscardControllerEffect extends OneShotEffect {
|
|||
protected boolean randomDiscard;
|
||||
|
||||
public DiscardControllerEffect(int amount) {
|
||||
this(new StaticValue(amount));
|
||||
this(StaticValue.get(amount));
|
||||
}
|
||||
|
||||
public DiscardControllerEffect(int amount, boolean randomDiscard) {
|
||||
this(new StaticValue(amount), randomDiscard);
|
||||
this(StaticValue.get(amount), randomDiscard);
|
||||
}
|
||||
|
||||
public DiscardControllerEffect(DynamicValue amount) {
|
||||
|
|
|
|||
|
|
@ -27,15 +27,15 @@ public class DiscardEachPlayerEffect extends OneShotEffect {
|
|||
private TargetController targetController;
|
||||
|
||||
public DiscardEachPlayerEffect() {
|
||||
this(new StaticValue(1), false);
|
||||
this(StaticValue.get(1), false);
|
||||
}
|
||||
|
||||
public DiscardEachPlayerEffect(TargetController targetController) {
|
||||
this(new StaticValue(1), false, targetController);
|
||||
this(StaticValue.get(1), false, targetController);
|
||||
}
|
||||
|
||||
public DiscardEachPlayerEffect(int amount, boolean randomDiscard) {
|
||||
this(new StaticValue(amount), randomDiscard);
|
||||
this(StaticValue.get(amount), randomDiscard);
|
||||
}
|
||||
|
||||
public DiscardEachPlayerEffect(DynamicValue amount, boolean randomDiscard) {
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ public class DiscardTargetEffect extends OneShotEffect {
|
|||
}
|
||||
|
||||
public DiscardTargetEffect(int amount) {
|
||||
this(new StaticValue(amount));
|
||||
this(StaticValue.get(amount));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -44,7 +44,7 @@ public class DiscardTargetEffect extends OneShotEffect {
|
|||
public DiscardTargetEffect(int amount, boolean randomDiscard) {
|
||||
super(Outcome.Discard);
|
||||
this.randomDiscard = randomDiscard;
|
||||
this.amount = new StaticValue(amount);
|
||||
this.amount = StaticValue.get(amount);
|
||||
}
|
||||
|
||||
public DiscardTargetEffect(final DiscardTargetEffect effect) {
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ public class AmassEffect extends OneShotEffect {
|
|||
private UUID amassedCreatureId = null;
|
||||
|
||||
public AmassEffect(int amassNumber) {
|
||||
this(new StaticValue(amassNumber));
|
||||
this(StaticValue.get(amassNumber));
|
||||
staticText = "amass " + amassNumber + ". <i>(Put " + CardUtil.numberToText(amassNumber)
|
||||
+ " +1/+1 counter" + (amassNumber > 1 ? "s " : " ")
|
||||
+ "on an Army you control. If you don't control one, "
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ public class BolsterEffect extends OneShotEffect {
|
|||
private final DynamicValue amount;
|
||||
|
||||
public BolsterEffect(int amount) {
|
||||
this(new StaticValue(amount));
|
||||
this(StaticValue.get(amount));
|
||||
}
|
||||
|
||||
public BolsterEffect(DynamicValue amount) {
|
||||
|
|
|
|||
|
|
@ -20,8 +20,8 @@ public class SupportEffect extends AddCountersTargetEffect {
|
|||
private final boolean otherPermanent;
|
||||
|
||||
public SupportEffect(Card card, int amount, boolean otherPermanent) {
|
||||
super(CounterType.P1P1.createInstance(0), new StaticValue(1));
|
||||
this.amountSupportTargets = new StaticValue(amount);
|
||||
super(CounterType.P1P1.createInstance(0), StaticValue.get(1));
|
||||
this.amountSupportTargets = StaticValue.get(amount);
|
||||
this.otherPermanent = otherPermanent;
|
||||
if (card.isInstant() || card.isSorcery()) {
|
||||
card.getSpellAbility().addTarget(new TargetCreaturePermanent(0, amount, new FilterCreaturePermanent("target creatures"), false));
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ public class AddConditionalManaOfAnyColorEffect extends ManaEffect {
|
|||
private final boolean oneChoice;
|
||||
|
||||
public AddConditionalManaOfAnyColorEffect(int amount, ConditionalManaBuilder manaBuilder) {
|
||||
this(new StaticValue(amount), manaBuilder);
|
||||
this(StaticValue.get(amount), manaBuilder);
|
||||
}
|
||||
|
||||
public AddConditionalManaOfAnyColorEffect(DynamicValue amount, ConditionalManaBuilder manaBuilder) {
|
||||
|
|
|
|||
|
|
@ -23,11 +23,11 @@ public class AddManaInAnyCombinationEffect extends ManaEffect {
|
|||
private final DynamicValue amount;
|
||||
|
||||
public AddManaInAnyCombinationEffect(int amount) {
|
||||
this(new StaticValue(amount), ColoredManaSymbol.B, ColoredManaSymbol.U, ColoredManaSymbol.R, ColoredManaSymbol.W, ColoredManaSymbol.G);
|
||||
this(StaticValue.get(amount), ColoredManaSymbol.B, ColoredManaSymbol.U, ColoredManaSymbol.R, ColoredManaSymbol.W, ColoredManaSymbol.G);
|
||||
}
|
||||
|
||||
public AddManaInAnyCombinationEffect(int amount, ColoredManaSymbol... coloredManaSymbols) {
|
||||
this(new StaticValue(amount), coloredManaSymbols);
|
||||
this(StaticValue.get(amount), coloredManaSymbols);
|
||||
}
|
||||
|
||||
public AddManaInAnyCombinationEffect(DynamicValue amount, ColoredManaSymbol... coloredManaSymbols) {
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ public class BushidoAbility extends TriggeredAbilityImpl {
|
|||
private String rulesText = null;
|
||||
|
||||
public BushidoAbility(int value) {
|
||||
this(new StaticValue(value));
|
||||
this(StaticValue.get(value));
|
||||
rulesText = "Bushido " + value + getReminder(Integer.toString(value));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ public class ReinforceAbility extends SimpleActivatedAbility {
|
|||
private Cost cost;
|
||||
|
||||
public ReinforceAbility(int count, Cost cost) {
|
||||
this(new StaticValue(count), cost);
|
||||
this(StaticValue.get(count), cost);
|
||||
}
|
||||
|
||||
public ReinforceAbility(DynamicValue count, Cost cost) {
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ public class RepairAbility extends DiesTriggeredAbility {
|
|||
private String ruleText;
|
||||
|
||||
public RepairAbility(int count) {
|
||||
super(new AddCountersSourceEffect(CounterType.REPAIR.createInstance(), new StaticValue(count), false, true));
|
||||
super(new AddCountersSourceEffect(CounterType.REPAIR.createInstance(), StaticValue.get(count), false, true));
|
||||
addSubAbility(new RepairBeginningOfUpkeepInterveningIfTriggeredAbility());
|
||||
addSubAbility(new RepairCastFromGraveyardTriggeredAbility());
|
||||
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ public class SoulshiftAbility extends DiesTriggeredAbility {
|
|||
private final DynamicValue amount;
|
||||
|
||||
public SoulshiftAbility(int amount) {
|
||||
this(new StaticValue(amount));
|
||||
this(StaticValue.get(amount));
|
||||
}
|
||||
|
||||
public SoulshiftAbility(DynamicValue amount) {
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ public class ConditionalAnyColorManaAbility extends ActivatedManaAbilityImpl {
|
|||
}
|
||||
|
||||
public ConditionalAnyColorManaAbility(Cost cost, int amount, ConditionalManaBuilder manaBuilder, boolean oneChoice) {
|
||||
this(cost, new StaticValue(amount), manaBuilder, oneChoice);
|
||||
this(cost, StaticValue.get(amount), manaBuilder, oneChoice);
|
||||
}
|
||||
|
||||
public ConditionalAnyColorManaAbility(Cost cost, DynamicValue amount, ConditionalManaBuilder manaBuilder, boolean oneChoice) {
|
||||
|
|
|
|||
|
|
@ -50,6 +50,13 @@ public final class StaticFilters {
|
|||
FILTER_CARD.setLockedFilter(true);
|
||||
}
|
||||
|
||||
|
||||
public static final FilterCard FILTER_CARD_A = new FilterCard("a card");
|
||||
|
||||
static {
|
||||
FILTER_CARD_A.setLockedFilter(true);
|
||||
}
|
||||
|
||||
public static final FilterCard FILTER_CARD_CARDS = new FilterCard("cards");
|
||||
|
||||
static {
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ class DrawCardsActivePlayerEffect extends OneShotEffect {
|
|||
protected DynamicValue amount;
|
||||
|
||||
public DrawCardsActivePlayerEffect(int amount) {
|
||||
this(new StaticValue(amount));
|
||||
this(StaticValue.get(amount));
|
||||
}
|
||||
|
||||
public DrawCardsActivePlayerEffect(DynamicValue amount) {
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ class UndercityReachesTriggeredAbility extends TriggeredAbilityImpl {
|
|||
if (((DamagedPlayerEvent) event).isCombatDamage()) {
|
||||
Permanent creature = game.getPermanent(event.getSourceId());
|
||||
if (creature != null) {
|
||||
Effect effect = new DrawCardTargetEffect(new StaticValue(1), false, true);
|
||||
Effect effect = new DrawCardTargetEffect(StaticValue.get(1), false, true);
|
||||
effect.setTargetPointer(new FixedTarget(creature.getControllerId()));
|
||||
effect.apply(game, null);
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -200,7 +200,7 @@ public abstract class StackObjImpl implements StackObject {
|
|||
// build a target definition with exactly one possible target to select that replaces old target
|
||||
Target tempTarget = target.copy();
|
||||
if (target instanceof TargetAmount) {
|
||||
((TargetAmount) tempTarget).setAmountDefinition(new StaticValue(target.getTargetAmount(targetId)));
|
||||
((TargetAmount) tempTarget).setAmountDefinition(StaticValue.get(target.getTargetAmount(targetId)));
|
||||
}
|
||||
tempTarget.setMinNumberOfTargets(1);
|
||||
tempTarget.setMaxNumberOfTargets(1);
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ public abstract class TargetAmount extends TargetImpl {
|
|||
int remainingAmount;
|
||||
|
||||
public TargetAmount(int amount) {
|
||||
this(new StaticValue(amount));
|
||||
this(StaticValue.get(amount));
|
||||
}
|
||||
|
||||
public TargetAmount(DynamicValue amount) {
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ public class TargetAnyTargetAmount extends TargetPermanentOrPlayerAmount {
|
|||
// any positive number or zero, unless something (such as damage or counters) is being divided
|
||||
// or distributed among “any number” of players and/or objects. In that case, a nonzero number
|
||||
// of players and/or objects must be chosen if possible.
|
||||
this(new StaticValue(amount), maxNumberOfTargets);
|
||||
this(StaticValue.get(amount), maxNumberOfTargets);
|
||||
this.minNumberOfTargets = 1;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ public class TargetCreatureOrPlayerAmount extends TargetPermanentOrPlayerAmount
|
|||
// any positive number or zero, unless something (such as damage or counters) is being divided
|
||||
// or distributed among “any number” of players and/or objects. In that case, a nonzero number
|
||||
// of players and/or objects must be chosen if possible.
|
||||
this(new StaticValue(amount));
|
||||
this(StaticValue.get(amount));
|
||||
this.minNumberOfTargets = 1;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ public abstract class TargetPermanentAmount extends TargetAmount {
|
|||
// any positive number or zero, unless something (such as damage or counters) is being divided
|
||||
// or distributed among “any number” of players and/or objects. In that case, a nonzero number
|
||||
// of players and/or objects must be chosen if possible.
|
||||
this(new StaticValue(amount), filter);
|
||||
this(StaticValue.get(amount), filter);
|
||||
}
|
||||
|
||||
TargetPermanentAmount(DynamicValue amount, FilterPermanent filter) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue