Battle Algorithm
To explain the algorithm, an example of a battle between 2 teams of 6 heroes is proposed, each hero equipped with 6 items.
Step 1. Calculation of the individual stats of each hero
Stat Global Heroe Item Constant Decision
Total Health: Sum (Hero Vitality * Item Vitality) for each item
Total Strength: Sum (Hero Strength * Item Strength) for each item
Total Speed: Sum (Hero Speed * Item Speed) for each item
Total Aim: Sum (Hero Vitality * Item Aim) for each item
Total Intelligence: Sum (Hero Intelligence * Item Intelligence) for each item
Total Luck: Sum (Hero Luck * Item Luck) for each item
Total Damage: (Hero's Total Strength/10 + 1) * (Sum(Item Damage) for each item)
Total Shield: (Hero's Total Strength/10 + 1) * (Sum(Item Shield) for each item)
Total Courage: (1 + (5 * (3 - #Battle Line))/100) * Level * CF * (Sum(Item Courage) for each item)
Items equipped on heroes of the same race will have a 10% bonus on all their stats
Step 2. Calculation of synergies
Synergies will be implemented in the future and will be bonuses and special effects.
Example: If you have 6 heroes of the same race, they all get a bonus of +200 life
Example: If you put 2 Celts on the same # battle line, they will get +20 damage
Step 3. Beginning of battle
Once the global stats and synergies and their respective bonuses have been calculated, the battle begins.
The battle lasts a maximum of T turns and ends when a team runs out of heroes. The battle begins and the hero with the highest speed attacks. If there is a tie, the Hero with the highest Intelligence attacks. If it is still a tie, the Hero with the lowest # ID attacks. This Hero attacks one of the 6 opponents with a probability determined for each opponent by the following function:
The probability that A decides to attack E is proportional to E's courage.
There is a chance that the gods will intervene and prevent the attack, even if A hits E. This probability is:
P (Attack Avoided) depends on luck and AAF
AAF: Attack Avoided =?
Since the blow affects the damage done, it is calculated as follows:
A's damage to E depends on A's total damage and E's shield
If the hit is critical, the hit does 200% damage
E loses an amount of life equal to the damage dealt by A
Step 4. Winner of the battle
If the T rounds are not reached, the team whose heroes remain alive wins. If the battle reaches T rounds without a winner, the team with the most heroes alive wins. If there are an equal number of Heroes alive, the team that dealt the most damage wins. If the two teams did equal amounts of damage, the team with the most health wins. Finally, and to avoid any sort of tie if all else fails, the team that has a hero with the lowest # ID wins the game.
T = 15 rounds
Step 5. Battle summary
You will see a summary of the fight with the number of rounds and the total damage of the battle, as well as a detailed report of everything that happened in each round. This way you can analyze what went well or wrong and get familiar with the battles.
Γltima actualizaciΓ³n