Elemental resist/immunity

Donavin69

Member
How do I test for elemental resistance or immunity in a consult script? Currently I'm explicitly defining the mobs in the area that I'm fighting in, but I would like to make it a little more universal. monster_element() returns what the monster is aligned with, not what it is resistant to or immune to (like the ghost of Fernwarthy is immune to physical)
 

Winterbay

Active member
I think that taking a look in BatBrain is not a bad idea in this case. Zarqon has defined a function called get_resistance which looks like this:
Code:
// build resistance(s)
spread get_resistance(element which) {
   spread res;
   foreach el in $elements[] res[el] = 0; res[$element[none]] = 0;
   if (which != $element[none]) res[which] = 1;
   switch (which) {
      case $element[hot]: res[$element[sleaze]] = -1; res[$element[stench]] = -1; break;
      case $element[spooky]: res[$element[hot]] = -1; res[$element[stench]] = -1; break;
      case $element[cold]:   res[$element[hot]] = -1; res[$element[spooky]] = -1; break;
      case $element[sleaze]: res[$element[cold]] = -1; res[$element[spooky]] = -1; break;
      case $element[stench]: res[$element[cold]] = -1; res[$element[sleaze]] = -1; break;
   }
   return res;
}

Where a spread is a defined class defined as
Code:
typedef float[element] spread;
.

I think that may be a good starting point.
 

Donavin69

Member
I saw that in Batbrain, its very much like the code snippet on the wiki, but it doesn't cover the physical immunity of Fernwarthy's Ghost. It looks to me like this might be a piece of information that isn't available :(
 

Bale

Minion
That information isn't available in mafia, but it is available if you import (or copy/paste) BatBrain. mres[$element[none]] = 1 means it is physically resistant.
 
Top