mirror of
https://github.com/correl/mage.git
synced 2025-01-13 11:01:58 +00:00
fixed Kydele, Chosen of Kruphix not properly counting redrawn cards
This commit is contained in:
parent
256ef63525
commit
dbb185c47a
1 changed files with 7 additions and 8 deletions
|
@ -84,7 +84,7 @@ class CardsDrawnThisTurnDynamicValue implements DynamicValue {
|
|||
@Override
|
||||
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
||||
KydeleCardsDrawnThisTurnWatcher watcher = (KydeleCardsDrawnThisTurnWatcher) game.getState().getWatchers().get(KydeleCardsDrawnThisTurnWatcher.class.getSimpleName());
|
||||
return watcher.getCardsDrawnThisTurn(sourceAbility.getControllerId()).size();
|
||||
return watcher.getCardsDrawnThisTurn(sourceAbility.getControllerId());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -99,13 +99,13 @@ class CardsDrawnThisTurnDynamicValue implements DynamicValue {
|
|||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return "number of cards you've drawn this turn";
|
||||
return "card you've drawn this turn";
|
||||
}
|
||||
}
|
||||
|
||||
class KydeleCardsDrawnThisTurnWatcher extends Watcher {
|
||||
|
||||
private final Map<UUID, Set<UUID>> cardsDrawnThisTurn = new HashMap<>();
|
||||
private final Map<UUID, Integer> cardsDrawnThisTurn = new HashMap<>();
|
||||
|
||||
public KydeleCardsDrawnThisTurnWatcher() {
|
||||
super(KydeleCardsDrawnThisTurnWatcher.class.getSimpleName(), WatcherScope.GAME);
|
||||
|
@ -119,14 +119,13 @@ class KydeleCardsDrawnThisTurnWatcher extends Watcher {
|
|||
@Override
|
||||
public void watch(GameEvent event, Game game) {
|
||||
if (event.getType() == GameEvent.EventType.DREW_CARD) {
|
||||
Set<UUID> cardsDrawn = getCardsDrawnThisTurn(event.getPlayerId());
|
||||
cardsDrawn.add(event.getTargetId());
|
||||
cardsDrawnThisTurn.put(event.getPlayerId(), cardsDrawn);
|
||||
int cardsDrawn = getCardsDrawnThisTurn(event.getPlayerId());
|
||||
cardsDrawnThisTurn.put(event.getPlayerId(), cardsDrawn + 1);
|
||||
}
|
||||
}
|
||||
|
||||
public Set<UUID> getCardsDrawnThisTurn(UUID playerId) {
|
||||
return cardsDrawnThisTurn.getOrDefault(playerId, new LinkedHashSet<>());
|
||||
public int getCardsDrawnThisTurn(UUID playerId) {
|
||||
return cardsDrawnThisTurn.getOrDefault(playerId, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue