- Determining Turn Order
- Applying Status Effects
- Adjusting Attributes
- Calculating Damage
- Reflecting Damage: if the character survives
- Poison Effect
- Lifesteal: if the character survives
Understanding Attack Rating and Priority in Combat
Attack Rating
- The attack rating affects both the chance to hit and the order of attacks.
- A higher attack rating allows you to strike first, potentially dealing lethal damage and avoiding an incoming hit.
- Magical attacks always have priority over non-magical ones.
- Monsters that use magic attacks have a 25% chance to land a melee attack instead of using magic.
- If you have a magical attack and your opponent has a high attack rating but uses a melee weapon, you can inflict lethal damage without taking any in return, regardless of their chance to hit.
- If both you and your opponent use magical attacks, the attack rating decides the order of attacks.
- This rule also works in reverse, where your opponent’s magical attack would take priority if you’re using a non-magical weapon.
Final Hit Chance
Final Hit Chance reflects the final probability of landing a hit before accounting for status effects.
This JavaScript function calculates the chance to hit a defender based on various attributes of the attacker and defender, such as their ratings, levels, and other factors.
export function chanceToHit(
attackersAttackRating: number,
defendersDefenceRating: number,
attackersLevel: number,
defendersLevel: number,
arFactor: number,
defenderBlockRating: number,
) {
attackersAttackRating += (attackersAttackRating * arFactor) / 100;
const x = Math.max(attackersAttackRating, 1);
const y = Math.max(attackersAttackRating + defendersDefenceRating, 1);
const z = attackersLevel;
const k = defendersLevel / 2;
const xy = x / y;
const zk = z / (attackersLevel + k);
const base = 2 * xy * zk;
return Math.max(Math.min(base, 0.95), 0.2) * 100 * (1 - adjustAttrDef(defenderBlockRating) / 100);
}
Here's a breakdown of its components:
- attackersAttackRating: The attack rating of the attacker.
- defendersDefenceRating: The defense rating of the defender.
- attackersLevel: The level of the attacker.
- defendersLevel: The level of the defender.
- arFactor: A percentage modifier applied to the attacker's attack rating.
- defenderBlockRating: The block rating of the defender, which reduces the final chance to hit.
¶ Steps and Calculations
- Adjusting Attack Rating:
attackersAttackRating += (attackersAttackRating * arFactor) / 100;
- The attack rating is increased by a percentage (arFactor).
- Mathematical Safeguards:
- Ensures values don't fall below 1:
const x = Math.max(attackersAttackRating, 1);
const y = Math.max(attackersAttackRating + defendersDefenceRating, 1);
- Key Calculations:
xy
: The normalized ratio of the attacker's attack rating to the combined ratings:
const xy = x / y;
zk
: A level-based adjustment factor:
const zk = z / (attackersLevel + k);
where:
const k = defendersLevel / 2;
base
: The base chance to hit:
const base = 2 * xy * zk;
- Capping the Chance to Hit:
- Ensures the final chance is between 20% and 95%:
Math.max(Math.min(base, 0.95), 0.2);
- Block Adjustment:
- Reduces the chance to hit based on the defender's block rating:
(1 - adjustAttrDef(defenderBlockRating) / 100);
- Final Return Value:
- The function multiplies the result by 100 to express it as a percentage:
return ... * 100;
The function returns the final chance to hit after applying:
- A cap between 20% and 95%.
- A reduction based on the defender's block rating.
Items Durability
Item durability reflects how long an item can last in combat — the higher the durability, the longer you can use it without needing repairs.
The base durability loss per battle is 3 points. The higher the biome level compared to the biome the item was obtained from, the greater the durability loss.
For example:
- An item from Biome 1 will lose:
- 3 durability per fight in Biome 1
- 6 durability per fight in Biome 2
- 12 durability per fight in Biome 3
- 24 durability per fight in Biome 4
- 48 durability per fight in Biome 5
All Skills lose a fixed amount of durability per battle regardless of the biome in which they are used (3 durability per battle).
Attack Rating Factor
Attack Rating Factor
Attack Rating Factor is the percentage increase of Attack Rating. It only affects hit chance and does not influence the attack order.
Formula is :
AttackersAttackRating += attackersAttackRating * arFactor / 100
- Effect of Skills:
- Skills like Onslaught modify the AR Factor by a percentage. For example:
- Onslaught adds 30% to the AR Factor.
- If the base Attack Rating is 100 points, Onslaught increases it to 130 points.
- Chance to Hit Enemies:
- The AR directly impacts your likelihood of successfully hitting a target. A higher AR improves your accuracy.
- What It Does Not Affect:
- The AR Factor does not influence the attack order or the sequence of actions in combat. It is strictly tied to hit probability.
Damage Reflection
Damage Reflection
- You deal enough damage in one action or turn to bring the enemy’s health to zero , effectively killing them instantly.
- Since the enemy is defeated immediately, they have no opportunity to reflect damage back. Reflective abilities generally require the enemy to be alive at the time of damage application for the effect to activate.
This mechanic can be particularly helpful for high-damage characters or strategies that focus on eliminating enemies quickly. By delivering a lethal hit in one turn, players can bypass the risks associated with enemies that reflect or retaliate. Dawn Box for example .
Life Stolen Per Hit
Life Stolen Per Hit
The mechanics of vampirism work as follows:
- First, the damage that you and the enemy will inflict is calculated.
- Based on the damage dealt, a portion of it is then used to restore the player’s health.
- If the player receives lethal damage before the health restoration can occur, the vampirism effect will not work, as the player will already be dead.
This means that vampirism can be effective for sustained survival but may not save the player in cases of fatal hits.
Poison
Poison
The poison mechanic works as follows:
- An attack (Normal or Magic) is performed, and the damage is calculated based on various factors such as attack power, defense, resistances, etc.
- The resulting damage directly reduces the target’s HP.
- After the initial damage, the poison effect kicks in, dealing a secondary damage amount.
- The poison damage is based on the HP left after the attack phase.
- Poison damage is inflicted even if the attacker or target has already died from the initial attack.
Magic Find
Magic Find
- Common – 1
- Rare – 3
- Boss – 10
/// @notice Apply all corrections to the chance of item drop
/// There are two params to increase chances: amplifier and magicFind
/// There are two params to decrease chances: destroyItems and mintDropChanceNgLevelMultiplier
/// @param info Assume here, that info.mintDropChanceNgLevelMultiplier is in the range [0..1e18]
/// @param di Assume that di <= 100
function _adjustChance(uint32 itemChance, MintItemInfo memory info, uint di) internal pure returns (uint) {
uint chance = uint(itemChance) * Math.min(1e18, info.mintDropChanceNgLevelMultiplier) / 1e18;
chance += chance * info.amplifier / StatLib._MAX_AMPLIFIER;
chance += chance * CalcLib.toUint(info.magicFind) / 100;
chance -= chance * di / 100;
return chance;
}