diff --git a/data/json/ammo_effects.json b/data/json/ammo_effects.json index 5633e561bbad8..65c5a98041dfa 100644 --- a/data/json/ammo_effects.json +++ b/data/json/ammo_effects.json @@ -56,7 +56,7 @@ { "id": "BOUNCE", "type": "ammo_effect", - "//": "Inflicts target with `bounced` effect and rebounds to a nearby target without this effect. Hardcoded" + "//": "Projectile with this effect will rebound to a nearby target after hitting the oringinal target. Will not choose targets already hit by this projectile. Hardcoded" }, { "id": "BURST", diff --git a/data/json/effects.json b/data/json/effects.json index 9a9f209603c7e..8c370d7cfca36 100644 --- a/data/json/effects.json +++ b/data/json/effects.json @@ -300,12 +300,6 @@ "name": [ { "str": "Turret Is Targeted", "//~": "NO_I18N" } ], "desc": [ { "str": "AI tag used for turret targeting sounds. This is a bug if you have it.", "//~": "NO_I18N" } ] }, - { - "type": "effect_type", - "id": "bounced", - "name": [ { "str": "Bounced", "//~": "NO_I18N" } ], - "desc": [ { "str": "AI tag used for bouncing ammo targeting. This is a bug if you have it.", "//~": "NO_I18N" } ] - }, { "type": "effect_type", "id": "npc_value_interaction_timer_short", diff --git a/data/mods/Aftershock/items/armor/military_armor.json b/data/mods/Aftershock/items/armor/military_armor.json index 58e0443bff1a1..9e69753bbc227 100644 --- a/data/mods/Aftershock/items/armor/military_armor.json +++ b/data/mods/Aftershock/items/armor/military_armor.json @@ -4,6 +4,8 @@ "type": "ARMOR", "name": { "str": "IPAV armor" }, "description": "Multipurpose military armor for the torso and upper arms, intended to protect against a wide variety of ballistic or direct energy attacks. Made from a single piece of ablative carbide that keeps it relatively lightweight and completely disposable.", + "category": "armor", + "price": "5 kUSD 500 USD", "weight": "7 kg", "volume": "8 L", "symbol": "[", diff --git a/data/mods/Aftershock/items/grenades.json b/data/mods/Aftershock/items/grenades.json index 881568e822714..bc98b8f9a88b1 100644 --- a/data/mods/Aftershock/items/grenades.json +++ b/data/mods/Aftershock/items/grenades.json @@ -110,6 +110,7 @@ "looks_like": "grenade_emp", "name": "electroshock grenade", "description": "This is an electronic weapon that will emit a short-ranged electric field. When activated, you'll have five turns before it starts doing so; throwing it before that would be a good idea.", + "price": "350 USD", "use_action": { "menu_text": "Pull pin", "need_wielding": true, @@ -138,8 +139,7 @@ "description": "This is a military-grade cryo hand grenade. Once it explodes it spreads exotic highly-radioactive shrapnel. Use this item to pull the pin and light the fuse. You will then have five seconds before it explodes; throwing it would be a good idea.", "weight": "397 g", "volume": "250 ml", - "price": "15 USD", - "price_postapoc": "10 USD", + "price": "450 USD", "to_hit": -1, "material": [ "steel", "plastic" ], "symbol": "*", diff --git a/data/mods/MindOverMatter/monsters/bosses.json b/data/mods/MindOverMatter/monsters/bosses.json index 995df482ba113..1f92e70d6c82f 100644 --- a/data/mods/MindOverMatter/monsters/bosses.json +++ b/data/mods/MindOverMatter/monsters/bosses.json @@ -36,7 +36,7 @@ "monster_message": "The air around %3$s wavers and shapes appear!" } ], - "flags": [ "MIND_SEEING", "TELEPORT_IMMUNE" ] + "flags": [ "TELEPORT_IMMUNE" ] } } ] diff --git a/data/mods/MindOverMatter/powers/teleportation.json b/data/mods/MindOverMatter/powers/teleportation.json index d00cf567474ff..5643cc52f5be7 100644 --- a/data/mods/MindOverMatter/powers/teleportation.json +++ b/data/mods/MindOverMatter/powers/teleportation.json @@ -712,12 +712,12 @@ "energy_source": "STAMINA", "base_energy_cost": { "math": [ - "u_effect_intensity('effect_teleport_loci_establishment') > -1 ? 0 : max( ( 3000 - ( u_spell_level('teleport_reactive_displacement') * 100 ) ), 1000 )" + "u_effect_intensity('effect_teleport_loci_establishment') > -1 ? 0 : max( ( 3000 - ( u_spell_level('teleport_loci_establishment') * 100 ) ), 1000 )" ] }, "base_casting_time": { "math": [ - "u_effect_intensity('effect_teleport_loci_establishment') > -1 ? 10 : max( ( 100 - ( u_spell_level('teleport_reactive_displacement') * 5 ) ), 25 )" + "u_effect_intensity('effect_teleport_loci_establishment') > -1 ? 10 : max( ( 100 - ( u_spell_level('teleport_loci_establishment') * 5 ) ), 25 )" ] } }, diff --git a/data/mods/TEST_DATA/overmap_terrain_coverage_test/overmap_terrain_coverage_whitelist.json b/data/mods/TEST_DATA/overmap_terrain_coverage_test/overmap_terrain_coverage_whitelist.json index 0225a1c88521e..5c1d5ad76ca6e 100644 --- a/data/mods/TEST_DATA/overmap_terrain_coverage_test/overmap_terrain_coverage_whitelist.json +++ b/data/mods/TEST_DATA/overmap_terrain_coverage_test/overmap_terrain_coverage_whitelist.json @@ -24,7 +24,11 @@ "s_reststop_1_roof", "s_reststop_2_roof", "s_restparking_1", - "s_restparking_2" + "s_restparking_2", + "roadstop", + "roadstop_roof", + "roadstop_a", + "roadstop_a_roof" ] } ] diff --git a/data/mods/aftershock_exoplanet/price_overrides/grenades.json b/data/mods/aftershock_exoplanet/price_overrides/grenades.json new file mode 100644 index 0000000000000..58395584294ec --- /dev/null +++ b/data/mods/aftershock_exoplanet/price_overrides/grenades.json @@ -0,0 +1,42 @@ +[ + { + "id": "smokebomb", + "type": "GENERIC", + "name": { "str": "smoke bomb" }, + "copy-from": "smokebomb", + "price": "150 USD", + "price_postapoc": "150 USD" + }, + { + "id": "grenade_emp", + "type": "TOOL", + "name": { "str": "EMP grenade" }, + "copy-from": "grenade_emp", + "price": "500 USD", + "price_postapoc": "500 USD" + }, + { + "id": "grenade", + "type": "TOOL", + "name": { "str": "grenade" }, + "copy-from": "grenade", + "price": "350 USD", + "price_postapoc": "350 USD" + }, + { + "id": "grenade_inc", + "type": "TOOL", + "name": { "str": "incendiary grenade" }, + "copy-from": "grenade_inc", + "price": "450 USD", + "price_postapoc": "450 USD" + }, + { + "id": "scrambler", + "type": "TOOL", + "name": { "str": "scrambler grenade" }, + "copy-from": "scrambler", + "price": "800 USD", + "price_postapoc": "800 USD" + } +] diff --git a/src/activity_handlers.cpp b/src/activity_handlers.cpp index aff7b3e5999d2..9ab149b15cf54 100644 --- a/src/activity_handlers.cpp +++ b/src/activity_handlers.cpp @@ -3576,6 +3576,11 @@ static void perform_zone_activity_turn( void activity_handlers::fertilize_plot_do_turn( player_activity *act, Character *you ) { itype_id fertilizer; + + auto have_fertilizer = [&]() { + return !fertilizer.is_empty() && you->has_amount( fertilizer, 1 ); + }; + auto check_fertilizer = [&]( bool ask_user = true ) -> void { if( act->str_values.empty() ) { @@ -3584,7 +3589,7 @@ void activity_handlers::fertilize_plot_do_turn( player_activity *act, Character fertilizer = itype_id( act->str_values[0] ); /* If unspecified, or if we're out of what we used before, ask */ - if( ask_user && ( fertilizer.is_empty() || !you->has_charges( fertilizer, 1 ) ) ) + if( ask_user && !have_fertilizer() ) { fertilizer = iexamine::choose_fertilizer( *you, "plant", false /* Don't confirm action with player */ ); @@ -3592,9 +3597,6 @@ void activity_handlers::fertilize_plot_do_turn( player_activity *act, Character } }; - auto have_fertilizer = [&]() { - return !fertilizer.is_empty() && you->has_charges( fertilizer, 1 ); - }; const auto reject_tile = [&]( const tripoint_bub_ms & tile ) { check_fertilizer(); diff --git a/src/ballistics.cpp b/src/ballistics.cpp index 1cb1abd86ee22..126a2494a62f1 100644 --- a/src/ballistics.cpp +++ b/src/ballistics.cpp @@ -57,8 +57,6 @@ static const ammo_effect_str_id ammo_effect_STREAM_TINY( "STREAM_TINY" ); static const ammo_effect_str_id ammo_effect_TANGLE( "TANGLE" ); static const ammo_effect_str_id ammo_effect_WIDE( "WIDE" ); -static const efftype_id effect_bounced( "bounced" ); - static const itype_id itype_glass_shard( "glass_shard" ); static const json_character_flag json_flag_HARDTOHIT( "HARDTOHIT" ); @@ -220,10 +218,10 @@ projectile_attack_aim projectile_attack_roll( const dispersion_sources &dispersi return aim; } -dealt_projectile_attack projectile_attack( const projectile &proj_arg, - const tripoint_bub_ms &source, const tripoint_bub_ms &target_arg, - const dispersion_sources &dispersion, Creature *origin, const vehicle *in_veh, - const weakpoint_attack &wp_attack, bool first ) +void projectile_attack( dealt_projectile_attack &attack, const projectile &proj_arg, + const tripoint_bub_ms &source, const tripoint_bub_ms &target_arg, + const dispersion_sources &dispersion, Creature *origin, const vehicle *in_veh, + const weakpoint_attack &wp_attack, bool first ) { const bool do_animation = first && get_option( "ANIMATION_PROJECTILES" ); @@ -258,14 +256,16 @@ dealt_projectile_attack projectile_attack( const projectile &proj_arg, // TODO: move to-hit roll back in here - dealt_projectile_attack attack { - proj_arg, nullptr, dealt_damage_instance(), source, aim.missed_by - }; + attack.proj = proj_arg; + attack.hit_critter = nullptr; + attack.dealt_dam = dealt_damage_instance(); + attack.end_point = source; + attack.missed_by = aim.missed_by; // No suicidal shots if( source == target_arg ) { debugmsg( "Projectile_attack targeted own square." ); - return attack; + return; } projectile &proj = attack.proj; @@ -543,30 +543,29 @@ dealt_projectile_attack projectile_attack( const projectile &proj_arg, // TODO: Move this outside now that we have hit point in return values? if( proj.proj_effects.count( ammo_effect_BOUNCE ) ) { - // Add effect so the shooter is not targeted itself. - if( origin && !origin->has_effect( effect_bounced ) ) { - origin->add_effect( effect_bounced, 1_turns ); - } Creature *mon_ptr = g->get_creature_if( [&]( const Creature & z ) { + if( &z == origin ) { + return false; + } // search for creatures in radius 4 around impact site if( rl_dist( z.pos_bub(), tp ) <= 4 && here.sees( z.pos_bub(), tp, -1 ) ) { // don't hit targets that have already been hit - if( !z.has_effect( effect_bounced ) ) { - return true; + for( auto it : attack.targets_hit ) { + if( &z == it.first ) { + return false; + } } + return true; } return false; } ); if( mon_ptr ) { Creature &z = *mon_ptr; add_msg( _( "The attack bounced to %s!" ), z.get_name() ); - z.add_effect( effect_bounced, 1_turns ); - projectile_attack( proj, tp, z.pos_bub(), dispersion, origin, in_veh ); + projectile_attack( attack, proj, tp, z.pos_bub(), dispersion, origin, in_veh ); sfx::play_variant_sound( "fire_gun", "bio_lightning_tail", sfx::get_heard_volume( z.pos_bub() ), sfx::get_heard_angle( z.pos_bub() ) ); } } - - return attack; } diff --git a/src/ballistics.h b/src/ballistics.h index 59c2e36a7bceb..e4da7a63b7a0a 100644 --- a/src/ballistics.h +++ b/src/ballistics.h @@ -40,10 +40,10 @@ projectile_attack_aim projectile_attack_roll( const dispersion_sources &dispersi * dispersion. * Returns the rolled dispersion of the shot and the actually hit point. */ -dealt_projectile_attack projectile_attack( const projectile &proj_arg, - const tripoint_bub_ms &source, const tripoint_bub_ms &target_arg, - const dispersion_sources &dispersion, Creature *origin = nullptr, const vehicle *in_veh = nullptr, - const weakpoint_attack &attack = weakpoint_attack(), bool first = true ); +void projectile_attack( dealt_projectile_attack &attack, const projectile &proj_arg, + const tripoint_bub_ms &source, const tripoint_bub_ms &target_arg, + const dispersion_sources &dispersion, Creature *origin = nullptr, const vehicle *in_veh = nullptr, + const weakpoint_attack &wp_attack = weakpoint_attack(), bool first = true ); /* Used for selecting which part to target in a projectile attack * Primarily a template for ease of testing, but can be reused! diff --git a/src/bionics.cpp b/src/bionics.cpp index 35ffb41b560a4..24d54d138abb8 100644 --- a/src/bionics.cpp +++ b/src/bionics.cpp @@ -1026,8 +1026,8 @@ bool Character::activate_bionic( bionic &bio, bool eff_only, bool *close_bionics proj.range = rl_dist( pr.second, pos_bub() ) - 1; proj.proj_effects = {{ ammo_effect_NO_ITEM_DAMAGE, ammo_effect_DRAW_AS_LINE, ammo_effect_NO_DAMAGE_SCALING, ammo_effect_JET }}; - dealt_projectile_attack dealt = projectile_attack( - proj, pr.second, pos_bub(), dispersion_sources{ 0 }, this ); + dealt_projectile_attack dealt; + projectile_attack( dealt, proj, pr.second, pos_bub(), dispersion_sources{ 0 }, this ); here.add_item_or_charges( dealt.end_point, pr.first ); } diff --git a/src/creature.cpp b/src/creature.cpp index 4060ce2b48dcd..88374fe610a68 100644 --- a/src/creature.cpp +++ b/src/creature.cpp @@ -80,7 +80,6 @@ struct mutation_branch; static const ammo_effect_str_id ammo_effect_APPLY_SAP( "APPLY_SAP" ); static const ammo_effect_str_id ammo_effect_BEANBAG( "BEANBAG" ); static const ammo_effect_str_id ammo_effect_BLINDS_EYES( "BLINDS_EYES" ); -static const ammo_effect_str_id ammo_effect_BOUNCE( "BOUNCE" ); static const ammo_effect_str_id ammo_effect_FOAMCRETE( "FOAMCRETE" ); static const ammo_effect_str_id ammo_effect_IGNITE( "IGNITE" ); static const ammo_effect_str_id ammo_effect_INCENDIARY( "INCENDIARY" ); @@ -101,7 +100,6 @@ static const damage_type_id damage_heat( "heat" ); static const efftype_id effect_all_fours( "all_fours" ); static const efftype_id effect_blind( "blind" ); -static const efftype_id effect_bounced( "bounced" ); static const efftype_id effect_downed( "downed" ); static const efftype_id effect_eff_mind_seeing_bonus_10( "eff_mind_seeing_bonus_10" ); static const efftype_id effect_eff_mind_seeing_bonus_20( "eff_mind_seeing_bonus_20" ); @@ -972,13 +970,6 @@ double Creature::accuracy_projectile_attack( dealt_projectile_attack &attack ) c return attack.missed_by + std::max( 0.0, std::min( 1.0, dodge_rescaled ) ); } -void projectile::apply_effects_nodamage( Creature &target, Creature *source ) const -{ - if( proj_effects.count( ammo_effect_BOUNCE ) ) { - target.add_effect( effect_source( source ), effect_bounced, 1_turns ); - } -} - void projectile::apply_effects_damage( Creature &target, Creature *source, const dealt_damage_instance &dealt_dam, bool critical ) const { @@ -1339,8 +1330,6 @@ void Creature::deal_projectile_attack( Creature *source, dealt_projectile_attack return; } - proj.apply_effects_nodamage( *this, source ); - // Create a copy that records whether the attack is a crit. weakpoint_attack wp_attack_copy = wp_attack; wp_attack_copy.type = weakpoint_attack::attack_type::PROJECTILE; @@ -1376,14 +1365,20 @@ void Creature::deal_projectile_attack( Creature *source, dealt_projectile_attack proj.apply_effects_damage( *this, source, dealt_dam, goodhit < accuracy_critical ); + int total_dam = dealt_dam.total_damage(); + if( print_messages ) { - messaging_projectile_attack( source, hit_selection, dealt_dam.total_damage() ); + messaging_projectile_attack( source, hit_selection, total_dam ); } check_dead_state(); attack.hit_critter = this; attack.missed_by = goodhit; attack.headshot = hit_selection.is_headshot; + attack.targets_hit[this].first++; + if( total_dam > 0 ) { + attack.targets_hit[this].second += total_dam; + } } dealt_damage_instance Creature::deal_damage( Creature *source, bodypart_id bp, diff --git a/src/monattack.cpp b/src/monattack.cpp index 6a6ffa2b042a4..e00e27a1ef5d8 100644 --- a/src/monattack.cpp +++ b/src/monattack.cpp @@ -279,8 +279,9 @@ static bool sting_shoot( monster *z, Creature *target, damage_instance &dam, flo proj.impact.add( dam ); proj.proj_effects.insert( ammo_effect_NO_OVERSHOOT ); - dealt_projectile_attack atk = projectile_attack( proj, z->pos_bub(), target->pos_bub(), - dispersion_sources{ 500 }, z ); + dealt_projectile_attack atk; + projectile_attack( atk, proj, z->pos_bub(), target->pos_bub(), + dispersion_sources{ 500 }, z ); if( atk.dealt_dam.total_damage() > 0 ) { target->add_msg_if_player( m_bad, _( "The %s shoots a dart into you!" ), z->name() ); // whether this function returns true determines whether it applies a status effect like paralysis or mutation @@ -733,8 +734,9 @@ bool mattack::acid( monster *z ) proj.impact.add_damage( damage_acid, 5 ); proj.range = 10; proj.proj_effects.insert( ammo_effect_NO_OVERSHOOT ); - dealt_projectile_attack dealt = projectile_attack( proj, z->pos_bub(), target->pos_bub(), - dispersion_sources{ 5400 }, z ); + dealt_projectile_attack dealt; + projectile_attack( dealt, proj, z->pos_bub(), target->pos_bub(), + dispersion_sources{ 5400 }, z ); const tripoint_bub_ms &hitp = tripoint_bub_ms( dealt.end_point ); const Creature *hit_critter = dealt.hit_critter; if( hit_critter == nullptr && here.hit_with_acid( hitp ) ) { @@ -958,8 +960,9 @@ bool mattack::pull_metal_weapon( monster *z ) proj.range = rl_dist( foe->pos_bub(), z->pos_bub() ) - 1; proj.proj_effects = { { ammo_effect_NO_ITEM_DAMAGE, ammo_effect_DRAW_AS_LINE, ammo_effect_NO_DAMAGE_SCALING, ammo_effect_JET } }; - dealt_projectile_attack dealt = projectile_attack( proj, foe->pos_bub(), z->pos_bub(), - dispersion_sources{ 0 }, z ); + dealt_projectile_attack dealt; + projectile_attack( dealt, proj, foe->pos_bub(), z->pos_bub(), + dispersion_sources{ 0 }, z ); get_map().add_item( dealt.end_point, pulled_weapon ); target->add_msg_player_or_npc( m_type, _( "The %s is pulled away from your hands!" ), _( "The %s is pulled away from 's hands!" ), pulled_weapon.tname() ); @@ -1555,7 +1558,8 @@ bool mattack::spit_sap( monster *z ) proj.range = 12; proj.proj_effects.insert( ammo_effect_APPLY_SAP ); proj.impact.add_damage( damage_acid, rng( 5, 10 ) ); - projectile_attack( proj, z->pos_bub(), target->pos_bub(), dispersion_sources{ 150 }, z ); + dealt_projectile_attack atk; + projectile_attack( atk, proj, z->pos_bub(), target->pos_bub(), dispersion_sources{ 150 }, z ); return true; } diff --git a/src/mondefense.cpp b/src/mondefense.cpp index d8013e4824a25..e9756b902d406 100644 --- a/src/mondefense.cpp +++ b/src/mondefense.cpp @@ -134,9 +134,10 @@ void mdefense::acidsplash( monster &m, Creature *const source, prj.proj_effects.insert( ammo_effect_DRAW_AS_LINE ); prj.proj_effects.insert( ammo_effect_NO_DAMAGE_SCALING ); prj.impact.add_damage( damage_acid, rng( 1, 3 ) ); + dealt_projectile_attack atk; for( size_t i = 0; i < num_drops; i++ ) { const tripoint_bub_ms &target = random_entry( pts ); - projectile_attack( prj, m.pos_bub(), target, dispersion_sources{ 1200 }, &m ); + projectile_attack( atk, prj, m.pos_bub(), target, dispersion_sources{ 1200 }, &m ); } if( get_player_view().sees( m.pos_bub() ) ) { diff --git a/src/projectile.h b/src/projectile.h index 8ebf3a4b9f367..63d1179a1b5d1 100644 --- a/src/projectile.h +++ b/src/projectile.h @@ -50,8 +50,6 @@ struct projectile { void apply_effects_damage( Creature &target, Creature *source, const dealt_damage_instance &dealt_dam, bool critical ) const; - // pplies proj_effects to a creature that was hit but not damaged - void apply_effects_nodamage( Creature &target, Creature *source ) const; projectile(); projectile( const projectile & ); @@ -74,6 +72,8 @@ struct dealt_projectile_attack { double missed_by; // Accuracy of dealt attack bool headshot = false; // Headshot or not; bool shrapnel = false; // True if the projectile is generated from an explosive + // Critters that hit by the projectile or null + std::map> targets_hit; }; void apply_ammo_effects( Creature *source, const tripoint_bub_ms &p, diff --git a/src/ranged.cpp b/src/ranged.cpp index 51ddaa3376e18..3b0aa7a895bfb 100644 --- a/src/ranged.cpp +++ b/src/ranged.cpp @@ -1059,21 +1059,14 @@ int Character::fire_gun( const tripoint_bub_ms &target, int shots, item &gun, it bool first = true; bool headshot = false; bool multishot = proj.count > 1; - std::map< Creature *, std::pair < int, int >> targets_hit; + dealt_projectile_attack shot; for( int projectile_number = 0; projectile_number < proj.count; ++projectile_number ) { if( !first && !proj.multi_projectile_effects ) { proj.proj_effects.erase( proj.proj_effects.begin(), proj.proj_effects.end() ); } - dealt_projectile_attack shot = projectile_attack( proj, pos_bub(), aim, - dispersion, this, in_veh, wp_attack, first ); + projectile_attack( shot, proj, pos_bub(), aim, + dispersion, this, in_veh, wp_attack, first ); first = false; - if( shot.hit_critter ) { - int damage = shot.dealt_dam.total_damage(); - if( damage > 0 ) { - targets_hit[ shot.hit_critter ].second += damage; - } - targets_hit[ shot.hit_critter ].first++; - } if( shot.headshot ) { headshot = true; } @@ -1083,10 +1076,10 @@ int Character::fire_gun( const tripoint_bub_ms &target, int shots, item &gun, it break; } } - if( !targets_hit.empty() ) { + if( !shot.targets_hit.empty() ) { hits++; } - for( std::pair> &hit_entry : targets_hit ) { + for( std::pair> &hit_entry : shot.targets_hit ) { if( monster *const m = hit_entry.first->as_monster() ) { cata::event e = cata::event::make( getID(), gun_id, m->type->id ); @@ -1557,8 +1550,9 @@ dealt_projectile_attack Character::throw_item( const tripoint_bub_ms &target, co weakpoint_attack wp_attack; wp_attack.weapon = &to_throw; wp_attack.is_thrown = true; - dealt_projectile_attack dealt_attack = projectile_attack( proj, throw_from, target, dispersion, - this, nullptr, wp_attack ); + dealt_projectile_attack dealt_attack; + projectile_attack( dealt_attack, proj, throw_from, target, dispersion, + this, nullptr, wp_attack ); const double missed_by = dealt_attack.missed_by; diff --git a/tests/archery_damage_test.cpp b/tests/archery_damage_test.cpp index 268e51ce0bc64..3c229daed8981 100644 --- a/tests/archery_damage_test.cpp +++ b/tests/archery_damage_test.cpp @@ -83,9 +83,11 @@ static void test_archery_balance( const std::string &weapon_type, const std::str test_projectile.impact = weapon.gun_damage(); test_projectile.proj_effects = weapon.ammo_effects(); test_projectile.critical_multiplier = weapon.ammo_data()->ammo->critical_multiplier; + std::map> targets_hit; dealt_projectile_attack attack { - test_projectile, nullptr, dealt_damage_instance(), tripoint_bub_ms::zero, accuracy_critical * 0.75 + test_projectile, nullptr, dealt_damage_instance(), tripoint_bub_ms::zero, accuracy_critical * 0.75, + false, false, targets_hit }; if( !killable.empty() ) { test_projectile_attack( killable, true, attack, weapon_type, headshot ); diff --git a/tests/coverage_test.cpp b/tests/coverage_test.cpp index 123d600f4d586..4a997852fae93 100644 --- a/tests/coverage_test.cpp +++ b/tests/coverage_test.cpp @@ -140,8 +140,9 @@ static float get_avg_bullet_dmg( const std::string &clothing_id ) dude->setpos( dude_pos ); dude->wear_item( cloth, false ); dude->add_effect( effect_sleep, 1_hours ); - dealt_projectile_attack atk = projectile_attack( proj, badguy_pos, dude_pos, dispersion_sources(), - &*badguy ); + dealt_projectile_attack atk; + projectile_attack( atk, proj, badguy_pos, dude_pos, dispersion_sources(), + &*badguy ); dude->deal_projectile_attack( &*badguy, atk, false ); if( atk.missed_by < 1.0 ) { num_hits++; diff --git a/tests/projectile_test.cpp b/tests/projectile_test.cpp index fe5797e172569..5d8fc6b399cd7 100644 --- a/tests/projectile_test.cpp +++ b/tests/projectile_test.cpp @@ -36,9 +36,8 @@ static tripoint_bub_ms projectile_end_point( const std::vector dealt_projectile_attack attack; - attack = projectile_attack( test_proj, range[0], range[2], dispersion_sources(), - &get_player_character(), - nullptr ); + projectile_attack( attack, test_proj, range[0], range[2], dispersion_sources(), + &get_player_character(), nullptr ); return attack.end_point; } diff --git a/tests/test_main.cpp b/tests/test_main.cpp index 38e435ac65087..3f47e32431b81 100644 --- a/tests/test_main.cpp +++ b/tests/test_main.cpp @@ -224,7 +224,12 @@ struct CataListener : Catch::TestEventListenerBase { void sectionStarting( Catch::SectionInfo const §ionInfo ) override { TestEventListenerBase::sectionStarting( sectionInfo ); // Initialize the cata RNG with the Catch seed for reproducible tests - rng_set_engine_seed( m_config->rngSeed() ); + const unsigned int seed = m_config->rngSeed(); + if( seed ) { + rng_set_engine_seed( seed ); + } else { + rng_set_engine_seed( rng_get_first_seed() ); + } // Clear the message log so on test failures we see only messages from // during that test Messages::clear_messages();