mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 11:18:01 +00:00
Card & Player: more fixes with setCounters
This commit is contained in:
@@ -1015,7 +1015,7 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
setTotalCountersToAdd(addAmount);
|
||||
|
||||
if (fireEvents) {
|
||||
final Integer oldValue = counters.get(counterType);
|
||||
final Integer oldValue = getCounters(counterType);
|
||||
final Integer newValue = addAmount + (oldValue == null ? 0 : oldValue);
|
||||
|
||||
if (!newValue.equals(oldValue)) {
|
||||
@@ -1083,7 +1083,7 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
|
||||
@Override
|
||||
public final void subtractCounter(final CounterType counterName, final int n) {
|
||||
Integer oldValue = counters.get(counterName);
|
||||
Integer oldValue = getCounters(counterName);
|
||||
int newValue = oldValue == null ? 0 : Math.max(oldValue - n, 0);
|
||||
|
||||
final int delta = (oldValue == null ? 0 : oldValue) - newValue;
|
||||
|
||||
@@ -940,7 +940,7 @@ public class Player extends GameEntity implements Comparable<Player> {
|
||||
|
||||
public void setCounters(final CounterType counterType, final Integer num, boolean fireEvents) {
|
||||
Integer old = getCounters(counterType);
|
||||
counters.put(counterType, num);
|
||||
setCounters(counterType, num);
|
||||
view.updateCounters(this);
|
||||
if (fireEvents) {
|
||||
getGame().fireEvent(new GameEventPlayerCounters(this, counterType, old, num));
|
||||
|
||||
Reference in New Issue
Block a user