# Triangle Attack

Three Houses

## True Hit

The difference between Displayed Hit and True Hit.

# 2 RN System

Like many other games in the series, Three Houses uses True Hit with 2 rolled random numbers. This means that the hit rate displayed during combat (AKA Displayed Hit) is not a true percentage (AKA True Hit). Rather, the actual percentage chance that an attack will hit is skewed.

To see whether or not any attack hits, the game will generate 2 random numbers between 0 and 99. If the mean average of these 2 random numbers is below the Displayed Hit number, the attack will connect, otherwise it will miss. In a nutshell, in order to miss a "high" hit rate attack, you will have to be unlucky with 2 random numbers, not just 1. The opposite is true for "low" hit rate attacks. This will make high hit rate attacks land more often, and low hit rate attacks miss more often (than the game would have you think).

## True Hit Calculator

True Hit calculator and values table.

# True Hit Calculator

Enter a Displayed Hit rate between 0 and 100 to calculate the True Hit percentage.

# True Hit Table

To view a complete table of all True Hit percentage values, click the button below. These values were computed using the formulas described in the next section.

## Math and Calculations

The formulas needed for calculating True Hit as a percentage.

# Calculations

Calculating the True Hit percentage from a Displayed Hit is a combinatorics problem. Since there are two independent random numbers being rolled from 0 to 99, there are a total of $$100 * 100 = 10000$$ possible combinations of numbers rolled. Note that these rolls are ordered, this means that the 2 RN combination of $$(71, 19)$$ is distinct from the combination of $$(19, 71)$$, but $$(0, 0)$$ is considered a single distinct combination.

To calculate the True Hit percentage, we need to see how many combinations out of the 10000 total possible combinations results in a hit. In other words, we need to count the number of combinations of 2 RNs there that average less than the Displayed Hit, then divide that count by 10000. A basic example of this would be using a Displayed Hit of 1. There are only 3 combinations of 2 RNs that will average to less than 1: $$(0, 0)$$, $$(0, 1)$$, and $$(1, 0)$$. Hence, out of the 10000 possibilities, only 3 of them result in a hit. The True Hit is then $$\frac{3}{10000}$$, which is 0.0003, or 0.03%.

To generalize all of the above concepts into a formula, we define the variables $$R_{1}, R_{2} = 2 RNs$$, then an attack will hit under the following conditions:

$$\frac{R_{1} + R_{2}}{2} < Hit_{displayed}$$
$$R_{1} + R_{2} < 2 * Hit_{displayed}$$

The number of ways to sum 2 positive integers to another position integer can be calculated using the integer composition formula. We will refer to the number of ways to compose a positive integer $$n$$ with 2 positive integers as $$c_{2,n}$$.

$$c_{2,n} = {n - 1 \choose 1} = \frac{(n - 1)!}{(n - 2)!} = n - 1$$

The problem with integer composition is that it will consider all possibilities, even the ones that do not make sense in a Fire Emblem context. For example, lets say our Displayed Hit is 78. Then, we would want to count the number of ways that we can sum 2 integers to 155, 154, 153... and so on (since$$2 * 78 = 156$$, we want all numbers less than 156). This can be done using the $$c_{2,n}$$ formula above, except as far as that formula knows, $$(155, 1)$$ is a valid combination. Of course, the Fire Emblem random number generator would never generate 155 as a number. Since the highest random number that is generated is 99, we need a way to skip all of the combinations that include a number over that. Note that this will only happen for Displayed Hits over 50. Since $$50 * 2 - 1 = 99$$ means that the integer composition formula cannot consider a combination where one of the numbers is over 99 (this applies to all numbers below 50 as well). However, for a Displayed Hit of 51, we get $$51 * 2 - 1 = 101$$, meaning the integer composition formula will consider both $$(100, 1)$$ and $$(1, 100)$$ as valid combinations even if the Random Number Generator will never generate 100. Thankfully, it is really easy to ignore these invalid combinations. Let's take the extreme example of 99 Displayed Hit. We want to count all of the ways to make $$99 * 2 - 1 = 197$$ using positive numbers less than or equal to 99. The $$c_{2,n}$$ formula provides a baseline count, except it also includes a bunch of invalid ones. The first instance of an invalid combination is $$(1, 196)$$, then $$(2, 195)$$, then $$(3, 194)$$, and so on. This pattern continues until $$(98, 99)$$ and $$(99, 98)$$, which are valid. Then, another string of invalid combinations appear: $$(100, 97)$$, $$(101, 96)$$, ... all the way down to $$(196, 1)$$. Hence, we can calculate the number of invalid combinations to be $$(n - 99) * 2$$, where $$n > 99$$. With this in mind, we can provide a constrained count formula denoted as $$p_{2,n}$$.

$$p_{2,n} = \begin{cases} {n - 1 \choose 1}, & \text{if n \leq 99} \\[2ex] {n - 1 \choose 1} - (n - 99) * 2, & \text{if n > 99} \end{cases}$$

However, since $$R1$$ and $$R2$$ can equal $$0$$, we need to consider two other cases: $$(n, 0)$$ and $$(0, n)$$. Hence, the exact number of ways to sum 2 integers (including 0) to a positive integer $$n$$ is $$p_{2,n} + 2$$. To find the True Hit percentage, we have to find all of the different ways to sum $$(R1, R2)$$ to all integers between $$1 \leq k \leq 2 * Hit_{displayed} - 1$$, then adding the $$(0, 0)$$ case. Of course, if the Displayed Hit is 0 or 100, then the True Hit percentage will be 0% and 100%. This formula can be written as follows.

$$Hit_{true} = \frac{\sum_{i=1}^{2 * Hit_{displayed} - 1}(p_{2,i} + 2) + 1}{10000}$$
$$Hit_{true}\% = Hit_{true} * 100$$

# Sample Calculation

Let's take the very extreme value of $$Hit_{displayed} = 2$$. Plugging in this value to the formula yields:

$$Hit_{true} = \frac{\sum_{i=1}^{2*(2)-1}(p_{2,i} + 2) + 1}{10000}$$
$$Hit_{true} = \frac{\sum_{i=1}^{3}(p_{2,i} + 2) + 1}{10000}$$
$$Hit_{true} = \frac{p_{2,1}+2+p_{2,2}+2+p_{2,3}+2+1}{10000}$$
$$Hit_{true} = \frac{{0 \choose 1}+{1 \choose 1}+{2 \choose 1}+7}{10000}$$
$$Hit_{true} = \frac{0+1+2+7}{10000}$$
$$Hit_{true} = 0.001$$
$$Hit_{true}\% = 0.1\%$$

Note: although $${k \choose 1} = k$$ for all positive integers, I am showing the nCr notation here so that the formula can be easily adapted to any future random number systems that IntSys implements. For example, if the game were to generate 3 RNs instead of 2, the formula for $$p_{3,n}$$ would use $${n - 1 \choose 2}$$ instead.