PRESPELLTYPE Syntax

From PCGen Wiki
Revision as of 19:28, 4 September 2008 by Eddyanthony (talk | contribs) (New page: So generally, PROHIBITSPELL today is: PROHIBITSPELL:PSTYPE.Foo[.Foo2] Where PSTYPE is ALIGNMENT, SCHOOL, or DESCRIPTOR... I would like to alter PROHIBITSPELL's SYNTAX: PROHIBITSPELL:PST...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

So generally, PROHIBITSPELL today is:

PROHIBITSPELL:PSTYPE.Foo[.Foo2]

Where PSTYPE is ALIGNMENT, SCHOOL, or DESCRIPTOR... I would like to alter PROHIBITSPELL's SYNTAX:

PROHIBITSPELL:PSTYPE|Foo[.Foo2][,Foo3[.Foo4]]

Changes:

1) | serves as a separator for the Prohibited 'type'

2) comma separated lists of dot separated items are allowed (the dots operating as they do today in PROHIBITSPELL as an and, the comma as a or)

Thus, prohibited spells end up as something like:

PROHIBITSPELL:SPELL|Dispel Magic,Fireball

The examples in the docs change to:

PROHIBITSPELL:ALIGNMENT|Evil
PROHIBITSPELL:ALIGNMENT|Chaotic.Evil
PROHIBITSPELL:DESCRIPTOR|Fear
PROHIBITSPELL:SCHOOL|Illusion

I do this so that the PSTYPE lookup can avoid a special exception for ALIGNMENT, SCHOOL, or DESCRIPTOR. This (in the long term, at least) helps the code stay clean.

Consider this 'bad' case that the code would have to resolve if this change is not made:

Spell LST file:
School Victim<tab>KEY:SCHOOL

Class LST file:
CLASS:Foo<tab>PROHIBITSPELL:SCHOOL.Invocation

This causes a NASTY lookahead - one has to test Invocation to check if it's a spell school, and then the code has to guess whether (1) Invocation was meant to be a spell and this is a typo or (2) Invocation really is a school and all is OK. If Invocation is actually a Spell, the situation is even worse, because both are valid and the code must then make a priority call. Those are BAD decisions to have to code, especially when a simple change can completely avoid the issue.