public static double getAccuracy(CombatType type, Player atker, Player opp) { int bonus = 1; int defBonusAttribute = 1; int level = 0; if(type == CombatType.MELEE) { level = 0; bonus = atker.skillId - 1; } if(type == CombatType.RANGE) { level = 4; bonus = 4; } if(type == CombatType.MAGIC) { level = 6; bonus = 3; defBonusAttribute = 8; } if(bonus < 0) { bonus = 0; } if(type != CombatType.MAGIC) { defBonusAttribute = bonus + 5; } double atkBonus = atker.playerBonus[bonus] < 1 ? 0 : atker.playerBonus[bonus]; double defBonus = opp.playerBonus[defBonusAttribute] < 1 ? 0 : opp.playerBonus[defBonusAttribute]; double atk = (atkBonus * atker.playerLevel[level]); double def = (defBonus * opp.playerLevel[1]); atk += (type == CombatType.MAGIC) ? 2 : 3; int wep = atker.playerEquipment[atker.playerWeapon]; if(wep == 8907) { atk = atk * 0.45; } if(atker.UsingSpecial) { switch(wep) { case 1434: case 5698 : atk = atk * 1.55; break; case 8086: case 4153: atk = atk * 1.30; break; } } double prayAtkBonus = 1 + (atker.AtkPray / 100); double prayDefBonus = 1 + (opp.DefPray / 100); if(prayAtkBonus < 0) { prayAtkBonus = 1.0; } if(prayDefBonus < 0) { prayDefBonus = 1.0; } if(type == CombatType.MELEE) { if(opp.HeadPray == 3) { def = def * 1.5; } } if(type == CombatType.RANGE) { if(opp.HeadPray == 2) { def = def * 1.5; } } atk = atk * prayAtkBonus; def = def * prayDefBonus; double outCome = MODIFIER * (atk/def); return outCome; }