Advertisement
Guest User

Untitled

a guest
May 26th, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.74 KB | None | 0 0
  1. import java.util.Scanner;
  2. /**
  3. * Write a description of class demacianJustice here.
  4. *
  5. * @author (your name)
  6. * @version (a version number or a date)
  7. */
  8.  
  9. public class demacianJustice
  10. {
  11.  
  12. public static void main(String[] args)
  13. {
  14. Scanner input = new Scanner( System.in );
  15. System.out.println("Input the Garen ultimate rank");
  16. int rank=input.nextInt();
  17. System.out.println("Input the enemies magic resist");
  18. int resist=input.nextInt();
  19. System.out.println("Input the enemies maximum hp");
  20. int hp=input.nextInt();
  21. System.out.println("21 Offense masteries? (1/0)?");
  22. int mast=input.nextInt();
  23.  
  24. if(mast==0)
  25. {
  26. int i=0;
  27. for(i=0; i<=5; i++)
  28. {
  29. System.out.printf("Garen ultimate will kill a %4d hp target at %4.2f hp or less\n",(hp+100*i),calcDmg(rank,resist,(hp+100*i)));
  30.  
  31. }
  32. }
  33. if(mast==1)
  34. {
  35. int j=0;
  36. for(j=0; j<=5; j++)
  37. {
  38. System.out.printf("Garen ultimate will kill a %4d hp target at %4.2f hp with 21Off\n",(hp+100*j),calcDmgO(rank,resist,(hp+100*j)));
  39.  
  40. }
  41. }
  42.  
  43. }
  44.  
  45. public static double calcDmg(int rank, int resist, int hp)
  46. {
  47. double result=0;
  48. double mr=resist;
  49. double m=100/(100+mr);
  50. //Demacian justice damage =175/350/550+28.57%//33.33%//40% missing hp
  51. //Kill when damage*missing hp=(hp-missing hp)
  52. //(100/100+resist)*damage(x)=hp-x
  53. //rank 1
  54. //damage=(175+.2857x)*mitigation=hp-x
  55. //x=(hp-(175*m)/(1+.2857*m)
  56. if (rank==1)
  57. {
  58. result=(hp-(175*m))/(1+(.2857*m));
  59. }
  60. if (rank==2)
  61. {
  62. result=(hp-(350*m))/(1+(.333333*m));
  63. }
  64. if (rank==3)
  65. {
  66. result=(hp-(525*m))/(1+((0.4)*m));
  67. }
  68. return (hp-result);
  69. }
  70.  
  71. public static double calcDmgO(int rank, int resist, int hp)
  72. {
  73. double result=0;
  74. double mr=resist;
  75. double m=1.134*100/(100+mr);
  76. //Demacian justice damage =175/350/550+28.57%//33.33%//40% missing hp
  77. //Kill when damage*missing hp=(hp-missing hp)
  78. //(100/100+resist)*damage(x)=hp-x
  79. //rank 1
  80. //damage=(175+.2857x)*mitigation*1.134=hp-x
  81. //x=(hp-(175*m*1.134)/(1+.2857*m*1.134)
  82. if (rank==1)
  83. {
  84. result=(hp-(175*m))/(1+(.2857*m));
  85. }
  86. if (rank==2)
  87. {
  88. result=(hp-(350*m))/(1+(.333333*m));
  89. }
  90. if (rank==3)
  91. {
  92. result=(hp-(525*m))/(1+((0.4)*m));
  93. }
  94. return (hp-result);
  95. }
  96. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement