Card & Player: more fixes with setCounters

This commit is contained in:
Hanmac
2017-01-11 07:02:43 +00:00
parent 5055435222
commit 7c0a8412c9
2 changed files with 3 additions and 3 deletions

View File

@@ -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;

View File

@@ -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));