Reworked emblems

This commit is contained in:
magenoxx 2012-06-12 20:57:23 +04:00
parent 3f1ae983c1
commit 9c8fe7268b
12 changed files with 264 additions and 18 deletions

View file

@ -28,6 +28,7 @@
package mage.view;
import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.MageObject;
@ -38,6 +39,7 @@ import mage.game.permanent.Permanent;
import mage.game.permanent.PermanentToken;
import mage.game.permanent.token.Token;
import mage.game.stack.Spell;
import mage.game.stack.StackAbility;
import mage.target.Target;
import mage.target.Targets;
@ -150,6 +152,15 @@ public class CardView extends SimpleCardView {
this.expansionSetCode = ((PermanentToken) card).getExpansionSetCode();
this.rules = ((PermanentToken) card).getRules();
}
if (name.equals("") && card instanceof StackAbility) {
StackAbility stackAbility = (StackAbility)card;
if (stackAbility.getZone().equals(Constants.Zone.COMMAND)) {
this.name = "Emblem";
this.rarity = Rarity.NA;
this.rules = new ArrayList<String>();
this.rules.add(stackAbility.getRule());
}
}
}
protected CardView() {
@ -164,6 +175,11 @@ public class CardView extends SimpleCardView {
fillEmpty();
}
public CardView(String name) {
this(true);
this.name = name;
}
private void fillEmpty() {
this.name = "Face Down";
this.rules = new ArrayList<String>();

View file

@ -28,9 +28,6 @@
package mage.view;
import java.util.Collection;
import java.util.HashMap;
import java.util.UUID;
import mage.Constants.Zone;
import mage.abilities.Ability;
import mage.cards.Card;
@ -38,11 +35,15 @@ import mage.game.Game;
import mage.game.GameState;
import mage.game.permanent.Permanent;
import java.util.Collection;
import java.util.LinkedHashMap;
import java.util.UUID;
/**
*
* @author BetaSteward_at_googlemail.com
*/
public class CardsView extends HashMap<UUID, CardView> {
public class CardsView extends LinkedHashMap<UUID, CardView> {
public CardsView() {}
@ -66,6 +67,10 @@ public class CardsView extends HashMap<UUID, CardView> {
if (sourceCard == null)
sourceCard = (Permanent)game.getLastKnownInformation(ability.getSourceId(), Zone.BATTLEFIELD);
break;
case COMMAND:
ability.newId();
this.put(ability.getId(), new AbilityView(ability, "Emblem", new CardView("Emblem")));
break;
}
if (sourceCard != null) {
this.put(ability.getId(), new AbilityView(ability, sourceCard.getName(), new CardView(sourceCard)));

View file

@ -57,7 +57,7 @@ public class GameView implements Serializable {
private SimpleCardsView hand;
private Map<String, SimpleCardsView> opponentHands;
private CardsView stack = new CardsView();
private List<UUID> stackOrder = new ArrayList<UUID>();
//private List<UUID> stackOrder = new ArrayList<UUID>();
private List<ExileView> exiles = new ArrayList<ExileView>();
private List<RevealedView> revealed = new ArrayList<RevealedView>();
private List<LookedAtView> lookedAt = new ArrayList<LookedAtView>();
@ -87,15 +87,17 @@ public class GameView implements Serializable {
updateLatestCardView(game, card, stackObject.getId());
}
} else if (object != null) {
stack.put(stackObject.getId(), new CardView(object));
StackAbility stackAbility = ((StackAbility)object);
stackAbility.newId();
stack.put(stackObject.getId(), new CardView(stackAbility));
}
}
else {
stack.put(stackObject.getId(), new CardView((Spell)stackObject));
}
stackOrder.add(stackObject.getId());
//stackOrder.add(stackObject.getId());
}
Collections.reverse(stackOrder);
//Collections.reverse(stackOrder);
for (ExileZone exileZone: state.getExile().getExileZones()) {
exiles.add(new ExileView(exileZone, game));
}
@ -203,7 +205,7 @@ public class GameView implements Serializable {
return special;
}
public List<UUID> getStackOrder() {
/*public List<UUID> getStackOrder() {
return stackOrder;
}
}*/
}