FF1Randomizer icon indicating copy to clipboard operation
FF1Randomizer copied to clipboard

Make "Starting AoE Caster Item" guarantee that an AoE attack magic item exists (if possible)

Open markyys opened this issue 1 year ago • 4 comments

I think this will work, but it's hard for me to test. The scenario is "we generated a random set of spells for item magic, none of which happened to include a spell in the 'AoE attack' set". This code should, in that case, pick a random AoE attack spell and add it to the list to be applied to items.

It's arguable that if it does so it should also remove a random spell from the list so that the total number of items with magic does not change.

markyys avatar Sep 21 '24 15:09 markyys

I'll explain how the code works. If you randomize item magic and for example pick "support" magic as the pool, then there will be 42(including duplicates) Spells in the pool. The pool is shuffled. There are 12(not fixed) items that want magic. So the first 12 Spells from the shuffled pool will be assigned to the items. There's now some possibilities what can happen:

  • There is an aoe spell within the first 12 slots(we're good)
  • There is an aoe spell in the pool, but not in the first 12 slots(we should pick an aoe spell from the pool and randomly insert it into one of the first 12 slots)
  • There isn't an aoe spell in the pool(good question what to do, but very unlikely to happen as all pools allow for aoe inflict status(like sleep or charm))

In case there really isn't and aoe spell in the pool, I'd personally fail with a message(to reroll). It can only happen in combination with spellcrafter, probably will never happen and if it does a new seed will fix it.

mhn65536 avatar Sep 22 '24 07:09 mhn65536

i'm pretty sure spellcrafter has guarantee aoe elemental spells anyway, so there's no scenario where the spellbook has no aoe spells

wildham0 avatar Sep 22 '24 13:09 wildham0

Yes, but the Support Pool does not include InflictDamage spells, only InflictStatus and Buffs. But Spellcrafter is pretty much guaranteed to generate at least one AoE InflictStatus.

mhn65536 avatar Sep 22 '24 14:09 mhn65536

This has definitely happened in the while, though it probably is quite rare

markyys avatar Sep 23 '24 22:09 markyys