diff --git a/Mage/src/main/java/mage/watchers/common/AmountOfDamageAPlayerReceivedThisTurnWatcher.java b/Mage/src/main/java/mage/watchers/common/AmountOfDamageAPlayerReceivedThisTurnWatcher.java index 23a4884150..e372d8d612 100644 --- a/Mage/src/main/java/mage/watchers/common/AmountOfDamageAPlayerReceivedThisTurnWatcher.java +++ b/Mage/src/main/java/mage/watchers/common/AmountOfDamageAPlayerReceivedThisTurnWatcher.java @@ -39,7 +39,7 @@ import mage.watchers.Watcher; /** * @author jeffwadsworth - *
+ * * Amount of damage received by a player this turn */ public class AmountOfDamageAPlayerReceivedThisTurnWatcher extends Watcher { diff --git a/Mage/src/main/java/mage/watchers/common/CardsAmountDrawnThisTurnWatcher.java b/Mage/src/main/java/mage/watchers/common/CardsAmountDrawnThisTurnWatcher.java index ad0f8568d6..39fc825179 100644 --- a/Mage/src/main/java/mage/watchers/common/CardsAmountDrawnThisTurnWatcher.java +++ b/Mage/src/main/java/mage/watchers/common/CardsAmountDrawnThisTurnWatcher.java @@ -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); } } @@ -86,7 +86,7 @@ public class CardsAmountDrawnThisTurnWatcher extends Watcher { } public int getAmountCardsDrawn(UUID playerId) { - return amountOfCardsDrawnThisTurn.getOrDefault(playerId,0); + return amountOfCardsDrawnThisTurn.getOrDefault(playerId, 0); } @Override diff --git a/Mage/src/main/java/mage/watchers/common/CardsDrawnDuringDrawStepWatcher.java b/Mage/src/main/java/mage/watchers/common/CardsDrawnDuringDrawStepWatcher.java index 8f213a336d..59e9a91b77 100644 --- a/Mage/src/main/java/mage/watchers/common/CardsDrawnDuringDrawStepWatcher.java +++ b/Mage/src/main/java/mage/watchers/common/CardsDrawnDuringDrawStepWatcher.java @@ -41,7 +41,7 @@ import mage.watchers.Watcher; /** * @author LevelX2 - *
+ *
* Counts cards drawn during draw step
*/
diff --git a/Mage/src/main/java/mage/watchers/common/CastSpellLastTurnWatcher.java b/Mage/src/main/java/mage/watchers/common/CastSpellLastTurnWatcher.java
index 17e204b339..27193a9dda 100644
--- a/Mage/src/main/java/mage/watchers/common/CastSpellLastTurnWatcher.java
+++ b/Mage/src/main/java/mage/watchers/common/CastSpellLastTurnWatcher.java
@@ -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) {
diff --git a/Mage/src/main/java/mage/watchers/common/CommanderInfoWatcher.java b/Mage/src/main/java/mage/watchers/common/CommanderInfoWatcher.java
index 769484331b..f6784b84c9 100644
--- a/Mage/src/main/java/mage/watchers/common/CommanderInfoWatcher.java
+++ b/Mage/src/main/java/mage/watchers/common/CommanderInfoWatcher.java
@@ -77,7 +77,7 @@ public class CommanderInfoWatcher extends Watcher {
DamagedPlayerEvent damageEvent = (DamagedPlayerEvent) event;
if (damageEvent.isCombatDamage()) {
UUID playerUUID = event.getTargetId();
- Integer damage = damageToPlayer.getOrDefault(playerUUID,0);
+ Integer damage = damageToPlayer.getOrDefault(playerUUID, 0);
damage += damageEvent.getAmount();
damageToPlayer.put(playerUUID, damage);
Player player = game.getPlayer(playerUUID);
diff --git a/Mage/src/main/java/mage/watchers/common/MiracleWatcher.java b/Mage/src/main/java/mage/watchers/common/MiracleWatcher.java
index f5ff489e4b..a3a966bd78 100644
--- a/Mage/src/main/java/mage/watchers/common/MiracleWatcher.java
+++ b/Mage/src/main/java/mage/watchers/common/MiracleWatcher.java
@@ -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);
}
}
diff --git a/Mage/src/main/java/mage/watchers/common/PlayerAttackedWatcher.java b/Mage/src/main/java/mage/watchers/common/PlayerAttackedWatcher.java
index 96e1f89209..434cbb2dc9 100644
--- a/Mage/src/main/java/mage/watchers/common/PlayerAttackedWatcher.java
+++ b/Mage/src/main/java/mage/watchers/common/PlayerAttackedWatcher.java
@@ -31,20 +31,20 @@ 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
*/
public class PlayerAttackedWatcher extends Watcher {
// With how many creatures attacked this player this turn
- private final Map