mirror of
https://github.com/magefree/mage.git
synced 2025-12-27 14:02:05 -08:00
[GUI] Displaying spell target with arrow. (at the moment only first target is displayed).
This commit is contained in:
parent
c82d3c6dd9
commit
2fc9fc1301
8 changed files with 337 additions and 7 deletions
|
|
@ -32,13 +32,17 @@ import java.io.Serializable;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.ObjectColor;
|
||||
import mage.Constants.CardType;
|
||||
import mage.Constants.Rarity;
|
||||
import mage.ObjectColor;
|
||||
import mage.abilities.Ability;
|
||||
import mage.cards.Card;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.game.permanent.PermanentToken;
|
||||
import mage.game.permanent.token.Token;
|
||||
import mage.game.stack.Spell;
|
||||
import mage.target.Target;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -61,6 +65,8 @@ public class CardView implements Serializable {
|
|||
protected Rarity rarity;
|
||||
protected String expansionSetCode;
|
||||
|
||||
public UUID firstTarget; //TODO: there may be several targets
|
||||
|
||||
public CardView(Card card) {
|
||||
this.id = card.getId();
|
||||
this.name = card.getName();
|
||||
|
|
@ -89,6 +95,17 @@ public class CardView implements Serializable {
|
|||
this.rarity = card.getRarity();
|
||||
this.expansionSetCode = card.getExpansionSetCode();
|
||||
}
|
||||
|
||||
if (card instanceof Spell) {
|
||||
Spell<?> spell = (Spell<?>)card;
|
||||
if (spell.getSpellAbility().getTargets().size() > 0) {
|
||||
Target target = spell.getSpellAbility().getTargets().get(0);
|
||||
if (target.isChosen()) {
|
||||
firstTarget = target.getFirstTarget();
|
||||
System.out.println("First target: " + firstTarget);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected CardView() {
|
||||
|
|
@ -181,4 +198,8 @@ public class CardView implements Serializable {
|
|||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public UUID getFirstTarget() {
|
||||
return firstTarget;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue