Closed kgar closed 8 months ago
A setting is not good for the individual actor, at the time I had used Sdenec's solution with the DAE module, but I think that giving the option on the actor's spell tab to enter a formula such as @classes.druid.levels + @abilities.wis.mod as DAE use (in a flag probably) should be sufficient for any use case, homebrew subclass or not.
An automated solution is impossible too many use cases to account for if one really wants one can create a separate module to update the flag in question.
Add a piece of code as reference:
function calculateMaxPreparedSpells(ability, className, additionalBonus = 0) {
const levels = actor.itemTypes.class.find(e => e.name === className)?.system.levels;
const typeOfCaster = // add some code for this for say 2 == fullCaster, 1 == Half Caster, 0 === No Caster
if(!levels) {
return 0;
}
let maxPreparedSpells = 0;
if(typeOfCaster == 2) {
maxPreparedSpells = levels + Math.max(actor.system.abilities[ability].mod, 0) +additionalBonus;
} else if(typeOfCaster == 1) {
maxPreparedSpells = (levels/2) + Math.max(actor.system.abilities[ability].mod, 0) + additionalBonus;
}
return maxPreparedSpells;
}
const maxPreparedSpells = calculateMaxPreparedSpells("int", "Wizard");
const typeOfCaster = // add some code for this for say 2 == fullCaster, 1 == Half Caster, 0 === No Caster
Don't forget that Artificers are like half casters, but have spell slots at character level 1.
Also, Eldritch Knights and Arcane Trickers (and possibly some other sub-classes that I'm forgetting) are quarter(?) casters.
Here's what I'm thinking... The existing flag is fine to keep using, but we do this:
Functionally, it works as intended:
As the TODO text states, I would like some buttons there with starter formulas for the core classes so the user can click one and get the basic formula applied to the input box.
It also recalculates as your actor updates. So if you change Akra's wisdom or level up, it does exactly what is expected.
Coming soon,
Excellent work. What about Eldritch Knight and Arcane Tricksters?
Excellent work. What about Eldritch Knight and Arcane Tricksters?
If someone can supply me with a formula, I will add a button. I asked around on TPosney's server and got these, but I can definitely add more as I receive them.
I found this Google sheet that has lots of handy formulae. These are for Dice Cloud though, so a simple cut n paste might not work for foundry. The Eldritch Knight and Arcane Trickster spells known formulae are insane though.
I found this Google sheet that has lots of handy formulae. These are for Dice Cloud though, so a simple cut n paste might not work for foundry. The Eldritch Knight and Arcane Trickster spells known formulae are insane though.
They do look pretty complex. I wonder if those if
statements work in Foundry's roll code. Thinking about this and various other edge cases, maybe I can provide an external link to a Tidy 5e sheet github repo readme with a fuller list of sample formulas 🤔
Especially because of all the subclasses out there and those that haven't been invented yet.
I can take user-submitted formulas, too.
I started looking for how to do conditional selection (if/else logic) within rolls. So, at least with my current understanding of Foundry formulas, a port of some of those formulas is not really feasible. I will still add an external link to the community-submitted formulas readme. Hopefully some folks with a lot more knowledge on it can submit something. In the meantime, a hard number is also accepted in the formula field, as before.
Building it up here: https://github.com/kgar/foundry-vtt-tidy-5e-sheets/wiki/Max-Prepared-Spells-Formulas
Closing. Will handle any additional work in other issues.
Is there a way to provide an option which calculates max prepared spells on the spellbook tab for player characters? This calculation differs between spellcasting classes. How would we represent this difference? Use a client / world setting or provide a max prepared spells formula box in the Class/Subclass item?