Example #1
0
 public double getAccuracy() {
   int base = p.skillLvl[6];
   if (p.usingPrayer(4)) base *= 1.05;
   if (p.usingPrayer(12)) base *= 1.10;
   if (p.usingPrayer(21)) base *= 1.15;
   double divider = 255.00;
   return base / divider;
 }
Example #2
0
 public double magicAccuracy(Player opp) {
   double magic = p.skillLvl[6];
   double defence = opp.skillLvl[1];
   double oppMagic = opp.skillLvl[6];
   double magicOffense = p.equipmentBonus[3];
   double magicDefence = opp.equipmentBonus[8];
   if (p.usingPrayer(4)) {
     magic *= 1.05;
   }
   if (p.usingPrayer(12)) {
     magic *= 1.10;
   }
   if (p.usingPrayer(21)) {
     magic *= 1.15;
   }
   if (opp.usingPrayer(4)) {
     oppMagic *= 1.05;
   }
   if (opp.usingPrayer(12)) {
     oppMagic *= 1.10;
   }
   if (opp.usingPrayer(17)) { // Protect from Magic <-- Coded by Shahir!!
     magic -= 0.50;
   }
   if (opp.usingPrayer(21)) {
     oppMagic *= 1.15;
   }
   if (opp.usingPrayer(0)) {
     defence *= 1.05;
   }
   if (opp.usingPrayer(5)) {
     defence *= 1.10;
   }
   if (opp.usingPrayer(13)) {
     defence *= 1.15;
   }
   if (opp.usingPrayer(25)) {
     defence *= 1.20;
   }
   if (opp.usingPrayer(26)) {
     defence *= 1.25;
   }
   if (opp.attackStyle() == 4) {
     defence += 1;
   }
   if (opp.attackStyle() == 3) {
     defence += 3;
   }
   double offensiveAttribute = magic + magicOffense;
   double defensiveAttribute = (defence * 0.30) + (oppMagic * 0.70) + magicDefence;
   double difference = Math.abs(offensiveAttribute - defensiveAttribute);
   boolean positive = offensiveAttribute > defensiveAttribute;
   double interval = difference * 0.0040;
   double percentage = 0.65;
   if (!positive) {
     percentage -= interval;
   }
   if (positive) {
     percentage += interval;
   }
   if (p.voidSet(3)) {
     percentage *= 1.30;
   }
   return percentage;
 }