This commit is contained in:
magenoxx 2011-06-24 19:23:42 +04:00
parent 854473bb58
commit 92e9d94c33
2 changed files with 9 additions and 15 deletions

View file

@ -36,6 +36,7 @@ import mage.abilities.Ability;
import mage.cards.Card; import mage.cards.Card;
import mage.game.Game; import mage.game.Game;
import mage.game.GameState; import mage.game.GameState;
import mage.game.permanent.Permanent;
/** /**
* *
@ -43,7 +44,6 @@ import mage.game.GameState;
*/ */
public class CardsView extends HashMap<UUID, CardView> { public class CardsView extends HashMap<UUID, CardView> {
public CardsView() {} public CardsView() {}
public CardsView(Collection<Card> cards) { public CardsView(Collection<Card> cards) {
@ -52,38 +52,31 @@ public class CardsView extends HashMap<UUID, CardView> {
} }
} }
// public CardsView(Cards cards) {
// if (cards != null)
// for (Card card: cards.values()) {
// this.add(new CardView(card));
// }
// }
public CardsView ( Collection<? extends Ability> abilities, Game game ) { public CardsView ( Collection<? extends Ability> abilities, Game game ) {
for ( Ability ability : abilities ) { for ( Ability ability : abilities ) {
Card sourceCard = null; Card sourceCard = null;
String sourceName = null;
switch ( ability.getZone() ) { switch ( ability.getZone() ) {
case ALL: case ALL:
case EXILED: case EXILED:
case GRAVEYARD: case GRAVEYARD:
sourceCard = game.getCard(ability.getSourceId()); sourceCard = game.getCard(ability.getSourceId());
sourceName = sourceCard.getName();
break; break;
case BATTLEFIELD: case BATTLEFIELD:
sourceCard = game.getState().getPermanent(ability.getSourceId()); sourceCard = game.getLastKnownInformation(ability.getSourceId(), Zone.BATTLEFIELD);
sourceName = sourceCard.getName();
break; 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<? extends Ability> abilities, GameState state) { public CardsView(Collection<? extends Ability> abilities, GameState state) {
for (Ability ability: abilities) { for (Ability ability: abilities) {
Card sourceCard = state.getPermanent(ability.getSourceId()); Card sourceCard = state.getPermanent(ability.getSourceId());
String sourceName = sourceCard.getName(); if (sourceCard != null) {
this.put(ability.getId(), new AbilityView(ability, sourceName, new CardView(sourceCard))); this.put(ability.getId(), new AbilityView(ability, sourceCard.getName(), new CardView(sourceCard)));
}
} }
} }

View file

@ -50,6 +50,7 @@ public class LoseLifeControllerEffect extends OneShotEffect<LoseLifeControllerEf
public LoseLifeControllerEffect(final LoseLifeControllerEffect effect) { public LoseLifeControllerEffect(final LoseLifeControllerEffect effect) {
super(effect); super(effect);
this.amount = effect.amount;
} }
@Override @Override