Fix so poison counters show up properly

This commit is contained in:
drdev
2015-11-24 19:42:45 +00:00
parent f224cf9b0e
commit 3b81f30e28
6 changed files with 32 additions and 14 deletions

View File

@@ -191,6 +191,16 @@ public class CardView extends GameEntityView {
public Map<CounterType, Integer> getCounters() {
return get(TrackableProperty.Counters);
}
public int getCounters(CounterType counterType) {
final Map<CounterType, Integer> counters = getCounters();
if (counters != null) {
Integer count = counters.get(counterType);
if (count != null) {
return count;
}
}
return 0;
}
public boolean hasSameCounters(CardView otherCard) {
Map<CounterType, Integer> counters = getCounters();
if (counters == null) {

View File

@@ -7,6 +7,7 @@ import java.util.Map;
import java.util.Map.Entry;
import forge.game.card.CounterType;
import org.apache.commons.lang3.StringUtils;
import com.google.common.base.Objects;
@@ -153,15 +154,18 @@ public class PlayerView extends GameEntityView {
set(TrackableProperty.Life, p.getLife());
}
public int getPoisonCounters() {
return get(TrackableProperty.PoisonCounters);
}
void updatePoisonCounters(Player p) {
set(TrackableProperty.PoisonCounters, p.getPoisonCounters());
}
public Map<CounterType, Integer> getCounters() {
return get(TrackableProperty.Counters);
return get(TrackableProperty.Counters);
}
public int getCounters(CounterType counterType) {
final Map<CounterType, Integer> counters = getCounters();
if (counters != null) {
Integer count = counters.get(counterType);
if (count != null) {
return count;
}
}
return 0;
}
void updateCounters(Player p) {
set(TrackableProperty.Counters, p.getCounters());