diff --git a/build-scripts/gha_compile_only.sh b/build-scripts/gha_compile_only.sh index c75576c9219a9..f9cb303c4aca3 100755 --- a/build-scripts/gha_compile_only.sh +++ b/build-scripts/gha_compile_only.sh @@ -62,7 +62,10 @@ then .. make -j$num_jobs else - make -j "$num_jobs" RELEASE=1 CCACHE=1 CROSS="$CROSS_COMPILATION" LINTJSON=0 + # The OSX_MIN version here should match that used in release builds so that + # CI detects issues that will affect releases. It doesn't affect builds on + # other platforms. + make -j "$num_jobs" RELEASE=1 CCACHE=1 CROSS="$CROSS_COMPILATION" LINTJSON=0 OSX_MIN=10.12 fi # vim:tw=0 diff --git a/data/json/bionics.json b/data/json/bionics.json index 95215c159b1db..534ff6d316e29 100644 --- a/data/json/bionics.json +++ b/data/json/bionics.json @@ -750,7 +750,8 @@ "ALCMET", "SAPROVORE", "LACTOSE", - "GRAZER" + "GRAZER", + "VEGETARIAN" ] }, { diff --git a/data/json/npcs/common_chat/TALK_COMMON_OTHER.json b/data/json/npcs/common_chat/TALK_COMMON_OTHER.json index 4a788417fc587..a141c9fb1f787 100644 --- a/data/json/npcs/common_chat/TALK_COMMON_OTHER.json +++ b/data/json/npcs/common_chat/TALK_COMMON_OTHER.json @@ -103,7 +103,12 @@ "default": true, "text": "I can keep you safe.", "trial": { "type": "PERSUADE", "difficulty": 20, "mod": [ [ "FEAR", 8 ], [ "VALUE", 2 ], [ "TRUST", 2 ], [ "BRAVERY", -2 ] ] }, - "success": { "topic": "TALK_AGREE_FOLLOW", "effect": "follow", "opinion": { "trust": 1, "value": 1 } }, + "success": { + "topic": "TALK_AGREE_FOLLOW", + "effect": "follow", + "opinion": { "trust": 1, "value": 1 }, + "npc_lose_trait": [ "RETURN_TO_START_POS", "NO_BASH", "IGNORE_SOUND" ] + }, "failure": { "topic": "TALK_DENY_FOLLOW", "effect": "deny_follow", "opinion": { "value": -1, "anger": 1 } } }, { diff --git a/data/json/npcs/island_prison/prisoners.json b/data/json/npcs/island_prison/prisoners.json index bf54614d8de41..c977d242d455e 100644 --- a/data/json/npcs/island_prison/prisoners.json +++ b/data/json/npcs/island_prison/prisoners.json @@ -38,13 +38,13 @@ "id": "NC_THUG_PRISONER", "name": { "str": "Prisoner" }, "job_description": "I'm here to kick ass.", + "common": false, "traits": [ { "group": "BG_survival_story_CRIMINAL" }, { "group": "NPC_starting_traits" }, { "group": "Appearance_demographics" }, { "trait": "IGNORE_SOUND" }, - { "trait": "NO_BASH" }, - { "trait": "RETURN_TO_START_POS" } + { "trait": "NO_BASH" } ], "bonus_str": { "rng": [ 2, 4 ] }, "bonus_dex": { "rng": [ 0, 2 ] }, diff --git a/data/json/recipes/food/bread.json b/data/json/recipes/food/bread.json index 128e70ea24b40..6cfc2b723195c 100644 --- a/data/json/recipes/food/bread.json +++ b/data/json/recipes/food/bread.json @@ -13,7 +13,7 @@ "book_learn": [ [ "family_cookbook", 1 ], [ "baking_book", 1 ], [ "cookbook", 2 ] ], "proficiencies": [ { "proficiency": "prof_food_prep" }, { "proficiency": "prof_baking" }, { "proficiency": "prof_baking_bread" } ], "qualities": [ { "id": "OVEN", "level": 1 } ], - "tools": [ [ [ "surface_heat", 52, "LIST" ] ] ], + "tools": [ [ [ "surface_heat", 54, "LIST" ] ] ], "//": "Flour: 40u, milk: 2u, pumpkin: 4u, eggs: 6u, oil: 1u, other: 1u.", "components": [ [ [ "flour_any", 40, "LIST" ] ], diff --git a/data/json/recipes/food/brewing.json b/data/json/recipes/food/brewing.json index 5db01f34804d3..670007c3dcf42 100644 --- a/data/json/recipes/food/brewing.json +++ b/data/json/recipes/food/brewing.json @@ -66,7 +66,7 @@ "book_learn": [ [ "distilling_cookbook", 5 ], [ "scots_cookbook", 5 ] ], "proficiencies": [ { "proficiency": "prof_food_prep" }, { "proficiency": "prof_fermenting" }, { "proficiency": "prof_brewing" } ], "qualities": [ { "id": "BOIL", "level": 2 } ], - "tools": [ [ [ "surface_heat", 57, "LIST" ] ] ], + "tools": [ [ [ "surface_heat", 58, "LIST" ] ] ], "//": "assuming grains are roasted, that's 52u flour by weight, plus 6u to heat water and activate yeast", "components": [ [ [ "water_clean", 3 ] ], [ [ "malted_grain", 2 ] ], [ [ "sugar", 50 ] ], [ [ "yeast", 1 ] ] ] }, @@ -383,6 +383,7 @@ ], "proficiencies": [ { "proficiency": "prof_food_prep" }, { "proficiency": "prof_fermenting" }, { "proficiency": "prof_winemaking" } ], "qualities": [ { "id": "CONTAIN", "level": 1 } ], + "tools": [ [ [ "surface_heat", 6, "LIST" ] ] ], "//": "6u to heat water and activate yeast, dandelions don't appear to be roasted here", "components": [ [ [ "water_clean", 3 ] ], @@ -416,7 +417,7 @@ { "proficiency": "prof_winemaking" } ], "qualities": [ { "id": "CUT", "level": 2 }, { "id": "BOIL", "level": 2 } ], - "tools": [ [ [ "surface_heat", 6, "LIST" ] ] ], + "tools": [ [ [ "surface_heat", 26, "LIST" ] ] ], "//": "20u to roast the burdocks and 6u to heat water & activate the yeast", "components": [ [ [ "water_clean", 3 ] ], diff --git a/data/json/recipes/food/dry.json b/data/json/recipes/food/dry.json index f0930685ed1ac..34034039365d9 100644 --- a/data/json/recipes/food/dry.json +++ b/data/json/recipes/food/dry.json @@ -121,7 +121,7 @@ "time": "20 m", "autolearn": true, "batch_time_factors": [ 67, 5 ], - "tools": [ [ [ "dehydrating_heat", 15, "LIST" ] ], [ [ "surface_heat", 8, "LIST" ] ] ], + "tools": [ [ [ "dehydrating_heat", 19, "LIST" ] ], [ [ "surface_heat", 8, "LIST" ] ] ], "//": "194g of stuff", "components": [ [ [ "raw_beans", 1 ] ] ] }, @@ -361,7 +361,7 @@ "time": "20 m", "autolearn": true, "batch_time_factors": [ 67, 5 ], - "tools": [ [ [ "dehydrating_heat", 21, "LIST" ] ], [ [ "surface_heat", 2, "LIST" ] ] ], + "tools": [ [ [ "dehydrating_heat", 21, "LIST" ] ], [ [ "surface_heat", 8, "LIST" ] ] ], "//": "210g of stuff - kernels are rather heavy, 8u to cook", "components": [ [ [ "corn_kernels", 1 ] ] ] }, @@ -476,7 +476,7 @@ "time": "20 m", "autolearn": true, "batch_time_factors": [ 67, 5 ], - "tools": [ [ [ "dehydrating_heat", 55, "LIST" ] ], [ [ "surface_heat", 2, "LIST" ] ] ], + "tools": [ [ [ "dehydrating_heat", 55, "LIST" ] ], [ [ "surface_heat", 36, "LIST" ] ] ], "//": "by weight of unfertilized bird egg 550g of stuff plus 36u heat for the eggs (standard is 3 per egg)", "components": [ [ [ "eggs_bird", 12, "LIST" ], [ "egg_reptile", 12 ], [ "eggs_insect", 1, "LIST" ] ] ] }, diff --git a/data/json/recipes/food/offal_dishes.json b/data/json/recipes/food/offal_dishes.json index ac0f1320e3366..caaa1eafd1c1d 100644 --- a/data/json/recipes/food/offal_dishes.json +++ b/data/json/recipes/food/offal_dishes.json @@ -160,7 +160,7 @@ "batch_time_factors": [ 83, 5 ], "book_learn": [ [ "family_cookbook", 2 ], [ "cookbook", 2 ], [ "cookbook_liverforkids", 1 ] ], "qualities": [ { "id": "CUT", "level": 2 }, { "id": "COOK", "level": 2 } ], - "tools": [ [ [ "surface_heat", 25, "LIST" ] ] ], + "tools": [ [ [ "surface_heat", 23, "LIST" ] ] ], "//": "12u from the liver, 8u for the batter, 1u for the milk, 2u flex", "components": [ [ [ "meat_liver", 3, "LIST" ] ], @@ -422,7 +422,7 @@ "charges": 3, "book_learn": [ [ "offalcooking", 2 ] ], "qualities": [ { "id": "COOK", "level": 3 }, { "id": "CUT", "level": 2 } ], - "tools": [ [ [ "surface_heat", 42, "LIST" ] ] ], + "tools": [ [ [ "surface_heat", 32, "LIST" ] ] ], "//": "eggs: 9u, garlic: 1u, brains: 8u, batter: 8u, onion: 2u, butter: 2u, milk: 2u", "components": [ [ [ "eggs_any_shape", 3, "LIST" ] ], diff --git a/data/json/recipes/food/pasta.json b/data/json/recipes/food/pasta.json index 8534973c89e80..c496d0104f5dd 100644 --- a/data/json/recipes/food/pasta.json +++ b/data/json/recipes/food/pasta.json @@ -28,7 +28,7 @@ "time": "10 m", "autolearn": true, "qualities": [ { "id": "COOK", "level": 3 } ], - "tools": [ [ [ "surface_heat", 7, "LIST" ] ] ], + "tools": [ [ [ "surface_heat", 8, "LIST" ] ] ], "//": "There are ways to cook pasta that don't require boiling the water, and they are a lot more efficient, so this uses surface_heat", "//1": "pasta by weight is 5u flour, 1u for the cheese + heating the water (2u)", "components": [ diff --git a/data/json/recipes/other/medical.json b/data/json/recipes/other/medical.json index 0789cba5b03bb..017f1494ff26a 100644 --- a/data/json/recipes/other/medical.json +++ b/data/json/recipes/other/medical.json @@ -60,9 +60,11 @@ "batch_time_factors": [ 95, 4 ], "autolearn": true, "qualities": [ { "id": "BOIL", "level": 1 } ], - "tools": [ [ [ "water_boiling_heat", 9, "LIST" ] ] ], + "tools": [ [ [ "water_boiling_heat", 4, "LIST" ] ] ], + "//": "3 units of water + 114g of cotton, bandages will soak up some of the water but the rest should be potable", "result_mult": 3, - "components": [ [ [ "bandages_makeshift", 3 ] ], [ [ "water_clean", 3 ], [ "water", 3 ] ] ] + "components": [ [ [ "bandages_makeshift", 3 ] ], [ [ "water_clean", 3 ], [ "water", 3 ] ] ], + "byproducts": [ [ "water_clean", 2 ] ] }, { "result": "adhesive_bandages", diff --git a/data/mods/Xedra_Evolved/monsters/bloodsuckers.json b/data/mods/Xedra_Evolved/monsters/bloodsuckers.json index bef65659ac5ea..e0a6652008b37 100644 --- a/data/mods/Xedra_Evolved/monsters/bloodsuckers.json +++ b/data/mods/Xedra_Evolved/monsters/bloodsuckers.json @@ -390,7 +390,7 @@ "id": "mon_renfield_abomination", "type": "MONSTER", "name": { "str": "abominable renfield" }, - "description": "A towering mutated test subject, covered in thick fur and the torn bottom part of a jumpsuit. Their legs end in large padded feet not unlike a dog's, but they still manage to stand upright, freeing up their clawed hands to tear you apart.", + "description": "A brobdignagian Renfield, twisted through unnatural alchemies. Their stump sized legs and feet pound the earth as they move, while their claw like hands to tear you apart.", "symbol": "A", "color": "brown_red", "default_faction": "vampire", @@ -418,11 +418,6 @@ [ "PARROT", 800 ], { "id": "cut_throat", "move_cost": 130, "cooldown": 4, "min_mul": 1.5, "max_mul": 3.5 }, { "id": "smash", "move_cost": 100, "cooldown": 8, "min_mul": 0.8, "throw_strength": 50 }, - { - "type": "bite", - "cooldown": 10, - "damage_max_instance": [ { "damage_type": "stab", "amount": 18, "armor_multiplier": 0.7 } ] - }, { "id": "longswipe", "move_cost": 120, "cooldown": 12, "min_mul": 1.5, "max_mul": 3 } ], "death_drops": "mon_renfield_abomination_death_drops", diff --git a/data/mods/Xedra_Evolved/monsters/nightmares_and_chimeras.json b/data/mods/Xedra_Evolved/monsters/nightmares_and_chimeras.json index 70e895e5c3094..dab675f48e618 100644 --- a/data/mods/Xedra_Evolved/monsters/nightmares_and_chimeras.json +++ b/data/mods/Xedra_Evolved/monsters/nightmares_and_chimeras.json @@ -109,5 +109,13 @@ "special_attacks": [ [ "DISAPPEAR", 1000 ] ], "death_function": { "message": "", "corpse_type": "NO_CORPSE" }, "flags": [ "FLIES", "NO_BREATHE", "NOT_HALLUCINATION", "HARDTOSHOOT" ] + }, + { + "id": "mon_you", + "copy-from": "mon_hologram", + "looks_like": "player", + "type": "MONSTER", + "name": { "str": "you" }, + "description": "It is you. It looks like you, it is equipped like you, it is even has a weapon like you." } ] diff --git a/data/mods/Xedra_Evolved/spells/XAEA.json b/data/mods/Xedra_Evolved/spells/XAEA.json index 8b2a753808310..eadf30384fac7 100644 --- a/data/mods/Xedra_Evolved/spells/XAEA.json +++ b/data/mods/Xedra_Evolved/spells/XAEA.json @@ -307,7 +307,7 @@ "valid_targets": [ "ground" ], "flags": [ "SILENT", "RANDOM_DAMAGE", "IGNORE_WALLS", "RANDOM_DURATION", "NO_EXPLOSION_SFX" ], "effect": "summon", - "effect_str": "mon_hologram", + "effect_str": "mon_you", "shape": "blast", "damage_type": "bash", "message": "It is you. And this is you. And that is you. You are everywhere.", diff --git a/data/mods/Xedra_Evolved/spells/classless_spells.json b/data/mods/Xedra_Evolved/spells/classless_spells.json index b7504264e4ba9..256c9518c5e0d 100644 --- a/data/mods/Xedra_Evolved/spells/classless_spells.json +++ b/data/mods/Xedra_Evolved/spells/classless_spells.json @@ -8,6 +8,7 @@ "valid_targets": [ "self" ], "effect": "attack", "effect_str": "night_sight", + "skill": "deduction", "shape": "blast", "min_range": 1, "max_range": 1, @@ -27,6 +28,7 @@ "description": "Everything around you faces an existential crisis and moves slower as a result. Including things that you wouldn't expect to suffer from existential crises, like the undead. The air around the targets' extremities chills dramatically. Higher levels allow a bigger AoE, and longer effect.", "effect": "attack", "effect_str": "effect_dread_weight", + "skill": "deduction", "shape": "blast", "affected_body_parts": [ "foot_l", "foot_r", "arm_l", "arm_r" ], "valid_targets": [ "hostile" ], @@ -59,6 +61,7 @@ "valid_targets": [ "self" ], "effect": "spawn_item", "effect_str": "obfuscating_aura", + "skill": "deduction", "shape": "blast", "energy_source": "MANA", "spell_class": "NONE", @@ -79,6 +82,7 @@ "//": "deal damage, give heal. nothing special.", "valid_targets": [ "hostile" ], "flags": [ "CONCENTRATE", "SOMATIC", "SILENT", "NO_PROJECTILE" ], + "skill": "deduction", "effect": "attack", "shape": "blast", "damage_type": "bash", @@ -117,6 +121,7 @@ "shape": "blast", "valid_targets": [ "ground" ], "flags": [ "SOMATIC", "SILENT", "NO_LEGS", "TARGET_TELEPORT" ], + "skill": "deduction", "min_range": 4, "max_range": 12, "range_increment": 0.3, diff --git a/data/mods/Xedra_Evolved/spells/dreamer_spells.json b/data/mods/Xedra_Evolved/spells/dreamer_spells.json index 3f93d750e3cbf..61b7d4e59e70d 100644 --- a/data/mods/Xedra_Evolved/spells/dreamer_spells.json +++ b/data/mods/Xedra_Evolved/spells/dreamer_spells.json @@ -444,6 +444,6 @@ "final_energy_cost": 1000, "base_casting_time": 1260000, "final_casting_time": 1260000, - "spell_class": "INVENTOR" + "spell_class": "DREAMER" } ] diff --git a/data/mods/Xedra_Evolved/spells/vampire_spells.json b/data/mods/Xedra_Evolved/spells/vampire_spells.json index d6a5cb1556a2f..74808cdc2017a 100644 --- a/data/mods/Xedra_Evolved/spells/vampire_spells.json +++ b/data/mods/Xedra_Evolved/spells/vampire_spells.json @@ -10,11 +10,10 @@ "effect_str": "eyegleam", "flags": [ "NO_HANDS", "SILENT", "NO_FAIL" ], "shape": "blast", + "skill": "deduction", "min_range": 1, "max_range": 1, "base_casting_time": 100, - "base_energy_cost": 0, - "energy_source": "NONE", "min_duration": 100000, "max_duration": 1000000, "duration_increment": 2000 @@ -29,6 +28,7 @@ "shape": "blast", "valid_targets": [ "self" ], "flags": [ "NO_HANDS", "SILENT", "NO_FAIL" ], + "skill": "deduction", "min_damage": 1500, "max_damage": 10000, "base_casting_time": 100, @@ -44,8 +44,7 @@ "effect_str": "vamp_blood_weave", "shape": "blast", "flags": [ "NO_HANDS", "SILENT", "NO_FAIL" ], - "energy_source": "NONE", - "spell_class": "NONE", + "skill": "deduction", "base_energy_cost": 150, "max_level": 20, "min_duration": 6000, @@ -62,14 +61,12 @@ "max_damage": -20, "damage_increment": -1.0, "max_level": 15, - "min_range": 0, "effect": "attack", "shape": "blast", "base_casting_time": 20, "flags": [ "NO_HANDS", "SILENT", "NO_FAIL" ], - "spell_class": "NONE", - "difficulty": 2, - "energy_source": "NONE" + "skill": "deduction", + "difficulty": 2 }, { "id": "spell_blood_haste", @@ -78,11 +75,10 @@ "description": "This spell gives you an enormous boost of speed lasting a short period of time.", "valid_targets": [ "self" ], "flags": [ "NO_HANDS", "SILENT", "NO_FAIL", "NO_PROJECTILE" ], + "skill": "deduction", "effect": "attack", "effect_str": "haste", "shape": "blast", - "spell_class": "NONE", - "energy_source": "NONE", "base_casting_time": 200, "max_level": 20, "min_duration": 600, @@ -99,12 +95,10 @@ "effect_str": "stunned", "shape": "blast", "flags": [ "NO_HANDS", "SILENT", "NO_FAIL", "NO_PROJECTILE" ], - "spell_class": "NONE", - "energy_source": "NONE", + "skill": "deduction", "difficulty": 3, "base_casting_time": 100, "max_level": 15, - "min_damage": 0, "min_range": 3, "max_range": 9, "range_increment": 0.4, diff --git a/doc/MAGIC.md b/doc/MAGIC.md index cc7e46ea6896a..0f727de1b80ff 100644 --- a/doc/MAGIC.md +++ b/doc/MAGIC.md @@ -782,7 +782,7 @@ The following is a list of possible enchantment `values`: | `BIONIC_POWER` | | `BONUS_BLOCK` | Affects the number of blocks you can perform. | `BONUS_DODGE` | Affects the number of dodges you can perform. -| `CARRY_WEIGHT` | +| `CARRY_WEIGHT` | Affect the summary weight player can carry. `"add": 1000` adds 1 kg of weight to carry. | `CLIMATE_CONTROL_HEAT` | Moves body temperature up towards comfortable by number of warmth units up to value. | `CLIMATE_CONTROL_CHILL` | Moves body temperature down towards comfortable by number of warmth units up to value. | `DEXTERITY` | Affects the dexterity stat. @@ -825,12 +825,12 @@ The following is a list of possible enchantment `values`: | `SOCIAL_LIE` | Affects your ability to lie. | `SOCIAL_PERSUADE` | Affects your ability to persuade. | `READING_EXP` | Changes the minimum you learn from each reading increment. -| `RECOIL_MODIFIER` | Affects recoil when shooting a gun. +| `RECOIL_MODIFIER` | Affects recoil when shooting a gun. Can be applied only to guns. Positive value increase the dispersion, negative decrease one. | `REGEN_HP` | Affects the rate you recover hp. | `REGEN_MANA` | | `REGEN_STAMINA` | | `THIRST` | -| `WEAPON_DISPERSION` | +| `WEAPON_DISPERSION` | Can be applied only to guns. Positive value increase the dispersion, negative decrease one. | Melee-only enchantment values | Description diff --git a/src/vehicle.cpp b/src/vehicle.cpp index 68e7ad3dd7bdc..c899115c81c46 100644 --- a/src/vehicle.cpp +++ b/src/vehicle.cpp @@ -7148,19 +7148,25 @@ item vehicle::get_folded_item() const folded.set_var( "folded_parts", veh_data.str() ); } catch( const JsonError &e ) { debugmsg( "Error storing vehicle: %s", e.c_str() ); + return folded; } units::volume folded_volume = 0_ml; - double sum_of_damage = 0; + int sum_of_damage = 0; int num_of_parts = 0; for( const vehicle_part &vp : real_parts() ) { folded_volume += vp.info().folded_volume.value_or( 0_ml ); - sum_of_damage += vp.damage_percent(); + sum_of_damage += vp.damage(); num_of_parts++; } + if( num_of_parts == 0 ) { + debugmsg( "Error storing vehicle: 0 real parts" ); + return folded; + } + // snapshot average damage of parts into both item's hp and item variable - const int avg_part_damage = static_cast( sum_of_damage / num_of_parts * folded.max_damage() ); + const int avg_part_damage = static_cast( sum_of_damage / num_of_parts ); folded.set_var( "tracking", tracking_on ? 1 : 0 ); folded.set_var( "weight", to_milligram( total_mass() ) ); @@ -7170,7 +7176,6 @@ item vehicle::get_folded_item() const folded.set_var( "unfolding_time", to_moves( unfolding_time() ) ); folded.set_var( "avg_part_damage", avg_part_damage ); folded.set_damage( avg_part_damage ); - // TODO: a better description? std::string desc = string_format( _( "A folded %s." ), name ) .append( "\n\n" ) .append( string_format( _( "It will take %s to unfold." ), to_string( unfolding_time() ) ) ); @@ -7193,16 +7198,40 @@ bool vehicle::restore_folded_parts( const item &it ) // item should have snapshot of average part damage in item var. take difference of current // item's damage and snapshotted damage, then randomly apply to parts in chunks to roughly match. - constexpr double damage_chunk = 0.25; - const double damage_diff = it.damage() - static_cast( it.get_var( "avg_part_damage", 0.0 ) ); - const int count = damage_diff / it.max_damage() * real_parts().size() / damage_chunk; - const int seed = static_cast( damage_diff ); - for( int part_idx : rng_sequence( count, 0, parts.size() - 1, seed ) ) { - vehicle_part &pt = parts[part_idx]; - if( pt.removed || pt.is_fake ) { - continue; + constexpr int chunk_damage = 400; + const int avg_part_damage = static_cast( it.get_var( "avg_part_damage", 0.0 ) ); + const int damage_diff = it.damage() - avg_part_damage; + int damage_to_apply = damage_diff * parts.size(); + if( damage_to_apply > 0 ) { + add_msg_debug( debugmode::DF_VEHICLE, + "unfolding vehicle item with %d damage, damage before folding was %d, " + "applying %d damage * %d parts = %d total damage to random parts", + it.damage(), avg_part_damage, damage_diff, parts.size(), damage_to_apply ); + std::vector part_sequence; + int no_damage_applied = 0; // safety from infinite loop (e.g. all parts with flag_UNBREAKABLE) + while( damage_to_apply > 0 && ( ++no_damage_applied < 100 ) ) { + if( part_sequence.empty() ) { + part_sequence = rng_sequence( 16, 0, parts.size() - 1, damage_to_apply ); + } + const int part_idx = part_sequence.back(); + part_sequence.pop_back(); + if( part_idx > part_count() ) { + continue; + } + vehicle_part &pt = parts[part_idx]; + if( pt.removed || pt.is_fake ) { + continue; + } + const int start_damage = pt.base.damage(); + pt.base.mod_damage( std::min( chunk_damage, damage_to_apply ) ); + const int applied_damage = pt.base.damage() - start_damage; + if( applied_damage > 0 ) { + no_damage_applied = 0; + damage_to_apply -= applied_damage; + add_msg_debug( debugmode::DF_VEHICLE, "unfolding applied %d damage to %s %d left to apply", + applied_damage, pt.name(), damage_to_apply ); + } } - pt.base.mod_damage( damage_chunk * pt.base.max_damage() ); } refresh(); diff --git a/tests/vehicle_test.cpp b/tests/vehicle_test.cpp index 8abc2e7e1b241..de3db0e05c5bd 100644 --- a/tests/vehicle_test.cpp +++ b/tests/vehicle_test.cpp @@ -391,8 +391,8 @@ static void check_folded_item_to_parts_damage_transfer( const folded_item_damage TEST_CASE( "Check folded item damage transfers to parts and vice versa", "[item][vehicle]" ) { std::vector presets { - { itype_folded_wheelchair_generic, 2111, 2277, 12666, 13666 }, - { itype_folded_bicycle, 1689, 1961, 18582, 21582 }, + { itype_folded_wheelchair_generic, 2111, 2411, 12666, 14466 }, + { itype_folded_bicycle, 1689, 1989, 18582, 21882 }, }; for( const folded_item_damage_preset &preset : presets ) { diff --git a/tools/spell_checker/dictionary.txt b/tools/spell_checker/dictionary.txt index f160bbd545e0d..ad0d33635e8fe 100644 --- a/tools/spell_checker/dictionary.txt +++ b/tools/spell_checker/dictionary.txt @@ -56,6 +56,7 @@ alay albertonykus albertosaurus alchemic +alchemies aldosterone alembic alexandrite @@ -363,6 +364,7 @@ brined bringin broadhead broadswords +brobdignagian bronchodilator bronchospasm bubblicious