Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.*;
- public class TestCharacter {
- public static void main (String args[])throws IOException{//main method
- {
- Dice dice = new Dice();
- Character ch1 = new Character();
- Character ch2 = new Character();
- int S1 =ch1.getStrength();
- int D1 =ch1.getDexterity();
- int I1 =ch1.getIntelligence();
- int Mx1=ch1.getMaxLife1();
- int CL1=Mx1;
- int A1 =ch1.getAttack1();
- int HL1 =ch1.getheal1();
- int S2 =ch1.getStrength2();
- int D2 =ch1.getDexterity2();
- int I2 =ch1.getIntelligence2();
- int Mx2=ch1.getMaxLife1();
- int CL2=Mx2;
- int A2=ch1.getAttack2();
- int HL2 =ch1.getheal2();
- int x,y;
- int Dm1 = 0;
- int Dm2 =0;
- int ctr=1;
- System.out.println(ch1.getName() + " " + "MaxLife is" + Mx1);
- System.out.println(ch2.getName1() + " " + "MaxLife is" + Mx2);
- //Attributes of player 1
- System.out.println("JOE's Attributes:");
- System.out.println(ch1.getName() + "Strength is" + " " + S1);
- System.out.println("Dexterity is" + " " + D1);
- System.out.println("Intelligence is" + " " + I1);
- System.out.println(" ");
- //Attributes of plaeer 2
- System.out.println("BOB's Attributes:");
- System.out.println(ch2.getName1() + "Strength is" + " " + S2);
- System.out.println("Dexterity is" + " " + D2);
- System.out.println("Intelligence is" + " " + I2);
- ///////////////////////////////////////////////////////////////////////////
- //Start of the battle
- System.out.println(" ");
- System.out.println("BATTLE COMMENCE");
- System.out.println(" ");
- //////////////////////////////////////////////////////////////////////////
- do
- {
- //Battle starts and counter increases by 1 each round
- System.out.println(" ");
- System.out.println("BATTLE" +"__" + ctr);
- System.out.println(" ");
- if(Dm1 > 0 || Dm2>0){
- {//player 1 attacks player 2 with random roll of dice times 4
- System.out.println("JOE Attack:");
- System.out.println( ch1.getName() + " Attacks " + ch2.getName1());
- System.out.println("Attacks:" + (x= A1 + dice.roll2()));
- System.out.println(ch2.getName1()+ "'s CL:" + Dm2);
- System.out.println(" ");
- CL2=CL2 - x;
- Dm2=CL2;
- //player 1 attacks player 2 with random roll of dice times 4
- System.out.println("BOB Attack:");
- System.out.println( ch2.getName1() + " Attacks " + ch1.getName());
- System.out.println("Attacks:" + (y= A2 + dice.roll1() ));
- System.out.println(ch1.getName()+ "'s CL:" + Dm1);
- System.out.println(" ");
- CL1=CL1 - y;
- Dm1=CL1;
- }
- }
- else{
- {//player 1 attacks player 2 with random roll of dice times 4
- System.out.println("BOB Attack:");
- System.out.println( ch2.getName1() + " Attacks " + ch1.getName());
- System.out.println("Attacks:" + (y= A2 + dice.roll1() ));
- System.out.println(ch1.getName()+ "'s CL:" + Dm1);
- System.out.println(" ");
- CL1=CL1 - y;
- Dm1=CL1;
- //player 1 attacks player 2 with random roll of dice times 4
- System.out.println("JOE Attack:");
- System.out.println( ch1.getName() + " Attacks " + ch2.getName1());
- System.out.println("Attacks:" + (x= A1 + dice.roll2()));
- System.out.println(ch2.getName1()+ "'s CL:" + Dm2);
- System.out.println(" ");
- CL2=CL2 - x;
- Dm2=CL2;
- }}
- ctr++;
- System.out.println("BATTLE" +"__" +ctr);
- }while(CL2 > 1 & CL1 >1);
- /////////////////////////////////////////////////////////////////////////
- int R = dice.roll1();
- if(R >2)
- {
- if(Dm1 < Mx1 || CL1 > 0)
- {
- Dm1 = CL1 + HL1;
- if(Dm1 > Mx1){
- Dm1 = CL1;
- System.out.println("Joe Heals_" + HL1);
- System.out.println("Joe's Health is_" + Dm1);
- }
- else
- {
- if(CL1 > 0)
- {
- System.out.println("Joe Heals" + HL1);
- System.out.println("Joe's Health is" + Dm1);
- }
- }
- }
- }
- /////////////////////////////////////////////////////////////////////////
- int W = dice.roll1();
- if(W >2)
- {
- if(Dm2 < Mx2 || CL2 > 0)
- {
- Dm2 = CL2 + HL2;
- if(Dm2 > Mx2){
- Dm2 = CL2;
- System.out.println("Joe Heals_" + HL2);
- System.out.println("Joe's Health is_" + Dm2);
- }
- else
- {
- if(CL2 > 0)
- {
- System.out.println("Joe Heals" + HL2);
- System.out.println("Joe's Health is" + Dm2);
- }
- }
- }
- }
- ////////////////////////////////////////////////////////////////////////////
- if(CL1 == CL2)
- {
- System.out.println("____DRAW!?!?!?!?!_____");
- }
- if(CL1 > CL2 )
- {
- System.out.println("____JOE KICKED BUTT(wins)!!!!!_____");
- }
- if(CL2 > CL1 )
- {
- System.out.println("____BOB KICKED BUTT (wins)!!!!!_____");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement