When a player initiates a fight in a room, the server first checks if there are any living
monsters in the current room. If there are not, an error message is sent to the player who
initiated the fight.
If there are monsters in the room, a 50/50 chance is rolled to determine who gets to attack
first: enemies or players.
When players or monsters attack, a total attack value is calculated by combining all battle
participants' attack. Each player/monster's attack stat value is given a ±20 offset (for
example, if a player has 300 attack, they could contribute anywhere from 280-320 attack to
the pool).
The server is careful to respect the join battle flags of each player; if a player does not have
the join battle flag set, their attack will not be contributed to the pool and they will receive
no damage.
After combining all eligible players/monsters' attack, a 5% chance is rolled for a 1.2x damage
increase critical strike.
The number of living players/enemies (depending on which group is attacking) is then calculated.
This number is used to divvy up damage evenly among the targets. For example, if there is one
player with 500 attack and two enemies in a room, the player will contribute 500 (±20) attack to
the pool and 250 damage will be applied to each monster.
The damage applied to each target is the target's defense subtracted from the incoming attack
power. For example, if 100 attack power is applied to a monster with 50 defense, the monster
will receive 50 damage.
After being attacked, the damaged character will regenerate [regen stat value] / 10 health. For
example, if a character has 400 regeneration, they will recover 40 health. Note that the
regeneration is applied before death checking. If a player or monster drops below 0 health after
receiving damage, but returns to >0 health because of their regeneration, they will remain
alive.
If a player or monster dies before it is their time to attack (if the monsters attack first and
kill a player who would otherwise contribute to the attack pool), they will be excluded from the
attack pool.