Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Write a description of class Game here.
- *
- * @author Bidderlyn
- * @version Red's mech thingy 1.0
- */
- import java.util.Scanner;
- public class Game
- {
- public String mech_name;
- public int mech_hp;
- public int mech_dices;
- public int mech_diceDamage;
- public int mech_initiative;
- public int mech_defense;
- public int mech_offense;
- public int mech_dmgBoost;
- public int mech_armor;
- public String mech2_name;
- public int mech2_hp;
- public int mech2_dices;
- public int mech2_diceDamage;
- public int mech2_initiative;
- public int mech2_defense;
- public int mech2_offense;
- public int mech2_dmgBoost;
- public int mech2_armor;
- public Game()
- {
- Scanner scan = new Scanner(System.in);
- System.out.println("What is the name of the first mecha?");
- mech_name = scan.nextLine();
- System.out.println("What is the name of the second mecha?");
- mech2_name = scan.nextLine();
- System.out.println("****** INITIATING FIRST MECHA ******");
- System.out.println("***");
- System.out.println("How much hp does he have");
- mech_hp = scan.nextInt();
- System.out.println("How much damage does the mech dice inflict");
- mech_diceDamage = scan.nextInt();
- System.out.println("How many dices does he roll");
- mech_dices = scan.nextInt();
- System.out.println("How much armor does he have");
- mech_armor = scan.nextInt();
- System.out.println("****** INITIATING SECOND MECHA ******");
- System.out.println("***");
- System.out.println("How much hp does he have");
- mech2_hp = scan.nextInt();
- System.out.println("How much damage does the mech dice inflict");
- mech2_diceDamage = scan.nextInt();
- System.out.println("How many dices does he roll");
- mech2_dices = scan.nextInt();
- System.out.println("How much armor does he have");
- mech2_armor = scan.nextInt();
- System.out.println("***");
- System.out.println("Type the CR of the environment roll");
- int envCR = scan.nextInt();
- System.out.println("Type the initiative bonus player mech gets if he passes or enemy gets if he fails:");
- int initiativeBonus = scan.nextInt();
- int r = ((int)((Math.random()*100)+1));
- System.out.println("["+mech_name+" rolls 1d100 Environment Roll against CR of "+envCR+" to get "+initiativeBonus+" initiative and scores "+r+"]");
- if(r >= envCR)
- {System.out.println("[Success!] "+mech_name+" increased its initiative by "+initiativeBonus+"!");mech_initiative = mech2_initiative+initiativeBonus;}
- else
- {System.out.println("[failure!] "+mech2_name+" increased its initiative by "+initiativeBonus+"!"); mech2_initiative = mech2_initiative+initiativeBonus;}
- System.out.println("Type the CR of the posture roll");
- int posCR = scan.nextInt();
- r = ((int)((Math.random()*100)+1));
- System.out.println("["+mech_name+" rolls 1d100 Posture Roll against CR of "+posCR+" and scores "+r+"]");
- if(r >= posCR)
- {System.out.println("[Success!] "+mech_name+" is now on [Aggresive] stance and gains 20% more damage !");mech_dmgBoost = 20;}
- else
- {System.out.println("[failure!] "+mech2_name+" increased its initiative by "+initiativeBonus+"!"); mech2_initiative = mech2_initiative+initiativeBonus;}
- boolean end = false;
- while(end == false)
- {
- int in1 = ((int)((Math.random()*100)+1+mech_initiative));
- System.out.println("["+mech_name+" rolls 1d100+"+mech_initiative+" initiative Roll scores "+in1+"]");
- int in2 = ((int)((Math.random()*100)+1+mech2_initiative));
- System.out.println("["+mech2_name+" rolls 1d100+"+mech2_initiative+" initiative Roll scores "+in2+"]");
- boolean KO = false;
- int dmg1=0;
- while(KO == false)
- {
- if(in1 >= in2)
- {
- dmg1=0;
- for(int i=0; i<mech_dices; i++)
- {
- dmg1 = dmg1 +((int)((Math.random()*mech_diceDamage)+1));
- }
- // adding boost
- dmg1 = (dmg1*(100+mech_dmgBoost))/100;
- System.out.println(mech_name+" rolls "+mech_dices+"d"+mech_diceDamage+" and strikes "+mech2_name+" for "+dmg1+" damage");
- mech2_hp = mech2_hp - dmg1+mech2_armor;
- if(mech2_hp <=0){ System.out.println(mech2_name+" is defeated");
- KO = true;
- end = true;}
- if(KO ==false)
- {
- dmg1=0;
- for(int i=0; i<mech2_dices; i++)
- {
- dmg1 = dmg1 +((int)((Math.random()*mech2_diceDamage)+1));
- }
- // adding boost
- dmg1 = (dmg1*(100+mech2_dmgBoost))/100;
- // low initiative does .5 dmg
- dmg1 = dmg1/2;
- System.out.println(mech2_name+" rolls "+mech2_dices+"d"+mech2_diceDamage+" and strikes "+mech_name+" for "+dmg1+" damage");
- mech_hp = mech_hp - dmg1+mech_armor;
- if(mech_hp <=0){ System.out.println(mech_name+" is defeated");
- KO = true;
- end = true;}
- }
- }
- else
- {
- dmg1=0;
- for(int i=0; i<mech2_dices; i++)
- {
- dmg1 = dmg1 +((int)((Math.random()*mech2_diceDamage)+1));
- }
- // adding boost
- dmg1 = (dmg1*(100+mech2_dmgBoost))/100;
- System.out.println(mech2_name+" rolls "+mech2_dices+"d"+mech2_diceDamage+" and strikes "+mech_name+" for "+dmg1+" damage");
- mech_hp = mech_hp - dmg1+mech_armor;
- if(mech_hp <=0){ System.out.println(mech_name+" is defeated");
- KO = true;
- end = true;}
- if(KO ==false)
- {
- dmg1=0;
- for(int i=0; i<mech_dices; i++)
- {
- dmg1 = dmg1 +((int)((Math.random()*mech_diceDamage)+1));
- }
- // adding boost
- dmg1 = (dmg1*(100+mech_dmgBoost))/100;
- // low initiative does .5 dmg
- dmg1 = dmg1/2;
- System.out.println(mech_name+" rolls "+mech_dices+"d"+mech_diceDamage+" and strikes "+mech2_name+" for "+dmg1+" damage");
- mech2_hp = mech2_hp - dmg1+mech2_armor;
- if(mech2_hp <=0){ System.out.println(mech2_name+" is defeated");
- KO = true;
- end = true;}
- }
- }
- }
- }
- System.out.println("");
- System.out.println("");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement