Wanted to drop some new info that Z3R01337 and I have been working out by a mix of code-checking and brute-force scenario testing with special scripts. This is also just to make sure it's listed somewhere to reference later as well.
Enemy Targeting AI
Like many things in the game, their approach to how an enemy chooses a particular target is... naive. This was all tested through brute-force testing to a significant number of trials (often 1000+).
A couple things matter for this: Your initial party orientation, and the eligible targets for a given attack. Attack types come in many flavors, but for the purpose of this discussion we'll just focus on Single Front (SF) and Single All (SA). Rules for rows apply much the same way, however enemy column attacks always target their same column for as long as such a column of characters isn't KO'd.
OK, to put this in better context, here's an example: You have 3 characters in your party arranged in slots 1, 2, and 3, and an enemy uses either a SF or SA attack. The probability of that attack hitting any given slot is:
That's right, the third slot position is twice as likely to be targeted as the first two. The picture changes a bit if you're attacked with a SA attack and have 4 members...
The simple way to understand this is that every consecutive character slot is more likely to be targeted, if they are available. If that were a SF attack instead of SA though, it would still have the 25-25-50 probabilities as in the first case. This is because a SF attack only has at-most 3 eligible targets. SA can attack all non-KO'd party members, so it could have up to 6 eligible targets. The remaining probability cases are below, just for completeness.
Code: Select all
Code: Select all
Technical reasoning for this is that they use some fairly flawed logic versus what you'd expect for a "fair" targeting system. It could have been developed this way on purpose for some fairly obtuse reasons, but more likely is they just didn't think it through very well. My working theory is that when the enemy starts an attack, it calls RNG once to determine who to attack. It then checks bit (eligible targets-1) of the RNG. If it's 1, then it targets that slot. If zero, then check the next lowest bit, and repeat until you find a 1. If all are zero, then you attack slot 1. This makes it so that each consecutive slot is twice as likely as the prior one to be targeted, with the exception of the first two.