> For the complete documentation index, see [llms.txt](https://ton-docs.theoldcastle.xyz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ton-docs.theoldcastle.xyz/rewards-after-the-battle.md).

# Rewards After The Battle

There is a check on the strength of the attack power of both factions every 4,800 blocks. The Faction with the superior attack power wins the battle (\~4 hours).

> During battle, the task of the Terrible Creatures faction is to retrieve as many sapphires as possible. The task of the Knights faction is to protect the treasury. If successfully accomplished, the King will generously reward his defenders. Each battle won brings one side closer to victory.

There is a check on the strength of the attack power of both factions every 4,800 blocks. The Faction with the superior attack power wins the battle (\~4 hours).&#x20;

The victorious battle is recorded in the total score of the Siege of the Castle. At the end of the Siege (\~15 days), the team with the most victories in battles is considered the winner.

### Battle Reward

At the end of each battle, there is a distribution of $SPH. The amount of $SPH is determined by the formula:

$$
RewardSPH = 4000 \* (StakedNFTsAmount/200),
$$

where:

* AmountNFT is the total number of NFTs in the game at the time of the Battle;
* 4000 is the maximum amount of **$SPH** that is distributed after the Battle;
* 200 is the maximum total number of NFTs in a game

The sum of the attack power of both sides is 100%, each Faction will receive an amount of **$SPH** from the total pool, but depending on the amount of attack power as a percentage.&#x20;

{% hint style="info" %}
Example:&#x20;

* Faction 1: 170 attack power&#x20;
* Faction 2: 280 attack power&#x20;
* Faction 2 wins the battle 170 + 280 = 450 (100%)&#x20;
* Faction 1 will receive 1511.2 SPH (170 attack power is 37.78% of 450)&#x20;
* Faction 2 will receive 2488.8 SPH (280 attack power is 62.22% of 450)
  {% endhint %}

{% hint style="warning" %}
The distribution of rewards within the faction also occurs depending on the strength of the attack. The character with the highest attack power will get the biggest reward. The calculation takes place for each NFT separately.
{% endhint %}

The distribution of $SPH within the faction is determined by the formula:

$$
RewardForNFT = NFTAttack/FactionAttack\*FactionSPHReward,
$$

where:

* NFTAttack is attack of a single NFT;
* FactionAttack is attack of the Faction to which the NFT belongs (without strengthening the Faction's attack);
* FactionSPHReward is total Faction reward for the past battle ($SPH).

### Penalties for losing a battle

> You have lost the battle, your ranks are in turmoil. The economy is in decline.

For the losing Faction of a battle, the cost of healing NFTs and Faction attack power increases with each defeat, but only up to 100%. Victory after a row of defeats nullifies the losing penalties.

| Number of defeats | Increase in the cost of services (%) |
| ----------------- | ------------------------------------ |
| 1                 | +20                                  |
| 2                 | +30                                  |
| 3                 | +40                                  |
| 4                 | +50                                  |
| 5                 | +60                                  |
| n                 | n\*10+10 <= 100                      |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://ton-docs.theoldcastle.xyz/rewards-after-the-battle.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
