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.game.Game;
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 CardsView() {}
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 ) {
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<? extends Ability> 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)));
}
}
}

View file

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