mirror of
https://github.com/magefree/mage.git
synced 2025-12-22 03:22:00 -08: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
|
@Override
|
||||||
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
||||||
KydeleCardsDrawnThisTurnWatcher watcher = (KydeleCardsDrawnThisTurnWatcher) game.getState().getWatchers().get(KydeleCardsDrawnThisTurnWatcher.class.getSimpleName());
|
KydeleCardsDrawnThisTurnWatcher watcher = (KydeleCardsDrawnThisTurnWatcher) game.getState().getWatchers().get(KydeleCardsDrawnThisTurnWatcher.class.getSimpleName());
|
||||||
return watcher.getCardsDrawnThisTurn(sourceAbility.getControllerId()).size();
|
return watcher.getCardsDrawnThisTurn(sourceAbility.getControllerId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -99,13 +99,13 @@ class CardsDrawnThisTurnDynamicValue implements DynamicValue {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getMessage() {
|
public String getMessage() {
|
||||||
return "number of cards you've drawn this turn";
|
return "card you've drawn this turn";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class KydeleCardsDrawnThisTurnWatcher extends Watcher {
|
class KydeleCardsDrawnThisTurnWatcher extends Watcher {
|
||||||
|
|
||||||
private final Map<UUID, Set<UUID>> cardsDrawnThisTurn = new HashMap<>();
|
private final Map<UUID, Integer> cardsDrawnThisTurn = new HashMap<>();
|
||||||
|
|
||||||
public KydeleCardsDrawnThisTurnWatcher() {
|
public KydeleCardsDrawnThisTurnWatcher() {
|
||||||
super(KydeleCardsDrawnThisTurnWatcher.class.getSimpleName(), WatcherScope.GAME);
|
super(KydeleCardsDrawnThisTurnWatcher.class.getSimpleName(), WatcherScope.GAME);
|
||||||
|
|
@ -119,14 +119,13 @@ class KydeleCardsDrawnThisTurnWatcher extends Watcher {
|
||||||
@Override
|
@Override
|
||||||
public void watch(GameEvent event, Game game) {
|
public void watch(GameEvent event, Game game) {
|
||||||
if (event.getType() == GameEvent.EventType.DREW_CARD) {
|
if (event.getType() == GameEvent.EventType.DREW_CARD) {
|
||||||
Set<UUID> cardsDrawn = getCardsDrawnThisTurn(event.getPlayerId());
|
int cardsDrawn = getCardsDrawnThisTurn(event.getPlayerId());
|
||||||
cardsDrawn.add(event.getTargetId());
|
cardsDrawnThisTurn.put(event.getPlayerId(), cardsDrawn + 1);
|
||||||
cardsDrawnThisTurn.put(event.getPlayerId(), cardsDrawn);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Set<UUID> getCardsDrawnThisTurn(UUID playerId) {
|
public int getCardsDrawnThisTurn(UUID playerId) {
|
||||||
return cardsDrawnThisTurn.getOrDefault(playerId, new LinkedHashSet<>());
|
return cardsDrawnThisTurn.getOrDefault(playerId, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue