Thread: Almost perfect formula for range

Results 1 to 3 of 3
  1. #1 Almost perfect formula for range 
    Registered Member shoopdawhoop's Avatar
    Join Date
    Apr 2009
    Posts
    677
    Thanks
    10
    Thanked 18 Times in 12 Posts
    Rep Power
    57
    here's my range formula code
    Code:
    public int maxRangeHit2()
    {
    	double a = playerLevel[playerRanged] / 10; //9.9
    	double b = a + playerLevel[playerRanged]; //108.9
    	double c = b / 10; //10.89
    	double d = 0;//120
    	if(hasCrystalBow()) {
    		d = 70;
    	} else if(!hasCrystalBow() && (playerEquipment[playerArrows] == 882 || playerEquipment[playerArrows] == 883)) {
    		d = 1.37;
    	} else if(!hasCrystalBow() && (playerEquipment[playerArrows] == 884 || playerEquipment[playerArrows] == 885)) {
    		d = 1.87;
    	} else if(!hasCrystalBow() && (playerEquipment[playerArrows] == 886 || playerEquipment[playerArrows] == 887)) {
    		d = 2.88;
    	} else if(!hasCrystalBow() && (playerEquipment[playerArrows] == 888 || playerEquipment[playerArrows] == 889)) {
    		d = 3.88;
    	} else if(!hasCrystalBow() && (playerEquipment[playerArrows] == 890 || playerEquipment[playerArrows] == 891)) {
    		d = 5.38;
    	} else if(!hasCrystalBow() && (playerEquipment[playerArrows] == 892 || playerEquipment[playerArrows] == 893)) {
    		d = 8.70;
    	} else if(!hasCrystalBow() && (playerEquipment[playerArrows] == 882 || playerEquipment[playerArrows] == 883)) {
    		d = 1.50;
    	} else if(!hasCrystalBow() && (playerEquipment[playerArrows] == 9245)) {
    		d = 120;
    	} else {
    		d = 0.00;
    	}
    	int e = (int)Math.floor(d)/80 + (int)Math.floor(d);
    	int f = (int)Math.floor(d) * playerLevel[playerRanged];
    	int g = f / 640;
    	return (int) g;
    }
    i'm testing with onyx bolts(e) and my max hit is 18
    when it should be 30
    where's the mistake?
    if(WomanLocation != Kitchen)
    {
    DivideByZero();
    }
    Reply With Quote  
     

  2. #2  
    Registered Member

    Join Date
    Sep 2007
    Posts
    553
    Thanks
    7
    Thanked 5 Times in 4 Posts
    Rep Power
    96
    try this

    Code:
    	} else if(!hasCrystalBow() && (playerEquipment[playerArrows] == 9245)) {
    		d = 9.90;
    Reply With Quote  
     

  3. #3  
    Registered Member shoopdawhoop's Avatar
    Join Date
    Apr 2009
    Posts
    677
    Thanks
    10
    Thanked 18 Times in 12 Posts
    Rep Power
    57
    Quote Originally Posted by lemby pk View Post
    try this

    Code:
    	} else if(!hasCrystalBow() && (playerEquipment[playerArrows] == 9245)) {
    		d = 9.90;
    didn't work
    if(WomanLocation != Kitchen)
    {
    DivideByZero();
    }
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •