# Battle Logic

Each account's HP, Attack power, and Defense Power are determined by the sum of the stats and boosts of its deployed combatants.

When account A attempts to loot B, the rates of A winning are calculated as follows.

$$
Rate\,of\,win\,for\,A=\frac{q}{p+q}
$$

$$
p=\lceil \frac{HP\,of\,B}{(Attack\,Power\,of\,A)(1-Damage\,reduction\,rate\,of\,B)} \rceil
$$

$$
q=\lceil \frac{HP\,of\,A}{(Attack\,Power\,of\,B)(1-Damage\,reduction\,rate\,of\,A)} \rceil
$$

$$
Damage\,reduction\,rate=6\cdot 10^{-11}\cdot(Defense\,Power+100000)^2-0.6
$$

