# Combat Algorithm

## Combat Turns

Combat is made up of multiple turns where both gladiators are able to maneuver, strike, and potentially block each other's attacks. At the end of the combat turn if both gladiators are still standing then a new turn is generated.&#x20;

This continues until there is a winner.&#x20;

## Gladiator Statistics

Each gladiator has a set of base characteristics that determine their combat abilities.&#x20;

#### Initiative

Gladiators have a base initiative score. The algorithm rolls a random number for each gladiator and adds their initiative score. The highest score gets to go first.

At the end of the combat turn initiative is generated again to see who moves and strikes first.

#### Attack and Defense

Gladiators have a base attack stat which is added to a randomly generated value. The opposing gladiator uses their base defense stat added to a randomly generated value, the two numbers are then compared.&#x20;

The highest number wins. If the attack value is lower than the defense value then the attack is successfully blocked, parried, or evaded and no damage is delivered to the opponent.

If the attack value is higher than the opponents generated defense value then the attack lands and damage equal to the weapons damage stat is delivered to the opponent.

#### Weapon Damage

When a successful hit is accomplished a static value determined by the weapon type is deducted from the opponent's health value.&#x20;

#### Health

A static value that determines how much damage a gladiator can take before they are no longer able to carry on fighting.&#x20;

## Determining the Winner

When a gladiator's health is so low and the combat algorithm determines that the next successful hit will reduce them to zero hit points or below a "coup de grace" finishing animation will play instead of the usual attack animation. This finishing move executes the gladiator and sets the win or lose condition to enable any potential payouts.&#x20;

After the final blow, the duel will automatically stop and display a resolution screen detailing the bout's important stats.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://halls-of-olympia-developers.gitbook.io/halls-of-olympia/gladiatorial-combat/combat-overview/simulated-fight/combat-algorithm.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
