mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
- +1/+1 and -1/-1 Counters will now remove each other when added to a card that already has the other type of Counter.
This commit is contained in:
@@ -352,6 +352,33 @@ public class Card extends MyObservable {
|
|||||||
} else {
|
} else {
|
||||||
counters.put(counterName, Integer.valueOf(multiplier * n));
|
counters.put(counterName, Integer.valueOf(multiplier * n));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (counterName.equals(Counters.P1P1) || counterName.equals(Counters.M1M1)){
|
||||||
|
// +1/+1 counters should erase -1/-1 counters
|
||||||
|
int plusOneCounters = 0;
|
||||||
|
int minusOneCounters = 0;
|
||||||
|
|
||||||
|
Counters p1Counter = Counters.P1P1;
|
||||||
|
Counters m1Counter = Counters.M1M1;
|
||||||
|
if (counters.containsKey(p1Counter))
|
||||||
|
plusOneCounters = counters.get(p1Counter);
|
||||||
|
if (counters.containsKey(m1Counter))
|
||||||
|
minusOneCounters = counters.get(m1Counter);
|
||||||
|
|
||||||
|
if (plusOneCounters == minusOneCounters){
|
||||||
|
counters.remove(m1Counter);
|
||||||
|
counters.remove(p1Counter);
|
||||||
|
}
|
||||||
|
if (plusOneCounters > minusOneCounters){
|
||||||
|
counters.remove(m1Counter);
|
||||||
|
counters.put(p1Counter, (Integer)(plusOneCounters - minusOneCounters));
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
counters.put(m1Counter, (Integer)(minusOneCounters - plusOneCounters));
|
||||||
|
counters.remove(p1Counter);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.updateObservers();
|
this.updateObservers();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user