Hi there,
I did the majority of the files for Ultimate Wilderness. Just to be sure do you mean the one in cShfClaws (which is the class ability) or xShfClaws which is a helper that takes care of most of the mechanics of shifter claws (needed to do it this way because of archetypes changing the function of claws or granting different classes claws)?
I am guessing you mean the one in xShfClaws since it is rather complex.
Here is the annotated script. Before I begin here is what some of the fields do
abValue - stores our overall shifter level
abValue2 - value to increase our critical multiplier by
abValue5 - a flag that is nonzero when claws are active
abText - claws damage text
abText2 - DR bypass text
Code:
~ Get out if our effective shifter level is 0 or less
doneif (field[abValue].value <= 0)
perform assign[Helper.ShowSpec]
abValue is used in xShfClaws to store our shifter level. It can also be set of a negative number to prevent this script from running.
Code:
~ if we are in our major form, make sure we are still active
if (hero.tagis[Hero.MajorForm] <> 0) then
perform delete[Helper.SpcDisable]
trustme
field[polyDefLst].value = 1
endif
Since aspects use the polymorph routines for their major forms we need to make sure our claws helper is not disabled when we change form. That is what the field polyDefLst field is for. However, it is not a field that you can usually set in a script thus the use of trust me.
Code:
~ Get our claw damage pick, delete the damage tag from it, and
~ assign the new tag
~ we search for the attack with the ShifterClw tag so we
~ can use claw damage with major form natural attacks and
~ some archetypes replace the claw with a different attack
~ additionally we can use the claw attack damage in place of some
~ natural attack's damage when in wild shape
~ first get our new damage tag
var level as number
var clawavg as number
level = field[abValue].value
call ShfWepBase
~ set our dice damage in abText
var dicetext as string
call wMainText
field[abText].text = dicetext
As the comments here say, this part is setting the damage tags for the claws as well as granting shifter claw damage to natural attacks in our major form. The procedure ShfWepBase takes care of most of this. Note that whatever attack is going to use the damage from shifter claws needs to have the Helper.ShifterClw tag.
Code:
~ get out if we have not been activated by whatever called us
~ this is determined by abValue5
doneif (field[abValue5].value = 0)
abValue5 is used as a flag to let the helper know that claws have been activated. It is done this way because other things other than cShfClaws could potentially grant shifter claws. So whenever there is an ability that grants shifter claws it will need to bootstrap the helper and set the helper's abValue5 value to not zero when active.
Code:
~ now apply damage, critical increases, and DR bypass to all shifter claw weapons
foreach pick in hero from BaseWep where "Helper.ShifterClw"
~ we only increase our damage if our shifter claw damage is better,
~ in other words has a greater average
var dicetext as string
var average as number
dicetext = eachpick.tagnames[wMain.?]
call DieAverage
~ if our claw avg is greater than the current attack's avg
~ replace it
if (clawavg >= average) then
perform eachpick.delete[wMain.?]
perform eachpick.pushtags[wMain.?]
endif
~ if abValue2 has a value increase our weapon's critical multipler
~ by that ammount
if (field[abValue2].value <> 0) then
var crit as number
crit = eachpick.tagvalue[wCritMult.?]
crit += field[abValue2].value
~ crit should be at least 3, and no more than 4 if this runs
crit = maximum(3,crit)
crit = minimum(4,crit)
perform eachpick.delete[wCritMult.?]
perform eachpick.assignstr["wCritMult." & crit]
endif
~ finally give each weapon the DR bypass info in a situational
~ rageshape ignores hardness instead of the usual DR
var ignoretxt as string
if (#hasarchetype[arShfRages] <> 0) then
ignoretxt = ""
else
ignoretxt = "DR/"
endif
if (field[abText2].isempty = 0) then
#situational_nonstatblock[eachpick,"Attacks ignore " & ignoretxt & field[abText2].text,field[name].text]
endif
nexteach
This final part does a number of things. First it grants our claws the appropriate damage tags. It also increases our crit multiplier if we have a value in abValue2 as well as takes care of adding the DR bypass text to our claws.