mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 03:08:02 +00:00
- Added some colors for the different phases.
This commit is contained in:
@@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
package forge;
|
package forge;
|
||||||
|
|
||||||
|
|
||||||
@@ -58,6 +57,8 @@ import javax.swing.JTextArea;
|
|||||||
import javax.swing.ScrollPaneConstants;
|
import javax.swing.ScrollPaneConstants;
|
||||||
import javax.swing.SwingConstants;
|
import javax.swing.SwingConstants;
|
||||||
import javax.swing.SwingUtilities;
|
import javax.swing.SwingUtilities;
|
||||||
|
import javax.swing.border.Border;
|
||||||
|
import javax.swing.border.EmptyBorder;
|
||||||
import javax.swing.border.EtchedBorder;
|
import javax.swing.border.EtchedBorder;
|
||||||
import javax.swing.border.TitledBorder;
|
import javax.swing.border.TitledBorder;
|
||||||
import javax.swing.event.ListSelectionEvent;
|
import javax.swing.event.ListSelectionEvent;
|
||||||
@@ -135,12 +136,12 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
|
|||||||
/*
|
/*
|
||||||
public void addAssignDamage(Card attacker, Card blocker, int damage)
|
public void addAssignDamage(Card attacker, Card blocker, int damage)
|
||||||
{
|
{
|
||||||
multiBlockers.add(blocker);
|
multiBlockers.add(blocker);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addAssignDamage(Card attacker, int damage) {
|
public void addAssignDamage(Card attacker, int damage) {
|
||||||
//new Gui_MultipleBlockers3(attacker, blockers, damage, this);
|
//new Gui_MultipleBlockers3(attacker, blockers, damage, this);
|
||||||
new Gui_MultipleBlockers3(attacker, multiBlockers, damage, this);
|
new Gui_MultipleBlockers3(attacker, multiBlockers, damage, this);
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -252,7 +253,26 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void showMessage(String s) {
|
public void showMessage(String s) {
|
||||||
|
|
||||||
|
messageArea.setText(s);
|
||||||
|
|
||||||
messageArea.setText(s);
|
messageArea.setText(s);
|
||||||
|
Border border = new EmptyBorder(1, 1, 1, 1);
|
||||||
|
|
||||||
|
messageArea.setBorder(border);
|
||||||
|
|
||||||
|
int thickness = 3;
|
||||||
|
|
||||||
|
if (s.contains("Main"))
|
||||||
|
border = BorderFactory.createLineBorder(new Color(30, 0, 255), thickness);
|
||||||
|
else if (s.contains("To Block"))
|
||||||
|
border = BorderFactory.createLineBorder(new Color(13, 179, 0), thickness);
|
||||||
|
else if (s.contains("Play Instants and Abilities") )
|
||||||
|
border = BorderFactory.createLineBorder(new Color(255, 174, 0), thickness);
|
||||||
|
else if (s.contains("Declare Attackers"))
|
||||||
|
border = BorderFactory.createLineBorder(new Color(255, 0, 0), thickness);
|
||||||
|
|
||||||
|
messageArea.setBorder(border);
|
||||||
}
|
}
|
||||||
|
|
||||||
//returned Object could be null
|
//returned Object could be null
|
||||||
@@ -299,7 +319,7 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
|
|||||||
playerHandPanel.addMouseMotionListener(new MouseMotionAdapter() {
|
playerHandPanel.addMouseMotionListener(new MouseMotionAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void mouseMoved(MouseEvent me) {
|
public void mouseMoved(MouseEvent me) {
|
||||||
Card c = playerHandPanel.getCardFromMouseOverPanel();
|
Card c = playerHandPanel.getCardFromMouseOverPanel();
|
||||||
if(c != null) {
|
if(c != null) {
|
||||||
setCard(c);
|
setCard(c);
|
||||||
}
|
}
|
||||||
@@ -312,6 +332,7 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
|
|||||||
oppCreaturePanel.addMouseMotionListener(GuiDisplayUtil.getCardDetailMouse(this));
|
oppCreaturePanel.addMouseMotionListener(GuiDisplayUtil.getCardDetailMouse(this));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//opponent life mouse listener
|
//opponent life mouse listener
|
||||||
oppLifeLabel.addMouseListener(new MouseAdapter() {
|
oppLifeLabel.addMouseListener(new MouseAdapter() {
|
||||||
|
|
||||||
@@ -394,8 +415,8 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
|
|||||||
// won't work yet:
|
// won't work yet:
|
||||||
else if (block.contains(cardPanel.getCard()) && inputControl.input instanceof Input_Block)
|
else if (block.contains(cardPanel.getCard()) && inputControl.input instanceof Input_Block)
|
||||||
{
|
{
|
||||||
Card crd = cardPanel.getCard();
|
Card crd = cardPanel.getCard();
|
||||||
AllZone.Combat.removeFromCombat(crd);
|
AllZone.Combat.removeFromCombat(crd);
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -410,7 +431,7 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void mousePressed(MouseEvent e) {
|
public void mousePressed(MouseEvent e) {
|
||||||
if(e.getButton() != MouseEvent.BUTTON1) return;
|
if(e.getButton() != MouseEvent.BUTTON1) return;
|
||||||
Card c = playerHandPanel.getCardFromMouseOverPanel();
|
Card c = playerHandPanel.getCardFromMouseOverPanel();
|
||||||
if(c != null) {
|
if(c != null) {
|
||||||
inputControl.selectCard(c, AllZone.Human_Hand);
|
inputControl.selectCard(c, AllZone.Human_Hand);
|
||||||
@@ -505,16 +526,16 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
|
|||||||
AllZone.Computer_Life.updateObservers();
|
AllZone.Computer_Life.updateObservers();
|
||||||
|
|
||||||
if (AllZone.QuestData != null) {
|
if (AllZone.QuestData != null) {
|
||||||
File base = ForgeProps.getFile(IMAGE_ICON);
|
File base = ForgeProps.getFile(IMAGE_ICON);
|
||||||
String iconName = "";
|
String iconName = "";
|
||||||
if (Constant.Quest.oppIconName[0] != null) {
|
if (Constant.Quest.oppIconName[0] != null) {
|
||||||
iconName = Constant.Quest.oppIconName[0];
|
iconName = Constant.Quest.oppIconName[0];
|
||||||
File file = new File(base, iconName);
|
File file = new File(base, iconName);
|
||||||
ImageIcon icon = new ImageIcon(file.toString());
|
ImageIcon icon = new ImageIcon(file.toString());
|
||||||
oppIconLabel.setIcon(icon);
|
oppIconLabel.setIcon(icon);
|
||||||
oppIconLabel.setAlignmentX(100);
|
oppIconLabel.setAlignmentX(100);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
oppPCLabel.setText("Poison Counters: " + AllZone.Computer_PoisonCounter.getPoisonCounters());
|
oppPCLabel.setText("Poison Counters: " + AllZone.Computer_PoisonCounter.getPoisonCounters());
|
||||||
@@ -557,6 +578,7 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
|
|||||||
label = new JLabel("" + (count++) + ". " + stack.peek(i).getStackDescription());
|
label = new JLabel("" + (count++) + ". " + stack.peek(i).getStackDescription());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//update card detail
|
//update card detail
|
||||||
final CardPanel cardPanel = new CardPanel(stack.peek(i).getSourceCard());
|
final CardPanel cardPanel = new CardPanel(stack.peek(i).getSourceCard());
|
||||||
cardPanel.setLayout(new BorderLayout());
|
cardPanel.setLayout(new BorderLayout());
|
||||||
@@ -595,15 +617,15 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
|
|||||||
List<Card> tmp, diff;
|
List<Card> tmp, diff;
|
||||||
tmp = new ArrayList<Card>();
|
tmp = new ArrayList<Card>();
|
||||||
for(arcane.ui.CardPanel cpa : p.cardPanels)
|
for(arcane.ui.CardPanel cpa : p.cardPanels)
|
||||||
tmp.add(cpa.gameCard);
|
tmp.add(cpa.gameCard);
|
||||||
diff = new ArrayList<Card>(tmp);
|
diff = new ArrayList<Card>(tmp);
|
||||||
diff.removeAll(Arrays.asList(c));
|
diff.removeAll(Arrays.asList(c));
|
||||||
if(diff.size() == p.cardPanels.size())
|
if(diff.size() == p.cardPanels.size())
|
||||||
p.clear();
|
p.clear();
|
||||||
else {
|
else {
|
||||||
for(Card card : diff) {
|
for(Card card : diff) {
|
||||||
p.removeCardPanel(p.getCardPanel(card.getUniqueNumber()));
|
p.removeCardPanel(p.getCardPanel(card.getUniqueNumber()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
diff = new ArrayList<Card>(Arrays.asList(c));
|
diff = new ArrayList<Card>(Arrays.asList(c));
|
||||||
diff.removeAll(tmp);
|
diff.removeAll(tmp);
|
||||||
@@ -611,24 +633,24 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
|
|||||||
int fromZoneX = 0, fromZoneY = 0;
|
int fromZoneX = 0, fromZoneY = 0;
|
||||||
Rectangle pb = playerLibraryValue.getBounds();
|
Rectangle pb = playerLibraryValue.getBounds();
|
||||||
Point zoneLocation = SwingUtilities.convertPoint(playerLibraryValue, Math.round(pb.width / 2.0f), Math.round(pb.height / 2.0f), layeredPane);
|
Point zoneLocation = SwingUtilities.convertPoint(playerLibraryValue, Math.round(pb.width / 2.0f), Math.round(pb.height / 2.0f), layeredPane);
|
||||||
fromZoneX = zoneLocation.x;
|
fromZoneX = zoneLocation.x;
|
||||||
fromZoneY = zoneLocation.y;
|
fromZoneY = zoneLocation.y;
|
||||||
int startWidth, startX, startY;
|
int startWidth, startX, startY;
|
||||||
startWidth = 10;
|
startWidth = 10;
|
||||||
startX = fromZoneX - Math.round(startWidth / 2.0f);
|
startX = fromZoneX - Math.round(startWidth / 2.0f);
|
||||||
startY = fromZoneY - Math.round(Math.round(startWidth * arcane.ui.CardPanel.ASPECT_RATIO) / 2.0f);
|
startY = fromZoneY - Math.round(Math.round(startWidth * arcane.ui.CardPanel.ASPECT_RATIO) / 2.0f);
|
||||||
|
|
||||||
int endWidth, endX, endY;
|
int endWidth, endX, endY;
|
||||||
arcane.ui.CardPanel toPanel = null;
|
arcane.ui.CardPanel toPanel = null;
|
||||||
|
|
||||||
for(Card card : diff) {
|
for(Card card : diff) {
|
||||||
toPanel = p.addCard(card);
|
toPanel = p.addCard(card);
|
||||||
endWidth = toPanel.getCardWidth();
|
endWidth = toPanel.getCardWidth();
|
||||||
Point toPos = SwingUtilities.convertPoint(playerHandPanel, toPanel.getCardLocation(), layeredPane);
|
Point toPos = SwingUtilities.convertPoint(playerHandPanel, toPanel.getCardLocation(), layeredPane);
|
||||||
endX = toPos.x;
|
endX = toPos.x;
|
||||||
endY = toPos.y;
|
endY = toPos.y;
|
||||||
arcane.ui.CardPanel animationPanel = new arcane.ui.CardPanel(card);
|
arcane.ui.CardPanel animationPanel = new arcane.ui.CardPanel(card);
|
||||||
Animation.moveCard(startX, startY, startWidth, endX, endY, endWidth, animationPanel, toPanel, layeredPane, 500);
|
Animation.moveCard(startX, startY, startWidth, endX, endY, endWidth, animationPanel, toPanel, layeredPane, 500);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -868,6 +890,7 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
|
|||||||
if(!Gui_NewGame.useLAFFonts.isSelected()) oppGraveButton.setFont(statFont);
|
if(!Gui_NewGame.useLAFFonts.isSelected()) oppGraveButton.setFont(statFont);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
JPanel gravePanel = new JPanel(new BorderLayout());
|
JPanel gravePanel = new JPanel(new BorderLayout());
|
||||||
gravePanel.add(oppGraveButton, BorderLayout.EAST);
|
gravePanel.add(oppGraveButton, BorderLayout.EAST);
|
||||||
|
|
||||||
@@ -1002,8 +1025,8 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
|
|||||||
Dimension di = playerHandPanel.getPreferredSize();
|
Dimension di = playerHandPanel.getPreferredSize();
|
||||||
di.height = 100;
|
di.height = 100;
|
||||||
playerHandPanel.setPreferredSize(di);
|
playerHandPanel.setPreferredSize(di);
|
||||||
handScroll.setViewportView(playerHandPanel);
|
handScroll.setViewportView(playerHandPanel);
|
||||||
pane.add(new ExternalPanel(handScroll), "humanHand");
|
pane.add(new ExternalPanel(handScroll), "humanHand");
|
||||||
|
|
||||||
JPanel[] zones = {oppLandPanel, oppCreaturePanel, playerCreaturePanel, playerLandPanel};
|
JPanel[] zones = {oppLandPanel, oppCreaturePanel, playerCreaturePanel, playerLandPanel};
|
||||||
String[] names = {"compyLand", "compyPlay", "humanPlay", "humanLand"};
|
String[] names = {"compyLand", "compyPlay", "humanPlay", "humanLand"};
|
||||||
@@ -1038,18 +1061,18 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
|
|||||||
dispose();
|
dispose();
|
||||||
Constant.Runtime.WinLose.addLose();
|
Constant.Runtime.WinLose.addLose();
|
||||||
if (!Constant.Quest.fantasyQuest[0])
|
if (!Constant.Quest.fantasyQuest[0])
|
||||||
new Gui_WinLose();
|
new Gui_WinLose();
|
||||||
else {
|
else {
|
||||||
//new Gui_WinLose(Constant.Quest.humanList[0], Constant.Quest.computerList[0],Constant.Quest.humanLife[0], Constant.Quest.computerLife[0]);
|
//new Gui_WinLose(Constant.Quest.humanList[0], Constant.Quest.computerList[0],Constant.Quest.humanLife[0], Constant.Quest.computerLife[0]);
|
||||||
CardList humanList = QuestUtil.getHumanPlantAndPet(AllZone.QuestData, AllZone.QuestAssignment);
|
CardList humanList = QuestUtil.getHumanPlantAndPet(AllZone.QuestData, AllZone.QuestAssignment);
|
||||||
CardList computerList = QuestUtil.getComputerCreatures(AllZone.QuestData, AllZone.QuestAssignment);
|
CardList computerList = QuestUtil.getComputerCreatures(AllZone.QuestData, AllZone.QuestAssignment);
|
||||||
|
|
||||||
int humanLife = QuestUtil.getLife(AllZone.QuestData);
|
int humanLife = QuestUtil.getLife(AllZone.QuestData);
|
||||||
int computerLife = 20;
|
int computerLife = 20;
|
||||||
|
|
||||||
if (AllZone.QuestAssignment!=null)
|
if (AllZone.QuestAssignment!=null)
|
||||||
computerLife = AllZone.QuestAssignment.getComputerLife();
|
computerLife = AllZone.QuestAssignment.getComputerLife();
|
||||||
new Gui_WinLose(humanList, computerList, humanLife, computerLife);
|
new Gui_WinLose(humanList, computerList, humanLife, computerLife);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1073,7 +1096,7 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
|
|||||||
HandArea playerHandPanel = null;
|
HandArea playerHandPanel = null;
|
||||||
JPanel cdPanel = new JPanel();
|
JPanel cdPanel = new JPanel();
|
||||||
JLabel oppLifeLabel = new JLabel();
|
JLabel oppLifeLabel = new JLabel();
|
||||||
JLabel oppIconLabel = new JLabel();
|
JLabel oppIconLabel = new JLabel();
|
||||||
JLabel playerLifeLabel = new JLabel();
|
JLabel playerLifeLabel = new JLabel();
|
||||||
JLabel oppPCLabel = new JLabel();
|
JLabel oppPCLabel = new JLabel();
|
||||||
JLabel playerPCLabel = new JLabel();
|
JLabel playerPCLabel = new JLabel();
|
||||||
@@ -1186,6 +1209,7 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//very hacky
|
//very hacky
|
||||||
@@ -1196,7 +1220,7 @@ class Gui_MultipleBlockers4 extends JFrame {
|
|||||||
|
|
||||||
private int assignDamage;
|
private int assignDamage;
|
||||||
private Card att;
|
private Card att;
|
||||||
private CardList blockers;
|
private CardList blockers;
|
||||||
private CardContainer guiDisplay;
|
private CardContainer guiDisplay;
|
||||||
|
|
||||||
private BorderLayout borderLayout1 = new BorderLayout();
|
private BorderLayout borderLayout1 = new BorderLayout();
|
||||||
@@ -1231,11 +1255,11 @@ class Gui_MultipleBlockers4 extends JFrame {
|
|||||||
creaturePanel.add(new CardPanel(creatureList.get(i)));
|
creaturePanel.add(new CardPanel(creatureList.get(i)));
|
||||||
|
|
||||||
if (att.getKeyword().contains("Trample")) {
|
if (att.getKeyword().contains("Trample")) {
|
||||||
Card player = new Card();
|
Card player = new Card();
|
||||||
player.setName("Player");
|
player.setName("Player");
|
||||||
player.addIntrinsicKeyword("Shroud");
|
player.addIntrinsicKeyword("Shroud");
|
||||||
player.addIntrinsicKeyword("Indestructible");
|
player.addIntrinsicKeyword("Indestructible");
|
||||||
creaturePanel.add(new CardPanel(player));
|
creaturePanel.add(new CardPanel(player));
|
||||||
}
|
}
|
||||||
|
|
||||||
JDialog dialog = new JDialog(this, true);
|
JDialog dialog = new JDialog(this, true);
|
||||||
@@ -1292,7 +1316,7 @@ class Gui_MultipleBlockers4 extends JFrame {
|
|||||||
Object o = creaturePanel.getComponentAt(e.getPoint());
|
Object o = creaturePanel.getComponentAt(e.getPoint());
|
||||||
if(o instanceof CardPanel) {
|
if(o instanceof CardPanel) {
|
||||||
|
|
||||||
boolean assignedDamage = true;
|
boolean assignedDamage = true;
|
||||||
|
|
||||||
CardContainer cardPanel = (CardContainer) o;
|
CardContainer cardPanel = (CardContainer) o;
|
||||||
Card c = cardPanel.getCard();
|
Card c = cardPanel.getCard();
|
||||||
@@ -1301,34 +1325,34 @@ class Gui_MultipleBlockers4 extends JFrame {
|
|||||||
cl.add(att);
|
cl.add(att);
|
||||||
|
|
||||||
boolean assignedLethalDamageToAllBlockers = true;
|
boolean assignedLethalDamageToAllBlockers = true;
|
||||||
for (Card crd : blockers )
|
for (Card crd : blockers )
|
||||||
{
|
{
|
||||||
if (crd.getTotalAssignedDamage() < ( crd.getNetDefense() - crd.getDamage() ))
|
if (crd.getTotalAssignedDamage() < ( crd.getNetDefense() - crd.getDamage() ))
|
||||||
assignedLethalDamageToAllBlockers = false;
|
assignedLethalDamageToAllBlockers = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (c.getName().equals("Player") && att.getKeyword().contains("Trample") && assignedLethalDamageToAllBlockers)
|
if (c.getName().equals("Player") && att.getKeyword().contains("Trample") && assignedLethalDamageToAllBlockers)
|
||||||
{
|
{
|
||||||
//what happens with Double Strike???
|
//what happens with Double Strike???
|
||||||
if (att.getKeyword().contains("First Strike"))
|
if (att.getKeyword().contains("First Strike"))
|
||||||
AllZone.Combat.addDefendingFirstStrikeDamage(1, att);
|
AllZone.Combat.addDefendingFirstStrikeDamage(1, att);
|
||||||
else
|
else
|
||||||
AllZone.Combat.addDefendingDamage(1, att);
|
AllZone.Combat.addDefendingDamage(1, att);
|
||||||
|
|
||||||
AllZone.GameAction.addAssignedDamage(c, att, 1);
|
AllZone.GameAction.addAssignedDamage(c, att, 1);
|
||||||
}
|
}
|
||||||
else if (!c.getName().equals("Player")){
|
else if (!c.getName().equals("Player")){
|
||||||
AllZone.GameAction.addAssignedDamage(c, att, /*c.getTotalAssignedDamage() +*/1);
|
AllZone.GameAction.addAssignedDamage(c, att, /*c.getTotalAssignedDamage() +*/1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
assignedDamage = false;
|
assignedDamage = false;
|
||||||
|
|
||||||
if (assignedDamage)
|
if (assignedDamage)
|
||||||
{
|
{
|
||||||
assignDamage--;
|
assignDamage--;
|
||||||
updateDamageLabel();
|
updateDamageLabel();
|
||||||
if(assignDamage == 0) dispose();
|
if(assignDamage == 0) dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(guiDisplay != null) {
|
if(guiDisplay != null) {
|
||||||
@@ -1355,3 +1379,4 @@ class Gui_MultipleBlockers4 extends JFrame {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user