Combat

Combat is where the majority of the game's gameplay takes place. When walking in most areas in the overworld you may encounter enemies who will face you in battle.

Crimson Keep is an ATB gauge based game where action order is determined by a Time gauge which fills up based on your speed stat and the downtime of your last move.

This article aims to show a brief overview of the formulas used for combat in the game(s)

Time Gauge
During combats the participants take actions as their Time Gauge fills up. Once full an action may be performed. There are currently three actions Soriel may execute in combat.
 * Try to escape from the battle.
 * Use an item.
 * Perform an offensive move, attacking or utility.

These options are chosen using their respective options in the battle screen

$$eCD = C_{b} \cdot S_{r} + \operatorname{cap_{1}} \left ( C_{b} \cdot M_{s} \right ) $$ $$ S_{r} = \operatorname \left ( S_{p} : S_{e} \right )$$

Where:
 * $$\operatorname{cap_{1}}$$ is the slow bonus cap (2)
 * $$\operatorname{cap_{2}}$$ is the cap to the speed modifier (1.5)
 * $$C_{b}$$ is the base cooldown of the move
 * $$M_{s}$$ is the slow modifier (1.5 if slowed, 0 otherwise)
 * $$S_{p}$$ is Soriel's speed stat
 * $$S_{e}$$ is the enemy's speed stat
 * $$S_{r}$$ is the speed ratio

This formula is used to determine the relative speed of which the enemy's Time Gauge refills.

Tempt
For any enemy attracted to Soriel it is possible to end a battle by successfully tempting them. The chance to successfully tempt an enemy is dependent on either their current health or by depleting their tempt gauge.

This is the main way to defeat enemies and the first chapters revolve around Soriel learning to use his Incubus powers.

Tempt Rate
For enemies without a tempt gauge this formula is used to determine if a tempt succeeds or not $$ T_{r} = \left ( T_{t} + T_{a} + T_{b} \right ) \cdot \left (1 - (H_{c} \div H_{t}) \right ) + T_{m} $$

Where:
 * $$T_{r}$$ is the tempt rate.
 * $$T_{t}$$ is the base tempt modifier
 * $$T_{t} = T_{s} \div 1000$$ where $$ T_{s} $$ is Soriel's tempt stat.
 * $$T_{a}$$ is the attack modifier (0 for tempt, 0.15 for tempting slash)
 * $$T_{b}$$ is the base tempt rate of the target
 * $$H_{c}$$ is the current HP of the target
 * $$H_{t}$$ is the maximum HP of the target
 * $$T_{m}$$ is the sum of any flat conditional modifiers (e.g slime covenant)

Tempt Shield
For enchanted enemies, upon depleting their Health bar you will have to deplete their Tempt Shield and you cannot successfully tempt an enchanted enemy before this. The enemy will be successfully tempted once the Tempt Shield is depleted.

Damage is dealt to the Tempt Shield by Tempt based attacks using the formula below, and no other attacks will do any damage (Though their secondary effects can still apply).

Tempt Gauge
From chapter 5 onwards, if an enemy is not enchanted they will now also have a tempt gauge that gradually fills up, the enemy will be tempted once the gauge is filled out, though you may roll random tempt against non-boss enemies.

$$ G_{d} = D_{t} \cdot \left (1 - H_{c} \div H_{t} \right ) \cdot \left ( T_{s} \div T_{d} \right ) \cdot T_{r} $$

Where:
 * $$ G_{d} $$ is the damage done to the tempt gauge
 * $$ D_{t} $$ is the damage of the attacking tempt move.
 * $$ T_{d} $$ is the tempt resistance of the target.

Damage Calculation
This is the main formula used to handle the damage dealt. $$ \text{Damage } = T_{c} \cdot E \cdot M_{c} \cdot M_{d} \cdot B_{p} \cdot \left \lceil B_{a} \cdot (M_{l} + ((1 - M_{l}) \cdot \text{random} \in \left [ 0, 1 \right ] ) ) \right \rceil $$

Where:
 * $$T_{c}$$ is the type constant. Assumes a value of 0.1 for Physical and Magical attacks and 0.5 for Tempt based attacks.
 * $$E$$ is the effectiveness modifier.
 * $$M_{c}$$ is the critical attack modifier. Normally assumes a value of 1.5 if the attack is a critical hit, and is 1 otherwise.
 * $$M_{d}$$ is the defense modifier.
 * $$B_{p}$$ is the base power of the attack.
 * $$B_{a}$$ is the corresponding attack value.
 * $$M_{l}$$ is the mastery modifier.

Formulas for these modifiers can be found here

Hit Rate
$$ Hit = A - E$$

Where:
 * $$A$$ is the accuracy value of the attacker
 * $$E$$ is the evasion value of the target

This value is compared against a single random number roll which determines whether or not an attack will hit.

Fleeing
Soriel may attempt to escape from a battle by using the flee command, the success rate of this is given by:

$$ E_{r} = (E_{b} + M_{1}) \cdot M_{2}$$

Where:
 * $$E_{b}$$ is the base escape rate of the enemy.
 * $$M_{1}$$ is any additive modifier to the escape rate.
 * $$M_{2}$$ is any multiplicative modifier to the escape rate.

Soriel may not attempt to flee against bosses.