diff --git a/Mage.Sets/src/mage/cards/k/KydeleChosenOfKruphix.java b/Mage.Sets/src/mage/cards/k/KydeleChosenOfKruphix.java index d84d9c7877..309e8c6d14 100644 --- a/Mage.Sets/src/mage/cards/k/KydeleChosenOfKruphix.java +++ b/Mage.Sets/src/mage/cards/k/KydeleChosenOfKruphix.java @@ -65,7 +65,7 @@ public class KydeleChosenOfKruphix extends CardImpl { // {T}: Add {C} to your mana pool for each card you've drawn this turn. DynamicManaAbility ability = new DynamicManaAbility(Mana.ColorlessMana(1), new CardsDrawnThisTurnDynamicValue(), new TapSourceCost()); - this.addAbility(ability, new CardsDrawnThisTurnWatcher()); + this.addAbility(ability, new KydeleCardsDrawnThisTurnWatcher()); // Partner this.addAbility(PartnerAbility.getInstance()); @@ -85,7 +85,7 @@ class CardsDrawnThisTurnDynamicValue implements DynamicValue { @Override public int calculate(Game game, Ability sourceAbility, Effect effect) { - CardsDrawnThisTurnWatcher watcher = (CardsDrawnThisTurnWatcher) game.getState().getWatchers().get("CardsDrawnThisTurnWatcher"); + KydeleCardsDrawnThisTurnWatcher watcher = (KydeleCardsDrawnThisTurnWatcher) game.getState().getWatchers().get(KydeleCardsDrawnThisTurnWatcher.class.getName()); return watcher.getNumCardsDrawnThisTurn(sourceAbility.getControllerId()); } @@ -105,15 +105,15 @@ class CardsDrawnThisTurnDynamicValue implements DynamicValue { } } -class CardsDrawnThisTurnWatcher extends Watcher { +class KydeleCardsDrawnThisTurnWatcher extends Watcher { private final Map> cardsDrawnThisTurn = new HashMap<>(); - public CardsDrawnThisTurnWatcher() { - super("CardsDrawnThisTurnWatcher", WatcherScope.GAME); + public KydeleCardsDrawnThisTurnWatcher() { + super(KydeleCardsDrawnThisTurnWatcher.class.getName(), WatcherScope.GAME); } - public CardsDrawnThisTurnWatcher(final CardsDrawnThisTurnWatcher watcher) { + public KydeleCardsDrawnThisTurnWatcher(final KydeleCardsDrawnThisTurnWatcher watcher) { super(watcher); this.cardsDrawnThisTurn.putAll(watcher.cardsDrawnThisTurn); } @@ -130,10 +130,6 @@ class CardsDrawnThisTurnWatcher extends Watcher { } } - private Set getCardsDrawnThisTurn(UUID playerId) { - return cardsDrawnThisTurn.get(playerId); - } - public int getNumCardsDrawnThisTurn(UUID playerId) { if (cardsDrawnThisTurn.get(playerId) == null) { return 0; @@ -145,11 +141,11 @@ class CardsDrawnThisTurnWatcher extends Watcher { public void reset() { super.reset(); cardsDrawnThisTurn.clear(); - + } @Override - public CardsDrawnThisTurnWatcher copy() { - return new CardsDrawnThisTurnWatcher(this); + public KydeleCardsDrawnThisTurnWatcher copy() { + return new KydeleCardsDrawnThisTurnWatcher(this); } } diff --git a/Mage.Sets/src/mage/cards/s/SylvanLibrary.java b/Mage.Sets/src/mage/cards/s/SylvanLibrary.java index 4ebdb443a6..5643ca41fc 100644 --- a/Mage.Sets/src/mage/cards/s/SylvanLibrary.java +++ b/Mage.Sets/src/mage/cards/s/SylvanLibrary.java @@ -60,11 +60,11 @@ import mage.watchers.Watcher; public class SylvanLibrary extends CardImpl { public SylvanLibrary(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{1}{G}"); + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{G}"); // At the beginning of your draw step, you may draw two additional cards. If you do, choose two cards in your hand drawn this turn. For each of those cards, pay 4 life or put the card on top of your library. this.addAbility(new BeginningOfDrawTriggeredAbility(new SylvanLibraryEffect(), TargetController.YOU, true), - new CardsDrawnThisTurnWatcher()); + new SylvanLibraryCardsDrawnThisTurnWatcher()); } @@ -99,7 +99,7 @@ class SylvanLibraryEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { controller.drawCards(2, game); - CardsDrawnThisTurnWatcher watcher = (CardsDrawnThisTurnWatcher) game.getState().getWatchers().get("CardsDrawnThisTurnWatcher"); + SylvanLibraryCardsDrawnThisTurnWatcher watcher = (SylvanLibraryCardsDrawnThisTurnWatcher) game.getState().getWatchers().get("SylvanLibraryCardsDrawnThisTurnWatcher"); if (watcher != null) { Cards cards = new CardsImpl(); Set cardsDrawnThisTurn = watcher.getCardsDrawnThisTurn(controller.getId()); @@ -141,15 +141,15 @@ class SylvanLibraryEffect extends OneShotEffect { } } -class CardsDrawnThisTurnWatcher extends Watcher { +class SylvanLibraryCardsDrawnThisTurnWatcher extends Watcher { private final Map> cardsDrawnThisTurn = new HashMap<>(); - public CardsDrawnThisTurnWatcher() { - super("CardsDrawnThisTurnWatcher", WatcherScope.GAME); + public SylvanLibraryCardsDrawnThisTurnWatcher() { + super("SylvanLibraryCardsDrawnThisTurnWatcher", WatcherScope.GAME); } - public CardsDrawnThisTurnWatcher(final CardsDrawnThisTurnWatcher watcher) { + public SylvanLibraryCardsDrawnThisTurnWatcher(final SylvanLibraryCardsDrawnThisTurnWatcher watcher) { super(watcher); this.cardsDrawnThisTurn.putAll(watcher.cardsDrawnThisTurn); } @@ -177,8 +177,8 @@ class CardsDrawnThisTurnWatcher extends Watcher { } @Override - public CardsDrawnThisTurnWatcher copy() { - return new CardsDrawnThisTurnWatcher(this); + public SylvanLibraryCardsDrawnThisTurnWatcher copy() { + return new SylvanLibraryCardsDrawnThisTurnWatcher(this); } } diff --git a/Mage/src/main/java/mage/game/combat/CombatGroup.java b/Mage/src/main/java/mage/game/combat/CombatGroup.java index 1d3904c7c6..c5b64a44e6 100644 --- a/Mage/src/main/java/mage/game/combat/CombatGroup.java +++ b/Mage/src/main/java/mage/game/combat/CombatGroup.java @@ -189,6 +189,9 @@ public class CombatGroup implements Serializable, Copyable { * @return */ private boolean canDamage(Permanent perm, boolean first) { + if (perm == null) { + return false; + } // if now first strike combat damage step if (first) { // should have first strike or double strike