mirror of
https://github.com/magefree/mage.git
synced 2025-12-21 11:02:00 -08:00
New stack dialog (experimental)
This commit is contained in:
parent
397c393f1d
commit
48f2018af6
24 changed files with 1095 additions and 21 deletions
|
|
@ -77,6 +77,7 @@ public class CardView extends SimpleCardView {
|
|||
protected List<UUID> targets;
|
||||
|
||||
protected UUID pairedCard;
|
||||
protected boolean paid;
|
||||
|
||||
public CardView(Card card, UUID cardId) {
|
||||
this(card);
|
||||
|
|
@ -389,4 +390,12 @@ public class CardView extends SimpleCardView {
|
|||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public boolean isPaid() {
|
||||
return paid;
|
||||
}
|
||||
|
||||
public void setPaid(boolean paid) {
|
||||
this.paid = paid;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ import mage.Constants;
|
|||
import mage.Constants.PhaseStep;
|
||||
import mage.Constants.TurnPhase;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.cards.Card;
|
||||
import mage.game.ExileZone;
|
||||
import mage.game.Game;
|
||||
|
|
@ -90,6 +91,7 @@ public class GameView implements Serializable {
|
|||
if (card.canTransform()) {
|
||||
updateLatestCardView(game, card, stackObject.getId());
|
||||
}
|
||||
checkPaid(stackObject.getId(), (StackAbility)stackObject);
|
||||
} else if (object != null) {
|
||||
StackAbility stackAbility = ((StackAbility)object);
|
||||
stackAbility.newId();
|
||||
|
|
@ -103,10 +105,12 @@ public class GameView implements Serializable {
|
|||
}
|
||||
|
||||
stack.put(stackObject.getId(), new CardView(stackAbility));
|
||||
checkPaid(stackObject.getId(), stackAbility);
|
||||
}
|
||||
}
|
||||
else {
|
||||
stack.put(stackObject.getId(), new CardView((Spell)stackObject));
|
||||
checkPaid(stackObject.getId(), (Spell)stackObject);
|
||||
}
|
||||
//stackOrder.add(stackObject.getId());
|
||||
}
|
||||
|
|
@ -134,6 +138,31 @@ public class GameView implements Serializable {
|
|||
this.special = state.getSpecialActions().getControlledBy(state.getPriorityPlayerId()).size() > 0;
|
||||
}
|
||||
|
||||
private void checkPaid(UUID uuid, StackAbility stackAbility) {
|
||||
for (Cost cost : stackAbility.getManaCostsToPay()) {
|
||||
if (!cost.isPaid()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
CardView cardView = stack.get(uuid);
|
||||
cardView.paid = true;
|
||||
}
|
||||
|
||||
private void checkPaid(UUID uuid, Spell spell) {
|
||||
for (Cost cost : spell.getSpellAbility().getManaCostsToPay()) {
|
||||
if (!cost.isPaid()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
CardView cardView = stack.get(uuid);
|
||||
cardView.paid = true;
|
||||
}
|
||||
|
||||
private void setPaid(UUID uuid) {
|
||||
CardView cardView = stack.get(uuid);
|
||||
cardView.paid = true;
|
||||
}
|
||||
|
||||
private void updateLatestCardView(Game game, Card card, UUID stackId) {
|
||||
if (!card.canTransform()) {
|
||||
return;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue