engine/calculators/source/MeleeAndRangedCombatTargetNumberCalculator.cpp
// The target number:
//
// = the difficulty of the attacking creature's weapon
// - attacking creature's Hunting skill / 2, if the attacked creature is an animal
// + attacked creature's evade
//
The target number:
the difficulty of the attacking creature's weapon
attacking creature's Hunting skill / 2, if the attacked creature is an animal
+ attacked creature's evade
The target number : the difficulty of the attacking creature ' s weapon attacking creature ' s Hunting skill / 2 if the attacked creature is an animal + attacked creature ' s evade
int MeleeAndRangedCombatTargetNumberCalculator::calculate(CreaturePtr attacking_creature, CreaturePtr attacked_creature)
{
  int target_number = 0;
  if (attacking_creature && attacked_creature)
  {
    WeaponDifficultyCalculator wdc;
    int weapon_difficulty = wdc.calculate_base_difficulty(attacking_creature, attack_type);
    int hunting_bonus = 0;
    if (attacked_creature->get_race_id() == RaceConstants::RACE_CONSTANTS_RACE_ID_ANIMAL)
    {
      hunting_bonus = attacking_creature->get_skills().get_value(SkillType::SKILL_GENERAL_HUNTING) / 2;
    }
    int target_evade = attacked_creature->get_evade().get_current();
    target_number = weapon_difficulty 
                  - hunting_bonus 
                  + target_evade;
  }
  return target_number;
}
int MeleeAndRangedCombatTargetNumberCalculator :: calculate ( CreaturePtr attacking_creature , CreaturePtr attacked_creature ) { int target_number = 0 ; if ( attacking_creature && attacked_creature ) { WeaponDifficultyCalculator wdc ; int weapon_difficulty = wdc . calculate_base_difficulty ( attacking_creature , attack_type ) ; int hunting_bonus = 0 ; if ( attacked_creature -> get_race_id ( ) == RaceConstants :: RACE_CONSTANTS_RACE_ID_ANIMAL ) { hunting_bonus = attacking_creature -> get_skills ( ) . get_value ( SkillType :: SKILL_GENERAL_HUNTING ) / 2 ; } int target_evade = attacked_creature -> get_evade ( ) . get_current ( ) ; target_number = weapon_difficulty - hunting_bonus + target_evade ; } return target_number ; }
The target number:
 the difficulty of the attacking creature's weapon
 attacking creature's Hunting skill / 2, if the attacked creature is an animal
+ attacked creature's evade
The target number : the difficulty of the attacking creature ' s weapon attacking creature ' s Hunting skill / 2 if the attacked creature is an animal + attacked creature ' s evade