Attack Skill is a core combat mechanic in Remixed Dungeon that determines the chance of successfully hitting an enemy with attacks.
The attack skill is calculated in the Char.java file as part of the attackSkill method:
public int attackSkill(Char target) { int[] bf = {0}; forEachBuff(b -> bf[0] += b.attackSkillBonus(this)); int bonus = bf[0]; float accuracy = (float) Math.pow(1.4, bonus); if (target == null) { // Mainly to mask bug in Remixed RPG target = CharsList.DUMMY; } if (rangedWeapon.valid() && level().distance(getPos(), target.getPos()) == 1) { accuracy *= 0.5f; } float mainAccuracyFactor = getActiveWeapon().accuracyFactor(this); float secondaryAccuracyFactor = getSecondaryWeapon().accuracyFactor(this); float skillFactor = Utils.min(20f, mainAccuracyFactor, secondaryAccuracyFactor); int aSkill = (int) ((baseAttackSkill + lvl()) * accuracy * skillFactor); GLog.debug("%s attacking %s with factor %2.2f, resulting skill %d", getEntityKind(), target.getEntityKind(), skillFactor, aSkill); return aSkill; }
baseAttackSkill field in Char classbaseAttackSkill + lvl()baseAttackSkill + lvl() in the calculationattackSkillBonus increases the skillMath.pow(1.4, bonus)getActiveWeapon().accuracyFactor(this) and getSecondaryWeapon().accuracyFactor(this)CharUtils.java, Random.Float(attacker.attackSkill(defender)) > Random.Float(defender.defenseSkill(attacker))The Hero class has a special attack skill calculation that can be enhanced by subclass:
// In Hero.java public int attackSkill(Char target) { float attackSkillFactor = 1; if (getSubClass() == HeroSubClass.GLADIATOR) { attackSkillFactor *= 1.2; } return (int) (super.attackSkill(target) * attackSkillFactor); }
Random.Float(attacker.attackSkill(defender)) > Random.Float(defender.defenseSkill(attacker))