Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: A Cure for Insanity?  (Read 2144 times)

Kaos

  • Bay Watcher
    • View Profile
A Cure for Insanity?
« on: October 24, 2015, 10:23:22 am »

It just occured to me: could an insane dwarf be cured of insanity by being infected by a were-creature curse and turning during the full moon and back into a fully healthy, sane dwarf?

I'm thinking about exploiting the ability that were-curses have that the dwarf could even have missing limbs but they regrow on transformation... does this work for insanity too?
Logged

Pancakes

  • Bay Watcher
  • Cancels drink: Too insane
    • View Profile
Re: A Cure for Insanity?
« Reply #1 on: October 24, 2015, 10:43:42 am »

I'm not sure since werebeasts are berserk during their stay, so maybe it would change the type of insanity to berserk?
Logged

FortunaDraken

  • Bay Watcher
    • View Profile
Re: A Cure for Insanity?
« Reply #2 on: October 24, 2015, 08:44:22 pm »

I smell a SCIENCE opportunity.
Logged
I just had a "lord consort" visit and decide to stay. Preparing for Trojan war reenactment.
Protip: statues cannot be made out of wood unless they're artifacts. If you see what appears to be a wooden statue outside your fort and it's not an artifact, destroy it immediately.

TruePikachu

  • Bay Watcher
  • Accomplished System Administrator
    • View Profile
    • cDusto (my personal server)
Re: A Cure for Insanity?
« Reply #3 on: October 24, 2015, 10:59:48 pm »

I highly doubt this would work, since if memory serves, insanity is tied to the Unit (and possibly the Soul), and not to the Body. It is the Body which changes at full moon, not the Unit (and certainly not the Soul)...
EDIT: And the way the Body changes is by creating a new one...hm, does appearance change after turning? I haven't looked closely enough at the structures to see if there's a spare set of appearance details...
Logged
He likes Pokémon, composing ≡«☼characters☼»≡, Windows for its compatability, Linux for its security, and Pikachu for its electric capabilities. When possible, he prefers to consume pasta. He absolutely detests Apple.

Astrid

  • Bay Watcher
  • This is a text.
    • View Profile
Re: A Cure for Insanity?
« Reply #4 on: October 25, 2015, 10:10:55 am »

Considering that you can drive a were-dwarf into insanity by constantly hurting without killing him...

I doubt it. The transformation does not 'reset' the state of the Dwarfs emotions.
I kept an eye on just that not long ago.
Logged

TruePikachu

  • Bay Watcher
  • Accomplished System Administrator
    • View Profile
    • cDusto (my personal server)
Re: A Cure for Insanity?
« Reply #5 on: October 25, 2015, 03:05:59 pm »

Without an active fort, it is hard for me to test this. However, getting an insane werebeast shouldn't be too difficult, if one has DFHack. Please hold while I develop a script to make all werebeasts insane...
Logged
He likes Pokémon, composing ≡«☼characters☼»≡, Windows for its compatability, Linux for its security, and Pikachu for its electric capabilities. When possible, he prefers to consume pasta. He absolutely detests Apple.

Goatmaan

  • Bay Watcher
    • View Profile
Re: A Cure for Insanity?
« Reply #6 on: October 25, 2015, 03:45:16 pm »

The OP was wanting to cure insane DWARFS, by turning them INTO weres.

It would be hard, the insane would have to survive the fight not to mention get into the fight.

  Goatmaan
Logged
My !!XXcpuXX!! *HATES* me.

TruePikachu

  • Bay Watcher
  • Accomplished System Administrator
    • View Profile
    • cDusto (my personal server)
Re: A Cure for Insanity?
« Reply #7 on: October 25, 2015, 04:18:54 pm »

Okay, theoretically-working script:
Code: [Select]
-- Makes all werebeasts that are loaded insane

for _,unit in ipairs(df.global.world.units.all) do
  -- Get the historical figure
  for _,generalRef in ipairs(unit.general_refs) do
    if getmetatable(generalRef)=="general_ref_is_nemesisst" then
      local nemesis = df.global.world.nemesis.all[generalRef.nemesis_id]
      if nemesis.figure.info.curse then
        for _,active_interaction in ipairs(nemesis.figure.info.curse.active_interactions) do
          if string.find(active_interaction.name,"WEREBEAST") then
            -- This is a werecreature
            -- Select one of the three proper "insane" moods
            unit.mood = math.random(3) + 4 -- 5, 6, or 7
          end
        end
      end
    end
  end
end
When saved to a .lua file in the hack/scripts directory, then invoked, it will make all cursed creatures on the map insane.

Goatmaan: The central question is if turning cures insanity. This can be tested by cursing an insane dwarf (hard to do safely), or by insanifying a cursed dwarf (which the script above does).

Like I said earlier, I highly doubt that the werebeast turning will actually fix insanity. The reason is simple: the insanity is stored somewhere away from the curse and the body.

All loaded units are in memory, and listed through vector<unit*> global.world.units.all. Each unit contains a few fields, like unit.T_body unit::body (which is the actual body the unit is using, containing things like injuries), mood_type unit::mood (which determines the current strange mood, insanity form, or if the unit is a baby), and, somewhere in vector<general_ref*> unit::general_refs, a general_ref_is_nemesisst with a int32_t ::nemesis_id, referring to the actual historical figure. That is used as an index into vector<nemesis_record*> global.world.nemesis.all, and then the curse details are stored at historical_figure_info.T_curse nemesis_record::figure.info.curse.

In other words, all units (being entries in the Units list) store a body, insanity value, and reference to their historical figure (if applicable). The historical figure holds curse details, and the body holds stuff like the creature's actual body. I believe the werecreature turning creates a new body for the unit, which would only affect the body; the insanity isn't part of the body, so it wouldn't be affected.
Logged
He likes Pokémon, composing ≡«☼characters☼»≡, Windows for its compatability, Linux for its security, and Pikachu for its electric capabilities. When possible, he prefers to consume pasta. He absolutely detests Apple.