rrcampbell-exe / who-would-win

A cross-universe combat simulator for fans of Pokémon and Dungeons & Dragons.
https://rrcampbell-exe.github.io/who-would-win/
1 stars 0 forks source link

Matching Spells with Appropriate Classes #6

Open rrcampbell-exe opened 3 years ago

rrcampbell-exe commented 3 years ago

Description

Currently, spellcasting classes can cast any spell, including those not normally eligible to be cast by a given class. For example, beacon-of-hope is to be cast by clerics only, but could currently be cast by a wizard.

Possible Solutions

Logic could be established to check the result of chosenClass against the contents of data.classes.name.toLowerCase(), with the latter being found in /api/spells. If chosenClass is equal to any of the items in data.classes.name.toLowerCase(), then proceed with current spell. If not, choose a new spell.