Speed (turn meter) and hit/miss
In SplinterForge, battles are determined by a turn meter system that uses a cumulative speed score. Each monster, summoner, and boss has a speed attribute that is used to calculate their normalized speed. Normalized speed is calculated using the following formula:
This formula ensures that speed is not overpowered and helps to balance the game.
During a battle, a loop is executed 100 times, which is equivalent to one round. Within the loop, the game checks if the boss has any changes to its stats, applies fatigue damage to the team, and allows monsters to take their turns based on their cumulative speed score. The cumulative speed score is calculated by adding the normalized speed of each monster each time the loop runs. Once a monster's cumulative speed reaches 100, the monster takes its turn.
Bosses also have a cumulative speed score that is calculated similarly, and once the score reaches 100, the boss takes its turn. The boss always gets a chance to attack last, and heroes always get a chance to attack after monsters in case of a tie.
The game also calculates hit/miss probabilities using a set of conditions. First, the game checks if the attacker has the True Strike ability, which guarantees a hit. If the damage type is magic and the target does not have the phase ability, the attack also hits. If the target is flying and the attacker has the snare ability, the attack hits. If the target is flying and the attacker is not flying, the target gets an isolated chance to evade (instead of being calculated at 2.5 speed as before). If the attacker has the blind ability, the attacker's speed is decreased by 1.5.
The game also calculates the difference in speed between the attacker and the target. If the difference is less than 0 and the absolute value of the difference is greater than or equal to 10, the attack misses, and there is a 1 in 100 chance to get a critical hit. Otherwise, the chance to hit is calculated using the following formula:
For example, if the difference in speed is -1, the chance to hit is 90%. If the difference in speed is greater than 0, the attack hits, and there is a 1 in 100 chance to get a critical miss, just as there is a 1 in 100 chance to get a critical hit.
Overall, the SplinterForge battle system utilizes a turn meter and speed attribute to determine which monsters and bosses get to take their turns. The game also uses a set of conditions to determine the probability of hits and misses for each attack.
This does mean that a Hero, monster, or Boss can, with a high enough speed differential, be able to attack more than once at a time.
This is the following code for the battle loop:
To break that code down into more understandable words:
The
while
loop checks if the boss's health is greater than zero and if there are still monsters alive on the team.The loop executes for a total of 100 "rounds" before checking the while condition again.
There are three main conditions inside the loop that affect the boss and monsters:
If the loop number is 1200, then all of the boss's stats (presumably its attack, defense, etc.) increase by 1.
If the loop number is greater than 1200 and evenly divisible by 200, then all of the boss's stats increase by 2.
If the loop number is greater than 1200 and divisible by 100, then the monsters on the team take fatigue damage that increases by 1 every time. Fatigue damage likely represents some sort of penalty or debuff that lowers the team's performance over time.
There is a
forEach
loop that goes through each monster still alive on the team. For each monster, thecumulativeSpeed
property (representing its speed relative to the boss) is increased by itsnormalizedSpeed
property (representing its base speed). Once a monster'scumulativeSpeed
reaches or exceeds 100, the monster takes a turn.The boss's
cumulativeSpeed
is also increased by itsnormalizedSpeed
, and once it reaches or exceeds 100, the boss takes a turn.
Last updated