Evasion is a core combat mechanic in Remixed Dungeon that represents the ability to dodge incoming attacks, primarily determined by the character's defense skill.
The evasion calculation is part of the defense skill system in the Char.java file:
public int defenseSkill(Char enemy) { // ... base calculation ... final int[] bf = {0}; forEachBuff(b -> bf[0] += b.defenceSkillBonus(this)); int bonus = bf[0]; float evasion = (float) Math.pow(1.2, bonus); if (paralysed) { evasion /= 2; } // ... armor encumbrance calculation ... int aEnc = getItemFromSlot(Belongings.Slot.ARMOR).requiredSTR() - effectiveSTR(); if (aEnc > 0) { return (int) (defenseSkill * evasion / Math.pow(1.5, aEnc)); } else { if (getHeroClass() == HeroClass.ROGUE) { if (getCurAction() != null && getSubClass() == HeroSubClass.FREERUNNER && !isStarving()) { evasion *= 2; } return (int) ((defenseSkill - aEnc) * evasion); } else { return (int) (defenseSkill * evasion); } } }
Math.pow(1.2, bonus) where bonus is the sum of all defenceSkillBonus from buffsevasion /= 2)if (paralysed) { evasion /= 2; }getItemFromSlot(Belongings.Slot.ARMOR).requiredSTR() - effectiveSTR()aEnc > 0), evasion is reduced by Math.pow(1.5, aEnc)evasion *= 2)Random.Float(attacker.attackSkill(defender)) > Random.Float(defender.defenseSkill(attacker))defenceSkillBonus will affect evasion