# Fight

## Base values

The calculation of the fight starts with de base values of the Gainling. \
These stats are the **same for all Gainlings**:&#x20;

* <mark style="color:orange;">**Base Attack:**</mark> 1000
* <mark style="color:orange;">**Base Defense:**</mark> 250

## Randomness (Luck)

For each fight Chainlinks VRF provides the contract with randomness. From this random number, the contract derives two new random numbers between 0 and 1000. The first of the random numbers represents the luck of the attacker \[<mark style="color:blue;">**Attacker-Random**</mark>]. The second random number represents the luck of the defender \[<mark style="color:blue;">**Defender-Random**</mark>].\
\
On top of that the trophy-level gets added. If you already attacked successfully two times and your trophy level is on 2, the random range will be 200 - 1200 effectively increasing your damage by 100 per trophy.  Read more about the level system in the Trophies section.

{% content-ref url="trophies" %}
[trophies](https://the-gainlings.gitbook.io/the-gainlings/strategy/trophies)
{% endcontent-ref %}

## Equipment

Additionally the contract stores the following values as metadata of the warriors:

* Sum of all attack modifiers of the attackers equipment \[<mark style="color:red;">**Attacker-Attack-From-Equipment**</mark>]
* Sum of all defense modifiers of the attackers equipment \[<mark style="color:red;">**Attacker-Defense-From-Equipment**</mark>]
* Sum of all attack modifiers of the defenders equipment \[<mark style="color:green;">**Defender-Attack-From-Equipment**</mark>]
* Sum of all defense modifiers of the defenders equipment \[<mark style="color:green;">**Defender-Defense-From-Equipment**</mark>]

## Calculation

The total damage done by the **attacker** gets calculated as follows:

&#x20;      <mark style="color:orange;">**BaseAttack + BaseDefense**</mark>

**+   &#x20;**<mark style="color:red;">**Attacker-Attack-From-Equipment**</mark>

**+   &#x20;**<mark style="color:red;">**Attacker-Defense-From-Equipment**</mark>**&#x20;** ***(if not pierced by defender aura)***

**+   &#x20;**<mark style="color:blue;">**Attacker-Random**</mark>

\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_

\=    **Attacker Total Damage**

&#x20;

The total damage done by the **defender** gets calculated as follows:

&#x20;      <mark style="color:orange;">**BaseAttack + BaseDefense**</mark>**&#x20;*****(if not pierced by attacker aura)***

**+   &#x20;**<mark style="color:green;">**Defender-Attack-From-Equipment**</mark>

**+   &#x20;**<mark style="color:green;">**Defender-Defense-From-Equipment**</mark>  ***(if not pierced by attacker aura)***

**+   &#x20;**<mark style="color:blue;">**Defender-Random**</mark>

**+   &#x20;**<mark style="color:purple;">**Cooldown-Buff**</mark>**&#x20;(only applied if in cooldown)**

\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_

\=    **Defender Total Damage**

**The Gainling with the higher total damage output wins the battle.**\
**The defender wins in case of a tie.**

{% hint style="danger" %}
If an aura has weakness against another aura, the weak Gainlings defense will be ignored in the calculation of the opponents total damage.&#x20;
{% endhint %}

After the fight, the losing token will be burned and removed from the supply. The winning token will go into cooldown. The cooldown is calculated by the weight of the Gainling. Each weight-point adds 1 second. Each trophy-level reduces by 2%.&#x20;
