mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 04:38:00 +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) {
|
private void applyCountersToGameEntity(GameEntity entity, String counterString) {
|
||||||
entity.setCounters(new HashMap<CounterType, Integer>());
|
//entity.setCounters(new HashMap<CounterType, Integer>());
|
||||||
String[] allCounterStrings = counterString.split(",");
|
String[] allCounterStrings = counterString.split(",");
|
||||||
for (final String counterPair : allCounterStrings) {
|
for (final String counterPair : allCounterStrings) {
|
||||||
String[] pair = counterPair.split("=", 2);
|
String[] pair = counterPair.split("=", 2);
|
||||||
|
|
||||||
entity.addCounter(CounterType.valueOf(pair[0]), Integer.parseInt(pair[1]), false, false);
|
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);
|
setTotalCountersToAdd(addAmount);
|
||||||
|
|
||||||
if (fireEvents) {
|
|
||||||
final Integer oldValue = getCounters(counterType);
|
final Integer oldValue = getCounters(counterType);
|
||||||
final Integer newValue = addAmount + (oldValue == null ? 0 : oldValue);
|
final Integer newValue = addAmount + (oldValue == null ? 0 : oldValue);
|
||||||
|
if (fireEvents) {
|
||||||
|
// Not sure why firing events wraps EVERYTHING ins
|
||||||
if (!newValue.equals(oldValue)) {
|
if (!newValue.equals(oldValue)) {
|
||||||
final int powerBonusBefore = getPowerBonusFromCounters();
|
final int powerBonusBefore = getPowerBonusFromCounters();
|
||||||
final int toughnessBonusBefore = getToughnessBonusFromCounters();
|
final int toughnessBonusBefore = getToughnessBonusFromCounters();
|
||||||
@@ -1054,6 +1054,10 @@ public class Card extends GameEntity implements Comparable<Card> {
|
|||||||
if (addAmount > 0) {
|
if (addAmount > 0) {
|
||||||
getGame().getTriggerHandler().runTrigger(TriggerType.CounterAddedOnce, runParams, false);
|
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