Advertisement
markd315

Battle simulator v 1.1 (open source)

Mar 9th, 2013
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 18.72 KB | None | 0 0
  1. OUTDATED!  NEW VERSION HERE:  http://pastebin.com/F7tfZQqq
  2.  
  3. package Main;
  4.  
  5. import java.util.Scanner;
  6.  
  7. public class Battlesim
  8. {
  9.     public static int Randint;
  10.     static String P1name;
  11.     static String P2name;
  12.     static float P1Health;
  13.     static float P2Health;
  14.     static float P1Attack;
  15.     static float P2Attack;
  16.     static float P1Defense;
  17.     static float P2Defense;
  18.     static String P1Armor;
  19.     static String P2Armor;
  20.     static float P1Speed;
  21.     static float P2Speed;
  22.     static float Damage;
  23.     static String InputString;
  24.  
  25.     //Status weapons
  26.     static boolean P1Burner = false;
  27.     static boolean P2Burner = false;
  28.     static boolean P1Jarater = false;
  29.     static boolean P2Jarater = false;
  30.     static boolean P1Poisoner = false;
  31.     static boolean P2Poisoner = false;
  32.  
  33.     //Status effects
  34.     static boolean P1Burning = false;
  35.     static boolean P2Burning = false;
  36.     static boolean P1Poisoned = false;
  37.     static boolean P2Poisoned = false;
  38.     static boolean P1Stunned = false;
  39.     static boolean P2Stunned = false;
  40.     static boolean P1Bleeding = false;
  41.     static boolean P2Bleeding = false;
  42.     static boolean P1Jarated = false;
  43.     static boolean P2Jarated = false;
  44.     static boolean P1Confused = false;
  45.     static boolean P2Confused = false;
  46.     static boolean P1Rage = false;
  47.     static boolean P2Rage = false;
  48.     /*
  49.      * TODO
  50.      * Add moar status effects (introduced below, already declared)
  51.      * Add moar weapons
  52.      * Ranged?  Magic?
  53.      * Incorporate a story mode
  54.      */
  55.  
  56.     /*
  57.      * STATUS EFFECTS
  58.      * For status effects, add an end possibility to the bottom of a turn.
  59.      * INHERENT:  Confused = 30% chance damage self.  1/30 hit (staff = 1/15) 3/5 recover.
  60.      * INHERENT:  Bleeding = rand(15,28) damage done.  1/15 hit 4/5 recover.
  61.      * INHERENT:  Stunned = 1/2 chance of not being able to attack.  1/15 hit, 1/3 recover
  62.      * INHERENT  (1/15 hit chance with battleaxe, 1/50 otherwise):  Rage = 57/60 chance of miss, 2/60 chance of a Smash (*27 damage.)  1/60 chance of a final smash (*81 damage)  1/50 (or 1/15) hit, 1/2 recover.
  63.    
  64.     DONE=
  65.      * Burning = rand(20,60)/(rand(3,6)*defense) Damage done.  1/6 hit 1/10 recover
  66.      * INHERENT:  Jarated = all are crits and minicrits.  1/35 hit, 2/5 recover.
  67.      * Poisoned = rand(30,50) damage done.  1/7 hit, 1/4 recover.
  68.      */
  69.  
  70.  
  71.     //scanner declaration
  72.     static Scanner input = new Scanner(System.in);
  73.  
  74.     public static void main(String[] args)
  75.     {  
  76.         //Calls inputs method
  77.         Inputs();
  78.         // Main loop.  True until battle is completed
  79.         Combat();
  80.     }
  81.     public static void Combat()
  82.     {
  83.         while (P1Health > 0 && P2Health >0)
  84.         {
  85.             //speed test to determine who goes first
  86.             RandInt(0, P1Speed + P2Speed);
  87.             if (Randint < P1Speed)
  88.             {
  89.                 //P1's turn
  90.                 P1Turn();
  91.             }
  92.             else if (Randint > P1Speed)
  93.             {
  94.                 //P2's turn
  95.                 P2Turn();
  96.  
  97.             }
  98.             else
  99.             {
  100.                 //If both speeds are 1, I think this will happen.  This is to essentially "break the tie"
  101.                 RandInt(0, 1);
  102.                 if (Randint == 0)
  103.                     P1Speed = P1Speed++;
  104.                 if (Randint == 1)
  105.                     P2Speed = P2Speed++;
  106.             }
  107.  
  108.         }
  109.         //States winner based on results of battle
  110.         CombatResolver();
  111.     }
  112.     public static void P1Turn()
  113.     {
  114.         RandInt(60, 180);
  115.         Damage = (P1Attack * Randint);
  116.         if (P2Jarated == true)
  117.         {
  118.             RandInt(1,4);
  119.             if (Randint == 4)
  120.             {
  121.                 Damage = Damage * 9;
  122.                 System.out.print("Critical hit!  : ");
  123.  
  124.             }
  125.             if (Randint != 4)
  126.             {
  127.                 Damage = Damage * 3;
  128.                 System.out.print("Minicrit!  : ");
  129.             }
  130.         }
  131.         if (P2Jarated == false)
  132.         {
  133.             RandInt(1, 60);
  134.             if (Randint == 60)
  135.             {
  136.                 Damage = 3 * Damage;
  137.                 System.out.print("Critical hit!  : ");
  138.             }
  139.             if (Randint >= 57)
  140.             {
  141.                 Damage = 3 * Damage;
  142.                 if (Randint != 60)
  143.                     System.out.print("Minicrit!  : ");
  144.             }
  145.             if (Randint <= 7)
  146.             {
  147.                 Damage = 0 * Damage;
  148.                 System.out.print("Missed!  : ");
  149.             }
  150.         }
  151.  
  152.         RandInt(92, 97);
  153.         Damage = (float) Damage / ((Randint/10) * P2Defense);
  154.         System.out.print(P1name);
  155.         System.out.print(" does ");
  156.         System.out.print((int) (Damage));
  157.         System.out.print(" damage; ");
  158.         P2Health = P2Health - Damage;
  159.         System.out.print(P2name);
  160.         System.out.print(" has ");
  161.         if (P2Health > 0)
  162.             System.out.print((int) P2Health);
  163.         if (P2Health <= 0)
  164.             System.out.print("0");
  165.         System.out.println(" health remaining.");
  166.         P1PostCombatEffects();
  167.         System.out.println("");
  168.     }
  169.     public static void P2Turn()
  170.     {
  171.         RandInt(60, 180);
  172.         Damage = (P2Attack * Randint);
  173.         if (P1Jarated == true)
  174.         {
  175.             RandInt(1,4);
  176.             if (Randint == 4)
  177.             {
  178.                 Damage = Damage * 9;
  179.                 System.out.print("Critical hit!  : ");
  180.  
  181.             }
  182.             if (Randint != 4)
  183.             {
  184.                 Damage = Damage * 3;
  185.                 System.out.print("Minicrit!  : ");
  186.             }
  187.         }
  188.         if (P1Jarated == false)
  189.         {
  190.             RandInt(1, 60);
  191.             if (Randint == 60)
  192.             {
  193.                 Damage = 3 * Damage;
  194.                 System.out.print("Critical hit!  : ");
  195.             }
  196.             if (Randint >= 57)
  197.             {
  198.                 Damage = 3 * Damage;
  199.                 if (Randint != 60)
  200.                     System.out.print("Minicrit!  : ");
  201.             }
  202.             if (Randint <= 7)
  203.             {
  204.                 Damage = 0 * Damage;
  205.                 System.out.print("Missed!  : ");
  206.             }
  207.         }
  208.  
  209.         RandInt(92, 97);
  210.         Damage = (float) Damage / ((Randint/10) * P1Defense);
  211.         System.out.print(P2name);
  212.         System.out.print(" does ");
  213.         System.out.print((int) (Damage));
  214.         System.out.print(" damage; ");
  215.         P1Health = P1Health - Damage;
  216.         System.out.print(P1name);
  217.         System.out.print(" has ");
  218.         if (P1Health > 0)
  219.             System.out.print((int) P1Health);
  220.         if (P1Health <= 0)
  221.             System.out.print("0");
  222.         System.out.println(" health remaining.");
  223.         P2PostCombatEffects();
  224.         System.out.println("");
  225.     }
  226.     public static void CombatResolver()
  227.     {
  228.         if (P1Health <= 0)
  229.         {
  230.             System.out.println("");
  231.             System.out.println("[-------------]");
  232.             System.out.print(P2name);
  233.             System.out.println(" is victorious!");
  234.             System.out.println("[-------------]");
  235.             input.next();
  236.         }
  237.         if (P2Health <= 0)
  238.         {
  239.             System.out.println("");
  240.             System.out.println("[-------------]");
  241.             System.out.print(P1name);
  242.             System.out.println(" is victorious!");
  243.             System.out.println("[-------------]");
  244.             input.next();
  245.         }
  246.     }
  247.     public static void Inputs()
  248.     {
  249.         //Names
  250.         System.out.print("P1 Name?- ");
  251.         P1name = input.nextLine();
  252.         System.out.print("P2 Name?- ");
  253.         P2name = input.nextLine();
  254.  
  255.         //HP
  256.         System.out.print(P1name);
  257.         System.out.print(" Health?- ");
  258.         P1Health = input.nextFloat();
  259.         while (P1Health < 0)
  260.         {
  261.             System.out.println("Invalid input.");
  262.             P1Health = input.nextFloat();
  263.         }
  264.  
  265.         System.out.print(P2name);
  266.         System.out.print(" Health?- ");
  267.         P2Health = input.nextFloat();
  268.         while (P2Health < 0)
  269.         {
  270.             System.out.println("Invalid input.");
  271.             P2Health = input.nextFloat();
  272.         }
  273.         //nextInt, nextFloat, next, nextLine are all valid here
  274.  
  275.         //attack
  276.         System.out.print(P1name);
  277.         System.out.print(" Attack?- ");
  278.         P1Attack = input.nextFloat();
  279.         System.out.print(P2name);
  280.         System.out.print(" Attack?- ");
  281.         P2Attack = input.nextFloat();
  282.  
  283.         //P1 defense
  284.         System.out.print(P1name);
  285.         System.out.print(" Defense (100 or less please)?- ");
  286.         P1Defense = input.nextFloat();
  287.         while (P1Defense > 100 || P1Defense < 0)
  288.         {
  289.             System.out.println("Invalid input.");
  290.             P1Defense = input.nextFloat();
  291.         }
  292.  
  293.         //P2 defense
  294.         System.out.print(P2name);
  295.         System.out.print(" Defense (100 or less please)?- ");
  296.         P2Defense = input.nextFloat();
  297.         while (P2Defense > 100 || P2Defense < 0)
  298.         {
  299.             System.out.println("Invalid input.");
  300.             P2Defense = input.nextFloat();
  301.         }
  302.  
  303.         //Max value for inherent defense should be 60, although it is inputted as up to 100.
  304.         P1Defense = (P1Defense*6)/10;
  305.         P2Defense = (P2Defense*6)/10;
  306.  
  307.  
  308.         //P1 Armor
  309.         System.out.print(P1name);
  310.         System.out.print(" Armor? (none, leather, chainmail, iron, diamond, enchanted)- ");
  311.         P1Armor = input.next();
  312.         switch (P1Armor.toLowerCase())
  313.         {
  314.         case "leather":
  315.             P1Defense = P1Defense +7;
  316.             break;
  317.         case "chainmail":
  318.             P1Defense = P1Defense +15;
  319.             break;
  320.         case "iron":
  321.             P1Defense = P1Defense +25;
  322.             break;
  323.         case "diamond":
  324.             P1Defense = P1Defense +30;
  325.             break;
  326.         case "enchanted":
  327.             P1Defense = P1Defense +35;
  328.             break;
  329.         default:
  330.             System.out.println("Interpreted as 'none'");
  331.             break;
  332.         }
  333.         //P2 Armor
  334.         System.out.print(P2name);
  335.         System.out.print(" Armor? (none, leather, chainmail, iron, diamond, enchanted)- ");
  336.         P2Armor = input.next();
  337.         switch (P2Armor.toLowerCase())
  338.         {
  339.         case "leather":
  340.             P2Defense = P2Defense +7;
  341.             break;
  342.         case "chainmail":
  343.             P2Defense = P2Defense +15;
  344.             break;
  345.         case "iron":
  346.             P2Defense = P2Defense +25;
  347.             break;
  348.         case "diamond":
  349.             P2Defense = P2Defense +30;
  350.             break;
  351.         case "enchanted":
  352.             P2Defense = P2Defense +35;
  353.             break;
  354.         default:
  355.             System.out.println("Interpreted as 'none'");
  356.             break;
  357.         }
  358.  
  359.         //P1 shield
  360.         System.out.print(P1name);
  361.         System.out.print(" Shield? (none, wooden, square, kite)- ");
  362.         P1Armor = input.next();
  363.         switch (P1Armor.toLowerCase())
  364.         {
  365.         case "wooden":
  366.             P1Defense = P1Defense +5;
  367.             break;
  368.         case "square":
  369.             P1Defense = P1Defense +10;
  370.             break;
  371.         case "kite":
  372.             P1Defense = P1Defense +15;
  373.             break;
  374.         default:
  375.             System.out.println("Interpreted as 'none'");
  376.             break;
  377.         }
  378.  
  379.  
  380.         //P2 shield
  381.         System.out.print(P2name);
  382.         System.out.print(" Shield? (none, wooden, square, kite)- ");
  383.         P2Armor = input.next();
  384.         switch (P2Armor.toLowerCase())
  385.         {
  386.         case "wooden":
  387.             P2Defense = P2Defense +5;
  388.             break;
  389.         case "square":
  390.             P2Defense = P2Defense +10;
  391.             break;
  392.         case "kite":
  393.             P2Defense = P2Defense +15;
  394.             break;
  395.         default:
  396.             System.out.println("Interpreted as 'none'");
  397.             break;
  398.         }
  399.  
  400.  
  401.  
  402.         //Fixes Defense values so they can be used in dmg calc.
  403.         P1Defense = Math.abs(P1Defense - 130);
  404.         P2Defense = Math.abs(P2Defense - 130);
  405.         P1Defense = (float) Math.sqrt(P1Defense);
  406.         P2Defense = (float) Math.sqrt(P2Defense);
  407.  
  408.         //Speed inputs
  409.         System.out.print(P1name);
  410.         System.out.print(" Speed?- ");
  411.         P1Speed = input.nextFloat();
  412.         while (P1Speed <= 0)
  413.         {
  414.             System.out.println("Invalid input.");
  415.             P1Speed = input.nextFloat();
  416.         }
  417.  
  418.         System.out.print(P2name);
  419.         System.out.print(" Speed?- ");
  420.         P2Speed = input.nextFloat();
  421.         while (P2Speed <= 0)
  422.         {
  423.             System.out.println("Invalid input.");
  424.             P2Speed = input.nextFloat();
  425.         }
  426.         P1Speed = P1Speed + 100;
  427.         P2Speed = P2Speed + 100;
  428.  
  429.  
  430.         //Mount inputs
  431.         System.out.print(P1name);
  432.         System.out.print(" Mount? (none, pig, bull, horse, battlehorse, dragon)- ");
  433.         P1Armor = input.next();
  434.         switch (P1Armor.toLowerCase())
  435.         {
  436.         case "pig":
  437.             P1Speed = (float) (P1Speed * 1.25);
  438.             break;
  439.         case "bull":
  440.             P1Speed = (float) (P1Speed * 2.5);
  441.             P1Attack = (float) (P1Attack + 5);
  442.             P1Defense = (float) (P1Defense + 1);
  443.             break;
  444.         case "horse":
  445.             P1Speed = (float) (P1Speed * 4);
  446.             P1Defense = (float) (P1Defense + 3);
  447.             break;
  448.         case "battlehorse":
  449.             P1Speed = (float) (P1Speed * 6);
  450.             P1Attack = (float) (P1Attack + 7);
  451.             P1Defense = (float) (P1Defense + 10);
  452.             break;
  453.         case "dragon":
  454.             P1Speed = (float) (P1Speed * 8);
  455.             P1Attack = (float) (P1Attack + 12);
  456.             P1Defense = (float) (P1Defense + 10);
  457.             P1Burner = true;
  458.             break;
  459.         default:
  460.             System.out.println("Interpreted as 'none'");
  461.             break;
  462.         }
  463.         System.out.print(P2name);
  464.         System.out.print(" Mount? (none, pig, bull, horse, battlehorse, dragon)- ");
  465.         P2Armor = input.next();
  466.         switch (P2Armor.toLowerCase())
  467.         {
  468.         case "pig":
  469.             P2Speed = (float) (P2Speed * 1.25);
  470.             break;
  471.         case "bull":
  472.             P2Speed = (float) (P2Speed * 2.5);
  473.             P2Attack = (float) (P2Attack + 5);
  474.             P2Defense = (float) (P2Defense + 1);
  475.             break;
  476.         case "horse":
  477.             P2Speed = (float) (P2Speed * 4);
  478.             P2Defense = (float) (P2Defense + 3);
  479.             break;
  480.         case "battlehorse":
  481.             P2Speed = (float) (P2Speed * 6);
  482.             P2Attack = (float) (P2Attack + 7);
  483.             P2Defense = (float) (P2Defense + 10);
  484.             break;
  485.         case "dragon":
  486.             P2Speed = (float) (P2Speed * 8);
  487.             P2Attack = (float) (P2Attack + 12);
  488.             P2Defense = (float) (P2Defense + 10);
  489.             P2Burner = true;
  490.             break;
  491.         default:
  492.             System.out.println("Interpreted as 'none'");
  493.             break;
  494.         }
  495.  
  496.  
  497.         //Weapon inputs
  498.         System.out.print(P1name);
  499.         System.out.print(" Weapon? (none, dagger, sword, whip, lance, poisondagger, flamesword, battleaxe, staff)- ");
  500.         P1Armor = input.next();
  501.         switch (P1Armor.toLowerCase())
  502.         {
  503.         case "dagger":
  504.             P1Speed = (float) (P1Speed + 10);
  505.             P1Attack = (float) ((P1Attack * 1.1) +5);
  506.             break;
  507.         case "sword":
  508.             P1Speed = (float) (P1Speed * .9);
  509.             P1Attack = (float) ((P1Attack * 1.3) +7);
  510.             break;
  511.         case "flamesword":
  512.             P1Speed = (float) (P1Speed * .9);
  513.             P1Attack = (float) ((P1Attack * 1.3) +7);
  514.             P1Burner = true;
  515.             break;
  516.         case "whip":
  517.             P1Attack = (float) (P1Attack * 1.5);
  518.             break;
  519.         case "poisondagger":
  520.             P1Speed = (float) (P1Speed + 10);
  521.             P1Attack = (float) ((P1Attack * 1.1) +5);
  522.             P1Poisoner = true;
  523.         case "lance":
  524.             P1Attack = (P1Attack + P1Speed - 100);
  525.             break;
  526.         case "battleaxe":
  527.             P1Attack = (float) (P1Attack +17);
  528.             break;
  529.         case "staff":
  530.             P1Speed = (float) (P1Speed * 1.2);
  531.             P1Attack = (float) ((P1Attack * 1.2) +3);
  532.             break;
  533.         default:
  534.             System.out.println("Interpreted as 'none'");
  535.             break;
  536.         }
  537.         System.out.print(P2name);
  538.         System.out.print(" Weapon? (none, dagger, sword, whip, lance, poisondagger, flamesword, battleaxe, staff)- ");
  539.         P2Armor = input.next();
  540.         switch (P2Armor.toLowerCase())
  541.         {
  542.         case "dagger":
  543.             P2Speed = (float) (P2Speed + 10);
  544.             P2Attack = (float) ((P2Attack * 1.1) +5);
  545.             break;
  546.         case "sword":
  547.             P2Speed = (float) (P2Speed * .9);
  548.             P2Attack = (float) ((P2Attack * 1.3) +7);
  549.             break;
  550.         case "flamesword":
  551.             P2Speed = (float) (P2Speed * .9);
  552.             P2Attack = (float) ((P2Attack * 1.3) +7);
  553.             P2Burner = true;
  554.             break;
  555.         case "poisondagger":
  556.             P2Speed = (float) (P2Speed + 10);
  557.             P2Attack = (float) ((P2Attack * 1.1) +5);
  558.             P2Poisoner = true;
  559.             break;
  560.         case "whip":
  561.             P2Attack = (float) (P2Attack * 1.5);
  562.             break;
  563.         case "lance":
  564.             P2Attack = (P2Attack + P2Speed - 100);
  565.             break;
  566.         case "battleaxe":
  567.             P2Attack = (float) (P2Attack +17);
  568.             break;
  569.         case "staff":
  570.             P2Speed = (float) (P2Speed * 1.2);
  571.             P2Attack = (float) ((P2Attack * 1.2) +3);
  572.             break;
  573.         default:
  574.             System.out.println("Interpreted as 'none'");
  575.             break;
  576.         }
  577.  
  578.         System.out.println("---BATTLE---");
  579.         System.out.println("");
  580.         System.out.println("");
  581.         System.out.println("");
  582.     }
  583.     public static int RandInt(float a, float b)
  584.     {
  585.         Randint = (int) (a + (Math.random() * (b - a + 1)));
  586.         return Randint;
  587.     }
  588.     public static void P1PostCombatEffects()
  589.     {
  590.         if (P1Burner == true && Damage != 0 && P2Burning == false)
  591.         {
  592.             RandInt(1,6);
  593.             if (Randint == 6)
  594.             {
  595.                 P2Burning = true;
  596.                 System.out.print(P2name);
  597.                 System.out.println(" caught fire!");
  598.             }
  599.         }
  600.         if (P2Burning == true)
  601.         {
  602.             System.out.print(P2name);
  603.             System.out.print(" is on fire!  ");
  604.             RandInt(20, 60);
  605.             Damage = Randint;
  606.             RandInt(1, 2);
  607.             Damage = (float) Damage / (Randint * P2Defense);
  608.             System.out.print((int) Damage);
  609.             System.out.print(" damage taken as a result.  ");
  610.             P2Health = P2Health - Damage;
  611.             if (P2Health > 0)
  612.                 System.out.print((int) P2Health);
  613.             if (P2Health <= 0)
  614.                 System.out.print("0");
  615.             System.out.println(" health left.");
  616.             RandInt(1, 5);
  617.             if (Randint == 1)
  618.             {
  619.                 System.out.print(P2name);
  620.                 System.out.println(" is no longer burning.");
  621.                 P2Burning = false;
  622.             }
  623.         }
  624.         if (P1Poisoner == true && Damage != 0 && P2Poisoned == false)
  625.         {
  626.             RandInt(1,7);
  627.             if (Randint == 6)
  628.             {
  629.                 P2Poisoned = true;
  630.                 System.out.print(P2name);
  631.                 System.out.println(" has been poisoned!");
  632.             }
  633.         }
  634.         if (P2Poisoned == true)
  635.         {
  636.             System.out.print(P2name);
  637.             System.out.print(" is poisoned!  ");
  638.             RandInt(30, 60);
  639.             Damage = Randint;
  640.             RandInt(1, 2);
  641.             Damage = (float) Damage / (Randint * P2Defense);
  642.             System.out.print((int) Damage);
  643.             System.out.print(" damage taken as a result.  ");
  644.             P2Health = P2Health - Damage;
  645.             if (P2Health > 0)
  646.                 System.out.print((int) P2Health);
  647.             if (P2Health <= 0)
  648.                 System.out.print("0");
  649.             System.out.println(" health left.");
  650.             RandInt(1, 4);
  651.             if (Randint == 1)
  652.             {
  653.                 System.out.print(P2name);
  654.                 System.out.println(" is no longer poisoned.");
  655.                 P2Poisoned = false;
  656.             }
  657.         }
  658.         if (P2Jarated == true)
  659.         {
  660.             RandInt(1,5);
  661.             if (Randint == 1 || Randint == 2)
  662.             {
  663.                 System.out.print(P2name);
  664.                 System.out.println(" has recovered from jarate.");
  665.                 P2Jarated = false;
  666.             }
  667.         }
  668.         if (P2Jarated == false)
  669.         {
  670.             RandInt(1,35);
  671.             if (Randint == 1)
  672.             {
  673.                 P2Jarated = true;
  674.                 System.out.print(P2name);
  675.                 System.out.println(" has been jarated!");
  676.             }
  677.         }
  678.     }
  679.     public static void P2PostCombatEffects()
  680.     {
  681.         if (P2Burner == true && Damage != 0 && P1Burning == false)
  682.         {
  683.             RandInt(1,6);
  684.             if (Randint == 6)
  685.             {
  686.                 P1Burning = true;
  687.                 System.out.print(P1name);
  688.                 System.out.println(" caught fire!");
  689.             }
  690.         }
  691.         if (P1Burning == true)
  692.         {
  693.             System.out.print(P1name);
  694.             System.out.print(" is on fire!  ");
  695.             RandInt(20, 60);
  696.             Damage = Randint;
  697.             RandInt(1, 2);
  698.             Damage = (float) Damage / (Randint * P1Defense);
  699.             System.out.print((int) Damage);
  700.             System.out.print(" damage taken as a result.  ");
  701.             P1Health = P1Health - Damage;
  702.             if (P1Health > 0)
  703.                 System.out.print((int) P1Health);
  704.             if (P1Health <= 0)
  705.                 System.out.print("0");
  706.             System.out.println(" health left.");
  707.             RandInt(1, 5);
  708.             if (Randint == 1)
  709.             {
  710.                 System.out.print(P1name);
  711.                 System.out.println(" is no longer burning.");
  712.                 P1Burning = false;
  713.             }
  714.         }
  715.         if (P2Poisoner == true && Damage != 0 && P1Poisoned == false)
  716.         {
  717.             RandInt(1,7);
  718.             if (Randint == 5)
  719.             {
  720.                 P2Poisoned = true;
  721.                 System.out.print(P1name);
  722.                 System.out.println(" has been poisoned!");
  723.             }
  724.         }
  725.         if (P1Poisoned == true)
  726.         {
  727.             System.out.print(P1name);
  728.             System.out.print(" is poisoned!  ");
  729.             RandInt(30, 50);
  730.             Damage = Randint;
  731.             RandInt(1, 2);
  732.             Damage = (float) Damage / (Randint * P1Defense);
  733.             System.out.print((int) Damage);
  734.             System.out.print(" damage taken as a result.  ");
  735.             P1Health = P1Health - Damage;
  736.             if (P1Health > 0)
  737.                 System.out.print((int) P1Health);
  738.             if (P1Health <= 0)
  739.                 System.out.print("0");
  740.             System.out.println(" health left.");
  741.             RandInt(1, 4);
  742.             if (Randint == 1)
  743.             {
  744.                 System.out.print(P1name);
  745.                 System.out.println(" is no longer poisoned.");
  746.                 P1Poisoned = false;
  747.             }
  748.         }
  749.         if (P1Jarated == true)
  750.         {
  751.             RandInt(1,5);
  752.             if (Randint == 1 || Randint == 2)
  753.             {
  754.                 System.out.print(P1name);
  755.                 System.out.println(" has recovered from jarate.");
  756.                 P1Jarated = false;
  757.             }
  758.         }
  759.         if (P1Jarated == false)
  760.         {
  761.             RandInt(1,35);
  762.             if (Randint == 1)
  763.             {
  764.                 P1Jarated = true;
  765.                 System.out.print(P1name);
  766.                 System.out.println(" has been jarated!");
  767.             }
  768.         }
  769.     }
  770. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement