====== Accuracy ======
==== Overview ====
**Accuracy** in Remixed Dungeon represents the chance to successfully hit an enemy with an attack. It is a crucial combat mechanic that determines whether your attacks land or miss.
==== How Accuracy Works ====
Accuracy is calculated based on:
* **Attacker's Attack Skill** - Base attack skill plus the character's level
* **Defender's Defense Skill** - The target's evasion value
* **Weapon Accuracy Factor** - Encumbrance of equipped weapons relative to the wielder's Strength
* **Buffs/Debuffs** - Effects like Bless, Fury, etc. that modify attack or defense skill
The actual hit check (see ''CharUtils.hit()'') compares two random rolls:
hit = Random.Float(attackSkill) >= Random.Float(defenseSkill)
The attack skill is computed in ''Char.attackSkill()'' as:
attackSkill = (baseAttackSkill + lvl) * 1.4 ^ buffBonus * weaponAccuracyFactor
where ''weaponAccuracyFactor'' decreases when wielding weapons too heavy for the character's Strength. Attacks with a ranged weapon at point-blank range (distance 1) are only half as accurate.
==== Factors Affecting Accuracy ====
* **Character Level**: Higher level increases attack skill
* **Base Attack Skill**: Class-specific base value (heroes start with a base attack skill of 10)
* **Weapon Encumbrance**: Weapons requiring more Strength than the character has reduce accuracy
* **Rings**: [[en:rpd:ring_of_accuracy_item|Ring of Accuracy]] provides an attack skill bonus through buffs
==== Accuracy vs. Evasion ====
* **Accuracy**: Attacker's ability to hit
* **Evasion**: Defender's ability to avoid being hit (represented by Defense Skill)
* High defense skill enemies (bosses, armored foes) are harder to hit
* Flying enemies may have additional evasion bonuses
==== Improving Accuracy ====
* Level up to increase attack skill
* Use the **[[en:rpd:ring_of_accuracy_item|Ring of Accuracy]]** for a direct attack skill bonus
* Keep your weapon's Strength requirement within your effective Strength to avoid encumbrance
* Gain buffs that provide an attack skill bonus (e.g. the Blessed buff)
==== Related Mechanics ====
* **Critical Hits**: When the attacker's accuracy roll exceeds twice the defender's evasion roll, damage is increased by 50% (see ''Char.checkCriticalHit()'')
* **Miss**: When the accuracy check fails, attack misses entirely
* **[[en:rpd:evasion_mechanic|Evasion]]**: The defensive counterpart of accuracy
==== Source Code ====
* [[https://github.com/NYRDS/remixed-dungeon/blob/master/RemixedDungeon/src/main/java/com/watabou/pixeldungeon/actors/Char.java|Char.java]] - Base character stats, attackSkill/defenseSkill and critical hits
* [[https://github.com/NYRDS/remixed-dungeon/blob/master/RemixedDungeon/src/main/java/com/watabou/pixeldungeon/actors/CharUtils.java|CharUtils.java]] - The hit() chance check
* [[https://github.com/NYRDS/remixed-dungeon/blob/master/RemixedDungeon/src/main/java/com/watabou/pixeldungeon/items/weapon/Weapon.java|Weapon.java]] - Weapon accuracy factor (encumbrance)
==== See Also ====
* [[en:rpd:ring_of_accuracy_item|Ring of Accuracy]]
* [[en:rpd:combat_mechanic|Combat Mechanics]]
* [[en:rpd:stats|Stats]]
* [[en:rpd:weapons|Weapons]]
{{tag> rpd mechanics combat accuracy}}