7777
7878struct mutation_branch ;
7979
80+ static const ammo_effect_str_id ammo_effect_id_APPLY_SAP ( " APPLY_SAP" );
81+ static const ammo_effect_str_id ammo_effect_id_BEANBAG ( " BEANBAG" );
82+ static const ammo_effect_str_id ammo_effect_id_BLINDS_EYES ( " BLINDS_EYES" );
83+ static const ammo_effect_str_id ammo_effect_id_BOUNCE ( " BOUNCE" );
84+ static const ammo_effect_str_id ammo_effect_id_FOAMCRETE ( " FOAMCRETE" );
85+ static const ammo_effect_str_id ammo_effect_id_LARGE_BEANBAG ( " LARGE_BEANBAG" );
86+ static const ammo_effect_str_id ammo_effect_id_MAGIC ( " MAGIC" );
87+ static const ammo_effect_str_id ammo_effect_id_NO_DAMAGE_SCALING ( " NO_DAMAGE_SCALING" );
88+ static const ammo_effect_str_id ammo_effect_id_NOGIB ( " NOGIB" );
89+ static const ammo_effect_str_id ammo_effect_id_PARALYZEPOISON ( " PARALYZEPOISON" );
90+ static const ammo_effect_str_id ammo_effect_id_ROBOT_DAZZLE ( " ROBOT_DAZZLE" );
91+ static const ammo_effect_str_id ammo_effect_id_TANGLE ( " TANGLE" );
92+ static const ammo_effect_str_id ammo_effect_id_IGNITE ( " IGNITE" );
93+ static const ammo_effect_str_id ammo_effect_id_INCENDIARY ( " INCENDIARY" );
94+
8095static const anatomy_id anatomy_human_anatomy ( " human_anatomy" );
8196
8297static const damage_type_id damage_acid ( " acid" );
@@ -846,7 +861,7 @@ double Creature::accuracy_projectile_attack( dealt_projectile_attack &attack ) c
846861
847862void projectile::apply_effects_nodamage ( Creature &target, Creature *source ) const
848863{
849- if ( proj_effects.count ( " BOUNCE " ) ) {
864+ if ( proj_effects.count ( ammo_effect_id_BOUNCE ) ) {
850865 target.add_effect ( effect_source ( source ), effect_bounced, 1_turns );
851866 }
852867}
@@ -855,7 +870,7 @@ void projectile::apply_effects_damage( Creature &target, Creature *source,
855870 const dealt_damage_instance &dealt_dam, bool critical ) const
856871{
857872 // Apply ammo effects to target.
858- if ( proj_effects.count ( " TANGLE " ) ) {
873+ if ( proj_effects.count ( ammo_effect_id_TANGLE ) ) {
859874 // if its a tameable animal, its a good way to catch them if they are running away, like them ranchers do!
860875 // we assume immediate success, then certain monster types immediately break free in monster.cpp move_effects()
861876 if ( target.is_monster () ) {
@@ -878,7 +893,7 @@ void projectile::apply_effects_damage( Creature &target, Creature *source,
878893 }
879894
880895 Character &player_character = get_player_character ();
881- if ( proj_effects.count ( " INCENDIARY " ) ) {
896+ if ( proj_effects.count ( ammo_effect_id_INCENDIARY ) ) {
882897 if ( x_in_y ( 1 , 100 ) ) { // 1% chance
883898 if ( target.made_of ( material_veggy ) || target.made_of_any ( Creature::cmat_flammable ) ) {
884899 target.add_effect ( effect_source ( source ), effect_onfire, rng ( 2_turns, 6_turns ),
@@ -896,7 +911,7 @@ void projectile::apply_effects_damage( Creature &target, Creature *source,
896911 player_character.rem_morale ( MORALE_PYROMANIA_NOFIRE );
897912 }
898913 }
899- } else if ( proj_effects.count ( " IGNITE " ) ) {
914+ } else if ( proj_effects.count ( ammo_effect_id_IGNITE ) ) {
900915 if ( x_in_y ( 1 , 2 ) ) { // 50% chance
901916 if ( target.made_of ( material_veggy ) || target.made_of_any ( Creature::cmat_flammable ) ) {
902917 target.add_effect ( effect_source ( source ), effect_onfire, 10_turns, dealt_dam.bp_hit );
@@ -914,7 +929,7 @@ void projectile::apply_effects_damage( Creature &target, Creature *source,
914929 }
915930 }
916931
917- if ( proj_effects.count ( " ROBOT_DAZZLE " ) ) {
932+ if ( proj_effects.count ( ammo_effect_id_ROBOT_DAZZLE ) ) {
918933 if ( critical && target.in_species ( species_ROBOT ) ) {
919934 time_duration duration = rng ( 6_turns, 8_turns );
920935 target.add_effect ( effect_source ( source ), effect_stunned, duration );
@@ -927,31 +942,31 @@ void projectile::apply_effects_damage( Creature &target, Creature *source,
927942 }
928943
929944 if ( dealt_dam.bp_hit ->has_type ( body_part_type::type::head ) &&
930- proj_effects.count ( " BLINDS_EYES " ) ) {
945+ proj_effects.count ( ammo_effect_id_BLINDS_EYES ) ) {
931946 // TODO: Change this to require bp_eyes
932947 target.add_env_effect ( effect_blind,
933948 target.get_random_body_part_of_type ( body_part_type::type::sensor ), 5 , rng ( 3_turns, 10_turns ) );
934949 }
935950
936- if ( proj_effects.count ( " APPLY_SAP " ) ) {
951+ if ( proj_effects.count ( ammo_effect_id_APPLY_SAP ) ) {
937952 target.add_effect ( effect_source ( source ), effect_sap, 1_turns * dealt_dam.total_damage () );
938953 }
939- if ( proj_effects.count ( " PARALYZEPOISON " ) && dealt_dam.total_damage () > 0 &&
954+ if ( proj_effects.count ( ammo_effect_id_PARALYZEPOISON ) && dealt_dam.total_damage () > 0 &&
940955 !dealt_dam.bp_hit ->has_flag ( json_flag_BIONIC_LIMB ) ) {
941956 target.add_msg_if_player ( m_bad, _ ( " You feel poison coursing through your body!" ) );
942957 target.add_effect ( effect_source ( source ), effect_paralyzepoison, 5_minutes );
943958 }
944959
945- if ( proj_effects.count ( " FOAMCRETE " ) && effect_foamcrete_slow.is_valid () ) {
960+ if ( proj_effects.count ( ammo_effect_id_FOAMCRETE ) && effect_foamcrete_slow.is_valid () ) {
946961 target.add_msg_if_player ( m_bad, _ ( " The foamcrete stiffens around you!" ) );
947962 target.add_effect ( effect_source ( source ), effect_foamcrete_slow, 5_minutes );
948963 }
949964
950965 int stun_strength = 0 ;
951- if ( proj_effects.count ( " BEANBAG " ) ) {
966+ if ( proj_effects.count ( ammo_effect_id_BEANBAG ) ) {
952967 stun_strength = 4 ;
953968 }
954- if ( proj_effects.count ( " LARGE_BEANBAG " ) ) {
969+ if ( proj_effects.count ( ammo_effect_id_LARGE_BEANBAG ) ) {
955970 stun_strength = 16 ;
956971 }
957972 if ( stun_strength > 0 ) {
@@ -995,7 +1010,7 @@ projectile_attack_results Creature::select_body_part_projectile_attack(
9951010 const projectile &proj, const double goodhit, const double missed_by ) const
9961011{
9971012 projectile_attack_results ret ( proj );
998- const bool magic = proj.proj_effects .count ( " MAGIC " ) > 0 ;
1013+ const bool magic = proj.proj_effects .count ( ammo_effect_id_MAGIC ) > 0 ;
9991014 double hit_value = missed_by + rng_float ( -0.5 , 0.5 );
10001015 if ( magic ) {
10011016 // Best possible hit
@@ -1121,7 +1136,7 @@ void Creature::messaging_projectile_attack( const Creature *source,
11211136void Creature::deal_projectile_attack ( Creature *source, dealt_projectile_attack &attack,
11221137 bool print_messages, const weakpoint_attack &wp_attack )
11231138{
1124- const bool magic = attack.proj .proj_effects .count ( " MAGIC " ) > 0 ;
1139+ const bool magic = attack.proj .proj_effects .count ( ammo_effect_id_MAGIC ) > 0 ;
11251140 const double missed_by = attack.missed_by ;
11261141 if ( missed_by >= 1.0 && !magic ) {
11271142 // Total miss
@@ -1188,13 +1203,13 @@ void Creature::deal_projectile_attack( Creature *source, dealt_projectile_attack
11881203
11891204 // copy it, since we're mutating.
11901205 damage_instance impact = proj.impact ;
1191- if ( hit_selection.damage_mult > 0 .0f && proj_effects.count ( " NO_DAMAGE_SCALING " ) ) {
1206+ if ( hit_selection.damage_mult > 0 .0f && proj_effects.count ( ammo_effect_id_NO_DAMAGE_SCALING ) ) {
11921207 hit_selection.damage_mult = 1 .0f ;
11931208 }
11941209
11951210 impact.mult_damage ( hit_selection.damage_mult );
11961211
1197- if ( proj_effects.count ( " NOGIB " ) > 0 ) {
1212+ if ( proj_effects.count ( ammo_effect_id_NOGIB ) > 0 ) {
11981213 float dmg_ratio = static_cast <float >( impact.total_damage () ) / get_hp_max ( hit_selection.bp_hit );
11991214 if ( dmg_ratio > 1 .25f ) {
12001215 impact.mult_damage ( 1 .0f / dmg_ratio );
0 commit comments