Advertisement
markd315

Battle simulator v 2.0 (open source)

Mar 9th, 2013
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 26.31 KB | None | 0 0
  1. package Main;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class Battlesim
  6. {
  7.     public static int Randint;
  8.     static String P1name;
  9.     static String P2name;
  10.     static float P1Health;
  11.     static float P2Health;
  12.     static float P1Attack;
  13.     static float P2Attack;
  14.     static float P1Defense;
  15.     static float P2Defense;
  16.     static String P1Armor;
  17.     static String P2Armor;
  18.     static float P1Speed;
  19.     static float P2Speed;
  20.     static float Damage;
  21.     static String InputString;
  22.  
  23.     //Status weapons
  24.     static boolean P1Burner = false;
  25.     static boolean P2Burner = false;
  26.     static boolean P1Poisoner = false;
  27.     static boolean P2Poisoner = false;
  28.     static boolean P1RageIncrease = false;
  29.     static boolean P2RageIncrease = false;
  30.     static boolean P1Bludgeoner = false;
  31.     static boolean P2Bludgeoner = 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.     static boolean HurtSelf = false;
  49.  
  50.     /*
  51.      * TODO
  52.      * Add moar weapons
  53.      * Ranged?  Magic?
  54.      * Incorporate a story mode
  55.      */
  56.  
  57.     //scanner declaration
  58.     static Scanner input = new Scanner(System.in);
  59.  
  60.     public static void main(String[] args)
  61.     {  
  62.         //Calls inputs method
  63.         Inputs();
  64.         // Main loop.  True until battle is completed
  65.         Combat();
  66.     }
  67.     public static void Combat()
  68.     {
  69.         while (P1Health > 0 && P2Health >0)
  70.         {
  71.             //speed test to determine who goes first
  72.             HurtSelf = false;
  73.             RandInt(0, P1Speed + P2Speed);
  74.             if (Randint < P1Speed)
  75.             {
  76.                 //P1's turn
  77.                 P1Turn();
  78.             }
  79.             else
  80.                 if (Randint > P1Speed)
  81.                 {
  82.                     //P2's turn
  83.                     P2Turn();
  84.  
  85.                 }
  86.                 else
  87.                 {
  88.                     //If both speeds are 1, I think this will happen.  This is to essentially "break the tie"
  89.                     RandInt(0, 1);
  90.                     if (Randint == 0)
  91.                         P1Speed = P1Speed++;
  92.                     if (Randint == 1)
  93.                         P2Speed = P2Speed++;
  94.                 }
  95.  
  96.         }
  97.         //States winner based on results of battle
  98.         CombatResolver();
  99.     }
  100.     public static void P1Turn()
  101.     {
  102.         RandInt(60, 180);
  103.         Damage = (P1Attack * Randint);
  104.         if (P2Jarated == true)
  105.         {
  106.             RandInt(1,4);
  107.             if (Randint == 4)
  108.             {
  109.                 Damage = Damage * 9;
  110.                 System.out.print("Critical hit!  : ");
  111.  
  112.             }
  113.             if (Randint != 4)
  114.             {
  115.                 Damage = Damage * 3;
  116.                 System.out.print("Minicrit!  : ");
  117.             }
  118.         }
  119.         if (P1Rage == true)
  120.         {
  121.             RandInt(1,60);
  122.             if (Randint >= 58)
  123.             {
  124.                 Damage = Damage * 27;
  125.                 System.out.print("Smash hit!  : ");
  126.             }
  127.             if (Randint == 60)
  128.             {
  129.                 Damage = Damage * 3;
  130.                 System.out.print("Final smash!  : ");
  131.             }
  132.             if (Randint < 58)
  133.             {
  134.                 Damage = Damage * 0;
  135.                 System.out.print("Missed!  : ");
  136.             }
  137.         }
  138.         if (P2Jarated == false && P1Rage == false)
  139.         {
  140.             RandInt(1, 60);
  141.             if (Randint == 60)
  142.             {
  143.                 Damage = 3 * Damage;
  144.                 System.out.print("Critical hit!  : ");
  145.             }
  146.             if (Randint >= 57)
  147.             {
  148.                 Damage = 3 * Damage;
  149.                 if (Randint != 60)
  150.                     System.out.print("Minicrit!  : ");
  151.             }
  152.             if (Randint <= 7)
  153.             {
  154.                 Damage = 0 * Damage;
  155.                 System.out.print("Missed!  : ");
  156.             }
  157.         }
  158.         RandInt(1,2);
  159.         if (P1Stunned == true && Randint == 2)
  160.         {
  161.             Damage = 0 * Damage;
  162.             System.out.print(P1name);
  163.             System.out.print(" is stunned, and can't move!  : ");
  164.         }
  165.         RandInt(1,10);
  166.         if (P1Confused == true && Randint >= 8)
  167.         {
  168.             System.out.print(P1name);
  169.             System.out.print(" hurt himself, because he's confused!  : ");
  170.             HurtSelf = true;
  171.         }
  172.  
  173.         if (HurtSelf == false)
  174.         {
  175.             RandInt(92, 97);
  176.             Damage = (float) Damage / ((Randint/10) * P2Defense);
  177.             System.out.print(P1name);
  178.             System.out.print(" does ");
  179.             System.out.print((int) (Damage));
  180.             System.out.print(" damage; ");
  181.             P2Health = P2Health - Damage;
  182.             System.out.print(P2name);
  183.             System.out.print(" has ");
  184.             if (P2Health > 0)
  185.                 System.out.print((int) P2Health);
  186.             if (P2Health <= 0)
  187.                 System.out.print("0");
  188.             System.out.println(" health remaining.");
  189.             P1PostCombatEffects();
  190.             System.out.println("");
  191.         }
  192.         else
  193.         {
  194.             RandInt(92, 97);
  195.             Damage = (float) Damage / ((Randint/10) * P1Defense);
  196.             System.out.print(P1name);
  197.             System.out.print(" does ");
  198.             System.out.print((int) (Damage));
  199.             System.out.print(" damage; ");
  200.             P1Health = P1Health - Damage;
  201.             System.out.print(P1name);
  202.             System.out.print(" has ");
  203.             if (P1Health > 0)
  204.                 System.out.print((int) P1Health);
  205.             if (P1Health <= 0)
  206.                 System.out.print("0");
  207.             System.out.println(" health remaining.");
  208.             P1PostCombatEffects();
  209.             System.out.println("");
  210.         }
  211.     }
  212.     public static void P2Turn()
  213.     {
  214.         RandInt(60, 180);
  215.         Damage = (P2Attack * Randint);
  216.         if (P1Jarated == true)
  217.         {
  218.             RandInt(1,4);
  219.             if (Randint == 4)
  220.             {
  221.                 Damage = Damage * 9;
  222.                 System.out.print("Critical hit!  : ");
  223.  
  224.             }
  225.             if (Randint != 4)
  226.             {
  227.                 Damage = Damage * 3;
  228.                 System.out.print("Minicrit!  : ");
  229.             }
  230.         }
  231.         if (P2Rage == true)
  232.         {
  233.             RandInt(1,60);
  234.             if (Randint >= 58)
  235.             {
  236.                 Damage = Damage * 27;
  237.                 System.out.print("Smash hit!  : ");
  238.             }
  239.             if (Randint == 60)
  240.             {
  241.                 Damage = Damage * 3;
  242.                 System.out.print("Final smash!  : ");
  243.             }
  244.             if (Randint < 58)
  245.             {
  246.                 Damage = Damage * 0;
  247.                 System.out.print("Missed!  : ");
  248.             }
  249.         }
  250.         if (P1Jarated == false && P2Rage == false)
  251.         {
  252.             RandInt(1, 60);
  253.             if (Randint == 60)
  254.             {
  255.                 Damage = 3 * Damage;
  256.                 System.out.print("Critical hit!  : ");
  257.             }
  258.             if (Randint >= 57)
  259.             {
  260.                 Damage = 3 * Damage;
  261.                 if (Randint != 60)
  262.                     System.out.print("Minicrit!  : ");
  263.             }
  264.             if (Randint <= 7)
  265.             {
  266.                 Damage = 0 * Damage;
  267.                 System.out.print("Missed!  : ");
  268.             }
  269.         }
  270.         RandInt(1,2);
  271.         if (P2Stunned == true && Randint == 2)
  272.         {
  273.             Damage = 0 * Damage;
  274.             System.out.print(P2name);
  275.             System.out.print(" is stunned, and can't move!  : ");
  276.         }
  277.         RandInt(1,10);
  278.         if (P2Confused == true && Randint >= 8)
  279.         {
  280.             System.out.print(P2name);
  281.             System.out.print(" hurt himself, because he's confused!  : ");
  282.             HurtSelf = true;
  283.         }
  284.  
  285.         if (HurtSelf == false)
  286.         {
  287.             RandInt(92, 97);
  288.             Damage = (float) Damage / ((Randint/10) * P1Defense);
  289.             System.out.print(P2name);
  290.             System.out.print(" does ");
  291.             System.out.print((int) (Damage));
  292.             System.out.print(" damage; ");
  293.             P1Health = P1Health - Damage;
  294.             System.out.print(P1name);
  295.             System.out.print(" has ");
  296.             if (P1Health > 0)
  297.                 System.out.print((int) P1Health);
  298.             if (P1Health <= 0)
  299.                 System.out.print("0");
  300.             System.out.println(" health remaining.");
  301.             P2PostCombatEffects();
  302.             System.out.println("");
  303.         }
  304.         else
  305.         {
  306.             RandInt(92, 97);
  307.             Damage = (float) Damage / ((Randint/10) * P2Defense);
  308.             System.out.print(P2name);
  309.             System.out.print(" does ");
  310.             System.out.print((int) (Damage));
  311.             System.out.print(" damage; ");
  312.             P2Health = P2Health - Damage;
  313.             System.out.print(P2name);
  314.             System.out.print(" has ");
  315.             if (P2Health > 0)
  316.                 System.out.print((int) P2Health);
  317.             if (P2Health <= 0)
  318.                 System.out.print("0");
  319.             System.out.println(" health remaining.");
  320.             P2PostCombatEffects();
  321.             System.out.println("");
  322.         }
  323.     }
  324.     public static void CombatResolver()
  325.     {
  326.         if (P1Health <= 0)
  327.         {
  328.             System.out.println("");
  329.             System.out.println("[-------------]");
  330.             System.out.print(P2name);
  331.             System.out.println(" is victorious!");
  332.             System.out.println("[-------------]");
  333.         }
  334.         if (P2Health <= 0)
  335.         {
  336.             System.out.println("");
  337.             System.out.println("[-------------]");
  338.             System.out.print(P1name);
  339.             System.out.println(" is victorious!");
  340.             System.out.println("[-------------]");
  341.         }
  342.         System.out.println("");
  343.         System.out.println("");
  344.         System.out.println("");
  345.         System.out.println("[---------------------------------------------------------------------------------]");
  346.         System.out.println("Did you enjoy this program?");
  347.         System.out.println("I enjoyed making it.");
  348.         System.out.print("This project was coded in console java entirely by Mark Davis");
  349.         System.out.println("It is and will remain open source");
  350.         System.out.println("Source code availible here: http://pastebin.com/F7tfZQqq");
  351.         System.out.println("Please feel free to use it for any educational or otherwise non-commercial purpose.");
  352.         System.out.println("[---------------------------------------------------------------------------------]");
  353.  
  354.     }
  355.     public static void Inputs()
  356.     {
  357.         //Names
  358.         System.out.print("P1 Name?- ");
  359.         P1name = input.nextLine();
  360.         System.out.print("P2 Name?- ");
  361.         P2name = input.nextLine();
  362.  
  363.         //HP
  364.         System.out.print(P1name);
  365.         System.out.print(" Health?- ");
  366.         P1Health = input.nextFloat();
  367.         while (P1Health < 0)
  368.         {
  369.             System.out.println("Invalid input.");
  370.             P1Health = input.nextFloat();
  371.         }
  372.  
  373.         System.out.print(P2name);
  374.         System.out.print(" Health?- ");
  375.         P2Health = input.nextFloat();
  376.         while (P2Health < 0)
  377.         {
  378.             System.out.println("Invalid input.");
  379.             P2Health = input.nextFloat();
  380.         }
  381.         //nextInt, nextFloat, next, nextLine are all valid here
  382.  
  383.         //attack
  384.         System.out.print(P1name);
  385.         System.out.print(" Attack?- ");
  386.         P1Attack = input.nextFloat();
  387.         System.out.print(P2name);
  388.         System.out.print(" Attack?- ");
  389.         P2Attack = input.nextFloat();
  390.  
  391.         //P1 defense
  392.         System.out.print(P1name);
  393.         System.out.print(" Defense (100 or less please)?- ");
  394.         P1Defense = input.nextFloat();
  395.         while (P1Defense > 100 || P1Defense < 0)
  396.         {
  397.             System.out.println("Invalid input.");
  398.             P1Defense = input.nextFloat();
  399.         }
  400.  
  401.         //P2 defense
  402.         System.out.print(P2name);
  403.         System.out.print(" Defense (100 or less please)?- ");
  404.         P2Defense = input.nextFloat();
  405.         while (P2Defense > 100 || P2Defense < 0)
  406.         {
  407.             System.out.println("Invalid input.");
  408.             P2Defense = input.nextFloat();
  409.         }
  410.  
  411.         //Max value for inherent defense should be 60, although it is inputted as up to 100.
  412.         P1Defense = (P1Defense*6)/10;
  413.         P2Defense = (P2Defense*6)/10;
  414.  
  415.  
  416.         //P1 Armor
  417.         System.out.print(P1name);
  418.         System.out.print(" Armor? (none, leather, chainmail, iron, diamond, enchanted)- ");
  419.         P1Armor = input.next();
  420.         switch (P1Armor.toLowerCase())
  421.         {
  422.         case "leather":
  423.             P1Defense = P1Defense +7;
  424.             break;
  425.         case "chainmail":
  426.             P1Defense = P1Defense +15;
  427.             break;
  428.         case "iron":
  429.             P1Defense = P1Defense +25;
  430.             break;
  431.         case "diamond":
  432.             P1Defense = P1Defense +30;
  433.             break;
  434.         case "enchanted":
  435.             P1Defense = P1Defense +35;
  436.             break;
  437.         default:
  438.             System.out.println("Interpreted as 'none'");
  439.             break;
  440.         }
  441.         //P2 Armor
  442.         System.out.print(P2name);
  443.         System.out.print(" Armor? (none, leather, chainmail, iron, diamond, enchanted)- ");
  444.         P2Armor = input.next();
  445.         switch (P2Armor.toLowerCase())
  446.         {
  447.         case "leather":
  448.             P2Defense = P2Defense +7;
  449.             break;
  450.         case "chainmail":
  451.             P2Defense = P2Defense +15;
  452.             break;
  453.         case "iron":
  454.             P2Defense = P2Defense +25;
  455.             break;
  456.         case "diamond":
  457.             P2Defense = P2Defense +30;
  458.             break;
  459.         case "enchanted":
  460.             P2Defense = P2Defense +35;
  461.             break;
  462.         default:
  463.             System.out.println("Interpreted as 'none'");
  464.             break;
  465.         }
  466.  
  467.         //P1 shield
  468.         System.out.print(P1name);
  469.         System.out.print(" Shield? (none, wooden, square, kite)- ");
  470.         P1Armor = input.next();
  471.         switch (P1Armor.toLowerCase())
  472.         {
  473.         case "wooden":
  474.             P1Defense = P1Defense +5;
  475.             break;
  476.         case "square":
  477.             P1Defense = P1Defense +10;
  478.             break;
  479.         case "kite":
  480.             P1Defense = P1Defense +15;
  481.             break;
  482.         default:
  483.             System.out.println("Interpreted as 'none'");
  484.             break;
  485.         }
  486.  
  487.  
  488.         //P2 shield
  489.         System.out.print(P2name);
  490.         System.out.print(" Shield? (none, wooden, square, kite)- ");
  491.         P2Armor = input.next();
  492.         switch (P2Armor.toLowerCase())
  493.         {
  494.         case "wooden":
  495.             P2Defense = P2Defense +5;
  496.             break;
  497.         case "square":
  498.             P2Defense = P2Defense +10;
  499.             break;
  500.         case "kite":
  501.             P2Defense = P2Defense +15;
  502.             break;
  503.         default:
  504.             System.out.println("Interpreted as 'none'");
  505.             break;
  506.         }
  507.  
  508.  
  509.  
  510.         //Fixes Defense values so they can be used in dmg calc.
  511.         P1Defense = Math.abs(P1Defense - 130);
  512.         P2Defense = Math.abs(P2Defense - 130);
  513.         P1Defense = (float) Math.sqrt(P1Defense);
  514.         P2Defense = (float) Math.sqrt(P2Defense);
  515.  
  516.         //Speed inputs
  517.         System.out.print(P1name);
  518.         System.out.print(" Speed?- ");
  519.         P1Speed = input.nextFloat();
  520.         while (P1Speed <= 0)
  521.         {
  522.             System.out.println("Invalid input.");
  523.             P1Speed = input.nextFloat();
  524.         }
  525.  
  526.         System.out.print(P2name);
  527.         System.out.print(" Speed?- ");
  528.         P2Speed = input.nextFloat();
  529.         while (P2Speed <= 0)
  530.         {
  531.             System.out.println("Invalid input.");
  532.             P2Speed = input.nextFloat();
  533.         }
  534.         P1Speed = P1Speed + 100;
  535.         P2Speed = P2Speed + 100;
  536.  
  537.  
  538.         //Mount inputs
  539.         System.out.print(P1name);
  540.         System.out.print(" Mount? (none, pig, bull, horse, battlehorse, dragon)- ");
  541.         P1Armor = input.next();
  542.         switch (P1Armor.toLowerCase())
  543.         {
  544.         case "pig":
  545.             P1Speed = (float) (P1Speed * 1.25);
  546.             break;
  547.         case "bull":
  548.             P1Speed = (float) (P1Speed * 2.5);
  549.             P1Attack = (float) (P1Attack + 5);
  550.             P1Defense = (float) (P1Defense + 1);
  551.             break;
  552.         case "horse":
  553.             P1Speed = (float) (P1Speed * 4);
  554.             P1Defense = (float) (P1Defense + 3);
  555.             break;
  556.         case "battlehorse":
  557.             P1Speed = (float) (P1Speed * 6);
  558.             P1Attack = (float) (P1Attack + 7);
  559.             P1Defense = (float) (P1Defense + 10);
  560.             break;
  561.         case "dragon":
  562.             P1Speed = (float) (P1Speed * 8);
  563.             P1Attack = (float) (P1Attack + 12);
  564.             P1Defense = (float) (P1Defense + 10);
  565.             P1Burner = true;
  566.             break;
  567.         default:
  568.             System.out.println("Interpreted as 'none'");
  569.             break;
  570.         }
  571.         System.out.print(P2name);
  572.         System.out.print(" Mount? (none, pig, bull, horse, battlehorse, dragon)- ");
  573.         P2Armor = input.next();
  574.         switch (P2Armor.toLowerCase())
  575.         {
  576.         case "pig":
  577.             P2Speed = (float) (P2Speed * 1.25);
  578.             break;
  579.         case "bull":
  580.             P2Speed = (float) (P2Speed * 2.5);
  581.             P2Attack = (float) (P2Attack + 5);
  582.             P2Defense = (float) (P2Defense + 1);
  583.             break;
  584.         case "horse":
  585.             P2Speed = (float) (P2Speed * 4);
  586.             P2Defense = (float) (P2Defense + 3);
  587.             break;
  588.         case "battlehorse":
  589.             P2Speed = (float) (P2Speed * 6);
  590.             P2Attack = (float) (P2Attack + 7);
  591.             P2Defense = (float) (P2Defense + 10);
  592.             break;
  593.         case "dragon":
  594.             P2Speed = (float) (P2Speed * 8);
  595.             P2Attack = (float) (P2Attack + 12);
  596.             P2Defense = (float) (P2Defense + 10);
  597.             P2Burner = true;
  598.             break;
  599.         default:
  600.             System.out.println("Interpreted as 'none'");
  601.             break;
  602.         }
  603.  
  604.  
  605.         //Weapon inputs
  606.         System.out.print(P1name);
  607.         System.out.print(" Weapon? (none, dagger, sword, whip, lance, poisondagger, flamesword, battleaxe, staff)- ");
  608.         P1Armor = input.next();
  609.         switch (P1Armor.toLowerCase())
  610.         {
  611.         case "dagger":
  612.             P1Speed = (float) (P1Speed + 10);
  613.             P1Attack = (float) ((P1Attack * 1.1) +5);
  614.             break;
  615.         case "sword":
  616.             P1Speed = (float) (P1Speed * .9);
  617.             P1Attack = (float) ((P1Attack * 1.3) +7);
  618.             break;
  619.         case "flamesword":
  620.             P1Speed = (float) (P1Speed * .9);
  621.             P1Attack = (float) ((P1Attack * 1.3) +7);
  622.             P1Burner = true;
  623.             break;
  624.         case "whip":
  625.             P1Attack = (float) (P1Attack * 1.5);
  626.             break;
  627.         case "poisondagger":
  628.             P1Speed = (float) (P1Speed + 10);
  629.             P1Attack = (float) ((P1Attack * 1.1) +5);
  630.             P1Poisoner = true;
  631.         case "lance":
  632.             P1Attack = (P1Attack + P1Speed - 100);
  633.             break;
  634.         case "battleaxe":
  635.             P1Attack = (float) (P1Attack +17);
  636.             P1RageIncrease = true;
  637.             break;
  638.         case "staff":
  639.             P1Speed = (float) (P1Speed * 1.2);
  640.             P1Attack = (float) ((P1Attack * 1.2) +3);
  641.             break;
  642.         default:
  643.             System.out.println("Interpreted as 'none'");
  644.             break;
  645.         }
  646.         System.out.print(P2name);
  647.         System.out.print(" Weapon? (none, dagger, sword, whip, lance, poisondagger, flamesword, battleaxe, staff)- ");
  648.         P2Armor = input.next();
  649.         switch (P2Armor.toLowerCase())
  650.         {
  651.         case "dagger":
  652.             P2Speed = (float) (P2Speed + 10);
  653.             P2Attack = (float) ((P2Attack * 1.1) +5);
  654.             break;
  655.         case "sword":
  656.             P2Speed = (float) (P2Speed * .9);
  657.             P2Attack = (float) ((P2Attack * 1.3) +7);
  658.             break;
  659.         case "flamesword":
  660.             P2Speed = (float) (P2Speed * .9);
  661.             P2Attack = (float) ((P2Attack * 1.3) +7);
  662.             P2Burner = true;
  663.             break;
  664.         case "poisondagger":
  665.             P2Speed = (float) (P2Speed + 10);
  666.             P2Attack = (float) ((P2Attack * 1.1) +5);
  667.             P2Poisoner = true;
  668.             break;
  669.         case "whip":
  670.             P2Attack = (float) (P2Attack * 1.5);
  671.             break;
  672.         case "lance":
  673.             P2Attack = (P2Attack + P2Speed - 100);
  674.             break;
  675.         case "battleaxe":
  676.             P2Attack = (float) (P2Attack +17);
  677.             P2RageIncrease = true;
  678.             break;
  679.         case "staff":
  680.             P2Speed = (float) (P2Speed * 1.2);
  681.             P2Attack = (float) ((P2Attack * 1.2) +3);
  682.             break;
  683.         default:
  684.             System.out.println("Interpreted as 'none'");
  685.             break;
  686.         }
  687.  
  688.         System.out.println("---BATTLE---");
  689.         System.out.println("");
  690.         System.out.println("");
  691.         System.out.println("");
  692.     }
  693.     public static int RandInt(float a, float b)
  694.     {
  695.         Randint = (int) (a + (Math.random() * (b - a + 1)));
  696.         return Randint;
  697.     }
  698.     public static void P1PostCombatEffects()
  699.     {
  700.         RandInt(1,30);
  701.         if (P1Confused == true)
  702.         {
  703.             RandInt(1,5);
  704.             if (Randint >= 3)
  705.             {
  706.                 System.out.print(P1name);
  707.                 System.out.println(" is no longer confused.");
  708.                 P1Confused = false;
  709.             }
  710.         }
  711.         if (P2Confused == false && P1Bludgeoner == false && Randint == 30)
  712.         {
  713.             P2Confused = true;
  714.             System.out.print(P2name);
  715.             System.out.println(" is now confused!");
  716.         }
  717.         if (P2Confused == false && P1Bludgeoner == true && Randint >= 29)
  718.         {
  719.             P2Confused = true;
  720.             System.out.print(P2name);
  721.             System.out.println(" is now confused!");
  722.         }
  723.         RandInt(1,30);
  724.         if (P1Stunned == true)
  725.         {
  726.             RandInt(1,3);
  727.             if (Randint == 1)
  728.             {
  729.                 System.out.print(P1name);
  730.                 System.out.println(" is no longer Stunned.");
  731.                 P1Stunned = false;
  732.             }
  733.         }
  734.         if (P2Stunned == false && P1Bludgeoner == false && Randint == 30)
  735.         {
  736.             P2Stunned = true;
  737.             System.out.print(P2name);
  738.             System.out.println(" is now Stunned!");
  739.         }
  740.         if (P2Stunned == false && P1Bludgeoner == true && Randint >= 29)
  741.         {
  742.             P2Stunned = true;
  743.             System.out.print(P2name);
  744.             System.out.println(" is now Stunned!");
  745.         }
  746.         //Others
  747.         if (P1Burner == true && Damage != 0 && P2Burning == false)
  748.         {
  749.             RandInt(1,6);
  750.             if (Randint == 6)
  751.             {
  752.                 P2Burning = true;
  753.                 System.out.print(P2name);
  754.                 System.out.println(" caught fire!");
  755.             }
  756.         }
  757.         if (P2Burning == true)
  758.         {
  759.             System.out.print(P2name);
  760.             System.out.print(" is on fire!  ");
  761.             RandInt(20, 60);
  762.             Damage = Randint;
  763.             RandInt(1, 2);
  764.             Damage = (float) Damage / (Randint * P2Defense);
  765.             System.out.print((int) Damage);
  766.             System.out.print(" damage taken as a result.  ");
  767.             P2Health = P2Health - Damage;
  768.             if (P2Health > 0)
  769.                 System.out.print((int) P2Health);
  770.             if (P2Health <= 0)
  771.                 System.out.print("0");
  772.             System.out.println(" health left.");
  773.             RandInt(1, 5);
  774.             if (Randint == 1)
  775.             {
  776.                 System.out.print(P2name);
  777.                 System.out.println(" is no longer burning.");
  778.                 P2Burning = false;
  779.             }
  780.         }
  781.         if (P1Poisoner == true && Damage != 0 && P2Poisoned == false)
  782.         {
  783.             RandInt(1,7);
  784.             if (Randint == 6)
  785.             {
  786.                 P2Poisoned = true;
  787.                 System.out.print(P2name);
  788.                 System.out.println(" has been poisoned!");
  789.             }
  790.         }
  791.         if (P2Poisoned == true)
  792.         {
  793.             System.out.print(P2name);
  794.             System.out.print(" is poisoned!  ");
  795.             RandInt(30, 60);
  796.             Damage = Randint;
  797.             RandInt(1, 2);
  798.             Damage = (float) Damage / (Randint * P2Defense);
  799.             System.out.print((int) Damage);
  800.             System.out.print(" damage taken as a result.  ");
  801.             P2Health = P2Health - Damage;
  802.             if (P2Health > 0)
  803.                 System.out.print((int) P2Health);
  804.             if (P2Health <= 0)
  805.                 System.out.print("0");
  806.             System.out.println(" health left.");
  807.             RandInt(1, 4);
  808.             if (Randint == 1)
  809.             {
  810.                 System.out.print(P2name);
  811.                 System.out.println(" is no longer poisoned.");
  812.                 P2Poisoned = false;
  813.             }
  814.         }
  815.         if (Damage != 0 && P2Bleeding == false)
  816.         {
  817.             RandInt(1,15);
  818.             if (Randint == 1)
  819.             {
  820.                 P2Bleeding = true;
  821.                 System.out.print(P2name);
  822.                 System.out.println(" is now bleeding!");
  823.             }
  824.         }
  825.         if (P2Bleeding == true)
  826.         {
  827.             System.out.print(P2name);
  828.             System.out.print(" is bleeding!  ");
  829.             RandInt(15, 28);
  830.             Damage = Randint;
  831.             RandInt(1, 2);
  832.             Damage = (float) Damage / (Randint * P2Defense);
  833.             System.out.print((int) Damage);
  834.             System.out.print(" damage taken as a result.  ");
  835.             P2Health = P2Health - Damage;
  836.             if (P1Health > 0)
  837.                 System.out.print((int) P2Health);
  838.             if (P1Health <= 0)
  839.                 System.out.print("0");
  840.             System.out.println(" health left.");
  841.             RandInt(1, 5);
  842.             if (Randint != 5)
  843.             {
  844.                 System.out.print(P2name);
  845.                 System.out.println(" is no longer bleeding.");
  846.                 P2Bleeding = false;
  847.             }
  848.         }
  849.         if (P1Rage == true)
  850.         {
  851.             RandInt(1,2);
  852.             if (Randint == 1)
  853.             {
  854.                 System.out.print(P1name);
  855.                 System.out.println(" is no longer enraged.");
  856.                 P1Rage = false;
  857.             }
  858.         }
  859.         RandInt(1,45);
  860.         if (P2Rage == false && P2RageIncrease == false && Randint == 45)
  861.         {
  862.             P2Rage = true;
  863.             System.out.print(P2name);
  864.             System.out.println(" is now enraged!");
  865.         }
  866.         if (P2Rage == false && P2RageIncrease == true && Randint >= 43)
  867.         {
  868.             P2Rage = true;
  869.             System.out.print(P2name);
  870.             System.out.println(" is now enraged!");
  871.         }
  872.         if (P2Jarated == true)
  873.         {
  874.             RandInt(1,5);
  875.             if (Randint == 1 || Randint == 2)
  876.             {
  877.                 System.out.print(P2name);
  878.                 System.out.println(" has recovered from jarate.");
  879.                 P2Jarated = false;
  880.             }
  881.         }
  882.         if (P2Jarated == false)
  883.         {
  884.             RandInt(1,35);
  885.             if (Randint == 1)
  886.             {
  887.                 P2Jarated = true;
  888.                 System.out.print(P2name);
  889.                 System.out.println(" has been jarated!");
  890.             }
  891.         }
  892.     }
  893.     public static void P2PostCombatEffects()
  894.     {
  895.         RandInt(1,30);
  896.         if (P2Confused == true)
  897.         {
  898.             RandInt(1,5);
  899.             if (Randint >= 3)
  900.             {
  901.                 System.out.print(P2name);
  902.                 System.out.println(" is no longer confused.");
  903.                 P2Confused = false;
  904.             }
  905.         }
  906.         if (P1Confused == false && P2Bludgeoner == false && Randint == 30)
  907.         {
  908.             P1Confused = true;
  909.             System.out.print(P1name);
  910.             System.out.println(" is now confused!");
  911.         }
  912.         if (P1Confused == false && P2Bludgeoner == true && Randint >= 29)
  913.         {
  914.             P1Confused = true;
  915.             System.out.print(P1name);
  916.             System.out.println(" is now confused!");
  917.         }
  918.         RandInt(1,30);
  919.         if (P2Stunned == true)
  920.         {
  921.             RandInt(1,3);
  922.             if (Randint == 1)
  923.             {
  924.                 System.out.print(P2name);
  925.                 System.out.println(" is no longer Stunned.");
  926.                 P2Stunned = false;
  927.             }
  928.         }
  929.         if (P1Stunned == false && P2Bludgeoner == false && Randint == 30)
  930.         {
  931.             P1Stunned = true;
  932.             System.out.print(P1name);
  933.             System.out.println(" is now Stunned!");
  934.         }
  935.         if (P1Stunned == false && P2Bludgeoner == true && Randint >= 29)
  936.         {
  937.             P1Stunned = true;
  938.             System.out.print(P1name);
  939.             System.out.println(" is now Stunned!");
  940.         }
  941.         if (P2Burner == true && Damage != 0 && P1Burning == false)
  942.         {
  943.             RandInt(1,6);
  944.             if (Randint == 6)
  945.             {
  946.                 P1Burning = true;
  947.                 System.out.print(P1name);
  948.                 System.out.println(" caught fire!");
  949.             }
  950.         }
  951.         if (P1Burning == true)
  952.         {
  953.             System.out.print(P1name);
  954.             System.out.print(" is on fire!  ");
  955.             RandInt(20, 60);
  956.             Damage = Randint;
  957.             RandInt(1, 2);
  958.             Damage = (float) Damage / (Randint * P1Defense);
  959.             System.out.print((int) Damage);
  960.             System.out.print(" damage taken as a result.  ");
  961.             P1Health = P1Health - Damage;
  962.             if (P1Health > 0)
  963.                 System.out.print((int) P1Health);
  964.             if (P1Health <= 0)
  965.                 System.out.print("0");
  966.             System.out.println(" health left.");
  967.             RandInt(1, 5);
  968.             if (Randint == 1)
  969.             {
  970.                 System.out.print(P1name);
  971.                 System.out.println(" is no longer burning.");
  972.                 P1Burning = false;
  973.             }
  974.         }
  975.         if (P2Poisoner == true && Damage != 0 && P1Poisoned == false)
  976.         {
  977.             RandInt(1,7);
  978.             if (Randint == 5)
  979.             {
  980.                 P1Poisoned = true;
  981.                 System.out.print(P1name);
  982.                 System.out.println(" has been poisoned!");
  983.             }
  984.         }
  985.         if (P1Poisoned == true)
  986.         {
  987.             System.out.print(P1name);
  988.             System.out.print(" is poisoned!  ");
  989.             RandInt(30, 50);
  990.             Damage = Randint;
  991.             RandInt(1, 2);
  992.             Damage = (float) Damage / (Randint * P1Defense);
  993.             System.out.print((int) Damage);
  994.             System.out.print(" damage taken as a result.  ");
  995.             P1Health = P1Health - Damage;
  996.             if (P1Health > 0)
  997.                 System.out.print((int) P1Health);
  998.             if (P1Health <= 0)
  999.                 System.out.print("0");
  1000.             System.out.println(" health left.");
  1001.             RandInt(1, 4);
  1002.             if (Randint == 1)
  1003.             {
  1004.                 System.out.print(P1name);
  1005.                 System.out.println(" is no longer poisoned.");
  1006.                 P1Poisoned = false;
  1007.             }
  1008.         }
  1009.         if (Damage != 0 && P1Bleeding == false)
  1010.         {
  1011.             RandInt(1,15);
  1012.             if (Randint == 1)
  1013.             {
  1014.                 P1Bleeding = true;
  1015.                 System.out.print(P1name);
  1016.                 System.out.println(" is now bleeding!");
  1017.             }
  1018.         }
  1019.         if (P1Bleeding == true)
  1020.         {
  1021.             System.out.print(P1name);
  1022.             System.out.print(" is bleeding!  ");
  1023.             RandInt(15, 28);
  1024.             Damage = Randint;
  1025.             RandInt(1, 2);
  1026.             Damage = (float) Damage / (Randint * P1Defense);
  1027.             System.out.print((int) Damage);
  1028.             System.out.print(" damage taken as a result.  ");
  1029.             P1Health = P1Health - Damage;
  1030.             if (P1Health > 0)
  1031.                 System.out.print((int) P1Health);
  1032.             if (P1Health <= 0)
  1033.                 System.out.print("0");
  1034.             System.out.println(" health left.");
  1035.             RandInt(1, 5);
  1036.             if (Randint != 5)
  1037.             {
  1038.                 System.out.print(P1name);
  1039.                 System.out.println(" is no longer bleeding.");
  1040.                 P1Bleeding = false;
  1041.             }
  1042.         }
  1043.         if (P2Rage == true)
  1044.         {
  1045.             RandInt(1,2);
  1046.             if (Randint == 1)
  1047.             {
  1048.                 System.out.print(P2name);
  1049.                 System.out.println(" is no longer enraged.");
  1050.                 P2Rage = false;
  1051.             }
  1052.         }
  1053.         RandInt(1,45);
  1054.         if (P1Rage == false && P1RageIncrease == false && Randint == 45)
  1055.         {
  1056.             P1Rage = true;
  1057.             System.out.print(P1name);
  1058.             System.out.println(" is now enraged!");
  1059.         }
  1060.         if (P1Rage == false && P1RageIncrease == true && Randint >= 43)
  1061.         {
  1062.             P1Rage = true;
  1063.             System.out.print(P1name);
  1064.             System.out.println(" is now enraged!");
  1065.         }
  1066.         if (P1Jarated == true)
  1067.         {
  1068.             RandInt(1,5);
  1069.             if (Randint == 1 || Randint == 2)
  1070.             {
  1071.                 System.out.print(P1name);
  1072.                 System.out.println(" has recovered from jarate.");
  1073.                 P1Jarated = false;
  1074.             }
  1075.         }
  1076.         if (P1Jarated == false)
  1077.         {
  1078.             RandInt(1,35);
  1079.             if (Randint == 1)
  1080.             {
  1081.                 P1Jarated = true;
  1082.                 System.out.print(P1name);
  1083.                 System.out.println(" has been jarated!");
  1084.             }
  1085.         }
  1086.     }
  1087. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement