mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 02:38:02 +00:00
- Moved +1/+1 vs -1/-1 counters erasing to checkGameState (fixing the undying issue).
This commit is contained in:
@@ -1490,33 +1490,6 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
AllZone.getTriggerHandler().runTrigger("CounterAdded", runParams);
|
||||
}
|
||||
|
||||
if (counterName.equals(Counters.P1P1) || counterName.equals(Counters.M1M1)) {
|
||||
// +1/+1 counters should erase -1/-1 counters
|
||||
int plusOneCounters = 0;
|
||||
int minusOneCounters = 0;
|
||||
|
||||
final Counters p1Counter = Counters.P1P1;
|
||||
final Counters m1Counter = Counters.M1M1;
|
||||
if (this.counters.containsKey(p1Counter)) {
|
||||
plusOneCounters = this.counters.get(p1Counter);
|
||||
}
|
||||
if (this.counters.containsKey(m1Counter)) {
|
||||
minusOneCounters = this.counters.get(m1Counter);
|
||||
}
|
||||
|
||||
if (plusOneCounters == minusOneCounters) {
|
||||
this.counters.remove(m1Counter);
|
||||
this.counters.remove(p1Counter);
|
||||
}
|
||||
if (plusOneCounters > minusOneCounters) {
|
||||
this.counters.remove(m1Counter);
|
||||
this.counters.put(p1Counter, (plusOneCounters - minusOneCounters));
|
||||
} else {
|
||||
this.counters.put(m1Counter, (minusOneCounters - plusOneCounters));
|
||||
this.counters.remove(p1Counter);
|
||||
}
|
||||
}
|
||||
|
||||
this.updateObservers();
|
||||
}
|
||||
|
||||
@@ -1550,33 +1523,6 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
AllZone.getTriggerHandler().runTrigger("CounterAdded", runParams);
|
||||
}
|
||||
|
||||
if (counterName.equals(Counters.P1P1) || counterName.equals(Counters.M1M1)) {
|
||||
// +1/+1 counters should erase -1/-1 counters
|
||||
int plusOneCounters = 0;
|
||||
int minusOneCounters = 0;
|
||||
|
||||
final Counters p1Counter = Counters.P1P1;
|
||||
final Counters m1Counter = Counters.M1M1;
|
||||
if (this.counters.containsKey(p1Counter)) {
|
||||
plusOneCounters = this.counters.get(p1Counter);
|
||||
}
|
||||
if (this.counters.containsKey(m1Counter)) {
|
||||
minusOneCounters = this.counters.get(m1Counter);
|
||||
}
|
||||
|
||||
if (plusOneCounters == minusOneCounters) {
|
||||
this.counters.remove(m1Counter);
|
||||
this.counters.remove(p1Counter);
|
||||
}
|
||||
if (plusOneCounters > minusOneCounters) {
|
||||
this.counters.remove(m1Counter);
|
||||
this.counters.put(p1Counter, (plusOneCounters - minusOneCounters));
|
||||
} else {
|
||||
this.counters.put(m1Counter, (minusOneCounters - plusOneCounters));
|
||||
this.counters.remove(p1Counter);
|
||||
}
|
||||
}
|
||||
|
||||
AllZone.getGameAction().checkStateEffects();
|
||||
|
||||
this.updateObservers();
|
||||
|
||||
@@ -978,6 +978,28 @@ public class GameAction {
|
||||
}
|
||||
}
|
||||
|
||||
// +1/+1 counters should erase -1/-1 counters
|
||||
if (c.getCounters(Counters.P1P1) > 0 && c.getCounters(Counters.M1M1) > 0) {
|
||||
|
||||
final Counters p1Counter = Counters.P1P1;
|
||||
final Counters m1Counter = Counters.M1M1;
|
||||
int plusOneCounters = c.getCounters(Counters.P1P1);
|
||||
int minusOneCounters = c.getCounters(Counters.M1M1);
|
||||
|
||||
if (plusOneCounters == minusOneCounters) {
|
||||
c.getCounters().remove(m1Counter);
|
||||
c.getCounters().remove(p1Counter);
|
||||
}
|
||||
if (plusOneCounters > minusOneCounters) {
|
||||
c.getCounters().remove(m1Counter);
|
||||
c.getCounters().put(p1Counter, (plusOneCounters - minusOneCounters));
|
||||
} else {
|
||||
c.getCounters().put(m1Counter, (minusOneCounters - plusOneCounters));
|
||||
c.getCounters().remove(p1Counter);
|
||||
}
|
||||
checkAgain = true;
|
||||
}
|
||||
|
||||
} // while it.hasNext()
|
||||
|
||||
if (!checkAgain) {
|
||||
|
||||
Reference in New Issue
Block a user