Combat
How combat works
Hitting
When you try to hit an enemy, the following things happen:
1. The defense value of the enemy is determined.
- defense = "Defense"-Attribute of the enemy.
- if in hardmode, defense is multiplied by 3.
- if the creature is Elite (Crown above head), 10 is added.
2. The offense value of the player is determined.
- offense = Skill "Melee" if enemy is on adjacent tile and a melee weapon is used. Skill "Ranged" if enemy is more than 1 tile away and a ranged weapon is equipped.
- if it is dark (player in dungeon without light source), the offense is halfed.
3. The hit Chance is calculated:
chance = 50 + (offense - defense) * 5
4. Bonus against the Creature Type is applied:
chance += Bonus against Creature Type * 5
The bonus is based on the amount of Creature Cards the player has collected.
5. Stamina is taken into account. If the player's stamina is 0, the chance is halfed.
6. If it is dark and the attack is ranged, the chance is set to 0.
7. IF a random number between 1 and 100 is LESS THAN the calculated chance, the attack HITS.
Dealing Damage
After a successful hit, the damage is dealt.
1. Is this a critical hit?
- if the attacker has the Pacify Effect active, it is automatically a critical hit.
- the chance to Crit is initial 0. Luck is added.
- if the target's defense is < 0, the chance is +100.
- chance is adjusted by the Expertise for the target creature (see Bestiary).
- if a random roll of 1-100 is less than the chance, it's a crit.
2. damage is determined by the weapon's Base Damage + Random Damage stat.
3. Melee weapon: Strength is added. Ranged: Strength / 2 is added.
4. At this point, the damage is multiplied by 3 if the attacker is a hardmode enemy.
5. Resistances or Immunities to certain Damage Types are considered. E.G. if the player attacks a skeleton with a piercing weapon, the damage is halfed.
6. if the attack is NOT a crit...
- subtract the target's armor class OR
- subtract the Willpower value if it is a magic attack
6. if damage is still > 0...
- the damage is subtracted from the target's health.
- aggro is added to the target's aggro table (it hates the attacker more now).
- if the attacking weapon has special damage effects (Poison, Leech etc.) these effects are applied.
- if the enemy is in melee range, special effects from the shield slot's weapon are also applied.