# Combat Instances and End of Combat

> *Ever since the beginning of implementing a combat system in MD, we've had certain seemingly unsolvable issues constantly pestering us and blocking us from delivering our true vision for an objective, automated, skill-based combat system. However, with VEA, this all changes. Now, we have complete authority over the system and don't have to rely soley on Discord's roles to convey combat information, although it is still an important aspect of it. One of the most challeging issues has been starting/ending combat; more specifically how to forbid multiple people from participating in what is a 1v1 system, and how are we to give a potentially surrendering character a way out that is handled by the bot. Combat instances solve both of these issues.*

## Combat Instances

When a character attacks another character with the `attack` command, both of them are placed within an instance of Combat, given the role `In-Combat`, and will remain in combat until combat ends. While in combat, neither user can use commands (excluding `attack-info`, `character-info`, `help`, and `check-combat-roles`). At the beginning of combat, the person who initiated it is the first attacker, and they have the first move. Once they use any move, then the turn is on their opponent who becomes the attacker; this cycle continues until one character emerges as the victor. The ways in which you can lose your `In-Combat` role are:

{% content-ref url="/pages/-MXHzovpJxcmmuNBPf63" %}
[Death](/combat/end-of-combat/death.md)
{% endcontent-ref %}

{% content-ref url="/pages/-MXHzt7Sl\_oCcDm3jmch" %}
[Surrender](/combat/end-of-combat/yield.md)
{% endcontent-ref %}

{% content-ref url="/pages/-MXHzvJCJtqJjMfEP5fB" %}
[Knock Out](/combat/end-of-combat/knock-out.md)
{% endcontent-ref %}

{% content-ref url="/pages/-MXI--7Cwpqd8aDzNF7v" %}
[Escape](/combat/end-of-combat/escape.md)
{% endcontent-ref %}

{% hint style="info" %}
*There is an additional way for both characters to lose the `In-Combat` role. If one of the combatants times out after not responding for 60 minutes, Combat ends in favor of their opponent and it ends as it would if they had surrendered manually.*
{% endhint %}


---

# 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://docs.medievaldiscord.com/combat/end-of-combat.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.
