So I have this if statement:
if the value corresponding to a Pattern Complexity of The Pattern Complexity in Row N of the Table of Spells in The Table of Power <= the value corresponding to a Pattern complexity of The Pattern Complexity of the player in the Table of Power:
If that doest make much sense to you, I am essentially using a table to relate numerical values for a kind of value so that I can do comparisons like the above, but thats a pretty convoluted statement and im wondering if there is way to shorten it at all.
Tables for reference
Table of Spells
Spell Output Pattern Complexity Spell Source Description Knowledge
View Pattern "[View-Pattern-Output]" Dim Internal "[View-Pattern-Description]" learned
Table of Power
Pattern Complexity Value
Insanely Complex 4
Even if you can’t simplify the logic, you can make the code less unbearable by breaking it up using definitions.
Something like this:
To decide what number is the level of (P - a pattern complexity):
decide on the value corresponding to a pattern complexity of P in the Table of Power.
To decide what number is the level of spell number (N - a number):
decide on the level of the pattern complexity in row N of the Table of Spells.
To decide what number is the casting level of the player:
decide on the level of the pattern complexity of the player.
if the level of spell number N is at most the casting level of the player:
But a trick that might be useful to you — maybe you can get by without converting to numbers at all. Say you’ve defined your kind of value like this:
A pattern complexity is a kind of value. The pattern complexities are dim, simple, complex and insanely complex.
Then you should be able to compare the values directly, with dim<simple<complex<insanely complex. So you can say something like
if the pattern complexity in row N of the Table of Spells is at most the pattern complexity of the player:
That lets you get rid of the Table of Power entirely.
Edit: corrected an error in the last code snippet (“at most”, not “no more than”).
That is exactly what I was looking for, thanks.