mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 12:18:00 +00:00
Fix crash when tapping mana
This commit is contained in:
@@ -187,25 +187,18 @@ public class PlayerView extends GameEntityView {
|
||||
set(prop, CardView.getCollection(zone.getCards()));
|
||||
}
|
||||
|
||||
private Map<Byte, Integer> getMana() {
|
||||
return get(TrackableProperty.Mana);
|
||||
}
|
||||
void updateMana(Player p) {
|
||||
boolean changed = false;
|
||||
Map<Byte, Integer> mana = getMana();
|
||||
for (byte b : MagicColor.WUBRGC) {
|
||||
int value = p.getManaPool().getAmountOfColor(b);
|
||||
if (mana.put(b, value) != value) {
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
if (changed) {
|
||||
flagAsChanged(TrackableProperty.Mana);
|
||||
}
|
||||
}
|
||||
|
||||
public int getMana(final byte color) {
|
||||
Integer count = getMana().get(color);
|
||||
return count != null ? count.intValue() : 0;
|
||||
}
|
||||
private Map<Byte, Integer> getMana() {
|
||||
return get(TrackableProperty.Mana);
|
||||
}
|
||||
void updateMana(Player p) {
|
||||
Map<Byte, Integer> mana = new HashMap<Byte, Integer>();
|
||||
for (byte b : MagicColor.WUBRGC) {
|
||||
mana.put(b, p.getManaPool().getAmountOfColor(b));
|
||||
}
|
||||
set(TrackableProperty.Mana, mana);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user