Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions FF1Blazorizer/Tabs/ItemEquipmentTab.razor
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
<TriStateCheckBox UpdateAction="@UpdateAction" Id="startingEquipmentDragonslayer" IsEnabled="!Flags.Weaponizer" @bind-Value="Flags.StartingEquipmentDragonslayer">Dragonslayer</TriStateCheckBox>
<TriStateCheckBox UpdateAction="@UpdateAction" Id="startingEquipmentLegendKit" IsEnabled="!Flags.Weaponizer" @bind-Value="Flags.StartingEquipmentLegendKit">Legendary Kit</TriStateCheckBox>
<TriStateCheckBox UpdateAction="@UpdateAction" DisableTooltip="true" @bind-Value="Flags.StartingEquipmentRandomEndgameWeapon">Random Endgame Weapon</TriStateCheckBox>
<TriStateCheckBox UpdateAction="@UpdateAction" Id="startingEquipmentRandomAoE" @bind-Value="Flags.StartingEquipmentRandomAoe">Random AoE Caster Item</TriStateCheckBox>
<TriStateCheckBox UpdateAction="@UpdateAction"DisableTooltip="true" @bind-Value="Flags.StartingEquipmentRandomCasterItem">Random Caster Item</TriStateCheckBox>
<TriStateCheckBox UpdateAction="@UpdateAction" Id="startingEquipmentRandomAoE" @bind-Value="Flags.StartingEquipmentRandomAoe" isEnabled="Flags.ItemMagicMode != ItemMagicMode.None">Random AoE Caster Item</TriStateCheckBox>
<TriStateCheckBox UpdateAction="@UpdateAction"DisableTooltip="true" @bind-Value="Flags.StartingEquipmentRandomCasterItem" isEnabled="Flags.ItemMagicMode != ItemMagicMode.None">Random Caster Item</TriStateCheckBox>
<TriStateCheckBox UpdateAction="@UpdateAction" Id="startingEquipmentOneItem" @bind-Value="Flags.StartingEquipmentOneItem">One Legendary/Caster Item</TriStateCheckBox>
<TriStateCheckBox UpdateAction="@UpdateAction" Id="startingEquipmentRandomTypeWeapon" @bind-Value="Flags.StartingEquipmentRandomTypeWeapon">Random Typed Weapon</TriStateCheckBox>
<TriStateCheckBox UpdateAction="@UpdateAction" Id="startingEquipmentGrandpasSecretStash" @bind-Value="Flags.StartingEquipmentGrandpasSecretStash">Grandpa's Secret Stash</TriStateCheckBox>
Expand Down
9 changes: 9 additions & 0 deletions FF1Lib/Helpers/SpellHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,14 @@ public SpellHelper(List<MagicSpell> _spellInfos)
//yeah stupid way of doing it, but i don't care
return SpellInfos.Select(s => ((Spell)Convert.ToByte((int)Spell.CURE + s.Index), s)).ToList();
}

public IEnumerable<(Spell Id, MagicSpell Info)> GetAoEAttackSpells()
{
var damageAoes = FindSpells(SpellRoutine.Damage, SpellTargeting.AllEnemies);
var instaAoes = FindSpells(SpellRoutine.InflictStatus, SpellTargeting.AllEnemies, SpellElement.Any, SpellStatus.Death);
var powerWordAoes = FindSpells(SpellRoutine.PowerWord, SpellTargeting.AllEnemies, SpellElement.Any, SpellStatus.Death);

return damageAoes.Concat(instaAoes).Concat(powerWordAoes);
}
}
}
10 changes: 10 additions & 0 deletions FF1Lib/ItemMagic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,16 @@ public void ShuffleItemMagic(MT19337 rng, Flags flags)
Spells = GetAllSpells(rng);
}

if ((bool)flags.StartingEquipmentRandomAoe && flags.ItemMagicMode != ItemMagicMode.None) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so that doesn't seem to do what is intended, the aoe spell is placed at the end of the list so it will never be picked, and because it doesn't discriminate it could introduce back excluded aoe spells (like nuke in balanced)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good point. Is there an existing "exclude spells" utility which could be used to filter the list before picking a new random spell?
And yes, I did think that we may be required to also remove a spell from the pool, good to know.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as madmartin said you don't need to create a new list, the generated list has already all the valid spells, you need to find the aoe's in that list and move it up

// guarantee that at least one item has an AoE attack spell
if (!Spells.Any(spell => spell.IsAoEAttack())) {
var spellHelper = new SpellHelper(this);
var aoe_spells = new List<MagicSpell>(spellHelper.GetAoEAttackSpells().Select(s => s.Info).ToList());
aoe_spells.Shuffle(rng);
Spells.Add(aoe_spells.First());
}
}

foreach (var item in Spells.Zip(magicItems, (s, i) => new { Spell = s, Item = i }))
{
WriteItemSpellData(item.Spell, item.Item);
Expand Down
Loading