mirror of
https://github.com/correl/mage.git
synced 2024-12-25 03:00:15 +00:00
solving review issues
This commit is contained in:
parent
570c2c2c5d
commit
14c459b924
8 changed files with 15 additions and 15 deletions
|
@ -39,7 +39,7 @@ import mage.watchers.Watcher;
|
|||
|
||||
/**
|
||||
* @author jeffwadsworth
|
||||
* <p>
|
||||
*
|
||||
* Amount of damage received by a player this turn
|
||||
*/
|
||||
public class AmountOfDamageAPlayerReceivedThisTurnWatcher extends Watcher {
|
||||
|
|
|
@ -61,7 +61,7 @@ public class CardsAmountDrawnThisTurnWatcher extends Watcher {
|
|||
public void watch(GameEvent event, Game game) {
|
||||
if (event.getType() == GameEvent.EventType.DREW_CARD) {
|
||||
amountOfCardsDrawnThisTurn.putIfAbsent(event.getPlayerId(), 0);
|
||||
amountOfCardsDrawnThisTurn.compute(event.getPlayerId(), (k, amount) -> amount += 1);
|
||||
amountOfCardsDrawnThisTurn.compute(event.getPlayerId(), (k, amount) -> amount + 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ import mage.watchers.Watcher;
|
|||
|
||||
/**
|
||||
* @author LevelX2
|
||||
* <p>
|
||||
*
|
||||
* Counts cards drawn during draw step
|
||||
*/
|
||||
|
||||
|
|
|
@ -90,7 +90,7 @@ public class CastSpellLastTurnWatcher extends Watcher {
|
|||
}
|
||||
|
||||
public int getAmountOfSpellsAllPlayersCastOnCurrentTurn() {
|
||||
return amountOfSpellsCastOnCurrentTurn.values().stream().mapToInt(Integer::intValue).sum();
|
||||
return amountOfSpellsCastOnCurrentTurn.values().stream().reduce(0, Integer::sum);
|
||||
}
|
||||
|
||||
public int getAmountOfSpellsPlayerCastOnCurrentTurn(UUID playerId) {
|
||||
|
|
|
@ -75,9 +75,9 @@ public class MiracleWatcher extends Watcher {
|
|||
if (game.getPhase() != null && event.getType() == GameEvent.EventType.DREW_CARD) {
|
||||
UUID playerId = event.getPlayerId();
|
||||
if (playerId != null) {
|
||||
amountOfCardsDrawnThisTurn.putIfAbsent(playerId, 0);
|
||||
amountOfCardsDrawnThisTurn.compute(playerId, (p, amount) -> amount + 1);
|
||||
if (amountOfCardsDrawnThisTurn.get(playerId) == 1) {
|
||||
Integer amount = 1 + amountOfCardsDrawnThisTurn.getOrDefault(playerId, 0);
|
||||
amountOfCardsDrawnThisTurn.put(playerId, amount);
|
||||
if (amount == 1) {
|
||||
checkMiracleAbility(event, game);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,13 +31,13 @@ package mage.watchers.common;
|
|||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.constants.WatcherScope;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.watchers.Watcher;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@ import java.util.HashMap;
|
|||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.constants.WatcherScope;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
|
@ -39,7 +40,6 @@ import mage.watchers.Watcher;
|
|||
/**
|
||||
* Counts amount of life gained during the current turn by players.
|
||||
*
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class PlayerGainedLifeWatcher extends Watcher {
|
||||
|
|
Loading…
Reference in a new issue