how is RSC accuracy chance calculated?
Offline
Far from this servers "formula" but im sure you get the picture:
public static int calculateMaxCombatHit(double strMod, int str,
int fightMode, int wepPower) {
final int[] FIGHT_MODE_STR_BONUSES = new int[] { 1, 3, 0, 0 };
double rawResult = ((strMod * str) + FIGHT_MODE_STR_BONUSES[fightMode])
* ((wepPower * 0.00175) + 0.1) + 1.05;
return (int) Math.ceil(rawResult);
}
public static int calculateCombatHit(Mob att, Mob def) {
final int[] FIGHT_MODE_ATT_BONUSES = new int[] { 1, 0, 3, 0 };
final int[] FIGHT_MODE_DEF_BONUSES = new int[] { 1, 0, 0, 3 };
final double[] mods = { 1, 1, 1 };
int mode = 0;
if (att instanceof Player)
mode = ((Player) att).getCombatStyle();
int defMode = 0;
if (def instanceof Player)
defMode = ((Player) def).getCombatStyle();
int max = calculateMaxCombatHit(mods[2], att.getStrength(), mode, att
.getWeaponPowerPoints());
int ourAttack = ((int) (att.getAttack() * mods[0]))
+ FIGHT_MODE_ATT_BONUSES[mode];
double wepAim = att.getWeaponAimPoints() * 0.71;
int enemyDef = ((int) (def.getDefense() * mods[1]))
+ FIGHT_MODE_DEF_BONUSES[defMode];
double defPoints = def.getArmourPoints() * 0.47;
double probabilityOfHit = ((ourAttack + wepAim) - (enemyDef + defPoints)) / 100 + 0.6;
double rand = Math.random();
double maxrand = Math.random();
int hit = 0;
if (probabilityOfHit < ourAttack * 0.001)
probabilityOfHit = ourAttack * 0.001;
if (probabilityOfHit > 1)
maxrand += Math.random() * ((probabilityOfHit - 1) / 10);
if (maxrand > 1)
maxrand = 1;
if (probabilityOfHit > rand)
hit = (int) (maxrand * max);
return hit;
}
Offline
Copyright 2024 RSCEmulation
26 Mar 2018 02:12:41 #1