engine/actions/source/RangedCombatApplicabilityChecker.cpp
// The ammunition equipped needs to match the ranged weapon.  For example,
// slings and arrows are not much use, unless one is actually Outrageous
// Fortune.
The ammunition equipped needs to match the ranged weapon.  For example,
slings and arrows are not much use, unless one is actually Outrageous
Fortune.
The ammunition equipped needs to match the ranged weapon . For example slings and arrows are not much use unless one is actually Outrageous Fortune .
bool RangedCombatApplicabilityChecker::does_ranged_weapon_match_ammunition(CreaturePtr creature)
{
  bool weapon_match = false;
  if (creature)
  {
    Equipment& equipment = creature->get_equipment();
    WeaponPtr ranged_weapon = dynamic_pointer_cast<Weapon>(equipment.get_item(EquipmentWornLocation::EQUIPMENT_WORN_RANGED_WEAPON));
    ItemPtr ammo_slot_item = equipment.get_item(EquipmentWornLocation::EQUIPMENT_WORN_AMMUNITION);
    WeaponPtr ammunition = dynamic_pointer_cast<Weapon>(ammo_slot_item);
    PotionPtr potion_ammo = dynamic_pointer_cast<Potion>(ammo_slot_item);
    WeaponManager wm;
    weapon_match = ((potion_ammo && !ranged_weapon) || wm.is_ranged_weapon_skill_type_compatible_with_ammunition(ranged_weapon, ammunition));
  }
  return weapon_match;
}
bool RangedCombatApplicabilityChecker :: does_ranged_weapon_match_ammunition ( CreaturePtr creature ) { bool weapon_match = false ; if ( creature ) { Equipment & equipment = creature -> get_equipment ( ) ; WeaponPtr ranged_weapon = dynamic_pointer_cast < Weapon > ( equipment . get_item ( EquipmentWornLocation :: EQUIPMENT_WORN_RANGED_WEAPON ) ) ; ItemPtr ammo_slot_item = equipment . get_item ( EquipmentWornLocation :: EQUIPMENT_WORN_AMMUNITION ) ; WeaponPtr ammunition = dynamic_pointer_cast < Weapon > ( ammo_slot_item ) ; PotionPtr potion_ammo = dynamic_pointer_cast < Potion > ( ammo_slot_item ) ; WeaponManager wm ; weapon_match = ( ( potion_ammo && ! ranged_weapon ) || wm . is_ranged_weapon_skill_type_compatible_with_ammunition ( ranged_weapon , ammunition ) ) ; } return weapon_match ; }
The ammunition equipped needs to match the ranged weapon.
The ammunition equipped needs to match the ranged weapon .