| <--testing, continued | ^--xmld20--^ | testing, part 3--> |
There are two parts to the HitDice section: the list of hitdice from all levels, and the average hitpoints. The list of hitdice is easy to do, but the hitpoints are another matter. XSLT doesn't allow variables to be assigned more than once. This is a problem, because we have to do two things to calculate the average hitpoints -- loop through each of the classes, and then sum the average hitpoints from each. This isn't easy to do, because there are no true functions in XSL, nor can template call output be part of an expression.
Luckily, XSL is very similar to functional programming, and that gives us a Turing-complete language, so it's definitely possible, just awkward.
The one issue we might have to come back to is the fact that in monster descriptions, terms like "aquatic subtype" or "construct traits" are used to lump a bunch of SpecialQualities together -- what we really want, though, is the code to have access to all of them. For now, we'll just stick with the generic terms, but will have the lists later.
I think I'll definitely use a named template with a parameter for each save, to cut down on the number of functions. The cheat for now is that we'll still hard-code the checks for the bonuses to saves, specifically the feats (such as Lightning Reflexes), instead of searching through the data for anything that adds save bonuses.
For now, we'll have a "base" ability (this would be what a player would role or choose with a point-buy system); as well as the "racial" bonus to the ability. This allows us to also have the "inherent" bonus which is gained every four levels.
For instance, Iron Will should have something like <Bonus><Will>2</Will></Bonus>, so the XSLT can search for all feats that match the monster's and are relevant to the query (Will modifier). This would remove any hard-coding; instead of looking for Iron Will specifically, we just look at all the Feats (and Special Abilities, Special Qualities, equipment, etc.) for anything that affects what we're looking for.
This will be put off for now.
The aboleth is a good example, because it has the solitary (one creature), the brood (2-4) and the slaver brood (1d3+1, plus extra creatures). Do we need to support having a single number, a low-and-high range, AND a die roll calculation?
Seeing these three different requirements, I've had second thoughts on redesigning the storage of them. Instead, I'll let software do the calculations, if required, as the only needs for these values at the moment is moving them into a different format.
| <--testing, continued | ^--xmld20--^ | testing, part 3--> |