Mechanics: Grimoire Generation

Grimoires are those things that have skills on them that let you cross-pollenate skills on characters that can't learn them naturally, and also pick up enemy skills that are, by and large, useless. That's all I have for a basic intro.

There's a few different types of Grimoires, which correspond to types of skills and levels:Now, as you might have inferred, a character can generate Grimoires when they get a Grimoire Chance. How is a Grimoire Chance determined, exactly?


Before we continue, again, credits to violentlycar and Dr. Fetus for the actual annoying work on this stuff.

Firstly, to get a Grimoire Chance, a character must know at least one skill, and have a Grimoire equipped. They must also not be dead, petrified, paralyzed, panicked, or asleep.

At the start of every turn, your party has a 0.1% chance of triggering a "Grimoire Fever" (to borrow a term from EO2U), where all party members get a forced Grimoire Chance. This 0.1% chance is upped to 5% when there's a rare breed enemy in the battle.

If a "Grimoire Fever" is not active, then this shit happens:
A = [Highest level among enemies] - Character's Level.

If A < -10, B = 30
If A < 0, B = 100 + (A * 8)
If A >= 0, B = 100 + (A * 20)
If A > 10, B = 300
The lower the character's level is relative to the highest level in the enemy group, the higher chance they have of activating a Grimoire Chance.

By the way, enemy levels are completely invisible to the player, and are otherwise only used in disable recovery.
If A < 0, C = [(20 + (A * 2)) / 10] + 1. This value is rounded down.
If A >= 0, C = 3 + (A * 2)

T = Turn count.

If C >= T, D = 100
Else, D = 100 * [1 - ((T - C) / C + 3))]. D cannot be lower than 10. This value is rounded down.
This is a scaling bonus to your chance to get a GC based on the previous level difference, along with how long the battle's been going on. Having a severe level disadvantage increases the turn count bonus.
If there is a rare breed, E = 1200. Otherwise,

eHP = Highest current HP value among all enemies
eLVL = Highest level value among all enemies

E = [(1 + sqrt (eHP / (50 + (eLVL * (4 + (((eLVL + 10) ^ 2) / 2000)))))) * 100] / 2. This value is rounded down.
Get a gigantic fucking boost to the Grimoire Chance probability if you're fighting a rare breed. Otherwise, get a higher Grimoire Chance probability if at least one enemy has a lot of HP left, and if you're fighting a high-level enemy.
SP = Total number of skill points spent by the chancing character / 20. This value is rounded down.
GS = Grimoire stones owned by party (including ones in inventory)
F = GS - (SP * 15) - 20. F cannot be lower than 20 and cannot be greater than 100.
Your Grimoire Chance probability is increased by owning a shitload of Grimoires, and decreased by having a character that has invested a lot of skill points in things.

Makes sense to me.
LB = Living bonus. The number of living party members at the end of each turn is added onto this value. This is capped at 100. When a party member gets a Grimoire Chance, this value will be halved for them.
VA = Valid allies. The number of allies in your party who are not dead, petrified, panicking, asleep, or paralyzed.

Score: [((((((((250 / (VA + 1)) * B) / 100) * D) / 100) * E) / 100) * F) / (100 * (0.5 + (T / 4)))] * [1 + ((LB ^ 2) / 2500)]

Roll a number between 1 and 1000. If that number is lower than Score, you get a Grimoire Chance.
There's no way in fucking hell I'm going to dissect that formula at the bottom beyond "B, D, E, and F are all worth roughly the same."

That's not all though, folks! Now we get to wrestle with the Grimoire Resolution Formula, which determines how many slots the Grimoire will have, what skills it has, and what levels they will be. Note that we currently have no info on how enemy skills are determined for this, but I frankly don't give two shits.

Firstly, you have to roll to actually get a Grimoire from the Chance. The chance for this ranges anywhere from 40% to 52%, depending on some random factors.
Count all the skills known by the character generating the Grimoire, and subtract that by 1, and place those skills in an array. Roll a number between 0 and that number. Get the skill ID matching the rolled array index and store it along with its max level.

X = 0
Y = 0

Check a flag. If this flag is matched, skip the rest of this paragraph. Next, check if the party has the "extreme grimoire quality" enhancement effect. If not, skip the rest of this paragraph. If so, X = 7 and Y = 7.
Getting a given skill, as expected, is literally just a random dice roll between all of the skills that character knows innately, and any they have via Grimoires.
Roll a number between 0 and 99.

If it's less than or equal to 0 + X, A = 30
If it's between 1 and (X * 3 + 3), A = 15
If it's greater than 98 - Y, B = 70 (note: Y, not X. B, not A)
If it's greater than 60 + (X - (X * 4)), B = 40

Otherwise, A = 0 and B = 0.


C = number of grimoire slots filled
D = number of skill points invested
E = number of skills learned through skill points
F = number of skills learned through grimoires

Roll a number, then discard it. This advances the RNG to reduce the predictability of outcomes.

AG = ((1 - (((((8 - (7 - C)) * (100 - A)) / 100)) / (((2 + (D * 0.066667)) * (100 - B)) * 0.01))) * (((70 + (E * 2)) + F) * 10))

Roll a number between 0 and 999. If this number is less than AG, add another skill to the grimoire. If it's not, break the loop. Add a new skill by rolling a number between 0 and the remaining number of skills in the known skill array (minus 1). Get the skill ID matching the rolled array index and store it along with its max level. Return to the beginning of LOOP "A".
The number of skills on a Grimoire is decreased by the number of slots already generated on a Grimoire. Conversely, it is increased by how many skill points the character has invested, the number of skills in the character's innate skillset, and the number of skills the character has on the Grimoire that are not in their innate skillset.

Once that's done, onto determining levels.
Q = ??? (seems to always be 0?)
QQ = Q
G = (X * 3) + 3
H = 98 - Y
J = 60 + (X - (X * 4))
K = 30 + Q
L = 10 + Q
M = 100 + QQ
N = 30 + QQ


Load the rolled number. NOTE: This number is NOT rerolled when we come back to this loop to check for the next skill. The number that was most recently stored is used for each time through this part of the code.

If that number is less than X + 1,

P = K
R = QQ

Otherwise, check the rolled number again. If that number is less than G,

P = L
R = QQ

Otherwise, check the rolled number again. If that number is greater than H,

P = Q
R = M

Otherwise, check the rolled number again. If that number is greater than J,

P = Q
R = N


P = Q
R = QQ

(I think. it's loading memory from the stack which is 0 and I don't know where it's set)
This just sets a shitload of variables to a few constants based on RNG.
Next, check if the max level of the chosen skill. If it's 1, set the new grimoire skill's level to 1 and skip the next code. Otherwise, calculate its level:


S = max level of skill
T = times this loop has been completed + 2 (resets when you start rolling another skill)

LR = (1 - ((((100 - P) * T) / 100) * (((100 + R) * 0.01) / (S + 2)))) * 1000)

Check if LR > 0. If not, LR = 0.

Next, check if LR < 950. If not, LR = 950.

Roll a number between 0 and 999.

U = random number result * number of skills on your grimoire stone
V = (number of skill points the character has invested / 25) + 1. Round this down immediately, before doing the next formula
W = U / V

Check if W is less than LR. If so, add a level to the skill on the grimoire stone. If the max level hasn't been reached, go back to the start of LOOP "C".

If the max level has been reached and there are more skills on the grimoire to process, go back to the start of LOOP "B".
Skill levels are randomly-generated based on a bunch of shit you have no control over. Unsurprisingly, if a skill gains a level, the chance of it gaining a level again goes down, weighting the system towards lower levels.

Also, if it wasn't obvious, a Grimoire skill based on skills that character knows cannot be higher than the level the character has that skill at.

There's one more itty-bitty thing to note about Grimoires: King Grimoires.King Grimoires are a special case, in that they override all of the skill determination and skill level stuff I just mentioned. They can only be generated when fighting all five Stratum bosses, as well as two of the postgame bosses, with each boss having their own unique King Grimoire skill. Generating a King Grimoire is complete nonsense based on four stats on something most players probably don't pay attention to, and two invisible hidden stats! How fun. The stats are as follows:I should note that Walked is updated right as you begin a battle, but Enemies Hunted isn't updated until after you conclude a battle.

Now, how do the values of these actually matter? Simple: they're involved in a point system. The amount of points you have determines your chance of getting a King Grimoire. How do you gain points? By having the final digits of any of these values match up. If, for example, Ventured Days and Enemies Hunted both end with an 8, you get one point. If those two plus Walked end in an 8, you get two points, and so on.

This is annoying nonsense that would take forever to set up and track, right? Well, there's one extra thing. If the final digit in a given stat is a 7, you get a point, regardless of if it lines up with another stat. So, basically, the best way to get a King Grimoire is to just fuck about so that all of your stats end in 7s.

Here are the King Grimoire probabilities assigned to each point total:Essentially, you don't have a prayer of getting a King Grimoire until you get at least 4 points, and it's obviously most ideal to get 5 or 6 points--do note that 6 is only possible with getting 7s, though.

If you do generate a King Grimoire, you get a King Grimoire F, with the skill for that given boss at level 10.

While we're here, I might as well show off the King Grimoire skills. I should note that none of the following skills use body parts.
Wolf Pack

Increases all non-almighty damage dealt by the party for one turn. Has priority at all levels. Costs 15 TP at all levels.
This is the big one, and the most useful of all of the King Grimoire skills. This is basically Crusade from EO2U, in that it's a one-turn damage buff that bypasses the diminishing returns system, but minus the defense portion, 10% weaker at level 10, and oh yeah it can be cast every fucking turn. Slap this shit on a support class and have them cast it every time it's reasonable and you're going to be very, very happy.
Forest Guardian

Reduces all non-almighty damage dealt to the party for one turn. Has priority at all levels. Costs 15 TP at all levels.
This is far less fun, but I guess it's something you can use if you're really worried about wiping or losing critical party members.
Queen's Mark

The party will act after all enemies for one turn. Has priority at all levels.
I don't even know what the fuck you'd do with this.
Abyssal Prayer

Reduces TP costs for all party members for one turn. Has priority at all levels.
Ehhhhhhhhhhhh. This doesn't really reduce TP costs enough for it to matter too much, especially given that it costs the caster 30 TP per turn.
Phoenix Wings

The party will act before all enemies for one turn. Has priority at all levels.
Moving before all enemies is way too situational for me to really have any amazingly good uses for this.
Yggdra Vaccine

Attempts to nullify all ailments directed at the party for one turn. Does not nullify instant death or stuns. Has priority at all levels.
If you're dealing with an enemy that has extremely deadly disables on hand, Yggdra Vaccine can considerably make your life easier. The issue is knowing when to time it.
Offering Robe

The user will endure all mortal damage at 1 HP for one turn. Nullifies instant death against the user for one turn. Has priority at all levels.
Offering Robe has one consistent use I can think of, and that's somehow getting five copies of it, putting them on everyone in your party, and using them to nullify the postgame superboss's all-party instant death skill.

> Table of Contents