Advertisement
markd315

Battle simulator v 3.0 (open source)

May 3rd, 2013
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 42.82 KB | None | 0 0
  1. package Main;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class Battlesim
  6. {
  7.     //core vars
  8.     static int Randint;
  9.     static String p1Name;
  10.     static String p2Name;
  11.     static float p1Health;
  12.     static float p2Health;
  13.     static float p1Attack;
  14.     static float p2Attack;
  15.     static float p1RangedAttack = 0;
  16.     static float p2RangedAttack = 0;
  17.     static float p1Defense;
  18.     static float p2Defense;
  19.     static String p1Armor;
  20.     static String p2Armor;
  21.     static float p1Speed;
  22.     static float p2Speed;
  23.     static double damage;
  24.     static String inputString;
  25.     static int increp;
  26.     static int repetition;
  27.     static int p1Rounds;
  28.     static int p2Rounds;
  29.     static float p1MaxHealth;
  30.     static float p2MaxHealth;
  31.     static int distanceSeperating;
  32.  
  33.     //Status weapons
  34.     static boolean p1Burner = false;
  35.     static boolean p2Burner = false;
  36.     static boolean p1Poisoner = false;
  37.     static boolean p2Poisoner = false;
  38.     static boolean p1RageIncrease = false;
  39.     static boolean p2RageIncrease = false;
  40.     static boolean p1Bludgeoner = false;
  41.     static boolean p2Bludgeoner = false;
  42.  
  43.     //Status effects
  44.     static boolean isP1Burning = false;
  45.     static boolean isP2Burning = false;
  46.     static boolean isP1Poisoned = false;
  47.     static boolean isP2Poisoned = false;
  48.     static boolean isP1Stunned = false;
  49.     static boolean isP2Stunned = false;
  50.     static boolean isP1Bleeding = false;
  51.     static boolean isP2Bleeding = false;
  52.     static boolean isP1Jarated = false;
  53.     static boolean isP2Jarated = false;
  54.     static boolean isP1Confused = false;
  55.     static boolean isP2Confused = false;
  56.     static boolean isP1Enraged = false;
  57.     static boolean isP2Enraged = false;
  58.     static boolean isP1Ranged = false;
  59.     static boolean isP2Ranged = false;
  60.     static boolean justchanged = true;
  61.  
  62.     static boolean didPlayerHurtSelf = false;
  63.     static boolean noOutput = false;
  64.     //scanner declaration
  65.     static Scanner input = new Scanner(System.in);
  66.  
  67.  
  68.  
  69.     //Ranged update variables
  70.     static double p1RangedAccuracy;
  71.     static double p2RangedAccuracy;
  72.     static double p1RangedScaling;
  73.     static double p2RangedScaling;
  74.     private static boolean noGapClose;
  75.  
  76.     /*
  77.      * OVERALL TODO
  78.      * Add moar weapons
  79.      * Bug test.
  80.      * Life steal?
  81.      * Slow effect?
  82.      * Buffs? (red= AD 25% increase ranged or melee.  Purple= 1% true damage per turn.  Blue= Cannot be affected by statuses.  White= Movement speed tripled.   Yellow= 15% Life steal.  Green= Health regenerates.  Black= No damage is taken.  
  83.      * Knockback to reinitiate ranged combat?
  84.      * Add shields that absorb ranged damage better.
  85.      * Add magic combat core (mana, scrolls, elemental spells that apply effects and damage) and todo.
  86.      * Mount can die (random .25%ish chance)?  Continue the combat on foot!  :D
  87.      * Incorporate a story/campaign mode MAYBE LONG TERM!
  88.      */
  89.  
  90.     public static void main(String[] args)
  91.     {  
  92.         System.out.println("Hello, welcome to combat simulator version 2.0, created by Mark Davis.");
  93.         while (true)
  94.         {
  95.             System.out.println("To begin, please choose a game mode by entering the corresponding integer.");
  96.             System.out.println("1) Manual value input");
  97.             System.out.println("2) Use recommended skill values");
  98.             System.out.println("3) Multiple computations");
  99.             System.out.println("4) View instructions");
  100.             System.out.println("5) Status effect info");
  101.             System.out.println("6) Campaign mode? (Coming never most likely)");
  102.             System.out.println("Type a number and press enter.");
  103.             inputString = input.nextLine();
  104.             switch (inputString.toLowerCase())
  105.             {
  106.             case "1":
  107.             {
  108.                 noOutput = false;
  109.                 Inputs();
  110.                 Combat();
  111.                 break;
  112.             }
  113.             case "2":
  114.             {
  115.                 noOutput = false;
  116.                 System.out.print("P1 Name?- ");
  117.                 p1Name = input.nextLine();
  118.                 System.out.print("P2 Name?- ");
  119.                 p2Name = input.nextLine();
  120.                 p1Health = 10000;
  121.                 p2Health = 10000;
  122.                 p1Attack = 10;
  123.                 p2Attack = 10;
  124.                 p1Defense = 10;
  125.                 p2Defense = 10;
  126.                 p1Speed = 1;
  127.                 p2Speed = 1;
  128.                 distanceSeperating = 0;
  129.                 p1RangedAttack = 0;
  130.                 p2RangedAttack = 0;
  131.  
  132.  
  133.                 CoreInputs();
  134.                 Combat();
  135.                 break;
  136.             }
  137.             case "3":
  138.             {
  139.                 noOutput = true;
  140.                 System.out.println("NOTE:  This feature is early beta as of version 2.1, but all known bugs have been fixed.");
  141.                 System.out.println("");
  142.                 Inputs();
  143.                 System.out.println("How many rounds to simulate?");
  144.                 System.out.println("");
  145.                 repetition = input.nextInt();
  146.                 increp = 0;
  147.                 while (repetition != increp)
  148.                 {
  149.                     Combat();
  150.                     if (p1Health > p2Health)
  151.                     {
  152.                         p1Rounds++;
  153.                         System.out.print(p1Name);
  154.                         System.out.println(" wins a round!");
  155.                         System.out.println("");
  156.                     }
  157.                     if (p2Health > p1Health)
  158.                     {
  159.                         p2Rounds++;
  160.                         System.out.print(p2Name);                      
  161.                         System.out.println(" wins a round!");
  162.                         System.out.println("");
  163.                     }
  164.                     p1Health = p1MaxHealth;
  165.                     p2Health = p2MaxHealth;
  166.                     increp++;
  167.  
  168.                     isP1Burning = false;
  169.                     isP2Burning = false;
  170.                     isP1Poisoned = false;
  171.                     isP2Poisoned = false;
  172.                     isP1Stunned = false;
  173.                     isP2Stunned = false;
  174.                     isP1Bleeding = false;
  175.                     isP2Bleeding = false;
  176.                     isP1Jarated = false;
  177.                     isP2Jarated = false;
  178.                     isP1Confused = false;
  179.                     isP2Confused = false;
  180.                     isP1Enraged = false;
  181.                     isP2Enraged = false;
  182.                     didPlayerHurtSelf = false;
  183.                 }
  184.                 System.out.print("P1 has won ");
  185.                 System.out.println(p1Rounds);
  186.                 System.out.print("P2 has won ");
  187.                 System.out.println(p2Rounds);
  188.                 System.out.println("");
  189.                 if (p1Rounds > p2Rounds)
  190.                     System.out.println("P1 wins");
  191.                 if (p1Rounds < p2Rounds)
  192.                     System.out.println("P1 wins");
  193.                 if (p1Rounds == p2Rounds)
  194.                     System.out.println("Tie.");
  195.                 break;
  196.             }
  197.             case "4":
  198.             {
  199.                 System.out.println("The objective of this program is to create a semi-realistic but far fetched combat scenario.");
  200.                 System.out.println("You can enter names, attack, defense, health, and speed values for two combatants,");
  201.                 System.out.println("in addition, you can give the combatants armor, shields, weapons, and mounts to boost their stats.");
  202.                 System.out.println("Each weapon, shield, armor and mount has unique properties and advantages.");
  203.                 System.out.println("Some weapons have special status effects that can be incurred upon the enemy, like poison or fire.");
  204.                 System.out.println("Some effects occur rarely even without special items.");
  205.                 System.out.println("After values are inputted, a combat scenario will be computed,");
  206.                 System.out.println("and the final results displayed at the bottom.");
  207.                 System.out.println("Legal note: These results do not nessescarily accurately reflect a real combat encounter.");
  208.                 System.out.println("");
  209.                 System.out.println("Press enter please.");
  210.                 input.nextLine();
  211.                 System.out.println("");
  212.                 System.out.println("");
  213.                 System.out.println("");
  214.                 break;
  215.             }
  216.             case "5":
  217.             {
  218.                 System.out.println("Burning- Caused by dragons and flameswords.  Does low damage over time.");
  219.                 System.out.println("Poison- Caused by poisoned daggers.  Does low damage over time.");
  220.                 System.out.println("Bleeding- Occurs occasionally, independent of any special items.  Does low damage over time.");
  221.                 System.out.println("Stunned- May prevent the stunned player from attacking.  Occurs naturally, but chance doubles with staff.");
  222.                 System.out.println("Confused- May cause the player to attack himself.  Occurs naturally, but chance doubles with staff.");
  223.                 System.out.println("Rage- Can be positive as well as negative.  Causes most attacks to miss, but smash and final smash crits are possible and devastating.");
  224.                 System.out.println("  Occurs naturally, but chance of becoming enraged is x3 when equipping a battleaxe.");
  225.                 System.out.println("Jarate-  Occurs naturally.  Causes all attacks to hit, and deal crits and minicrits.");
  226.                 System.out.println("  Can be very painful if it doesn't go away fast.");
  227.                 System.out.println("");
  228.                 System.out.println("Press enter please.");
  229.                 input.nextLine();
  230.                 System.out.println("");
  231.                 System.out.println("");
  232.                 System.out.println("");
  233.                 break;
  234.             }
  235.             case "6":
  236.             {
  237.                 noOutput = false;
  238.                 System.out.println("Not implemented yet.");
  239.                 System.out.println("Press enter please.");
  240.                 input.nextLine();
  241.                 System.out.println("");
  242.                 break;
  243.             }
  244.             default:
  245.             {
  246.                 System.out.println("Uh.  That's not a valid input...");
  247.                 System.out.println("");
  248.                 break;
  249.             }
  250.             }
  251.         }
  252.     }
  253.     public static void Combat()
  254.     {
  255.         while (p1Health > 0 && p2Health >0)
  256.         {
  257.             //speed test to determine who goes first
  258.             didPlayerHurtSelf = false;
  259.  
  260.             while (distanceSeperating > 0 && p1Health > 0 && p2Health > 0 && p1RangedAttack > 0 || p2RangedAttack > 0)
  261.             {
  262.                 RandInt(0, p1Speed + p2Speed);
  263.                 if (Randint < p1Speed)
  264.                 {
  265.                     if (p1RangedAttack > 0)
  266.                         P1RangedTurn();
  267.                     if (p2RangedAttack > 0)
  268.                         P2RangedTurn();
  269.                     noGapClose = false;
  270.                 }
  271.                 else
  272.                     if (Randint > p2Speed)
  273.                     {
  274.                         if (p2RangedAttack > 0)
  275.                             P2RangedTurn();
  276.                         if (p1RangedAttack > 0)
  277.                             P1RangedTurn();
  278.                         noGapClose = false;
  279.  
  280.                     }
  281.                     else
  282.                     {
  283.                         //If both speeds are 1, I think this will happen.  This is to essentially "break the tie"
  284.                         RandInt(0, 1);
  285.                         if (Randint == 0)
  286.                         {
  287.                             p1Speed = p1Speed++;
  288.                         }
  289.                         if (Randint == 1)
  290.                         {
  291.                             p2Speed = p2Speed++;
  292.                         }
  293.                         noGapClose = true;
  294.                     }
  295.                 RandInt(5, 60);
  296.  
  297.                 if (!noGapClose)
  298.                 {
  299.                     if (p1RangedAttack == 0)
  300.                         Randint = (int) (Randint + 15 + p1Speed);
  301.                     if (p2RangedAttack == 0)
  302.                         Randint = (int) (Randint + 15 + p2Speed);
  303.                     distanceSeperating = distanceSeperating - Randint;
  304.                     if (distanceSeperating >= 0)
  305.                         System.out.print(distanceSeperating);
  306.                     if (distanceSeperating < 0)
  307.                         System.out.print("0");
  308.                     System.out.println(" meters remain between the combatants.");
  309.                     System.out.println("");
  310.                     justchanged = true;
  311.                 }
  312.             }
  313.             if (justchanged == true)
  314.             {
  315.                 justchanged = false;
  316.                 if (!noOutput)
  317.                 {
  318.                     System.out.println("");
  319.                     System.out.println("The champions are now engaged in melee combat!");
  320.                     System.out.println("");
  321.                 }
  322.             }
  323.             RandInt(0, p1Speed + p2Speed);
  324.             if (Randint < p1Speed)
  325.             {
  326.                 //P1's turn
  327.                 P1Turn();
  328.             }
  329.             else
  330.                 if (Randint > p1Speed)
  331.                 {
  332.                     //P2's turn
  333.                     P2Turn();
  334.  
  335.                 }
  336.                 else
  337.                 {
  338.                     //If both speeds are 1, I think this will happen.  This is to essentially "break the tie"
  339.                     RandInt(0, 1);
  340.                     if (Randint == 0)
  341.                         p1Speed = p1Speed++;
  342.                     if (Randint == 1)
  343.                         p2Speed = p2Speed++;
  344.                 }
  345.  
  346.         }
  347.         //States winner based on results of battle
  348.         if (!noOutput)
  349.             CombatResolver();
  350.     }
  351.     private static void P1RangedTurn()
  352.     {
  353.         double chance = (p1RangedScaling / distanceSeperating) * 100 *p1RangedAccuracy;
  354.         if (chance > 1)
  355.             chance = 1;
  356.         chance = (chance * 8)/10;
  357.         chance = chance * 100000;
  358.         RandInt(1,100000);
  359.         if (chance >= Randint)
  360.         {
  361.             damage = 0 * damage;
  362.             if (!noOutput)
  363.             {
  364.                 System.out.println("Missed!  : 0 damage dealt");
  365.                 System.out.println("");
  366.             }
  367.         }
  368.         else
  369.             damage = (p1RangedScaling/distanceSeperating) * 30 * p1RangedAttack;
  370.         RandInt(60, 180);
  371.         damage = (.8 * damage * Randint);
  372.         RandInt(92, 97);
  373.         damage = (float) damage / ((Randint/10) * p1Defense);
  374.  
  375.         RandInt(1, 100);
  376.         if (Randint >= 87)
  377.         {
  378.             damage = 15 * damage;
  379.             if (!noOutput)
  380.                 System.out.print("Critical hit!  : ");
  381.         }
  382.         if (Randint >= 65 && Randint < 87)
  383.         {
  384.             damage = 5 * damage;
  385.             if (!noOutput)
  386.                 System.out.print("Minicrit!  : ");
  387.         }
  388.         if (!noOutput)
  389.         {
  390.             System.out.print(p1Name);
  391.             System.out.print(" deals ");
  392.             System.out.print((int) (damage));
  393.             System.out.print(" ranged damage; ");
  394.         }
  395.         p2Health = (float) (p2Health - damage);
  396.         if (!noOutput)
  397.         {
  398.             System.out.print(p2Name);
  399.             System.out.print(" has ");
  400.             if (p2Health > 0)
  401.                 System.out.print((int) p2Health);
  402.             if (p2Health <= 0)
  403.                 System.out.print("0");
  404.             System.out.println(" health remaining.");
  405.         }
  406.         if (!noOutput)
  407.             System.out.println("");
  408.  
  409.     }
  410.     private static void P2RangedTurn()
  411.     {
  412.         double chance = (p2RangedScaling / distanceSeperating) * 100 *p2RangedAccuracy;
  413.         if (chance > 1)
  414.             chance = 1;
  415.         chance = (chance * 8)/10;
  416.         chance = chance * 100000;
  417.         RandInt(1,100000);
  418.         if (chance >= Randint)
  419.         {
  420.             damage = 0 * damage;
  421.             if (!noOutput)
  422.             {
  423.                 System.out.println("Missed!  : 0 damage dealt");
  424.                 System.out.println("");
  425.             }
  426.         }
  427.         else
  428.             damage = (p2RangedScaling/distanceSeperating) * 30 * p2RangedAttack;
  429.         RandInt(60, 180);
  430.         damage = (.8 * damage * Randint);
  431.         RandInt(92, 97);
  432.         damage = (float) damage / ((Randint/10) * p2Defense);
  433.  
  434.         RandInt(1, 100);
  435.         if (Randint >= 87)
  436.         {
  437.             damage = 15 * damage;
  438.             if (!noOutput)
  439.                 System.out.print("Critical hit!  : ");
  440.         }
  441.         if (Randint >= 65 && Randint < 87)
  442.         {
  443.             damage = 5 * damage;
  444.             if (!noOutput)
  445.                 System.out.print("Minicrit!  : ");
  446.         }
  447.         if (!noOutput)
  448.         {
  449.             System.out.print(p2Name);
  450.             System.out.print(" deals ");
  451.             System.out.print((int) (damage));
  452.             System.out.print(" ranged damage; ");
  453.         }
  454.         p1Health = (float) (p1Health - damage);
  455.         if (!noOutput)
  456.         {
  457.             System.out.print(p1Name);
  458.             System.out.print(" has ");
  459.             if (p1Health > 0)
  460.                 System.out.print((int) p1Health);
  461.             if (p1Health <= 0)
  462.                 System.out.print("0");
  463.             System.out.println(" health remaining.");
  464.         }
  465.         if (!noOutput)
  466.             System.out.println("");
  467.     }
  468.     public static void P1Turn()
  469.     {
  470.         RandInt(60, 180);
  471.         damage = (p1Attack * Randint);
  472.         if (isP2Jarated)
  473.         {
  474.             RandInt(1,4);
  475.             if (Randint == 4)
  476.             {
  477.                 damage = damage * 9;
  478.                 if (!noOutput)
  479.                     System.out.print("Critical hit!  : ");
  480.  
  481.             }
  482.             if (Randint != 4)
  483.             {
  484.                 damage = damage * 3;
  485.                 if (!noOutput)
  486.                     System.out.print("Minicrit!  : ");
  487.             }
  488.         }
  489.         if (isP1Enraged)
  490.         {
  491.             RandInt(1,60);
  492.             if (Randint >= 58)
  493.             {
  494.                 damage = damage * 27;
  495.                 if (!noOutput)
  496.                     System.out.print("Smash hit!  : ");
  497.             }
  498.             if (Randint == 60)
  499.             {
  500.                 damage = damage * 3;
  501.                 if (!noOutput)
  502.                     System.out.print("Final smash!  : ");
  503.             }
  504.             if (Randint < 58)
  505.             {
  506.                 damage = damage * 0;
  507.                 if (!noOutput)
  508.                     System.out.print("Missed!  : ");
  509.             }
  510.         }
  511.         if (isP2Jarated == false && isP1Enraged == false)
  512.         {
  513.             RandInt(1, 60);
  514.             if (Randint == 60)
  515.             {
  516.                 damage = 3 * damage;
  517.                 if (!noOutput)
  518.                     System.out.print("Critical hit!  : ");
  519.             }
  520.             if (Randint >= 57)
  521.             {
  522.                 damage = 3 * damage;
  523.                 if (Randint != 60 && !noOutput)
  524.                     System.out.print("Minicrit!  : ");
  525.             }
  526.             if (Randint <= 7)
  527.             {
  528.                 damage = 0 * damage;
  529.                 if (!noOutput)
  530.                     System.out.print("Missed!  : ");
  531.             }
  532.         }
  533.         RandInt(1,2);
  534.         if (isP1Stunned && Randint == 2)
  535.         {
  536.             damage = 0 * damage;
  537.             if (!noOutput)
  538.             {
  539.                 System.out.print(p1Name);
  540.                 System.out.print(" is stunned, and can't move!  : ");
  541.             }
  542.         }
  543.         RandInt(1,10);
  544.         if (isP1Confused && Randint >= 8)
  545.         {
  546.             if (!noOutput)
  547.             {
  548.                 System.out.print(p1Name);
  549.                 System.out.print(" hurt himself, because he's confused!  : ");
  550.             }
  551.             didPlayerHurtSelf = true;
  552.         }
  553.  
  554.         if (didPlayerHurtSelf == false)
  555.         {
  556.             RandInt(92, 97);
  557.             damage = (float) damage / ((Randint/10) * p2Defense);
  558.             if (!noOutput)
  559.             {
  560.                 System.out.print(p1Name);
  561.                 System.out.print(" does ");
  562.                 System.out.print((int) (damage));
  563.                 System.out.print(" damage; ");
  564.             }
  565.             p2Health = (float) (p2Health - damage);
  566.             if (!noOutput)
  567.             {
  568.                 System.out.print(p2Name);
  569.                 System.out.print(" has ");
  570.                 if (p2Health > 0)
  571.                     System.out.print((int) p2Health);
  572.                 if (p2Health <= 0)
  573.                     System.out.print("0");
  574.                 System.out.println(" health remaining.");
  575.             }
  576.             P1PostCombatEffects();
  577.             if (!noOutput)
  578.                 System.out.println("");
  579.         }
  580.         else
  581.         {
  582.             RandInt(92, 97);
  583.             damage = (float) damage / ((Randint/10) * p1Defense);
  584.             if (!noOutput)
  585.             {
  586.                 System.out.print(p1Name);
  587.                 System.out.print(" does ");
  588.                 System.out.print((int) (damage));
  589.                 System.out.print(" damage; ");
  590.             }
  591.             p1Health = (float) (p1Health - damage);
  592.             if (!noOutput)
  593.             {
  594.                 System.out.print(p1Name);
  595.                 System.out.print(" has ");
  596.                 if (p1Health > 0)
  597.                     System.out.print((int) p1Health);
  598.                 if (p1Health <= 0)
  599.                     System.out.print("0");
  600.                 System.out.println(" health remaining.");
  601.             }
  602.             P1PostCombatEffects();
  603.             if (!noOutput)
  604.                 System.out.println("");
  605.         }
  606.     }
  607.     public static void P2Turn()
  608.     {
  609.         RandInt(60, 180);
  610.         damage = (p2Attack * Randint);
  611.         if (isP1Jarated == true)
  612.         {
  613.             RandInt(1,4);
  614.             if (Randint == 4)
  615.             {
  616.                 damage = damage * 9;
  617.                 if (!noOutput)
  618.                     System.out.print("Critical hit!  : ");
  619.  
  620.             }
  621.             if (Randint != 4)
  622.             {
  623.                 damage = damage * 3;
  624.                 if (!noOutput)
  625.                     System.out.print("Minicrit!  : ");
  626.             }
  627.         }
  628.         if (isP2Enraged == true)
  629.         {
  630.             RandInt(1,60);
  631.             if (Randint >= 58)
  632.             {
  633.                 damage = damage * 27;
  634.                 if (!noOutput)
  635.                     System.out.print("Smash hit!  : ");
  636.             }
  637.             if (Randint == 60)
  638.             {
  639.                 damage = damage * 3;
  640.                 if (!noOutput)
  641.                     System.out.print("Final smash!  : ");
  642.             }
  643.             if (Randint < 58)
  644.             {
  645.                 damage = damage * 0;
  646.                 if (!noOutput)
  647.                     System.out.print("Missed!  : ");
  648.             }
  649.         }
  650.         if (isP1Jarated == false && isP2Enraged == false)
  651.         {
  652.             RandInt(1, 60);
  653.             if (Randint == 60)
  654.             {
  655.                 damage = 3 * damage;
  656.                 if (!noOutput)
  657.                     System.out.print("Critical hit!  : ");
  658.             }
  659.             if (Randint >= 57)
  660.             {
  661.                 damage = 3 * damage;
  662.                 if (Randint != 60  && !noOutput)
  663.                     System.out.print("Minicrit!  : ");
  664.             }
  665.             if (Randint <= 7)
  666.             {
  667.                 damage = 0 * damage;
  668.                 if (!noOutput)
  669.                     System.out.print("Missed!  : ");
  670.             }
  671.         }
  672.         RandInt(1,2);
  673.         if (isP2Stunned == true && Randint == 2)
  674.         {
  675.             damage = 0 * damage;
  676.             if (!noOutput)
  677.             {
  678.                 System.out.print(p2Name);
  679.                 System.out.print(" is stunned, and can't move!  : ");
  680.             }
  681.         }
  682.         RandInt(1,10);
  683.         if (isP2Confused == true && Randint >= 8)
  684.         {
  685.             if (!noOutput)
  686.             {
  687.                 System.out.print(p2Name);
  688.                 System.out.print(" hurt himself, because he's confused!  : ");
  689.             }
  690.             didPlayerHurtSelf = true;
  691.         }
  692.  
  693.         if (didPlayerHurtSelf == false)
  694.         {
  695.             RandInt(92, 97);
  696.             damage = (float) damage / ((Randint/10) * p1Defense);
  697.             if (!noOutput)
  698.             {
  699.                 System.out.print(p2Name);
  700.                 System.out.print(" does ");
  701.                 System.out.print((int) (damage));
  702.                 System.out.print(" damage; ");
  703.             }
  704.             p1Health = (float) (p1Health - damage);
  705.             if (!noOutput)
  706.             {
  707.                 System.out.print(p1Name);
  708.                 System.out.print(" has ");
  709.                 if (p1Health > 0)
  710.                     System.out.print((int) p1Health);
  711.                 if (p1Health <= 0)
  712.                     System.out.print("0");
  713.                 System.out.println(" health remaining.");
  714.             }
  715.             P2PostCombatEffects();
  716.             if (!noOutput)
  717.                 System.out.println("");
  718.         }
  719.         else
  720.         {
  721.             RandInt(92, 97);
  722.             damage = (float) damage / ((Randint/10) * p2Defense);
  723.             if (!noOutput)
  724.             {
  725.                 System.out.print(p2Name);
  726.                 System.out.print(" does ");
  727.                 System.out.print((int) (damage));
  728.                 System.out.print(" damage; ");
  729.             }
  730.             p2Health = (float) (p2Health - damage);
  731.             if (!noOutput)
  732.             {
  733.                 System.out.print(p2Name);
  734.                 System.out.print(" has ");
  735.                 if (p2Health > 0)
  736.                     System.out.print((int) p2Health);
  737.                 if (p2Health <= 0)
  738.                     System.out.print("0");
  739.                 System.out.println(" health remaining.");
  740.             }
  741.             P2PostCombatEffects();
  742.             if (!noOutput)
  743.                 System.out.println("");
  744.         }
  745.     }
  746.     public static void CombatResolver()
  747.     {
  748.         if (!noOutput)
  749.         {
  750.             if (p1Health <= 0)
  751.             {
  752.                 System.out.println("");
  753.                 System.out.println("[-------------]");
  754.                 System.out.print(p2Name);
  755.                 System.out.println(" is victorious!");
  756.                 System.out.println("[-------------]");
  757.             }
  758.             if (p2Health <= 0)
  759.             {
  760.                 System.out.println("");
  761.                 System.out.println("[-------------]");
  762.                 System.out.print(p1Name);
  763.                 System.out.println(" is victorious!");
  764.                 System.out.println("[-------------]");
  765.             }
  766.             System.out.println("");
  767.             System.out.println("");
  768.             System.out.println("");
  769.             System.out.println("[------------------------------------------------------------------------------]");
  770.             System.out.println("Did you enjoy this program?");
  771.             System.out.println("I enjoyed making it.");
  772.             System.out.println("This project was coded in console java entirely by Mark Davis");
  773.             System.out.println("It is and will remain open source");
  774.             System.out.println("Source code availible here: http://pastebin.com/XzAiZTyC");
  775.             System.out.println("Please feel free to use it for anythng educational or otherwise non-commercial.");
  776.             System.out.println("[------------------------------------------------------------------------------]");
  777.             System.out.println("");
  778.             System.out.println("Press enter to return to main menu.");
  779.             input.nextLine();
  780.             System.out.println("");
  781.         }
  782.     }
  783.     public static void Inputs()
  784.     {
  785.         //Names
  786.         System.out.print("P1 Name?- ");
  787.         p1Name = input.nextLine();
  788.         System.out.print("P2 Name?- ");
  789.         p2Name = input.nextLine();
  790.  
  791.         //HP
  792.         System.out.print(p1Name);
  793.         System.out.print(" Health?- ");
  794.         p1Health = input.nextFloat();
  795.         while (p1Health < 0)
  796.         {
  797.             System.out.println("Invalid input.");
  798.             p1Health = input.nextFloat();
  799.         }
  800.  
  801.         System.out.print(p2Name);
  802.         System.out.print(" Health?- ");
  803.         p2Health = input.nextFloat();
  804.         while (p2Health < 0)
  805.         {
  806.             System.out.println("Invalid input.");
  807.             p2Health = input.nextFloat();
  808.         }
  809.         //attack
  810.         System.out.print(p1Name);
  811.         System.out.print(" Attack?- ");
  812.         p1Attack = input.nextFloat();
  813.         System.out.print(p2Name);
  814.         System.out.print(" Attack?- ");
  815.         p2Attack = input.nextFloat();
  816.  
  817.         //P1 defense
  818.         System.out.print(p1Name);
  819.         System.out.print(" Defense (100 or less please)?- ");
  820.         p1Defense = input.nextFloat();
  821.         while (p1Defense > 100 || p1Defense < 0)
  822.         {
  823.             System.out.println("Invalid input.");
  824.             p1Defense = input.nextFloat();
  825.         }
  826.  
  827.         //P2 defense
  828.         System.out.print(p2Name);
  829.         System.out.print(" Defense (100 or less please)?- ");
  830.         p2Defense = input.nextFloat();
  831.         while (p2Defense > 100 || p2Defense < 0)
  832.         {
  833.             System.out.println("Invalid input.");
  834.             p2Defense = input.nextFloat();
  835.         }
  836.  
  837.         //Max value for inherent defense should be 60, although it is inputted as up to 100.
  838.         p1Defense = (p1Defense*6)/10;
  839.         p2Defense = (p2Defense*6)/10;
  840.  
  841.         //Speed inputs
  842.         System.out.print(p1Name);
  843.         System.out.print(" Speed?- ");
  844.         p1Speed = input.nextFloat();
  845.         while (p1Speed <= 0)
  846.         {
  847.             System.out.println("Invalid input.");
  848.             p1Speed = input.nextFloat();
  849.         }
  850.  
  851.         System.out.print(p2Name);
  852.         System.out.print(" Speed?- ");
  853.         p2Speed = input.nextFloat();
  854.         while (p2Speed <= 0)
  855.         {
  856.             System.out.println("Invalid input.");
  857.             p2Speed = input.nextFloat();
  858.         }
  859.  
  860.         System.out.print(p1Name);
  861.         System.out.print(" Ranged weapon? (none, knife, spear, bow, pistol, shotgun, sniper, rocket)- ");
  862.         p1Armor = input.next();
  863.         switch (p1Armor.toLowerCase())
  864.         {
  865.         case "knife":
  866.             p1RangedAttack = 85;
  867.             p1RangedAccuracy = .15;
  868.             p1RangedScaling = .15;
  869.             break;
  870.         case "spear":
  871.             p1RangedAttack = 35;
  872.             p1RangedAccuracy = .35;
  873.             p1RangedScaling = .25;
  874.             break;
  875.         case "bow":
  876.             p1RangedAttack = 85;
  877.             p1RangedAccuracy = .45;
  878.             p1RangedScaling = .55;
  879.             break;
  880.         case "pistol":
  881.             p1RangedAttack = 70;
  882.             p1RangedAccuracy = .75;
  883.             p1RangedScaling = .45;
  884.             break;
  885.         case "shotgun":
  886.             p1RangedAttack = 100;
  887.             p1RangedAccuracy = .15;
  888.             p1RangedScaling = .15;
  889.             break;
  890.         case "sniper":
  891.             p1RangedAttack = 100;
  892.             p1RangedAccuracy = .5;
  893.             p1RangedScaling = 1;
  894.             break;
  895.         case "rocket":
  896.             p1RangedAttack = 120;
  897.             p1RangedAccuracy = .6;
  898.             p1RangedScaling = .8;
  899.             break;
  900.         default:
  901.             System.out.println("Interpreted as 'none'");
  902.             break;
  903.         }
  904.         System.out.print(p2Name);
  905.         System.out.print(" Ranged weapon? (none, knife, spear, bow, pistol, shotgun, sniper, rocket)- ");
  906.         p2Armor = input.next();
  907.         switch (p2Armor.toLowerCase())
  908.         {
  909.         case "knife":
  910.             p2RangedAttack = 85;
  911.             p2RangedAccuracy = .15;
  912.             p2RangedScaling = .15;
  913.             break;
  914.         case "spear":
  915.             p2RangedAttack = 35;
  916.             p2RangedAccuracy = .35;
  917.             p2RangedScaling = .25;
  918.             break;
  919.         case "bow":
  920.             p2RangedAttack = 85;
  921.             p2RangedAccuracy = .45;
  922.             p2RangedScaling = .55;
  923.             break;
  924.         case "pistol":
  925.             p2RangedAttack = 70;
  926.             p2RangedAccuracy = .75;
  927.             p2RangedScaling = .45;
  928.             break;
  929.         case "shotgun":
  930.             p2RangedAttack = 100;
  931.             p2RangedAccuracy = .15;
  932.             p2RangedScaling = .15;
  933.             break;
  934.         case "sniper":
  935.             p2RangedAttack = 100;
  936.             p2RangedAccuracy = .5;
  937.             p2RangedScaling = 1;
  938.             break;
  939.         case "rocket":
  940.             p2RangedAttack = 120;
  941.             p2RangedAccuracy = .6;
  942.             p2RangedScaling = .8;
  943.             break;
  944.         default:
  945.             System.out.println("Interpreted as 'none'");
  946.             break;
  947.         }
  948.         System.out.println("Distance seperating combatants (meters, under 1000 please)?- ");
  949.         distanceSeperating = input.nextInt();
  950.         while (distanceSeperating < 0 || distanceSeperating > 1000)
  951.         {
  952.             System.out.println("Invalid input.");
  953.             distanceSeperating = input.nextInt();
  954.         }
  955.         CoreInputs();
  956.     }
  957.     public static void CoreInputs()
  958.     {
  959.         //NESSESCARY FOR MULTIROUND COMBAT!
  960.         p1MaxHealth = p1Health;
  961.         p2MaxHealth = p2Health;
  962.         //P1 Armor
  963.         System.out.print(p1Name);
  964.         System.out.print(" Armor? (none, leather, chainmail, iron, diamond, enchanted)- ");
  965.         p1Armor = input.next();
  966.         switch (p1Armor.toLowerCase())
  967.         {
  968.         case "leather":
  969.             p1Defense = p1Defense +7;
  970.             break;
  971.         case "chainmail":
  972.             p1Defense = p1Defense +15;
  973.             p1Speed = (float) (p1Speed * .975);
  974.             break;
  975.         case "iron":
  976.             p1Defense = p1Defense +25;
  977.             p1Speed = (float) (p1Speed * .7);
  978.             break;
  979.         case "diamond":
  980.             p1Defense = p1Defense +30;
  981.             p1Speed = (float) (p1Speed * .85);
  982.             break;
  983.         case "enchanted":
  984.             p1Defense = p1Defense +35;
  985.             p1Speed = (float) (p1Speed * .95);
  986.             break;
  987.         default:
  988.             System.out.println("Interpreted as 'none'");
  989.             break;
  990.         }
  991.         //P2 Armor
  992.         System.out.print(p2Name);
  993.         System.out.print(" Armor? (none, leather, chainmail, iron, diamond, enchanted)- ");
  994.         p2Armor = input.next();
  995.         switch (p2Armor.toLowerCase())
  996.         {
  997.         case "leather":
  998.             p2Defense = p2Defense +7;
  999.             break;
  1000.         case "chainmail":
  1001.             p2Defense = p2Defense +15;
  1002.             p2Speed = (float) (p2Speed * .975);
  1003.             break;
  1004.         case "iron":
  1005.             p2Defense = p2Defense +25;
  1006.             p2Speed = (float) (p2Speed * .7);
  1007.             break;
  1008.         case "diamond":
  1009.             p2Defense = p2Defense +30;
  1010.             p2Speed = (float) (p2Speed * .85);
  1011.             break;
  1012.         case "enchanted":
  1013.             p2Defense = p2Defense +35;
  1014.             p2Speed = (float) (p2Speed * .95);
  1015.             break;
  1016.         default:
  1017.             System.out.println("Interpreted as 'none'");
  1018.             break;
  1019.         }
  1020.  
  1021.         //P1 shield
  1022.         System.out.print(p1Name);
  1023.         System.out.print(" Shield? (none, wooden, square, kite)- ");
  1024.         p1Armor = input.next();
  1025.         switch (p1Armor.toLowerCase())
  1026.         {
  1027.         case "wooden":
  1028.             p1Defense = p1Defense +5;
  1029.             break;
  1030.         case "square":
  1031.             p1Defense = p1Defense +10;
  1032.             break;
  1033.         case "kite":
  1034.             p1Defense = p1Defense +15;
  1035.             break;
  1036.         default:
  1037.             System.out.println("Interpreted as 'none'");
  1038.             break;
  1039.         }
  1040.  
  1041.  
  1042.         //P2 shield
  1043.         System.out.print(p2Name);
  1044.         System.out.print(" Shield? (none, wooden, square, kite)- ");
  1045.         p2Armor = input.next();
  1046.         switch (p2Armor.toLowerCase())
  1047.         {
  1048.         case "wooden":
  1049.             p2Defense = p2Defense +5;
  1050.             break;
  1051.         case "square":
  1052.             p2Defense = p2Defense +10;
  1053.             break;
  1054.         case "kite":
  1055.             p2Defense = p2Defense +15;
  1056.             break;
  1057.         default:
  1058.             System.out.println("Interpreted as 'none'");
  1059.             break;
  1060.         }
  1061.  
  1062.  
  1063.  
  1064.         //Fixes Defense values so they can be used in dmg calc.
  1065.         p1Defense = Math.abs(p1Defense - 130);
  1066.         p2Defense = Math.abs(p2Defense - 130);
  1067.         p1Defense = (float) Math.sqrt(p1Defense);
  1068.         p2Defense = (float) Math.sqrt(p2Defense);
  1069.  
  1070.         //Mount inputs
  1071.         System.out.print(p1Name);
  1072.         System.out.print(" Mount? (none, pig, bull, horse, battlehorse, dragon)- ");
  1073.         p1Armor = input.next();
  1074.         switch (p1Armor.toLowerCase())
  1075.         {
  1076.         case "pig":
  1077.             p1Speed = (float) (p1Speed * 1.25);
  1078.             break;
  1079.         case "bull":
  1080.             p1Speed = (float) (p1Speed * 2.5);
  1081.             p1Attack = (float) (p1Attack + 5);
  1082.             p1Defense = (float) (p1Defense + 1);
  1083.             break;
  1084.         case "horse":
  1085.             p1Speed = (float) (p1Speed * 4);
  1086.             p1Defense = (float) (p1Defense + 3);
  1087.             break;
  1088.         case "battlehorse":
  1089.             p1Speed = (float) (p1Speed * 6);
  1090.             p1Attack = (float) (p1Attack + 7);
  1091.             p1Defense = (float) (p1Defense + 10);
  1092.             break;
  1093.         case "dragon":
  1094.             p1Speed = (float) (p1Speed * 8);
  1095.             p1Attack = (float) (p1Attack + 12);
  1096.             p1Defense = (float) (p1Defense + 10);
  1097.             p1Burner = true;
  1098.             break;
  1099.         default:
  1100.             System.out.println("Interpreted as 'none'");
  1101.             break;
  1102.         }
  1103.         System.out.print(p2Name);
  1104.         System.out.print(" Mount? (none, pig, bull, horse, battlehorse, dragon)- ");
  1105.         p2Armor = input.next();
  1106.         switch (p2Armor.toLowerCase())
  1107.         {
  1108.         case "pig":
  1109.             p2Speed = (float) (p2Speed * 1.25);
  1110.             break;
  1111.         case "bull":
  1112.             p2Speed = (float) (p2Speed * 2.5);
  1113.             p2Attack = (float) (p2Attack + 5);
  1114.             p2Defense = (float) (p2Defense + 1);
  1115.             break;
  1116.         case "horse":
  1117.             p2Speed = (float) (p2Speed * 4);
  1118.             p2Defense = (float) (p2Defense + 3);
  1119.             break;
  1120.         case "battlehorse":
  1121.             p2Speed = (float) (p2Speed * 6);
  1122.             p2Attack = (float) (p2Attack + 7);
  1123.             p2Defense = (float) (p2Defense + 10);
  1124.             break;
  1125.         case "dragon":
  1126.             p2Speed = (float) (p2Speed * 8);
  1127.             p2Attack = (float) (p2Attack + 12);
  1128.             p2Defense = (float) (p2Defense + 10);
  1129.             p2Burner = true;
  1130.             break;
  1131.         default:
  1132.             System.out.println("Interpreted as 'none'");
  1133.             break;
  1134.         }
  1135.  
  1136.  
  1137.         //Weapon inputs
  1138.         System.out.print(p1Name);
  1139.         System.out.print(" Weapon? (none, dagger, sword, whip, lance, poisondagger, flamesword, battleaxe, staff)- ");
  1140.         p1Armor = input.next();
  1141.         switch (p1Armor.toLowerCase())
  1142.         {
  1143.         case "dagger":
  1144.             p1Speed = (float) (p1Speed + 10);
  1145.             p1Attack = (float) ((p1Attack * 1.1) +5);
  1146.             break;
  1147.         case "sword":
  1148.             p1Speed = (float) (p1Speed * .9);
  1149.             p1Attack = (float) ((p1Attack * 1.3) +7);
  1150.             break;
  1151.         case "flamesword":
  1152.             p1Speed = (float) (p1Speed * .9);
  1153.             p1Attack = (float) ((p1Attack * 1.3) +7);
  1154.             p1Burner = true;
  1155.             break;
  1156.         case "whip":
  1157.             p1Attack = (float) (p1Attack * 1.5);
  1158.             break;
  1159.         case "poisondagger":
  1160.             p1Speed = (float) (p1Speed + 10);
  1161.             p1Attack = (float) ((p1Attack * 1.1) +5);
  1162.             p1Poisoner = true;
  1163.         case "lance":
  1164.             p1Attack = (p1Attack + p1Speed - 100);
  1165.             break;
  1166.         case "battleaxe":
  1167.             p1Attack = (float) (p1Attack +17);
  1168.             p1RageIncrease = true;
  1169.             break;
  1170.         case "staff":
  1171.             p1Speed = (float) (p1Speed * 1.2);
  1172.             p1Attack = (float) ((p1Attack * 1.2) +3);
  1173.             break;
  1174.         default:
  1175.             System.out.println("Interpreted as 'none'");
  1176.             break;
  1177.         }
  1178.         System.out.print(p2Name);
  1179.         System.out.print(" Weapon? (none, dagger, sword, whip, lance, poisondagger, flamesword, battleaxe, staff)- ");
  1180.         p2Armor = input.next();
  1181.         switch (p2Armor.toLowerCase())
  1182.         {
  1183.         case "dagger":
  1184.             p2Speed = (float) (p2Speed + 10);
  1185.             p2Attack = (float) ((p2Attack * 1.1) +5);
  1186.             break;
  1187.         case "sword":
  1188.             p2Speed = (float) (p2Speed * .9);
  1189.             p2Attack = (float) ((p2Attack * 1.3) +7);
  1190.             break;
  1191.         case "flamesword":
  1192.             p2Speed = (float) (p2Speed * .9);
  1193.             p2Attack = (float) ((p2Attack * 1.3) +7);
  1194.             p2Burner = true;
  1195.             break;
  1196.         case "poisondagger":
  1197.             p2Speed = (float) (p2Speed + 10);
  1198.             p2Attack = (float) ((p2Attack * 1.1) +5);
  1199.             p2Poisoner = true;
  1200.             break;
  1201.         case "whip":
  1202.             p2Attack = (float) (p2Attack * 1.5);
  1203.             break;
  1204.         case "lance":
  1205.             p2Attack = (p2Attack + p2Speed - 100);
  1206.             break;
  1207.         case "battleaxe":
  1208.             p2Attack = (float) (p2Attack +17);
  1209.             p2RageIncrease = true;
  1210.             break;
  1211.         case "staff":
  1212.             p2Speed = (float) (p2Speed * 1.2);
  1213.             p2Attack = (float) ((p2Attack * 1.2) +3);
  1214.             break;
  1215.         default:
  1216.             System.out.println("Interpreted as 'none'");
  1217.             break;
  1218.         }
  1219.  
  1220.         System.out.println("---BATTLE---");
  1221.         System.out.println("");
  1222.         System.out.println("");
  1223.         System.out.println("");
  1224.     }
  1225.     public static int RandInt(float a, float b)
  1226.     {
  1227.         Randint = (int) (a + (Math.random() * (b - a + 1)));
  1228.         return Randint;
  1229.     }
  1230.     public static void P1PostCombatEffects()
  1231.     {
  1232.         RandInt(1,30);
  1233.         if (isP1Confused)
  1234.         {
  1235.             RandInt(1,5);
  1236.             if (Randint >= 3)
  1237.             {
  1238.                 if (!noOutput)
  1239.                 {
  1240.                     System.out.print(p1Name);
  1241.                     System.out.println(" is no longer confused.");
  1242.                 }
  1243.                 isP1Confused = false;
  1244.             }
  1245.         }
  1246.         if (isP2Confused == false && p1Bludgeoner == false && Randint == 30)
  1247.         {
  1248.             isP2Confused = true;
  1249.             if (!noOutput)
  1250.             {
  1251.                 System.out.print(p2Name);
  1252.                 System.out.println(" is now confused!");
  1253.             }
  1254.         }
  1255.         if (isP2Confused == false && p1Bludgeoner == true && Randint >= 29)
  1256.         {
  1257.             isP2Confused = true;
  1258.             if (!noOutput)
  1259.             {
  1260.                 System.out.print(p2Name);
  1261.                 System.out.println(" is now confused!");
  1262.             }
  1263.         }
  1264.         if (isP1Stunned)
  1265.         {
  1266.             RandInt(1,3);
  1267.             if (Randint == 1)
  1268.             {
  1269.                 if (!noOutput)
  1270.                 {
  1271.                     System.out.print(p1Name);
  1272.                     System.out.println(" is no longer Stunned.");
  1273.                 }
  1274.                 isP1Stunned = false;
  1275.             }
  1276.         }
  1277.         RandInt(1,30);
  1278.         if (isP2Stunned == false && p1Bludgeoner == false && Randint == 30)
  1279.         {
  1280.             isP2Stunned = true;
  1281.             if (!noOutput)
  1282.             {
  1283.                 System.out.print(p2Name);
  1284.                 System.out.println(" is now Stunned!");
  1285.             }
  1286.         }
  1287.         if (isP2Stunned == false && p1Bludgeoner && Randint >= 29)
  1288.         {
  1289.             isP2Stunned = true;
  1290.             if (!noOutput)
  1291.             {
  1292.                 System.out.print(p2Name);
  1293.                 System.out.println(" is now Stunned!");
  1294.             }
  1295.         }
  1296.         //Others
  1297.         if (p1Burner && damage != 0 && isP2Burning == false)
  1298.         {
  1299.             RandInt(1,6);
  1300.             if (Randint == 6)
  1301.             {
  1302.                 isP2Burning = true;
  1303.                 if (!noOutput)
  1304.                 {
  1305.                     System.out.print(p2Name);
  1306.                     System.out.println(" caught fire!");
  1307.                 }
  1308.             }
  1309.         }
  1310.         if (isP2Burning)
  1311.         {
  1312.             if (!noOutput)
  1313.             {
  1314.                 System.out.print(p2Name);
  1315.                 System.out.print(" is on fire!  ");
  1316.             }
  1317.             RandInt(200, 600);
  1318.             damage = Randint;
  1319.             RandInt(1, 2);
  1320.             damage = (float) damage / (Randint * p2Defense);
  1321.             if (!noOutput)
  1322.             {
  1323.                 System.out.print((int) damage);
  1324.                 System.out.print(" damage taken as a result.  ");
  1325.                 p2Health = (float) (p2Health - damage);
  1326.                 if (p2Health > 0)
  1327.                     System.out.print((int) p2Health);
  1328.                 if (p2Health <= 0)
  1329.                     System.out.print("0");
  1330.                 System.out.println(" health left.");
  1331.             }
  1332.             RandInt(1, 5);
  1333.             if (Randint == 1)
  1334.             {
  1335.                 if (!noOutput)
  1336.                 {
  1337.                     System.out.print(p2Name);
  1338.                     System.out.println(" is no longer burning.");
  1339.                 }
  1340.                 isP2Burning = false;
  1341.             }
  1342.         }
  1343.         if (p1Poisoner && damage != 0 && isP2Poisoned == false)
  1344.         {
  1345.             RandInt(1,7);
  1346.             if (Randint == 6)
  1347.             {
  1348.                 isP2Poisoned = true;
  1349.                 if (!noOutput)
  1350.                 {
  1351.                     System.out.print(p2Name);
  1352.                     System.out.println(" has been poisoned!");
  1353.                 }
  1354.             }
  1355.         }
  1356.         if (isP2Poisoned)
  1357.         {
  1358.             if (!noOutput)
  1359.             {
  1360.                 System.out.print(p2Name);
  1361.                 System.out.print(" is poisoned!  ");
  1362.             }
  1363.             RandInt(300, 600);
  1364.             damage = Randint;
  1365.             RandInt(1, 2);
  1366.             damage = (float) damage / (Randint * p2Defense);
  1367.             if (!noOutput)
  1368.             {
  1369.                 System.out.print((int) damage);
  1370.                 System.out.print(" damage taken as a result.  ");
  1371.             }
  1372.             p2Health = (float) (p2Health - damage);
  1373.             if (!noOutput)
  1374.             {
  1375.                 if (p2Health > 0)
  1376.                     System.out.print((int) p2Health);
  1377.                 if (p2Health <= 0)
  1378.                     System.out.print("0");
  1379.                 System.out.println(" health left.");
  1380.             }
  1381.             RandInt(1, 4);
  1382.             if (Randint == 1)
  1383.             {
  1384.                 if (!noOutput)
  1385.                 {
  1386.                     System.out.print(p2Name);
  1387.                     System.out.println(" is no longer poisoned.");
  1388.                     isP2Poisoned = false;
  1389.                 }
  1390.             }
  1391.         }
  1392.         if (damage != 0 && isP2Bleeding == false)
  1393.         {
  1394.             RandInt(1,15);
  1395.             if (Randint == 1)
  1396.             {
  1397.                 isP2Bleeding = true;
  1398.                 if (!noOutput)
  1399.                 {
  1400.                     System.out.print(p2Name);
  1401.                     System.out.println(" is now bleeding!");
  1402.                 }
  1403.             }
  1404.         }
  1405.         if (isP2Bleeding)
  1406.         {
  1407.             if (!noOutput)
  1408.             {
  1409.                 System.out.print(p2Name);
  1410.                 System.out.print(" is bleeding!  ");
  1411.             }
  1412.             RandInt(150, 280);
  1413.             damage = Randint;
  1414.             RandInt(1, 2);
  1415.             damage = (float) damage / (Randint * p2Defense);
  1416.             if (!noOutput)
  1417.             {
  1418.                 System.out.print((int) damage);
  1419.                 System.out.print(" damage taken as a result.  ");
  1420.             }
  1421.             p2Health = (float) (p2Health - damage);
  1422.             if (!noOutput)
  1423.             {
  1424.                 if (p1Health > 0)
  1425.                     System.out.print((int) p2Health);
  1426.                 if (p1Health <= 0)
  1427.                     System.out.print("0");
  1428.                 System.out.println(" health left.");
  1429.             }
  1430.             RandInt(1, 5);
  1431.             if (Randint != 5)
  1432.             {
  1433.                 if (!noOutput)
  1434.                 {
  1435.                     System.out.print(p2Name);
  1436.                     System.out.println(" is no longer bleeding.");
  1437.                 }
  1438.                 isP2Bleeding = false;
  1439.             }
  1440.         }
  1441.         if (isP1Enraged == true)
  1442.         {
  1443.             RandInt(1,2);
  1444.             if (Randint == 1)
  1445.             {
  1446.                 if (!noOutput)
  1447.                 {
  1448.                     System.out.print(p1Name);
  1449.                     System.out.println(" is no longer enraged.");
  1450.                 }
  1451.                 isP1Enraged = false;
  1452.             }
  1453.         }
  1454.         RandInt(1,45);
  1455.         if (isP2Enraged == false && p2RageIncrease == false && Randint == 45)
  1456.         {
  1457.             isP2Enraged = true;
  1458.             if (!noOutput)
  1459.             {
  1460.                 System.out.print(p2Name);
  1461.                 System.out.println(" is now enraged!");
  1462.             }
  1463.         }
  1464.         if (isP2Enraged == false && p2RageIncrease && Randint >= 43)
  1465.         {
  1466.             isP2Enraged = true;
  1467.             if (!noOutput)
  1468.             {
  1469.                 System.out.print(p2Name);
  1470.                 System.out.println(" is now enraged!");
  1471.             }
  1472.         }
  1473.         if (isP2Jarated)
  1474.         {
  1475.             RandInt(1,5);
  1476.             if (Randint == 1 || Randint == 2)
  1477.             {
  1478.                 if (!noOutput)
  1479.                 {
  1480.                     System.out.print(p2Name);
  1481.                     System.out.println(" has recovered from jarate.");
  1482.                 }
  1483.                 isP2Jarated = false;
  1484.             }
  1485.         }
  1486.         if (isP2Jarated == false)
  1487.         {
  1488.             RandInt(1,35);
  1489.             if (Randint == 1)
  1490.             {
  1491.                 isP2Jarated = true;
  1492.                 if (!noOutput)
  1493.                 {
  1494.                     System.out.print(p2Name);
  1495.                     System.out.println(" has been jarated!");
  1496.                 }
  1497.             }
  1498.         }
  1499.     }
  1500.     public static void P2PostCombatEffects()
  1501.     {
  1502.         if (isP2Confused)
  1503.         {
  1504.             RandInt(1,5);
  1505.             if (Randint >= 3)
  1506.             {
  1507.                 if (!noOutput)
  1508.                 {
  1509.                     System.out.print(p2Name);
  1510.                     System.out.println(" is no longer confused.");
  1511.                 }
  1512.                 isP2Confused = false;
  1513.             }
  1514.         }
  1515.         RandInt(1,30);
  1516.         if (isP1Confused == false && p2Bludgeoner == false && Randint == 30)
  1517.         {
  1518.             isP1Confused = true;
  1519.             if (!noOutput)
  1520.             {
  1521.                 System.out.print(p1Name);
  1522.                 System.out.println(" is now confused!");
  1523.             }
  1524.         }
  1525.         if (isP1Confused == false && p2Bludgeoner && Randint >= 29)
  1526.         {
  1527.             isP1Confused = true;
  1528.             if (!noOutput)
  1529.             {
  1530.                 System.out.print(p1Name);
  1531.                 System.out.println(" is now confused!");
  1532.             }
  1533.         }
  1534.         RandInt(1,30);
  1535.         if (isP2Stunned)
  1536.         {
  1537.             RandInt(1,3);
  1538.             if (Randint == 1)
  1539.             {
  1540.                 if (!noOutput)
  1541.                 {
  1542.                     System.out.print(p2Name);
  1543.                     System.out.println(" is no longer Stunned.");
  1544.                 }
  1545.                 isP2Stunned = false;
  1546.             }
  1547.         }
  1548.         if (!isP1Stunned && !p2Bludgeoner && Randint == 30)
  1549.         {
  1550.             isP1Stunned = true;
  1551.             if (!noOutput)
  1552.             {
  1553.                 System.out.print(p1Name);
  1554.                 System.out.println(" is now Stunned!");
  1555.             }
  1556.         }
  1557.         if (!isP1Stunned && p2Bludgeoner && Randint >= 29)
  1558.         {
  1559.             isP1Stunned = true;
  1560.             if (!noOutput)
  1561.             {
  1562.                 System.out.print(p1Name);
  1563.                 System.out.println(" is now Stunned!");
  1564.             }
  1565.         }
  1566.         if (p2Burner && damage != 0 && !isP1Burning)
  1567.         {
  1568.             RandInt(1,6);
  1569.             if (Randint == 6)
  1570.             {
  1571.                 isP1Burning = true;
  1572.                 if (!noOutput)
  1573.                 {
  1574.                     System.out.print(p1Name);
  1575.                     System.out.println(" caught fire!");
  1576.                 }
  1577.             }
  1578.         }
  1579.         if (isP1Burning)
  1580.         {
  1581.             if (!noOutput)
  1582.             {
  1583.                 System.out.print(p1Name);
  1584.                 System.out.print(" is on fire!  ");
  1585.             }
  1586.             RandInt(200, 600);
  1587.             damage = Randint;
  1588.             RandInt(1, 2);
  1589.             damage = (float) damage / (Randint * p1Defense);
  1590.             if (!noOutput)
  1591.             {
  1592.                 System.out.print((int) damage);
  1593.                 System.out.print(" damage taken as a result.  ");
  1594.             }
  1595.             p1Health = (float) (p1Health - damage);
  1596.             if (!noOutput)
  1597.             {
  1598.                 if (p1Health > 0)
  1599.                     System.out.print((int) p1Health);
  1600.                 if (p1Health <= 0)
  1601.                     System.out.print("0");
  1602.                 System.out.println(" health left.");
  1603.             }
  1604.             RandInt(1, 5);
  1605.             if (Randint == 1)
  1606.             {
  1607.                 if (!noOutput)
  1608.                 {
  1609.                     System.out.print(p1Name);
  1610.                     System.out.println(" is no longer burning.");
  1611.                 }
  1612.                 isP1Burning = false;
  1613.             }
  1614.         }
  1615.         if (p2Poisoner && damage != 0 && !isP1Poisoned)
  1616.         {
  1617.             RandInt(1,7);
  1618.             if (Randint == 5)
  1619.             {
  1620.                 isP1Poisoned = true;
  1621.                 if (!noOutput)
  1622.                 {
  1623.                     System.out.print(p1Name);
  1624.                     System.out.println(" has been poisoned!");
  1625.                 }
  1626.             }
  1627.         }
  1628.         if (isP1Poisoned)
  1629.         {
  1630.             if (!noOutput)
  1631.             {
  1632.                 System.out.print(p1Name);
  1633.                 System.out.print(" is poisoned!  ");
  1634.             }
  1635.             RandInt(300, 500);
  1636.             damage = Randint;
  1637.             RandInt(1, 2);
  1638.             damage = (float) damage / (Randint * p1Defense);
  1639.             if (!noOutput)
  1640.             {
  1641.                 System.out.print((int) damage);
  1642.                 System.out.print(" damage taken as a result.  ");
  1643.             }
  1644.             p1Health = (float) (p1Health - damage);
  1645.             if (!noOutput)
  1646.             {
  1647.                 if (p1Health > 0)
  1648.                     System.out.print((int) p1Health);
  1649.                 if (p1Health <= 0)
  1650.                     System.out.print("0");
  1651.                 System.out.println(" health left.");
  1652.             }
  1653.             RandInt(1, 4);
  1654.             if (Randint == 1)
  1655.             {
  1656.                 if (!noOutput)
  1657.                 {
  1658.                     System.out.print(p1Name);
  1659.                     System.out.println(" is no longer poisoned.");
  1660.                 }
  1661.                 isP1Poisoned = false;
  1662.             }
  1663.         }
  1664.         if (damage != 0 && isP1Bleeding == false)
  1665.         {
  1666.             RandInt(1,15);
  1667.             if (Randint == 1)
  1668.             {
  1669.                 isP1Bleeding = true;
  1670.                 if (!noOutput)
  1671.                 {
  1672.                     System.out.print(p1Name);
  1673.                     System.out.println(" is now bleeding!");
  1674.                 }
  1675.             }
  1676.         }
  1677.         if (isP1Bleeding)
  1678.         {
  1679.             if (!noOutput)
  1680.             {
  1681.                 System.out.print(p1Name);
  1682.                 System.out.print(" is bleeding!  ");
  1683.             }
  1684.             RandInt(150, 280);
  1685.             damage = Randint;
  1686.             RandInt(1, 2);
  1687.             damage = (float) damage / (Randint * p1Defense);
  1688.             if (!noOutput)
  1689.             {
  1690.                 System.out.print((int) damage);
  1691.                 System.out.print(" damage taken as a result.  ");
  1692.             }
  1693.             p1Health = (float) (p1Health - damage);
  1694.             if (!noOutput)
  1695.             {
  1696.                 if (p1Health > 0)
  1697.                     System.out.print((int) p1Health);
  1698.                 if (p1Health <= 0)
  1699.                     System.out.print("0");
  1700.                 System.out.println(" health left.");
  1701.             }
  1702.             RandInt(1, 5);
  1703.             if (Randint != 5)
  1704.             {
  1705.                 if (!noOutput)
  1706.                 {
  1707.                     System.out.print(p1Name);
  1708.                     System.out.println(" is no longer bleeding.");
  1709.                     isP1Bleeding = false;
  1710.                 }
  1711.             }
  1712.         }
  1713.         if (isP2Enraged)
  1714.         {
  1715.             RandInt(1,2);
  1716.             if (Randint == 1)
  1717.             {
  1718.                 if (!noOutput)
  1719.                 {
  1720.                     System.out.print(p2Name);
  1721.                     System.out.println(" is no longer enraged.");
  1722.                 }
  1723.                 isP2Enraged = false;
  1724.             }
  1725.         }
  1726.         RandInt(1,45);
  1727.         if (isP1Enraged == false && p1RageIncrease == false && Randint == 45)
  1728.         {
  1729.             isP1Enraged = true;
  1730.             if (!noOutput)
  1731.             {
  1732.                 System.out.print(p1Name);
  1733.                 System.out.println(" is now enraged!");
  1734.             }
  1735.         }
  1736.         if (isP1Enraged == false && p1RageIncrease == true && Randint >= 43)
  1737.         {
  1738.             isP1Enraged = true;
  1739.             if (!noOutput)
  1740.             {
  1741.                 System.out.print(p1Name);
  1742.                 System.out.println(" is now enraged!");
  1743.             }
  1744.         }
  1745.         if (isP1Jarated)
  1746.         {
  1747.             RandInt(1,5);
  1748.             if (Randint == 1 || Randint == 2)
  1749.             {
  1750.                 if (!noOutput)
  1751.                 {
  1752.                     System.out.print(p1Name);
  1753.                     System.out.println(" has recovered from jarate.");
  1754.                 }
  1755.                 isP1Jarated = false;
  1756.             }
  1757.         }
  1758.         if (!isP1Jarated)
  1759.         {
  1760.             RandInt(1,35);
  1761.             if (Randint == 1)
  1762.             {
  1763.                 isP1Jarated = true;
  1764.                 if (!noOutput)
  1765.                 {
  1766.                     System.out.print(p1Name);
  1767.                     System.out.println(" has been jarated!");
  1768.                 }
  1769.             }
  1770.         }
  1771.     }
  1772. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement