GameGUI.java
1    package mainstuff; 
2     
3    import java.util.Scanner; 
4     
5    import characterabilities.Tool; 
6    import characterabilities.superpowers.*; 
7    import characterabilities.weapons.*; 
8    import characters.badguys.*; 
9    import characters.goodguys.*; 
10    
11   public class GameGUI { 
12    
13       static Scanner scanner = new Scanner(System.in); 
14    
15       public static void main(String[] args) { 
16    
17    
18           Tool[] tools = new Tool[3]; 
19           tools[0] = new MartialArtsWeapon("quarter star", 10, true); 
20           tools[1] = new PsychicSuperPower("telekinesis", 20, false); 
21           tools[2] = new MagicSuperPower("super nova", 101, true); 
22    
23           JusticeLeague wonderWoman = new JusticeLeague("Wonder Woman", tools, 400, 8.6f); 
24            
25            
26    
27           Tool[] thanosTools = new Tool[2]; 
28           thanosTools[0] = new ContemporaryWeapon("Tazer", 35, "ACME Co."); 
29           thanosTools[1] = new PsychicSuperPower("Mind Reading", 25, true); 
30    
31           BlackOrderBadGuy thanos = new BlackOrderBadGuy("Thanos", thanosTools, 123, true); 
32    
33    
34           boolean gameOn = true; 
35           while(gameOn){ 
36               char whatToDo = 'z'; 
37               System.out.println("Do you want to duel, (d), or tag team (t) or end the game? (e)"); 
38    
39               whatToDo = scanner.nextLine().toLowerCase().charAt(0); 
40               if(whatToDo == 'd'){ 
41                   System.out.println(duel(thanos, wonderWoman)); //<<<<<<<,---------- Add sout 
42               } 
43               else if(whatToDo == 't'){ 
44                   BadGuy [] badGuys = {thanos, thanos}; 
45                   GoodGuy [] goodGuys = {wonderWoman, wonderWoman}; 
46                   tagTeamFight(badGuys, goodGuys); 
47               } 
48               else if(whatToDo == 'e'){ 
49                   System.out.println("Thanks for playing."); 
50                   gameOn = false; 
51               } 
52           } 
53    
54       } 
55    
56       public static String duel(BadGuy badGuy, GoodGuy goodGuy){ 
57            
58           double badGuyTotal = 0; 
59           for(int i = 0; i < badGuy.getTools().length; i++){ 
60               badGuyTotal += badGuy.getTools()[i].calculateDamage(); 
61           } 
62            
63           double goodGuyTotal = 0; 
64           for(int i = 0; i < goodGuy.getTools().length; i++){ 
65               goodGuyTotal += goodGuy.getTools()[i].calculateDamage(); 
66           } 
67    
68            
69           String winner = "not set yet"; 
70           if(badGuyTotal > goodGuyTotal){ 
71               winner = badGuy.getPlayerName(); 
72           } 
73           else if(goodGuyTotal > badGuyTotal){ 
74               winner = goodGuy.getPlayerName(); 
75           } 
76           else { 
77               winner = "tie"; 
78           } 
79           return winner; //<<<<<<------------- Is this done yet? 
80       } 
81    
82       public static String tagTeamFight(BadGuy [] villainTeam, GoodGuy [] heroesTeam){ 
83           //To do later 
84           return "tie"; 
85       } 
86   } 
87