Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- /**
- * Write a description of class demacianJustice here.
- *
- * @author (your name)
- * @version (a version number or a date)
- */
- public class demacianJustice
- {
- public static void main(String[] args)
- {
- Scanner input = new Scanner( System.in );
- System.out.println("Input the Garen ultimate rank");
- int rank=input.nextInt();
- System.out.println("Input the enemies magic resist");
- int resist=input.nextInt();
- System.out.println("Input the enemies maximum hp");
- int hp=input.nextInt();
- System.out.println("21 Offense masteries? (1/0)?");
- int mast=input.nextInt();
- if(mast==0)
- {
- int i=0;
- for(i=0; i<=5; i++)
- {
- 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)));
- }
- }
- if(mast==1)
- {
- int j=0;
- for(j=0; j<=5; j++)
- {
- 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)));
- }
- }
- }
- public static double calcDmg(int rank, int resist, int hp)
- {
- double result=0;
- double mr=resist;
- double m=100/(100+mr);
- //Demacian justice damage =175/350/550+28.57%//33.33%//40% missing hp
- //Kill when damage*missing hp=(hp-missing hp)
- //(100/100+resist)*damage(x)=hp-x
- //rank 1
- //damage=(175+.2857x)*mitigation=hp-x
- //x=(hp-(175*m)/(1+.2857*m)
- if (rank==1)
- {
- result=(hp-(175*m))/(1+(.2857*m));
- }
- if (rank==2)
- {
- result=(hp-(350*m))/(1+(.333333*m));
- }
- if (rank==3)
- {
- result=(hp-(525*m))/(1+((0.4)*m));
- }
- return (hp-result);
- }
- public static double calcDmgO(int rank, int resist, int hp)
- {
- double result=0;
- double mr=resist;
- double m=1.134*100/(100+mr);
- //Demacian justice damage =175/350/550+28.57%//33.33%//40% missing hp
- //Kill when damage*missing hp=(hp-missing hp)
- //(100/100+resist)*damage(x)=hp-x
- //rank 1
- //damage=(175+.2857x)*mitigation*1.134=hp-x
- //x=(hp-(175*m*1.134)/(1+.2857*m*1.134)
- if (rank==1)
- {
- result=(hp-(175*m))/(1+(.2857*m));
- }
- if (rank==2)
- {
- result=(hp-(350*m))/(1+(.333333*m));
- }
- if (rank==3)
- {
- result=(hp-(525*m))/(1+((0.4)*m));
- }
- return (hp-result);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement