TemplePlus
TemplePlus copied to clipboard
Various changes related to spells that modify a critter's size
This started with an aim to prevent Enlarge Person and Righteous Might from stacking, but I ended up doing a lot of work to make the overall system (hopefully) work better. Here's the overall changes.
- Added a couple new
BonusListfunctions- gets the largest penalty, which I ended up not needing, but someone might
- a special function used for model scale queries, which treats the 'initial value' differently from the rest of the bonuses. I don't think you ever see the bonus list for these queries, so hopefully it won't lead to confusion
- Replaced some more standard functions that test conditions by pointer. Doing
ExtendExistingcan break these unless you try aGetByNameusing the name from the old struct. But not all the functions that include these tests were fixed. - Tweaked the size category callbacks for spells that enlarge/reduce characters. They now use
data1anddata2to keep track of whether the size has already been enlarged/reduced once. This fixes the stacking of enlarge with righteous might w/r/t size category - Replaced the on-add/remove behavior for enlarge/reduce/etc. to just trigger a model update. They no longer set object fields; all the changes are determined dynamically.
- Likewise, removed the Co8, player-only reach modification for enlarge. It doesn't get set, and removes itself on the first BeginRound if you load a save game.
- Added
dispTypeModelScalecallbacks to the relevant conditions- this uses the second
BonusListfunction above. The initial value is set to the object's normal model scale. Then, the conditions add+1or-1bonuses. At the end, the extra bonuses are summed, and used as an exponent to scale the initial value. So, this ends up asinit*1.8^(overall bonus). This fixes Enlarge Person and Righteous Might stacking w/r/t/ model scale, because the bonuses overlap.
- this uses the second
- Changed the weapon dice queries for these conditions. The query already had a bonus list in it, so the conditions just add a +1 bonus or -1 penalty. Then the query uses the overall bonus/penalty to figure out how to adjust the dice. This fixes the stacking for this case (bonuses overlap again).
- Changed the
GetReachfunction to dynamically figure out an adjustment to the critter's reach by using size category queries (both base and current).- Critters that become tiny now get decreased reach. The area they threaten is comparable to a single 'square', which I think is P&P accurate. This is from the perspective of being able to AoO enemies that enter your square, for instance.
- Changed the
GetRadiusfunction similarly. This was not being handled at all before, so being enlarged didn't really make you occupy more space, strangely.- While testing this, I've come to the conclusion that many radii in the protos are just wrong. The values often don't even make sense from a visual perspective. So there are some clamps in the code to prevent really stupid numbers. Like, if you reduce a dire wolf, which has radius 30 (inches) despite being large, you don't want to get a radius of 5.
- Uniformized the stat bonus types for enlarge/reduce/righteous might stuff, so that they don't stack
- Removed the old model scale fixes, because they're no longer needed.
- Systematically replaced one of the
stat_base/level_getcases for stats with the same category as size and stuff. They should now properly report the base and current value respectively, which was dicey before. I also renamed the category to "Physical," which is suggested by the original dll, and seems better than "Type3" or "Combat" (since not all the stats are really combat related). - Tweaked Reduce Animal spell stuff:
- It's supposed to be 1hr/lvl, not 1min/lvl
- It's supposed to work only with willing animals
I think that's about it. This should fix atari bug 138 (stacking enlarge w/ righteous might).
A couple things I haven't done, that I know about.
- If you load a save with the Co8 stuff applied, you'll probably have the wrong reach until your next turn. I can add extra checks to try to work around that, but I'm not sure if it's a big enough deal to justify it.
- Reduce Animal enters combat even though you can only cast it on a willing target. I forget if that's hard coded somewhere, but changing the AI designation in the spell info didn't fix it, at least.
Nice change! I will take a closer look when I get a chance.