mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 20:58:03 +00:00
Fix GameState counters for Permanents
This commit is contained in:
@@ -328,11 +328,10 @@ public abstract class GameState {
|
||||
}
|
||||
|
||||
private void applyCountersToGameEntity(GameEntity entity, String counterString) {
|
||||
entity.setCounters(new HashMap<CounterType, Integer>());
|
||||
//entity.setCounters(new HashMap<CounterType, Integer>());
|
||||
String[] allCounterStrings = counterString.split(",");
|
||||
for (final String counterPair : allCounterStrings) {
|
||||
String[] pair = counterPair.split("=", 2);
|
||||
|
||||
entity.addCounter(CounterType.valueOf(pair[0]), Integer.parseInt(pair[1]), false, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1022,10 +1022,10 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
}
|
||||
setTotalCountersToAdd(addAmount);
|
||||
|
||||
final Integer oldValue = getCounters(counterType);
|
||||
final Integer newValue = addAmount + (oldValue == null ? 0 : oldValue);
|
||||
if (fireEvents) {
|
||||
final Integer oldValue = getCounters(counterType);
|
||||
final Integer newValue = addAmount + (oldValue == null ? 0 : oldValue);
|
||||
|
||||
// Not sure why firing events wraps EVERYTHING ins
|
||||
if (!newValue.equals(oldValue)) {
|
||||
final int powerBonusBefore = getPowerBonusFromCounters();
|
||||
final int toughnessBonusBefore = getToughnessBonusFromCounters();
|
||||
@@ -1054,6 +1054,10 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
if (addAmount > 0) {
|
||||
getGame().getTriggerHandler().runTrigger(TriggerType.CounterAddedOnce, runParams, false);
|
||||
}
|
||||
} else {
|
||||
setCounters(counterType, newValue);
|
||||
getController().addCounterToPermThisTurn(counterType, addAmount);
|
||||
view.updateCounters(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user