From 216562149fdeed52d5dad9bc158dc583e9b9b2c3 Mon Sep 17 00:00:00 2001 From: Kevin Granade Date: Fri, 3 Apr 2020 07:18:48 +0000 Subject: [PATCH] Drop archery damage by 5x and increase archery crit damage by 5x --- data/json/items/gunmod/rail.json | 2 +- data/json/items/ranged/archery.json | 38 ++++++++++++++++-------- data/json/items/ranged/crossbows.json | 22 ++++++++++---- data/mods/More_Survival_Tools/items.json | 2 +- data/mods/Salvaged_Robots/roboguns.json | 3 +- data/mods/blazemod/blaze_test.json | 4 +-- data/mods/blazemod/blaze_weapons.json | 4 +-- src/creature.cpp | 17 ++++++----- src/item.cpp | 12 +++++++- src/item_factory.cpp | 3 +- src/iteminfo_query.h | 1 + src/itype.h | 11 +++++++ src/map.cpp | 2 +- src/projectile.cpp | 3 +- src/projectile.h | 1 + src/ranged.cpp | 1 + tests/archery_damage_test.cpp | 3 ++ tests/item_sort_test.cpp | 35 ++++++++++++++++++++++ tests/iteminfo_test.cpp | 8 +++-- 19 files changed, 131 insertions(+), 41 deletions(-) create mode 100644 tests/item_sort_test.cpp diff --git a/data/json/items/gunmod/rail.json b/data/json/items/gunmod/rail.json index cdc2ba0a05111..e39e843939db3 100644 --- a/data/json/items/gunmod/rail.json +++ b/data/json/items/gunmod/rail.json @@ -16,7 +16,7 @@ "ammo": "bolt", "skill": "rifle", "range": 8, - "ranged_damage": { "damage_type": "stab", "amount": 10 }, + "ranged_damage": { "damage_type": "stab", "amount": 3 }, "dispersion": 180, "durability": 10, "clip_size": 1 diff --git a/data/json/items/ranged/archery.json b/data/json/items/ranged/archery.json index 277b55c7743e8..a551ba69c61a0 100644 --- a/data/json/items/ranged/archery.json +++ b/data/json/items/ranged/archery.json @@ -17,6 +17,7 @@ "dispersion": 250, "loudness": 0, "count": 10, + "critical_multiplier": 10, "effects": [ "RECOVER_2" ] }, { @@ -38,6 +39,7 @@ "dispersion": 150, "loudness": 0, "count": 10, + "critical_multiplier": 10, "effects": [ "RECOVER_30" ] }, { @@ -102,6 +104,7 @@ "dispersion": 110, "loudness": 0, "count": 10, + "critical_multiplier": 10, "effects": [ "RECOVER_25" ] }, { @@ -123,6 +126,7 @@ "dispersion": 150, "loudness": 0, "count": 10, + "critical_multiplier": 10, "effects": [ "RECOVER_6" ] }, { @@ -144,6 +148,7 @@ "dispersion": 150, "loudness": 0, "count": 10, + "critical_multiplier": 10, "effects": [ "RECOVER_35", "NOGIB" ] }, { @@ -167,6 +172,7 @@ "loudness": 0, "count": 10, "show_stats": true, + "critical_multiplier": 10, "effects": [ "RECOVER_8" ] }, { @@ -189,6 +195,7 @@ "loudness": 0, "count": 10, "show_stats": true, + "critical_multiplier": 10, "effects": [ "RECOVER_20" ] }, { @@ -212,6 +219,7 @@ "dispersion": 75, "loudness": 0, "count": 10, + "critical_multiplier": 10, "effects": [ "RECOVER_35" ] }, { @@ -235,6 +243,7 @@ "dispersion": 75, "loudness": 0, "count": 10, + "critical_multiplier": 10, "effects": [ "RECOVER_40" ] }, { @@ -258,6 +267,7 @@ "dispersion": 75, "loudness": 0, "count": 10, + "critical_multiplier": 10, "effects": [ "RECOVER_45", "NOGIB" ] }, { @@ -281,6 +291,7 @@ "loudness": 0, "count": 10, "stack_size": 10, + "critical_multiplier": 10, "effects": [ "RECOVER_30" ] }, { @@ -339,6 +350,7 @@ "dispersion": 285, "loudness": 0, "count": 5, + "critical_multiplier": 10, "effects": [ "IGNITE" ] }, { @@ -363,7 +375,7 @@ "price_postapoc": 50, "bashing": 6, "armor_data": { "covers": [ "TORSO" ], "coverage": 5, "material_thickness": 1, "encumbrance": 20 }, - "ranged_damage": { "damage_type": "stab", "amount": 7 }, + "ranged_damage": { "damage_type": "stab", "amount": 1 }, "range": 8, "dispersion": 1250, "durability": 4, @@ -391,7 +403,7 @@ "armor_data": { "covers": [ "TORSO" ], "coverage": 5, "material_thickness": 1, "encumbrance": 14 }, "reload_noise_volume": 3, "loudness": 6, - "ranged_damage": { "damage_type": "stab", "amount": 20 }, + "ranged_damage": { "damage_type": "stab", "amount": 4 }, "range": 10, "dispersion": 1000, "durability": 6, @@ -420,7 +432,7 @@ "to_hit": 1, "reload_noise_volume": 3, "loudness": 10, - "ranged_damage": { "damage_type": "stab", "amount": 50 }, + "ranged_damage": { "damage_type": "stab", "amount": 10 }, "range": 18, "dispersion": 850, "durability": 6, @@ -442,7 +454,7 @@ "description": "A high-power bow with shaped cams and extra cables for high velocity shots that can be used effectively by very strong archers. Currently set to a high weight, and ready to cause some real damage - if you can draw it.", "//": "80 lb draw weight, efficient, 0.62 slugs of momentum with a 30g arrow.", "min_strength": 11, - "ranged_damage": { "damage_type": "stab", "amount": 61 }, + "ranged_damage": { "damage_type": "stab", "amount": 12 }, "use_action": { "menu_text": "Loosen Limbs", "type": "transform", @@ -459,7 +471,7 @@ "description": "A high-power bow with shaped cams and extra cables for high velocity shots that can be used effectively by average archers. Currently set to a low weight, making it much easier to draw.", "//": "40 lb draw weight, efficient, 0.45 slugs of momentum with a 30g arrow.", "min_strength": 7, - "ranged_damage": { "damage_type": "stab", "amount": 35 }, + "ranged_damage": { "damage_type": "stab", "amount": 7 }, "use_action": { "menu_text": "Tighten Limbs", "type": "transform", @@ -490,7 +502,7 @@ "armor_data": { "covers": [ "TORSO" ], "coverage": 5, "material_thickness": 1, "encumbrance": 14 }, "reload_noise_volume": 3, "loudness": 6, - "ranged_damage": { "damage_type": "stab", "amount": 38 }, + "ranged_damage": { "damage_type": "stab", "amount": 8 }, "range": 12, "dispersion": 950, "durability": 6, @@ -519,7 +531,7 @@ "armor_data": { "covers": [ "TORSO" ], "coverage": 5, "material_thickness": 1, "encumbrance": 20 }, "reload_noise_volume": 3, "loudness": 8, - "ranged_damage": { "damage_type": "stab", "amount": 28 }, + "ranged_damage": { "damage_type": "stab", "amount": 6 }, "range": 14, "dispersion": 850, "durability": 6, @@ -548,7 +560,7 @@ "armor_data": { "covers": [ "TORSO" ], "coverage": 5, "material_thickness": 1, "encumbrance": 14 }, "reload_noise_volume": 3, "loudness": 6, - "ranged_damage": { "damage_type": "stab", "amount": 29 }, + "ranged_damage": { "damage_type": "stab", "amount": 6 }, "range": 12, "dispersion": 950, "durability": 6, @@ -577,7 +589,7 @@ "armor_data": { "covers": [ "TORSO" ], "coverage": 5, "material_thickness": 1, "encumbrance": 20 }, "reload_noise_volume": 3, "loudness": 8, - "ranged_damage": { "damage_type": "stab", "amount": 58 }, + "ranged_damage": { "damage_type": "stab", "amount": 10 }, "range": 14, "dispersion": 850, "durability": 6, @@ -605,7 +617,7 @@ "armor_data": { "covers": [ "TORSO" ], "coverage": 5, "material_thickness": 1, "encumbrance": 20 }, "reload_noise_volume": 3, "loudness": 8, - "ranged_damage": { "damage_type": "stab", "amount": 23 }, + "ranged_damage": { "damage_type": "stab", "amount": 5 }, "range": 18, "dispersion": 1000, "durability": 6, @@ -627,7 +639,7 @@ "armor_data": { "covers": [ "TORSO" ], "coverage": 7, "material_thickness": 2, "encumbrance": 25 }, "durability": 8, "loudness": 16, - "ranged_damage": { "damage_type": "stab", "amount": 44 }, + "ranged_damage": { "damage_type": "stab", "amount": 11 }, "range": 20 }, { @@ -652,7 +664,7 @@ "reload_noise_volume": 4, "loudness": 20, "durability": 8, - "ranged_damage": { "damage_type": "stab", "amount": 43 }, + "ranged_damage": { "damage_type": "stab", "amount": 11 }, "range": 22, "dispersion": 1000, "clip_size": 1, @@ -680,7 +692,7 @@ "armor_data": { "covers": [ "TORSO" ], "coverage": 5, "material_thickness": 1, "encumbrance": 14 }, "reload_noise_volume": 3, "loudness": 8, - "ranged_damage": { "damage_type": "stab", "amount": 28 }, + "ranged_damage": { "damage_type": "stab", "amount": 6 }, "range": 18, "dispersion": 950, "durability": 6, diff --git a/data/json/items/ranged/crossbows.json b/data/json/items/ranged/crossbows.json index d09bfe41a587f..ed3fe47b6b99c 100644 --- a/data/json/items/ranged/crossbows.json +++ b/data/json/items/ranged/crossbows.json @@ -17,6 +17,7 @@ "dispersion": 250, "loudness": 0, "count": 10, + "critical_multiplier": 10, "effects": [ "RECOVER_2" ] }, { @@ -37,6 +38,7 @@ "dispersion": 180, "loudness": 0, "count": 10, + "critical_multiplier": 10, "effects": [ "RECOVER_6" ] }, { @@ -79,6 +81,7 @@ "loudness": 0, "count": 10, "show_stats": true, + "critical_multiplier": 10, "effects": [ "RECOVER_8" ] }, { @@ -99,6 +102,7 @@ "dispersion": 110, "loudness": 0, "count": 10, + "critical_multiplier": 10, "effects": [ "RECOVER_25" ] }, { @@ -119,6 +123,7 @@ "dispersion": 100, "loudness": 0, "count": 10, + "critical_multiplier": 10, "effects": [ "RECOVER_30" ] }, { @@ -160,6 +165,7 @@ "loudness": 0, "count": 10, "show_stats": true, + "critical_multiplier": 10, "effects": [ "RECOVER_20" ] }, { @@ -181,6 +187,7 @@ "dispersion": 70, "loudness": 0, "count": 10, + "critical_multiplier": 10, "effects": [ "RECOVER_35" ] }, { @@ -203,6 +210,7 @@ "dispersion": 65, "loudness": 0, "count": 10, + "critical_multiplier": 10, "effects": [ "RECOVER_40" ] }, { @@ -225,6 +233,7 @@ "dispersion": 70, "loudness": 0, "count": 10, + "critical_multiplier": 10, "effects": [ "RECOVER_45", "NOGIB" ] }, { @@ -248,6 +257,7 @@ "loudness": 0, "count": 10, "stack_size": 10, + "critical_multiplier": 10, "effects": [ "RECOVER_30" ] }, { @@ -326,7 +336,7 @@ "weight": "900 g", "volume": "500 ml", "bashing": 4, - "ranged_damage": { "damage_type": "stab", "amount": 13 }, + "ranged_damage": { "damage_type": "stab", "amount": 3 }, "range": 6, "dispersion": 400, "durability": 6, @@ -365,7 +375,7 @@ "bashing": 11, "to_hit": 1, "loudness": 10, - "ranged_damage": { "damage_type": "stab", "amount": 19 }, + "ranged_damage": { "damage_type": "stab", "amount": 4 }, "range": 9, "dispersion": 375, "durability": 6, @@ -394,7 +404,7 @@ "volume": "1750 ml", "bashing": 11, "to_hit": 1, - "ranged_damage": { "damage_type": "stab", "amount": 27 }, + "ranged_damage": { "damage_type": "stab", "amount": 6 }, "range": 16, "loudness": 8, "dispersion": 350, @@ -434,7 +444,7 @@ "price_postapoc": 6000, "bashing": 11, "to_hit": 1, - "ranged_damage": { "damage_type": "stab", "amount": 64 }, + "ranged_damage": { "damage_type": "stab", "amount": 13 }, "range": 22, "loudness": 12, "dispersion": 325, @@ -473,7 +483,7 @@ "price_postapoc": 4000, "bashing": 20, "to_hit": -1, - "ranged_damage": { "damage_type": "stab", "amount": 30 }, + "ranged_damage": { "damage_type": "stab", "amount": 6 }, "range": 30, "dispersion": 300, "recoil": 30, @@ -502,7 +512,7 @@ "price_postapoc": 6000, "bashing": 13, "to_hit": -1, - "ranged_damage": { "damage_type": "stab", "amount": 5 }, + "ranged_damage": { "damage_type": "stab", "amount": 1 }, "range": 8, "dispersion": 500, "recoil": 30, diff --git a/data/mods/More_Survival_Tools/items.json b/data/mods/More_Survival_Tools/items.json index c061458334309..d6710dd2a0b28 100644 --- a/data/mods/More_Survival_Tools/items.json +++ b/data/mods/More_Survival_Tools/items.json @@ -210,7 +210,7 @@ "ammo": "bolt", "skill": "rifle", "range": 6, - "ranged_damage": 7, + "ranged_damage": 3, "dispersion": 500, "durability": 6, "clip_size": 1, diff --git a/data/mods/Salvaged_Robots/roboguns.json b/data/mods/Salvaged_Robots/roboguns.json index 5322f21f0731d..ad840dddd490e 100644 --- a/data/mods/Salvaged_Robots/roboguns.json +++ b/data/mods/Salvaged_Robots/roboguns.json @@ -20,7 +20,8 @@ "name": "mounted crossbow", "ammo": "bolt", "skill": "archery", - "relative": { "volume": 1, "range": 3, "ranged_damage": 4 }, + "relative": { "volume": 1, "range": 3 }, + "ranged_damage": 4, "loudness": 1, "clip_size": 100, "dispersion": 300, diff --git a/data/mods/blazemod/blaze_test.json b/data/mods/blazemod/blaze_test.json index 38f1e0e0ce4e2..cac2b661b2f60 100644 --- a/data/mods/blazemod/blaze_test.json +++ b/data/mods/blazemod/blaze_test.json @@ -840,8 +840,8 @@ "ammo": "bolt", "skill": "rifle", "range": 15, - "ranged_damage": 30, - "pierce": 15, + "ranged_damage": 6, + "pierce": 5, "dispersion": 300, "sight_dispersion": 150, "durability": 8, diff --git a/data/mods/blazemod/blaze_weapons.json b/data/mods/blazemod/blaze_weapons.json index b669f92a08fb8..e1b1af23e5818 100644 --- a/data/mods/blazemod/blaze_weapons.json +++ b/data/mods/blazemod/blaze_weapons.json @@ -16,8 +16,8 @@ "ammo": "bolt", "skill": "rifle", "range": 30, - "ranged_damage": 35, - "pierce": 20, + "ranged_damage": 7, + "pierce": 10, "sight_dispersion": 150, "durability": 9, "modes": [ [ "DEFAULT", "semi-auto", 1 ], [ "AUTO", "auto", 3 ] ], diff --git a/src/creature.cpp b/src/creature.cpp index 98d1b233b62a0..6c545260be01f 100644 --- a/src/creature.cpp +++ b/src/creature.cpp @@ -633,27 +633,28 @@ void Creature::deal_projectile_attack( Creature *source, dealt_projectile_attack double damage_mult = 1.0; + const float crit_multiplier = proj.critical_multiplier; const int max_damage = proj.impact.total_damage(); std::string message; game_message_type gmtSCTcolor = m_neutral; if( magic ) { damage_mult *= rng_float( 0.9, 1.1 ); - } else if( goodhit < accuracy_headshot && max_damage > 0.4 * get_hp_max( hp_head ) ) { + } else if( goodhit < accuracy_headshot && max_damage * crit_multiplier > get_hp_max( hp_head ) ) { message = _( "Headshot!" ); gmtSCTcolor = m_headshot; - damage_mult *= rng_float( 1.95, 2.05 ); + damage_mult *= rng_float( 0.95, 1.05 ); + damage_mult *= crit_multiplier; bp_hit = bp_head; // headshot hits the head, of course - - } else if( goodhit < accuracy_critical && max_damage > 0.4 * get_hp_max( hp_torso ) ) { + } else if( goodhit < accuracy_critical && max_damage * crit_multiplier > get_hp_max( hp_torso ) ) { message = _( "Critical!" ); gmtSCTcolor = m_critical; - damage_mult *= rng_float( 1.5, 2.0 ); - + damage_mult *= rng_float( 0.75, 1.0 ); + damage_mult *= crit_multiplier; } else if( goodhit < accuracy_goodhit ) { message = _( "Good hit!" ); gmtSCTcolor = m_good; - damage_mult *= rng_float( 1, 1.5 ); - + damage_mult *= rng_float( 0.5, 0.75 ); + damage_mult *= std::sqrt( 2.0 * crit_multiplier ); } else if( goodhit < accuracy_standard ) { damage_mult *= rng_float( 0.5, 1 ); diff --git a/src/item.cpp b/src/item.cpp index 025d6ff186731..e3c48ffecc6f2 100644 --- a/src/item.cpp +++ b/src/item.cpp @@ -1816,7 +1816,10 @@ void item::ammo_info( std::vector &info, const iteminfo_query *parts, } if( parts->test( iteminfo_parts::AMMO_DAMAGE_RECOIL ) ) { info.emplace_back( "AMMO", _( "Recoil: " ), "", - iteminfo::lower_is_better, ammo.recoil ); + iteminfo::lower_is_better | iteminfo::no_newline, ammo.recoil ); + } + if( parts->test( iteminfo_parts::AMMO_DAMAGE_CRIT_MULTIPLIER ) ) { + info.emplace_back( "AMMO", space + _( "Critical multiplier: " ), ammo.critical_multiplier ); } } @@ -1906,6 +1909,13 @@ void item::gun_info( const item *mod, std::vector &info, const iteminf } info.back().bNewLine = true; + if( mod->ammo_required() && curammo->ammo->critical_multiplier != 1.0 ) { + if( parts->test( iteminfo_parts::AMMO_DAMAGE_CRIT_MULTIPLIER ) ) { + info.push_back( iteminfo( "GUN", _( "Critical multiplier: " ), "", + iteminfo::no_flags, curammo->ammo->critical_multiplier ) ); + } + } + int max_gun_range = loaded_mod->gun_range( &g->u ); if( max_gun_range > 0 && parts->test( iteminfo_parts::GUN_MAX_RANGE ) ) { info.emplace_back( "GUN", _( "Maximum range: " ), "", iteminfo::no_flags, diff --git a/src/item_factory.cpp b/src/item_factory.cpp index 25ebed82ccdae..0b614e5d5453a 100644 --- a/src/item_factory.cpp +++ b/src/item_factory.cpp @@ -1490,7 +1490,8 @@ void Item_factory::load( islot_ammo &slot, const JsonObject &jo, const std::stri assign( jo, "count", slot.def_charges, strict, 1 ); assign( jo, "loudness", slot.loudness, strict, 0 ); assign( jo, "effects", slot.ammo_effects, strict ); - + assign( jo, "prop_damage", slot.prop_damage, strict ); + assign( jo, "critical_multiplier", slot.critical_multiplier, strict ); assign( jo, "show_stats", slot.force_stat_display, strict ); } diff --git a/src/iteminfo_query.h b/src/iteminfo_query.h index d7f89184cd4ab..3fd69441d76b8 100644 --- a/src/iteminfo_query.h +++ b/src/iteminfo_query.h @@ -47,6 +47,7 @@ enum class iteminfo_parts : size_t { AMMO_REMAINING_OR_TYPES, AMMO_DAMAGE_VALUE, AMMO_DAMAGE_PROPORTIONAL, + AMMO_DAMAGE_CRIT_MULTIPLIER, AMMO_DAMAGE_AP, AMMO_DAMAGE_RANGE, AMMO_DAMAGE_DISPERSION, diff --git a/src/itype.h b/src/itype.h index 48aa571e6a365..0a68b560addfa 100644 --- a/src/itype.h +++ b/src/itype.h @@ -710,6 +710,17 @@ struct islot_ammo : common_ranged_data { * */ bool special_cookoff = false; + /** + * If set, ammo does not give a flat damage, instead it multiplies the base + * damage of the gun by this value. + */ + cata::optional prop_damage; + + /** + * The damage multiplier to apply after a critical hit. + */ + float critical_multiplier = 2.0; + /** * Some combat ammo might not have a damage or prop_damage value * Set this to make it show as combat ammo anyway diff --git a/src/map.cpp b/src/map.cpp index c0ff16c829204..c68a1d3c71de2 100755 --- a/src/map.cpp +++ b/src/map.cpp @@ -3423,7 +3423,7 @@ void map::shoot( const tripoint &p, projectile &proj, const bool hit_items ) // TODO: Make bashing count fully, but other types much less float initial_damage = 0.0; for( damage_unit dam : proj.impact ) { - initial_damage += dam.amount / 3; + initial_damage += dam.amount; initial_damage += dam.res_pen; } if( initial_damage < 0 ) { diff --git a/src/projectile.cpp b/src/projectile.cpp index 4199133e2bb41..80aa0174c62f8 100644 --- a/src/projectile.cpp +++ b/src/projectile.cpp @@ -15,7 +15,7 @@ #include "string_id.h" projectile::projectile() : - speed( 0 ), range( 0 ), drop( nullptr ), custom_explosion( nullptr ) + speed( 0 ), range( 0 ), critical_multiplier( 2.0 ), drop( nullptr ), custom_explosion( nullptr ) { } projectile::~projectile() = default; @@ -33,6 +33,7 @@ projectile &projectile::operator=( const projectile &other ) speed = other.speed; range = other.range; proj_effects = other.proj_effects; + critical_multiplier = other.critical_multiplier; set_drop( other.get_drop() ); set_custom_explosion( other.get_custom_explosion() ); diff --git a/src/projectile.h b/src/projectile.h index 6e287a1594bd9..f1dfd894606b1 100644 --- a/src/projectile.h +++ b/src/projectile.h @@ -19,6 +19,7 @@ struct projectile { // bullets have arbitrarily high values but thrown objects have dodgeable values. int speed; int range; + float critical_multiplier; std::set proj_effects; diff --git a/src/ranged.cpp b/src/ranged.cpp index 76f8c3e2c5228..21f2379280fe8 100644 --- a/src/ranged.cpp +++ b/src/ranged.cpp @@ -2320,6 +2320,7 @@ static projectile make_gun_projectile( const item &gun ) } const auto &ammo = gun.ammo_data()->ammo; + proj.critical_multiplier = ammo->critical_multiplier; if( ammo->drop != "null" && x_in_y( ammo->drop_chance, 1.0 ) ) { item drop( ammo->drop ); if( ammo->drop_active ) { diff --git a/tests/archery_damage_test.cpp b/tests/archery_damage_test.cpp index fdab4cbb0b0cf..506340be7301e 100644 --- a/tests/archery_damage_test.cpp +++ b/tests/archery_damage_test.cpp @@ -21,6 +21,7 @@ #include "game_constants.h" #include "int_id.h" #include "item.h" +#include "itype.h" #include "map.h" #include "mapdata.h" #include "monster.h" @@ -75,6 +76,8 @@ static void test_archery_balance( std::string weapon_type, std::string ammo_type projectile test_projectile; test_projectile.speed = 1000; test_projectile.impact = weapon.gun_damage(); + test_projectile.proj_effects = weapon.ammo_effects(); + test_projectile.critical_multiplier = weapon.ammo_data()->ammo->critical_multiplier; dealt_projectile_attack attack { test_projectile, nullptr, dealt_damage_instance(), tripoint_zero, accuracy_critical - 0.05 diff --git a/tests/item_sort_test.cpp b/tests/item_sort_test.cpp new file mode 100644 index 0000000000000..4102d09a7d1a4 --- /dev/null +++ b/tests/item_sort_test.cpp @@ -0,0 +1,35 @@ +#include "catch/catch.hpp" + +#include +#include + +#include "game.h" +#include "item.h" +#include "map.h" + +TEST_CASE( "map_sort_stack_bug" ) +{ + const itype_id water_id = "water"; + const itype_id plank_id = "2x4"; + + tripoint test_pos( 50, 50, 0 ); + item water_bottle( water_id ); + water_bottle = water_bottle.in_its_container(); + g->m.add_item( test_pos, water_bottle ); + g->m.spawn_item( test_pos, plank_id, 10 ); + + std::stack> items_at_src; + for( auto &it : g->m.i_at( test_pos ) ) { + if( !it.made_of_from_type( LIQUID ) ) { // skip unpickable liquid + items_at_src.push( &it ); + } + } + + g->m.process_active_items(); + + while( !items_at_src.empty() ) { + auto item_to_sort = items_at_src.top(); + items_at_src.pop(); + CHECK( !item_to_sort->made_of_from_type( LIQUID ) ); + } +} diff --git a/tests/iteminfo_test.cpp b/tests/iteminfo_test.cpp index 636d1302857c3..fdfd68c28e859 100644 --- a/tests/iteminfo_test.cpp +++ b/tests/iteminfo_test.cpp @@ -267,13 +267,15 @@ TEST_CASE( "ranged weapon attributes", "[item][iteminfo][weapon][ranged][gun]" ) SECTION( "weapon damage including floating-point multiplier" ) { iteminfo_query q = q_vec( { iteminfo_parts::GUN_DAMAGE, iteminfo_parts::GUN_DAMAGE_AMMOPROP, - iteminfo_parts::GUN_DAMAGE_TOTAL, iteminfo_parts::GUN_ARMORPIERCE + iteminfo_parts::GUN_DAMAGE_TOTAL, iteminfo_parts::GUN_ARMORPIERCE, + iteminfo_parts::AMMO_DAMAGE_CRIT_MULTIPLIER } ); test_info_equals( item( "test_compbow" ), q, "--\n" "Ranged damage:" " 18*1.50 = 27\n" + "Critical multiplier: 10\n" "Armor-pierce: 0\n" ); } @@ -317,7 +319,7 @@ TEST_CASE( "ammunition", "[item][iteminfo][ammo]" ) iteminfo_query q = q_vec( { iteminfo_parts::AMMO_REMAINING_OR_TYPES, iteminfo_parts::AMMO_DAMAGE_VALUE, iteminfo_parts::AMMO_DAMAGE_PROPORTIONAL, iteminfo_parts::AMMO_DAMAGE_AP, iteminfo_parts::AMMO_DAMAGE_RANGE, iteminfo_parts::AMMO_DAMAGE_DISPERSION, - iteminfo_parts::AMMO_DAMAGE_RECOIL + iteminfo_parts::AMMO_DAMAGE_RECOIL, iteminfo_parts::AMMO_DAMAGE_CRIT_MULTIPLIER } ); SECTION( "simple item with ammo damage" ) { @@ -327,7 +329,7 @@ TEST_CASE( "ammunition", "[item][iteminfo][ammo]" ) "Ammunition type: rocks\n" "Damage: 7 Armor-pierce: 0\n" "Range: 10 Dispersion: 14\n" - "Recoil: 0\n" ); + "Recoil: 0 Critical multiplier: 2\n" ); } }