import javax.swing.JFrame;
import javax.swing.JPanel;
import java.awt.Graphics;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.util.logging.Logger;
import javax.imageio.ImageIO;
//import javax.swing.JLabel;
import java.util.ArrayList;
import java.util.Random;
import java.util.Scanner;
import java.math.*;
@SuppressWarnings("serial")
public class Main extends JPanel{
private static final int appversionmajor = 0;
private static final double appversionminor = 1.3;
private static final String appname = "Yu-Gi-Oh!: Trading Card Game";
private static final String appstage = "Alpha";
private static final String versionstring = appname + " (" + appversionmajor + "." + appversionminor + " " + appstage + ")";
private BufferedImage sdk1, sdk2, sdk3, sdk4, sdk5, sdk6, sdk7, sdk8, sdk9, sdk10, bc;
public Main() {
try {
sdk1 = ImageIO.read(getClass().getResourceAsStream("img\\cards\\sdk001.png"));
sdk2 = ImageIO.read(getClass().getResourceAsStream("img\\cards\\sdk002.png"));
sdk3 = ImageIO.read(getClass().getResourceAsStream("img\\cards\\sdk003.png"));
sdk4 = ImageIO.read(getClass().getResourceAsStream("img\\cards\\sdk004.png"));
sdk5 = ImageIO.read(getClass().getResourceAsStream("img\\cards\\sdk005.png"));
}
catch (IOException e) {
Logger LogErr = Logger.getLogger(Main.class.getName());
System.err.println(appname + " " + "Caught IOException: " + e.getMessage());
}
}
@Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
g.drawImage(sdk1, 0, 0, Card.cardwidth / 5, Card.cardheight / 5, null);
g.drawImage(sdk2, Card.cardlong, 0, Card.cardwidth / 5, Card.cardheight / 5, null);
g.drawImage(sdk3, Card.cardlong * 2, 0, Card.cardwidth / 5, Card.cardheight / 5, null);
g.drawImage(sdk4, Card.cardlong * 3, 0, Card.cardwidth / 5, Card.cardheight / 5, null);
g.drawImage(sdk5, Card.cardlong * 4, 0, Card.cardwidth / 5, Card.cardheight / 5, null);
}
public static void main(String[] args) {
JFrame frame = new JFrame(versionstring);
frame.add(new Main());
frame.setSize(1020, 680);
frame.setVisible(false);
frame.setResizable(false);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setExtendedState(JFrame.MAXIMIZED_BOTH);
ArrayList<MonsterCard> deck1 = new ArrayList(50);
ArrayList<MonsterCard> deck2 = new ArrayList(50);
deck1.add(CardListKaiba.BlueEyesWhiteDragon);
deck1.add(CardListKaiba.HitotsuMeGiant);
deck1.add(CardListKaiba.RyuKishin);
deck1.add(CardListKaiba.TheWickedWormBeast);
deck1.add(CardListKaiba.BattleOx);
/*deck1.add(CardListKaiba.KoumoriDragon);
deck1.add(CardListKaiba.JudgeMan);
deck1.add(CardListKaiba.RogueDoll);
deck1.add(CardListKaiba.Kojikocy);
deck1.add(CardListKaiba.Uraby); */
ArrayList<MonsterCard> monsterfield1 = new ArrayList(5);
ArrayList<MonsterCard> monsterfield2 = new ArrayList(5);
ArrayList<SpellCard> magicfield1 = new ArrayList(5);
ArrayList<SpellCard> magicfield2 = new ArrayList(5);
ArrayList<MonsterCard> hand1 = new ArrayList(5);
ArrayList<MonsterCard> hand2 = new ArrayList(5);
int lifepoints1 = 2000;
int lifepoints2 = 2000;
Random r = new Random();
System.out.println("Drawing Hand from Deck...");
int randomPos1 = r.nextInt(deck1.size());
hand1.add(deck1.get(randomPos1));
deck1.remove(randomPos1);
hand1.add(deck1.get(randomPos1));
deck1.remove(randomPos1);
hand1.add(deck1.get(randomPos1));
deck1.remove(randomPos1);
hand1.add(deck1.get(randomPos1));
deck1.remove(randomPos1);
while(lifepoints1 > 0|| lifepoints2 > 0){
hand1.add(deck1.get(randomPos1));
deck1.remove(randomPos1);
System.out.println("Initiating Draw Phase:");
System.out.println("Your hand consists of:");
for(int i = 0; i <hand1.size(); i++){
System.out.println(hand1.get(i).toString() + "");
}
System.out.println("Initiating Main Phase 1:");
System.out.println("Which monster would you like to summon?");
Scanner monSummon = new Scanner(System.in);
int whichMonsterPOS1 = monSummon.nextInt();
monsterfield1.add(hand1.get(whichMonsterPOS1));
hand1.remove(whichMonsterPOS1);
for(int i = 0; i<monsterfield1.size(); i++){
System.out.println(monsterfield1.get(i).toString() + " has been summoned");
}
frame.setVisible(false);
System.out.println("Your side of the Field contains: " + monsterfield1);
break;
}
}
}