<--Rethink, part 3 ^--xmld20--^ Rethink, part 5-->

xmld20 - an XML Schema for d20 gaming systems - rethink, part 4

We're humming along so far with the simpler abilities and level gains, so let's work our way through the basic classes, at least, and see what we get hung up on.

Barbarian

Fast movement

How do we handle this barbarian ability, one gained at first level? We could just record the fact that the ability exists:
	<Add type="SpecialAbility" name="fast movement"/>
This assumes that any code that is calculating or displaying speed knows that this special ability affects speed. The same goes for the monk, who gets an unarmored speed bonus.

The alternative is that we state that the character has such an ability, like above, but also set some sort of speed value in the character sheet:

	<Add type="SpecialAbility" name="fast movement"/>
	<Increase type="Speed" subtype="barbarian">10</Increase>
I'm not sure if Speed should be its own type, but because it's a fundamental concept in d20, I'm thinking it might. Some might say that I should go through the ruleset and figure out what deserves its own types, and what's a subtype or just a named instance of a type, but I'm finding, for now at least, that working "backwards" in this way is helping to reveal what should and should not be represented specifically and generally.

What I like about this two-part representation of the fast movement ability is that the code doesn't have to know what it means. Yes, we could have a table of special abilities, and in there record that fast movement is a "SpeedAffecting" ability, but then we'd have to represent how much and when (in light or no armor). With this method, code that cares about speed can find all Speed entries, look at the subtype and decide if they're appropriate, and do its math there. We use the subtype on speed, because it is a class-based increase, and in the case of the monk, there might be prestige classes that advance that number as well as the monk class.

Rage

Rage is handled similar to the uncanny dodge problem. Rage has different versions (rage, greater rage, mighty rage), and also a numerical value (times per day), so we will code it like this:
	<Increase type="SpecialAbility" name="rage">1</Increase>
	<Increase type="Level" name="rage">1</Increase>
This design, of course, assumes that getting rage from another source, such as a prestige class, will stack. I'm not sure if another class that gives rage would automatically upgrade you to greater rage (as uncanny dodge did to improved uncanny dodge); I do know that some rage-related prestige classes just increase the times-per-day, which is fine, because they assume you already have the rage ability, and thus don't add it themselves. We shall have to see how this plays out when we look at some prestige classes.

This may sounds like a bit of a cop-out, but in the case of a prestige class that gives rage (but doesn't say to upgrade), we can always add it in this manner:

	<Increase type="SpecialAbility" subtype="ragemaster" name="rage">1</Increase>
	<Increase type="Level" name="rage">1</Increase>
This will not override or stack with any generic rage (from barbarian, say), but will increase rage-per-day, if that's stated in the prestige class's progression table. If it isn't, we could use
	<Increase type="SpecialAbility" subtype="ragemaster" name="rage">1</Increase>
	<Increase type="Level" type="ragemaster" name="rage">1</Increase>
This will keep the rages-per-day separate from the general one. But should we do this for the barbarian class as well? I don't think so, because if anything is going to be stacking, it will be with the most basic case, which is the barbarian. Classes with stacking will say "this stacks with any previous levels of (uncanny dodge/rage/spellcasting) the character may have." This tells us that it should remain the general, default case, and that any classes that might have similar but non-stacking versions will get the named (subtype) versions.

This does, of course, mean that code needs to expect that there might be multiple rage times-per-day when writing up a character sheet, or simulating combat, but that isn't our concern from the data point-of-view.

trap sense

Here's another good ability that shows the stacking need. Rogues also get this ability, and the description specifically say "bonuses gained from multiple classes stack." Here's our level 3 barbarian entry (or rather, entries) for trap sense:
	<Increase type="SpecialAbility" name="trap sense">1</Increase>
Future levels (every three) will have the same. Note that we're not using Level, but SpecialAbility. That's because there aren't different versions of "trap sense", just better ability in it.

But what if a better trap sense does get added? Should we not use Level just in case? Something like

	<Add type="SpecialAbility" name="trap sense"/>
	<Increase type="Level" name="trap sense">1</Increase>
so if in the future trap sense has different versions, we can increment it, and let the code that uses it still use Level?

This certainly does let us abstract the idea of having and ability and the level of the ability. And, if the ability has different strengths, this too can be represented. Let's recap the different cases.

A special ability might just exist or not -- it doesn't have different strengths, doesn't have levels or numbers. The barbarian's illiteracy ability is like this. Not a stellar example, but it would be represented as

	<Add type="SpecialAbility" name="illiteracy"/>
We might also have such an ability, with only one stage or strength, but that has a numerical value (that probably increases), like the trap sense ability:
	<Add type="SpecialAbility" name="trap sense"/>
	<Increase type="Level" name="trap sense">1</Increase>
We can also have an ability that has a few stages, but doesn't have anything numerical attached to it. The evasion/improved evasion abilities are a good example:
	<Increase type="SpecialAbility" name="trap sense">1</Increase>
Finally, we can have a case of an ability that has different stages or strengths, as well as a numerical value, like the uncanny dodge:
	<Increase type="SpecialAbility" name="uncanny dodge">1</Increase>
	<Increase type="Level" name="uncanny dodge">1</Increase>
For now, I like this abstraction. It's not too convoluted, as we only use the version that makes sense for the ability we're talking about. The code is consistent for processing these abilities. And for now, we have taken care of the case of subtypes and stacking.

Here's our barbarian progression for now:

<Class name="barbarian">
  <Levels>
    <Level number="1">
	<Increase type="HD">12</Increase>
	<Increase type="BAB">1</Increase>
	<Increase type="SavingThrow" name="fortitude">2</Increase>
	<Increase type="Skill">4</Increase>
	<Add type="SpecialAbility" name="fast movement"/>
	<Increase type="Speed" subtype="barbarian">10</Increase>
	<Add type="SpecialAbility" name="illiteracy"/>
	<Increase type="SpecialAbility" name="rage">1</Increase>
	<Increase type="Level" name="rage">1</Increase>
    </Level>
    <Level number="2">
	<Increase type="HD">12</Increase>
	<Increase type="BAB">1</Increase>
	<Increase type="SavingThrow" name="fortitude">1</Increase>
	<Increase type="Skill">4</Increase>
	<Increase type="SpecialAbility" name="uncanny dodge">1</Increase>
    </Level>
    <Level number="3">
	<Increase type="HD">12</Increase>
	<Increase type="BAB">1</Increase>
	<Increase type="SavingThrow" name="reflex">1</Increase>
	<Increase type="SavingThrow" name="will">1</Increase>
	<Increase type="Skill">4</Increase>
	<Add type="SpecialAbility" name="trap sense"/>
	<Increase type="Level" name="trap sense">1</Increase>
    </Level>
    <Level number="4">
	<Increase type="HD">12</Increase>
	<Increase type="BAB">1</Increase>
	<Increase type="SavingThrow" name="fortitude">1</Increase>
	<Increase type="Skill">4</Increase>
	<Increase type="Level" name="rage">1</Increase>
    </Level>
    <Level number="5">
	<Increase type="HD">12</Increase>
	<Increase type="BAB">1</Increase>
	<Increase type="Skill">4</Increase>
	<Increase type="SpecialAbility" name="uncanny dodge">1</Increase>
    </Level>
    <Level number="6">
	<Increase type="HD">12</Increase>
	<Increase type="BAB">1</Increase>
	<Increase type="SavingThrow" name="fortitude">1</Increase>
	<Increase type="SavingThrow" name="reflex">1</Increase>
	<Increase type="SavingThrow" name="will">1</Increase>
	<Increase type="Skill">4</Increase>
	<Increase type="Level" name="trap sense">1</Increase>
    </Level>
    <Level number="7">
	<Increase type="HD">12</Increase>
	<Increase type="BAB">1</Increase>
	<Increase type="Skill">4</Increase>
	<Increase type="SpecialAbility" subtype="barbarian" name="DR" subname="-">1</Increase>
    </Level>
    <Level number="8">
	<Increase type="HD">12</Increase>
	<Increase type="BAB">1</Increase>
	<Increase type="SavingThrow" name="fortitude">1</Increase>
	<Increase type="Skill">4</Increase>
	<Increase type="Level" name="rage">1</Increase>
    </Level>
    <Level number="9">
	<Increase type="HD">12</Increase>
	<Increase type="BAB">1</Increase>
	<Increase type="SavingThrow" name="reflex">1</Increase>
	<Increase type="SavingThrow" name="will">1</Increase>
	<Increase type="Skill">4</Increase>
	<Increase type="Level" name="trap sense">1</Increase>
    </Level>
    <Level number="10">
	<Increase type="HD">12</Increase>
	<Increase type="BAB">1</Increase>
	<Increase type="SavingThrow" name="fortitude">1</Increase>
	<Increase type="Skill">4</Increase>
	<Increase type="SpecialAbility" name="rage">1</Increase>
	<Increase type="SpecialAbility" subtype="barbarian" name="DR" subname="-">1</Increase>
    </Level>
    <Level number="11">
	<Increase type="HD">12</Increase>
	<Increase type="BAB">1</Increase>
	<Increase type="Skill">4</Increase>
    </Level>
    <Level number="12">
	<Increase type="HD">12</Increase>
	<Increase type="BAB">1</Increase>
	<Increase type="SavingThrow" name="fortitude">1</Increase>
	<Increase type="SavingThrow" name="reflex">1</Increase>
	<Increase type="SavingThrow" name="will">1</Increase>
	<Increase type="Skill">4</Increase>
	<Increase type="Level" name="rage">1</Increase>
	<Increase type="Level" name="trap sense">1</Increase>
    </Level>
    <Level number="13">
	<Increase type="HD">12</Increase>
	<Increase type="BAB">1</Increase>
	<Increase type="Skill">4</Increase>
	<Increase type="SpecialAbility" subtype="barbarian" name="DR" subname="-">1</Increase>
    </Level>
    <Level number="14">
	<Increase type="HD">12</Increase>
	<Increase type="BAB">1</Increase>
	<Increase type="SavingThrow" name="fortitude">1</Increase>
	<Increase type="Skill">4</Increase>
	<Add type="SpecialAbility" name="indomitable will"/> 
    </Level>
    <Level number="15">
	<Increase type="HD">12</Increase>
	<Increase type="BAB">1</Increase>
	<Increase type="SavingThrow" name="reflex">1</Increase>
	<Increase type="SavingThrow" name="will">1</Increase>
	<Increase type="Skill">4</Increase>
	<Increase type="Level" name="trap sense">1</Increase>
    </Level>
    <Level number="16">
	<Increase type="HD">12</Increase>
	<Increase type="BAB">1</Increase>
	<Increase type="SavingThrow" name="fortitude">1</Increase>
	<Increase type="Skill">4</Increase>
	<Increase type="Level" name="rage">1</Increase>
	<Increase type="SpecialAbility" subtype="barbarian" name="DR" subname="-">1</Increase>
    </Level>
    <Level number="17">
	<Increase type="HD">12</Increase>
	<Increase type="BAB">1</Increase>
	<Increase type="Skill">4</Increase>
	<Increase type="SpecialAbility" name="rage">1</Increase>
    </Level>
    <Level number="18">
	<Increase type="HD">12</Increase>
	<Increase type="BAB">1</Increase>
	<Increase type="SavingThrow" name="fortitude">1</Increase>
	<Increase type="SavingThrow" name="reflex">1</Increase>
	<Increase type="SavingThrow" name="will">1</Increase>
	<Increase type="Skill">4</Increase>
	<Increase type="Level" name="trap sense">1</Increase>
    </Level>
    <Level number="19">
	<Increase type="HD">12</Increase>
	<Increase type="BAB">1</Increase>
	<Increase type="Skill">4</Increase>
	<Increase type="SpecialAbility" subtype="barbarian" name="DR" subname="-">1</Increase>
    </Level>
    <Level number="20">
	<Increase type="HD">12</Increase>
	<Increase type="BAB">1</Increase>
	<Increase type="SavingThrow" name="fortitude">1</Increase>
	<Increase type="Skill">4</Increase>
	<Increase type="SpecialAbility" name="rage">1</Increase>
	<Increase type="Level" name="rage">1</Increase>
    </Level>
  </Levels>
</Class>
That's two down. The only thing that we hadn't explicitly talked about was how to handle the damage reduction for the barbarian. Specifically, the DR description says that it "rises by one point" every three levels, so we had to take the "/-" part out and make the whole thing a numerical value. This "subname" for the DR will be used by code that might need to figure out damage dealt, and will certainly have to look for all of the DR entries, and decide which one provides the best defense in a given circumstance.

As for whether or not that should have been subtyped as barbarian, I'm not sure. If there are prestige classes out there that say they add to any other class's DR, then this might be a problem. As we did with the rage, we might say that this is a default DR, so other classes might add to it, and if/when we find classes that give DR but have no mention of stacking, they can have the subtyped versions.

Bard

Here we finally address the issue of spells. One thing we have to keep in mind right off the bat is that there are many prestige classes that say "+1 level of existing (arcane/divine) spellcasting class". This means that we certainly cannot have a progression table that looks anything like what we see in the players handbook, where it states how many spells per day and how many spells known. Instead, this information should be in a table apart from the class progression, and the class progression should simply say "add a level of this class" and that level's value will be used to reference said table. Also, while it's mentioned in the class entry, the ability score that is used to determine the maximum spell level castable and the bonus spells should be part of the table information, and not the class itself.

Bardic Music

This pointed something out to me. Special Abilities, which we've just been calling such, come in three flavors: extraordinary, supernatural and spell-like. So far, we haven't been recording any of that. The question is whether we should.

If we do, then we're going to see entries such as

	<Increase type="SpecialAbility" abilitytype="Ex" name="rage">1</Increase>
	<Increase type="Level" name="rage">1</Increase>
on the barbarian. That's not so bad, especially because we separated the Level from the SpecialAbility. It would seem awful redundant if every rage gain had
	<Increase type="Level" abilitytype="Ex" name="rage">1</Increase>
It's already going to look a bit odd when we go from rage to greater rage, where we're going to have to specify the abilitytype yet again. So maybe we can get away with not saying so?

Perhaps the abilitytype should be recorded elsewhere, perhaps in a table of all of the abilities and their types? They don't detail anything that was an option -- the player didn't choose to take the Ex version over the SP version, for instance -- so perhaps any code that needs to know the abilitytype (character sheet generator, combat simulator) can look it up as needed?

I like this approach for now. The only problem I can foresee is if a given special ability has two versions, and there's one I can think of right now: DR. We can handle this case in this way:

<SpecialAbilityTypes>
	<SpecialAbility name="DR">Ex</Ability>
	<SpecialAbility name="DR" subtype="prestige class name">Sp</Ability>
</SpecialAbilityTypes>
The lookup code will need to know how to look from the specific to the general, but that's going to be the case for the Increase elements anyway.

Except for these two extra things (spells and ability types), the bard is pretty easy:

<Class name="bard">
  <Levels>
    <Level number="1">
	<Increase type="HD">6</Increase>
	<Increase type="SavingThrow" name="reflex">2</Increase>
	<Increase type="SavingThrow" name="will">2</Increase>
	<Increase type="Skill">6</Increase>
	<Add type="SpecialAbility" name="bardic music"/>
	<Add type="SpecialAbility" name="bardic knowledge"/>
	<Add type="SpecialAbility" name="countersong"/>
	<Add type="SpecialAbility" name="fascinate"/>
	<Add type="SpecialAbility" name="inspire courage"/>
	<Increase type="Level" name="inspire courage">1</Increase>
	<Increase type="Spell" subtype="bard">1</Increase>
    </Level>
    <Level number="2">
	<Increase type="HD">6</Increase>
	<Increase type="BAB">1</Increase>
	<Increase type="SavingThrow" name="reflex">1</Increase>
	<Increase type="SavingThrow" name="will">1</Increase>
	<Increase type="Skill">6</Increase>
	<Increase type="Spell" subtype="bard">1</Increase>
    </Level>
    <Level number="3">
	<Increase type="HD">6</Increase>
	<Increase type="BAB">1</Increase>
	<Increase type="SavingThrow" name="fortitude">1</Increase>
	<Increase type="Skill">6</Increase>
	<Add type="SpecialAbility" name="inspire competence"/>
	<Increase type="Spell" subtype="bard">1</Increase>
    </Level>
    <Level number="4">
	<Increase type="HD">6</Increase>
	<Increase type="BAB">1</Increase>
	<Increase type="SavingThrow" name="reflex">1</Increase>
	<Increase type="SavingThrow" name="will">1</Increase>
	<Increase type="Skill">6</Increase>
	<Increase type="Spell" subtype="bard">1</Increase>
    </Level>
    <Level number="5">
	<Increase type="HD">6</Increase>
	<Increase type="Skill">6</Increase>
	<Increase type="Spell" subtype="bard">1</Increase>
    </Level>
    <Level number="6">
	<Increase type="HD">6</Increase>
	<Increase type="BAB">1</Increase>
	<Increase type="SavingThrow" name="fortitude">1</Increase>
	<Increase type="SavingThrow" name="reflex">1</Increase>
	<Increase type="SavingThrow" name="will">1</Increase>
	<Increase type="Skill">6</Increase>
	<Add type="SpecialAbility" name="suggestion"/>
	<Increase type="Spell" subtype="bard">1</Increase>
    </Level>
    <Level number="7">
	<Increase type="HD">6</Increase>
	<Increase type="BAB">1</Increase>
	<Increase type="Skill">6</Increase>
	<Increase type="Spell" subtype="bard">1</Increase>
    </Level>
    <Level number="8">
	<Increase type="HD">6</Increase>
	<Increase type="BAB">1</Increase>
	<Increase type="SavingThrow" name="reflex">1</Increase>
	<Increase type="SavingThrow" name="will">1</Increase>
	<Increase type="Skill">6</Increase>
	<Add type="SpecialAbility" name="inspire greatness"/>
	<Increase type="Level" name="inspire courage">1</Increase>
	<Increase type="Spell" subtype="bard">1</Increase>
    </Level>
    <Level number="9">
	<Increase type="HD">6</Increase>
	<Increase type="SavingThrow" name="fortitude">1</Increase>
	<Increase type="Skill">6</Increase>
	<Increase type="Spell" subtype="bard">1</Increase>
    </Level>
    <Level number="10">
	<Increase type="HD">6</Increase>
	<Increase type="BAB">1</Increase>
	<Increase type="SavingThrow" name="reflex">1</Increase>
	<Increase type="SavingThrow" name="will">1</Increase>
	<Increase type="Skill">6</Increase>
	<Increase type="Spell" subtype="bard">1</Increase>
    </Level>
    <Level number="11">
	<Increase type="HD">6</Increase>
	<Increase type="BAB">1</Increase>
	<Increase type="Skill">6</Increase>
	<Increase type="Spell" subtype="bard">1</Increase>
    </Level>
    <Level number="12">
	<Increase type="HD">6</Increase>
	<Increase type="BAB">1</Increase>
	<Increase type="SavingThrow" name="fortitude">1</Increase>
	<Increase type="SavingThrow" name="reflex">1</Increase>
	<Increase type="SavingThrow" name="will">1</Increase>
	<Increase type="Skill">6</Increase>
	<Add type="SpecialAbility" name="song of freedom"/>
	<Increase type="Spell" subtype="bard">1</Increase>
    </Level>
    <Level number="13">
	<Increase type="HD">6</Increase>
	<Increase type="Skill">6</Increase>
	<Increase type="Spell" subtype="bard">1</Increase>
    </Level>
    <Level number="14">
	<Increase type="HD">6</Increase>
	<Increase type="BAB">1</Increase>
	<Increase type="SavingThrow" name="reflex">1</Increase>
	<Increase type="SavingThrow" name="will">1</Increase>
	<Increase type="Skill">6</Increase>
	<Increase type="Level" name="inspire courage">1</Increase>
	<Increase type="Spell" subtype="bard">1</Increase>
    </Level>
    <Level number="15">
	<Increase type="HD">6</Increase>
	<Increase type="BAB">1</Increase>
	<Increase type="SavingThrow" name="fortitude">1</Increase>
	<Increase type="Skill">6</Increase>
	<Add type="SpecialAbility" name="inspire heroics"/>
	<Increase type="Spell" subtype="bard">1</Increase>
    </Level>
    <Level number="16">
	<Increase type="HD">6</Increase>
	<Increase type="BAB">1</Increase>
	<Increase type="SavingThrow" name="reflex">1</Increase>
	<Increase type="SavingThrow" name="will">1</Increase>
	<Increase type="Skill">6</Increase>
	<Increase type="Spell" subtype="bard">1</Increase>
    </Level>
    <Level number="17">
	<Increase type="HD">6</Increase>
	<Increase type="Skill">6</Increase>
	<Increase type="Spell" subtype="bard">1</Increase>
    </Level>
    <Level number="18">
	<Increase type="HD">6</Increase>
	<Increase type="BAB">1</Increase>
	<Increase type="SavingThrow" name="fortitude">1</Increase>
	<Increase type="SavingThrow" name="reflex">1</Increase>
	<Increase type="SavingThrow" name="will">1</Increase>
	<Increase type="Skill">6</Increase>
	<Add type="SpecialAbility" name="mass suggestion"/>
	<Increase type="Spell" subtype="bard">1</Increase>
    </Level>
    <Level number="19">
	<Increase type="HD">6</Increase>
	<Increase type="BAB">1</Increase>
	<Increase type="Skill">6</Increase>
	<Increase type="Spell" subtype="bard">1</Increase>
    </Level>
    <Level number="20">
	<Increase type="HD">6</Increase>
	<Increase type="BAB">1</Increase>
	<Increase type="SavingThrow" name="reflex">1</Increase>
	<Increase type="SavingThrow" name="will">1</Increase>
	<Increase type="Skill">6</Increase>
	<Increase type="Level" name="inspire courage">1</Increase>
	<Increase type="Spell" subtype="bard">1</Increase>
    </Level>
  </Levels>
</Class>
<--Rethink, part 3 ^--xmld20--^ Rethink, part 5-->
©2002-2017 Wayne Pearson