Friday, 5 April 2013

Hero Lab - Sanity

As I mentioned yesterday, I've got Sanity working in my data files now too, thanks to the Tour of Darkness data files!

I know that, technically, I could have left the Sanity field to Hero Lab to deal with it, but that assumes the Horror Companion license is enabled and I wasn't happy assuming that everyone playing Achtung! Cthulhu was going to shell out the additional license costs... I'd like this one to run on the base Savage Worlds install and assume complete ignorance of everything else.

Sanity is calculated from a base value of 2, plus half of your Spirit.

First thing I had to do was add a Sanity thing to the data file. In the editor, these can be added under the Derived Trait tab. When writing the evaluation script we need to be aware that the dice values for the user's attributes are stored as half of the dice value, so d4 = 2, d6 = 3 etc. which gives us a range of 2-6. This also means we don't need to go dividing the dice value of Spirit when calculating Sanity, we can simply add it directly to the initial value of 2.

  <thing id="trACSanity" name="Sanity" description="Those who face the twisted horrors of the Mythos tend not to remain sane for very long. The Sanity statistic is a trait that lets you monitor your character&#146;s mental health. " compset="Trait" uniqueness="unique">
    <fieldval field="trtAbbrev" value="San"/>
    <fieldval field="trtBonus" value="2"/>
    <usesource source="sepActCth"/>
    <tag group="DashTacCon" tag="Basics" name="Basics" abbrev="Basics"/>
    <tag group="DashTacCon" tag="Traits" name="Traits" abbrev="Traits"/>
    <tag group="explicit" tag="3"/>
    <eval phase="Traits" priority="4000" name="Calc Derived Bonus"><![CDATA[
      ~Note: We must also handle an overage beyond d12 on a +1 per 2 full points basis.
      ~Note: We ADD the amount in case other effects have already applied adjustments.
      var bonus as number
      bonus = #trait[attrSpi]
      if (bonus >= 6) then
        bonus = 6 + round(hero.child[attrSpi].field[trtRoll].value / 2,0,-1)
        endif
      perform field[trtBonus].modify[+,bonus,"Half Spirit"]]]>
      <before name="Derived trtFinal"/>
      <after name="Calc trtFinal"/>
      </eval>
    </thing>

In the evaluation script we can see that we're looking at the attribute Spirit and assigning it to the bonus variable. If this value is 6 or more, i.e. we have a skill that improves our chances with additions to our Spirit rolls, then we need to work out what that new value of bonus would be. In order to work out the new value of bonus we need to divide the roll bonus by 2, rounding down and ignoring any decimal places and then add this to the new value of Bonus.

If the value of Bonus is less than 6, then we directly add the value of bonus to the field trtBonus. Tada! There's our rather faff worthy Sanity bonus. I wouldn't have thought of skills affecting the value enough to take it over D12... so thanks to the ToD team!

Now I've got to allow people to lose sanity points, otherwise we've no way of tracking these things.  I know Realms of Cthulhu have added another field in to track this and we may need to switch over to it later, but the A!C pre-gens don't have this listed... so I'm assuming they use a different method of tracking insanity. I'm sure there are other ways to do this, but I figure losing sanity is as close to an injury as you're going to get, so why not track it in the same manner?

Three Kings has one of the characters afflicted with a Special Ability called Fragile Mind, so this was my first injury.
  <thing id="injACFMind" name="Fragile Mind" description="The investigator has had a close brush with the Mythos and has suffered a -2 Sanity" compset="Injury">
    <usesource source="sepActCth"/>
    <eval phase="PreTraits" priority="5000"><![CDATA[perform #traitadjust[trACSanity,-,2,"Fragile Mind"]]]>
      <before name="Calc trtFinal"/>
      </eval>
    </thing>



In here you can see that when the injury is added, it modifies our Sanity trait trACSanity, reducing it by 2. When we remove the injury, their sanity levels return to normal.

I'm sure in future books there will be more sanity calculations, but for now we'll stick at this.

No comments:

Post a Comment