mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 12:18:00 +00:00
Fix NumLoyaltyAct counting limit and additional wrong together
This commit is contained in:
@@ -324,6 +324,7 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
|
||||
private SpellAbility[] basicLandAbilities = new SpellAbility[MagicColor.WUBRG.length];
|
||||
|
||||
private int planeswalkerAbilityActivated;
|
||||
private boolean planeswalkerActivationLimitUsed;
|
||||
|
||||
private final ActivationTable numberTurnActivations = new ActivationTable();
|
||||
private final ActivationTable numberGameActivations = new ActivationTable();
|
||||
@@ -7149,11 +7150,19 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
|
||||
}
|
||||
|
||||
public void addPlaneswalkerAbilityActivated() {
|
||||
planeswalkerAbilityActivated++;
|
||||
// track if increased limit was used for activation because if there are also additional ones they can count on top
|
||||
if (++planeswalkerAbilityActivated == 2 && StaticAbilityNumLoyaltyAct.limitIncrease(this)) {
|
||||
planeswalkerActivationLimitUsed = true;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean planeswalkerActivationLimitUsed() {
|
||||
return planeswalkerActivationLimitUsed;
|
||||
}
|
||||
|
||||
public void resetActivationsPerTurn() {
|
||||
planeswalkerAbilityActivated = 0;
|
||||
planeswalkerActivationLimitUsed = false;
|
||||
numberTurnActivations.clear();
|
||||
}
|
||||
|
||||
|
||||
@@ -475,12 +475,15 @@ public class SpellAbilityRestriction extends SpellAbilityVariables {
|
||||
}
|
||||
|
||||
if (sa.isPwAbility()) {
|
||||
final int initialLimit = StaticAbilityNumLoyaltyAct.limitIncrease(c) ? 1 : 0;
|
||||
final int limit = StaticAbilityNumLoyaltyAct.additionalActivations(c, sa) + initialLimit;
|
||||
|
||||
int numActivates = c.getPlaneswalkerAbilityActivated();
|
||||
if (numActivates > limit) {
|
||||
return false;
|
||||
int limit = StaticAbilityNumLoyaltyAct.limitIncrease(c) ? 2 : 1;
|
||||
|
||||
if (numActivates >= limit) {
|
||||
// increased limit only counts if it's been used already
|
||||
limit += StaticAbilityNumLoyaltyAct.additionalActivations(c, sa) - (limit == 1 || c.planeswalkerActivationLimitUsed() ? 0 : 1);
|
||||
if (numActivates >= limit) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user