Advertisement
markd315

Battle simulator v 1.0 (open source)

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