mirror of
https://github.com/correl/mage.git
synced 2024-12-24 11:50:45 +00:00
Added multitarget arrows (Fireball).
This commit is contained in:
parent
b0e4549959
commit
875614b96c
3 changed files with 39 additions and 30 deletions
|
@ -365,22 +365,24 @@ public class Card extends javax.swing.JPanel implements MouseMotionListener, Mou
|
|||
popupShowing = true;
|
||||
|
||||
// Draw Arrows for targets
|
||||
UUID uuid = card.getFirstTarget();
|
||||
if (uuid != null) {
|
||||
System.out.println("Getting play area panel for uuid: " + uuid);
|
||||
List<UUID> targets = card.getTargets();
|
||||
if (targets != null) {
|
||||
for (UUID uuid : targets) {
|
||||
System.out.println("Getting play area panel for uuid: " + uuid);
|
||||
|
||||
PlayAreaPanel p = session.getGame().getPlayers().get(uuid);
|
||||
if (p != null) {
|
||||
Point target = p.getLocationOnScreen();
|
||||
Point me = this.getLocationOnScreen();
|
||||
ArrowBuilder.addArrow((int)me.getX() + 35, (int)me.getY(), (int)target.getX() + 40, (int)target.getY() - 40, Color.red);
|
||||
} else {
|
||||
for (PlayAreaPanel pa : session.getGame().getPlayers().values()) {
|
||||
Permanent permanent = pa.getBattlefieldPanel().getPermanents().get(uuid);
|
||||
if (permanent != null) {
|
||||
Point target = permanent.getLocationOnScreen();
|
||||
Point me = this.getLocationOnScreen();
|
||||
ArrowBuilder.addArrow((int)me.getX() + 35, (int)me.getY(), (int)target.getX() + 40, (int)target.getY() + 10, Color.red);
|
||||
PlayAreaPanel p = session.getGame().getPlayers().get(uuid);
|
||||
if (p != null) {
|
||||
Point target = p.getLocationOnScreen();
|
||||
Point me = this.getLocationOnScreen();
|
||||
ArrowBuilder.addArrow((int)me.getX() + 35, (int)me.getY(), (int)target.getX() + 40, (int)target.getY() - 40, Color.red);
|
||||
} else {
|
||||
for (PlayAreaPanel pa : session.getGame().getPlayers().values()) {
|
||||
Permanent permanent = pa.getBattlefieldPanel().getPermanents().get(uuid);
|
||||
if (permanent != null) {
|
||||
Point target = permanent.getLocationOnScreen();
|
||||
Point me = this.getLocationOnScreen();
|
||||
ArrowBuilder.addArrow((int)me.getX() + 35, (int)me.getY(), (int)target.getX() + 40, (int)target.getY() + 10, Color.red);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,13 +36,13 @@ import java.util.UUID;
|
|||
import mage.ObjectColor;
|
||||
import mage.Constants.CardType;
|
||||
import mage.Constants.Rarity;
|
||||
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;
|
||||
import mage.target.Targets;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -65,7 +65,7 @@ public class CardView implements Serializable {
|
|||
protected Rarity rarity;
|
||||
protected String expansionSetCode;
|
||||
|
||||
public UUID firstTarget; //TODO: there may be several targets
|
||||
public List<UUID> targets;
|
||||
|
||||
public CardView(Card card) {
|
||||
this.id = card.getId();
|
||||
|
@ -99,10 +99,15 @@ public class CardView implements Serializable {
|
|||
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);
|
||||
Targets targets = spell.getSpellAbility().getTargets();
|
||||
for (Target target : targets) {
|
||||
if (target.isChosen()) {
|
||||
for (UUID targetUUID : target.getTargets()) {
|
||||
if (this.targets == null) this.targets = new ArrayList<UUID>();
|
||||
this.targets.add(targetUUID);
|
||||
System.out.println("Added target: " + targetUUID);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -199,7 +204,12 @@ public class CardView implements Serializable {
|
|||
return id;
|
||||
}
|
||||
|
||||
public UUID getFirstTarget() {
|
||||
return firstTarget;
|
||||
/**
|
||||
* Returns UUIDs for targets.
|
||||
* Can be null if there is no target selected.
|
||||
* @return
|
||||
*/
|
||||
public List<UUID> getTargets() {
|
||||
return targets;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,9 +6,6 @@
|
|||
# nickname - Player's name you connect to the game with
|
||||
#
|
||||
#
|
||||
hand:player:mage.sets.magic2010.LightningBolt:1
|
||||
hand:player:mage.sets.magic2011.Fireball:2
|
||||
battlefield:player:mage.sets.magic2011.BrindleBoar:2
|
||||
graveyard:player:mage.sets.magic2011.BrindleBoar:1
|
||||
hand:player:mage.sets.magic2011.DoomBlade:1
|
||||
battlefield:player:mage.cards.basiclands.Swamp:2
|
||||
hand:player:Fireball:2
|
||||
battlefield:player:Mountain:6
|
||||
battlefield:computer:Brindle Boar:2
|
||||
|
|
Loading…
Reference in a new issue