diff --git a/Mage.Common/src/mage/view/CardsView.java b/Mage.Common/src/mage/view/CardsView.java index d70cd0949a..dbba097dc4 100644 --- a/Mage.Common/src/mage/view/CardsView.java +++ b/Mage.Common/src/mage/view/CardsView.java @@ -36,6 +36,7 @@ import mage.abilities.Ability; import mage.cards.Card; import mage.game.Game; import mage.game.GameState; +import mage.game.permanent.Permanent; /** * @@ -43,7 +44,6 @@ import mage.game.GameState; */ public class CardsView extends HashMap { - public CardsView() {} public CardsView(Collection cards) { @@ -52,38 +52,31 @@ public class CardsView extends HashMap { } } -// public CardsView(Cards cards) { -// if (cards != null) -// for (Card card: cards.values()) { -// this.add(new CardView(card)); -// } -// } - public CardsView ( Collection abilities, Game game ) { for ( Ability ability : abilities ) { Card sourceCard = null; - String sourceName = null; switch ( ability.getZone() ) { case ALL: case EXILED: case GRAVEYARD: sourceCard = game.getCard(ability.getSourceId()); - sourceName = sourceCard.getName(); break; case BATTLEFIELD: - sourceCard = game.getState().getPermanent(ability.getSourceId()); - sourceName = sourceCard.getName(); + sourceCard = game.getLastKnownInformation(ability.getSourceId(), Zone.BATTLEFIELD); break; } - this.put(ability.getId(), new AbilityView(ability, sourceName, new CardView(sourceCard))); + if (sourceCard != null) { + this.put(ability.getId(), new AbilityView(ability, sourceCard.getName(), new CardView(sourceCard))); + } } } public CardsView(Collection abilities, GameState state) { for (Ability ability: abilities) { Card sourceCard = state.getPermanent(ability.getSourceId()); - String sourceName = sourceCard.getName(); - this.put(ability.getId(), new AbilityView(ability, sourceName, new CardView(sourceCard))); + if (sourceCard != null) { + this.put(ability.getId(), new AbilityView(ability, sourceCard.getName(), new CardView(sourceCard))); + } } } diff --git a/Mage/src/mage/abilities/effects/common/LoseLifeControllerEffect.java b/Mage/src/mage/abilities/effects/common/LoseLifeControllerEffect.java index d1dbe33099..5e89feaf4d 100644 --- a/Mage/src/mage/abilities/effects/common/LoseLifeControllerEffect.java +++ b/Mage/src/mage/abilities/effects/common/LoseLifeControllerEffect.java @@ -50,6 +50,7 @@ public class LoseLifeControllerEffect extends OneShotEffect