mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
Merge pull request #2726 from Card-Forge/MaxFromEffectv2
CountersPutEffect: remove MaxFromEffect, let the CounterTable handle it
This commit is contained in:
@@ -176,7 +176,6 @@ public class CountersPutEffect extends SpellAbilityEffect {
|
|||||||
final Player activator = sa.getActivatingPlayer();
|
final Player activator = sa.getActivatingPlayer();
|
||||||
final PlayerController pc = activator.getController();
|
final PlayerController pc = activator.getController();
|
||||||
final boolean etbcounter = sa.hasParam("ETB");
|
final boolean etbcounter = sa.hasParam("ETB");
|
||||||
final int max = sa.hasParam("MaxFromEffect") ? Integer.parseInt(sa.getParam("MaxFromEffect")) : -1;
|
|
||||||
|
|
||||||
boolean existingCounter = sa.hasParam("CounterType") && sa.getParam("CounterType").equals("ExistingCounter");
|
boolean existingCounter = sa.hasParam("CounterType") && sa.getParam("CounterType").equals("ExistingCounter");
|
||||||
boolean eachExistingCounter = sa.hasParam("EachExistingCounter");
|
boolean eachExistingCounter = sa.hasParam("EachExistingCounter");
|
||||||
@@ -453,10 +452,6 @@ public class CountersPutEffect extends SpellAbilityEffect {
|
|||||||
}
|
}
|
||||||
counterAmount = sa.usesTargeting() && sa.isDividedAsYouChoose() ? sa.getDividedValue(gameCard)
|
counterAmount = sa.usesTargeting() && sa.isDividedAsYouChoose() ? sa.getDividedValue(gameCard)
|
||||||
: counterAmount;
|
: counterAmount;
|
||||||
if (max != -1) {
|
|
||||||
counterAmount = Math.max(Math.min(max - gameCard.getCounters(counterType), counterAmount),
|
|
||||||
0);
|
|
||||||
}
|
|
||||||
if (sa.hasParam("UpTo")) {
|
if (sa.hasParam("UpTo")) {
|
||||||
int min = AbilityUtils.calculateAmount(card, sa.getParamOrDefault("UpToMin", "0"), sa);
|
int min = AbilityUtils.calculateAmount(card, sa.getParamOrDefault("UpToMin", "0"), sa);
|
||||||
Map<String, Object> params = Maps.newHashMap();
|
Map<String, Object> params = Maps.newHashMap();
|
||||||
|
|||||||
@@ -1427,6 +1427,10 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
|
|||||||
@Override
|
@Override
|
||||||
public void addCounterInternal(final CounterType counterType, final int n, final Player source, final boolean fireEvents, GameEntityCounterTable table, Map<AbilityKey, Object> params) {
|
public void addCounterInternal(final CounterType counterType, final int n, final Player source, final boolean fireEvents, GameEntityCounterTable table, Map<AbilityKey, Object> params) {
|
||||||
int addAmount = n;
|
int addAmount = n;
|
||||||
|
// Rules say it is only a SBA, but is it checked there too?
|
||||||
|
if (counterType.is(CounterEnumType.DREAM) && hasKeyword("CARDNAME can't have more than seven dream counters on it.")) {
|
||||||
|
addAmount = Math.min(addAmount, 7 - getCounters(CounterEnumType.DREAM));
|
||||||
|
}
|
||||||
if (addAmount <= 0 || !canReceiveCounters(counterType)) {
|
if (addAmount <= 0 || !canReceiveCounters(counterType)) {
|
||||||
// As per rule 107.1b
|
// As per rule 107.1b
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user