engine/calculators/source/TanningCalculator.cpp
// When applying a resistance via tanning, the base value is (resist / div),
// where divisor is based on the creature's tanning skill.
//
// Additional points (0.01) can potentially be added based on the
// creature's Tanning skill.
When applying a resistance via tanning, the base value is (resist / div),
where divisor is based on the creature's tanning skill.

Additional points (0.01) can potentially be added based on the
creature's Tanning skill.
When applying a resistance via tanning the base value is ( resist / div ) where divisor is based on the creature ' s tanning skill . Additional points ( 0 . 01 ) can potentially be added based on the creature ' s Tanning skill .
double TanningCalculator::calculate_resistance_value(CreaturePtr creature, ResistancePtr resistance)
{
  double resist_val = 0.0;
  if (creature != nullptr && resistance != nullptr)
  {
    int tanning_val = creature->get_skills().get_value(SkillType::SKILL_GENERAL_TANNING);
    double val = resistance->get_value();
    double divisor = 1.0;
    for (const pair<int, double>& r_pair : SKILL_VALUE_DIVISORS)
    {
      if (tanning_val >= r_pair.first)
      {
        divisor = r_pair.second;
        break;
      }
    }
    resist_val = (val / divisor);
    if (val > 0)
    {
      resist_val = std::max<double>(0.01, resist_val);
    }
    int potential_extra = calculate_potential_extra_resistance_points(creature);
    double extra = 0.0;
    if (resist_val > 0)
    {
      for (int i = 0; i < potential_extra; i++)
      {
        if (RNG::percent_chance(PCT_CHANCE_EXTRA_POINT))
        {
          extra += 0.01;
        }
        else
        {
          break;
        }
      }
    }
    resist_val += extra;
  }
  return resist_val;
}
double TanningCalculator :: calculate_resistance_value ( CreaturePtr creature , ResistancePtr resistance ) { double resist_val = 0.0 ; if ( creature != nullptr && resistance != nullptr ) { int tanning_val = creature -> get_skills ( ) . get_value ( SkillType :: SKILL_GENERAL_TANNING ) ; double val = resistance -> get_value ( ) ; double divisor = 1.0 ; for ( const pair < int , double > & r_pair : SKILL_VALUE_DIVISORS ) { if ( tanning_val >= r_pair . first ) { divisor = r_pair . second ; break ; } } resist_val = ( val / divisor ) ; if ( val > 0 ) { resist_val = std :: max < double > ( 0.01 , resist_val ) ; } int potential_extra = calculate_potential_extra_resistance_points ( creature ) ; double extra = 0.0 ; if ( resist_val > 0 ) { for ( int i = 0 ; i < potential_extra ; i ++ ) { if ( RNG :: percent_chance ( PCT_CHANCE_EXTRA_POINT ) ) { extra += 0.01 ; } else { break ; } } } resist_val += extra ; } return resist_val ; }
When applying a resistance via tanning, the base value is (resist / div),
where divisor is based on the creature's tanning skill.
When applying a resistance via tanning the base value is ( resist / div ) where divisor is based on the creature ' s tanning skill .
// Ensure that if this is a resist (> 0), there is a minimum value of 0.01. // That way, even with a large divisor, a small resistance can be carried // over.