PDA

View Full Version : (317-377) Void Bonus Calculation



Shaun
July 4th, 2010, 11:19
Well, most people only have a boolean checking if the player is equiping void and then increasing there damage by a set amount. This is a method of doing it to increase Range/Melee/Mage by 15% like it should. I won't walk you through how to implement it, but I included a way of checking for void and increasing at the bottom.





public boolean hasVoid(String type) {
int robes[] = {1, 2}; //Void Robe id's
int hats[] = {3, 4, 5}; //Void Hat id's

if (playerEquipment[playerChest] == robes[1] && playerEquipment[playerLegs] == robes[2]) { //If player has Void robes

if (type == "RANGE" && playerEquipment[playerHat] == hats[1]) { //Range hat
return true;
}
if (type == "MELEE" && playerEquipment[playerHat] == hats[2]) { //Melee hat
return true;
}
if (type == "MAGIC" && playerEquipment[playerHat] == hats[3]) { //Magic hat
return true;
}
}
return false;
}

public double percentage(int amt, int percent) {
double result;
result = ((double)amt / 100) * percent;
return result;
}

Add something similar to this at the top of your range maxhit method. Will be different than mine.



if (hasVoid("RANGE")) {
Range = ((int) percentage(playerLevel[playerRanged], 15)) + playerLevel[playerRanged];
}

So the above code will increase my range by 14.85 levels is my range is 99 rounded to 15. So basically if I have void equiped my range would be 114.

Mohammad
July 14th, 2010, 09:47
I already have a tutorial for that...
Any ways good job :P.

Shaun
July 14th, 2010, 16:18
I already have a tutorial for that...
Any ways good job :P.

Thanks.