From 2915fb1b713629fa030a9fecbc5b9269eaea859c Mon Sep 17 00:00:00 2001 From: Anton Simakov <67688115+GuardianDll@users.noreply.github.com> Date: Tue, 27 Feb 2024 20:30:58 +0100 Subject: [PATCH] More enchantments (#71976) * More enchantments * tweak * how did i miss it? * refine doc --- data/json/bionics.json | 3 +- data/json/effects.json | 2 + data/json/mutations/mutations.json | 7 ++- .../Magiclysm/mutations/fantasy_species.json | 2 +- .../effects/effects_potions.json | 2 +- .../enchantments/enchantments_player.json | 2 +- doc/JSON_FLAGS.md | 2 +- doc/MAGIC.md | 22 +++++-- src/activity_actor.cpp | 4 +- src/character.cpp | 63 +++++++------------ src/iexamine.cpp | 4 +- src/iuse_actor.cpp | 15 ++++- src/magic_enchantment.cpp | 12 ++++ src/magic_enchantment.h | 12 ++++ src/npc.cpp | 1 + tests/player_activities_test.cpp | 10 +-- 16 files changed, 100 insertions(+), 63 deletions(-) diff --git a/data/json/bionics.json b/data/json/bionics.json index 39eff69fbf13e..10d0963fef314 100644 --- a/data/json/bionics.json +++ b/data/json/bionics.json @@ -818,7 +818,8 @@ "occupied_bodyparts": [ [ "head", 2 ] ], "mutation_conflicts": [ "BATEARS" ], "flags": [ "BIONIC_TOGGLED", "IMMUNE_HEARING_DAMAGE" ], - "active_flags": [ "SUPER_HEARING" ], + "active_flags": [ "SAFECRACK_NO_TOOL" ], + "enchantments": [ { "condition": "ACTIVE", "values": [ { "value": "HEARING_MULT", "multiply": 2.5 } ] } ], "auto_deactivates": [ "bio_earplugs" ], "included_bionics": [ "bio_earplugs" ], "activated_on_install": true diff --git a/data/json/effects.json b/data/json/effects.json index 5eec0174ca505..2f61bd190cfbc 100644 --- a/data/json/effects.json +++ b/data/json/effects.json @@ -719,6 +719,7 @@ "desc": [ "You are wearing earphones and can't hear much from outside world." ], "rating": "bad", "limb_score_mods": [ { "limb_score": "reaction", "modifier": 0.9 } ], + "enchantments": [ { "values": [ { "value": "HEARING_MULT", "multiply": -0.75 } ] } ], "flags": [ "EFFECT_LIMB_SCORE_MOD" ] }, { @@ -3333,6 +3334,7 @@ "apply_message": "You feel lightheaded.", "miss_messages": [ [ "That critter's jumping around like a jitterbug! It needs to mellow out.", 1 ] ], "base_mods": { "per_mod": [ -1 ] }, + "enchantments": [ { "values": [ { "value": "VOMIT_MUL", "multiply": -0.9 } ] } ], "blood_analysis_description": "Intoxicant: THC" }, { diff --git a/data/json/mutations/mutations.json b/data/json/mutations/mutations.json index 04dbfc163f55a..6275cebc4be59 100644 --- a/data/json/mutations/mutations.json +++ b/data/json/mutations/mutations.json @@ -491,7 +491,7 @@ "description": "Your broad, pointed ears are like radar dishes. You can hear even the slightest sounds at great distance, and are less likely to be deafened by loud noises.", "types": [ "HEARING" ], "//": "Super_hearing multiplies hearing by 3.5 and let you crack safes. A bat mutant is a bit better at hearing overall than someone with GOODHEARING and a CBM.", - "flags": [ "HEARING_PROTECTION", "SUPER_HEARING" ], + "flags": [ "HEARING_PROTECTION", "SAFECRACK_NO_TOOL" ], "prereqs": [ "GOODHEARING" ], "category": [ "CHIROPTERAN" ], "hearing_modifier": 1.8 @@ -6204,6 +6204,7 @@ "prereqs2": [ "AMORPHOUS" ], "threshreq": [ "THRESH_SLIME" ], "category": [ "SLIME" ], + "enchantments": [ { "values": [ { "value": "HEARING_MULT", "multiply": { "math": [ "rng(-0.75, 1)" ] } } ] } ], "passive_mods": { "per_mod": -8 } }, { @@ -7889,6 +7890,7 @@ "name": { "str": "Shouter" }, "points": -2, "description": "You occasionally shout uncontrollably.", + "enchantments": [ { "values": [ { "value": "SHOUT_NOISE_BASE", "add": 2 } ] } ], "changes_to": [ "SHOUT2" ], "category": [ "RAPTOR", "BEAST", "CHIMERA", "LUPINE" ] }, @@ -7898,6 +7900,7 @@ "name": { "str": "Screamer" }, "points": -3, "description": "You sometimes scream uncontrollably.", + "enchantments": [ { "values": [ { "value": "SHOUT_NOISE_BASE", "add": 5 }, { "value": "SHOUT_NOISE_STR_MULT", "add": 1 } ] } ], "prereqs": [ "SHOUT1" ], "changes_to": [ "SHOUT3" ], "category": [ "BEAST", "CHIMERA", "LUPINE" ] @@ -7908,6 +7911,7 @@ "name": { "str": "Howler" }, "points": -4, "description": "You frequently let out a piercing howl.", + "enchantments": [ { "values": [ { "value": "SHOUT_NOISE_BASE", "add": 10 }, { "value": "SHOUT_NOISE_STR_MULT", "add": 2 } ] } ], "prereqs": [ "SHOUT2" ], "category": [ "CHIMERA", "LUPINE" ] }, @@ -9437,6 +9441,7 @@ "name": { "str": "Booming Voice" }, "points": 1, "description": "You know how to project your voice. You are able to shout much louder than the average person.", + "enchantments": [ { "values": [ { "value": "SHOUT_NOISE_BASE", "add": 10 }, { "value": "SHOUT_NOISE_STR_MULT", "add": 1 } ] } ], "category": [ "BEAST" ] }, { diff --git a/data/mods/Magiclysm/mutations/fantasy_species.json b/data/mods/Magiclysm/mutations/fantasy_species.json index 62a12097d5b03..f2af4e8335ef1 100644 --- a/data/mods/Magiclysm/mutations/fantasy_species.json +++ b/data/mods/Magiclysm/mutations/fantasy_species.json @@ -332,7 +332,7 @@ "types": [ "HEARING" ], "category": [ "SPECIES_ELF" ], "threshreq": [ "THRESH_SPECIES_ELF" ], - "flags": [ "SUPER_HEARING" ], + "flags": [ "SAFECRACK_NO_TOOL" ], "hearing_modifier": 1.75 }, { diff --git a/data/mods/MindOverMatter/effects/effects_potions.json b/data/mods/MindOverMatter/effects/effects_potions.json index de135236d1d1e..e5e5858a0eab1 100644 --- a/data/mods/MindOverMatter/effects/effects_potions.json +++ b/data/mods/MindOverMatter/effects/effects_potions.json @@ -49,7 +49,7 @@ "max_duration": "30 hours", "max_intensity": 1, "base_mods": { "per_mod": [ 4 ] }, - "flags": [ "SEESLEEP", "SUPER_HEARING", "IMMUNE_HEARING_DAMAGE" ], + "flags": [ "SEESLEEP", "SAFECRACK_NO_TOOL", "IMMUNE_HEARING_DAMAGE" ], "enchantments": [ "enchant_clair_potion" ] }, { diff --git a/data/mods/MindOverMatter/enchantments/enchantments_player.json b/data/mods/MindOverMatter/enchantments/enchantments_player.json index 1c0dc80f7a83f..8eca34490e1b8 100644 --- a/data/mods/MindOverMatter/enchantments/enchantments_player.json +++ b/data/mods/MindOverMatter/enchantments/enchantments_player.json @@ -4,7 +4,7 @@ "id": "enchant_clair_potion", "condition": "ALWAYS", "has": "HELD", - "values": [ { "value": "BONUS_DODGE", "add": 1 } ], + "values": [ { "value": "BONUS_DODGE", "add": 1 }, { "value": "HEARING_MULT", "multiply": 2.5 } ], "intermittent_activation": { "effects": [ { "frequency": "2 seconds", "spell_effects": [ { "id": "clair_potion_clairvoyance" } ] } ] } }, { diff --git a/doc/JSON_FLAGS.md b/doc/JSON_FLAGS.md index 7197397509ba3..826fd3ddd331a 100644 --- a/doc/JSON_FLAGS.md +++ b/doc/JSON_FLAGS.md @@ -417,7 +417,7 @@ Character flags can be `trait_id`, `json_flag_id` or `flag_id`. Some of these a - ```STRICT_HUMANITARIAN``` You can eat foodstuffs tagged with `STRICT_HUMANITARIANISM` without morale penalties. - ```SUNBURN``` TBD, probably related to `ALBINO`. - ```SUPER_CLAIRVOYANCE``` Gives a super clairvoyance effect (works with multiple z-levels), used for debug purposes. -- ```SUPER_HEARING``` You can hear much better than a normal person. +- ```SAFECRACK_NO_TOOL``` Allows to open safes without stethoscope. - ```TELEPORT_LOCK``` You cannot teleport. This has none of the protective effects of `DIMENSIONAL_ANCHOR`. - ```THERMOMETER``` You always know what temperature it is. - ```TINY``` Changes your size to `creature_size::tiny`. Checked first of the size category flags. diff --git a/doc/MAGIC.md b/doc/MAGIC.md index e0cbeb75c96f7..bf4dc4aee3e57 100644 --- a/doc/MAGIC.md +++ b/doc/MAGIC.md @@ -828,7 +828,7 @@ Character status value | Description `FATIGUE` | `FOOTSTEP_NOISE` | `FORCEFIELD` | Chance your character reduces incoming damage to 0. From 0.0 (no chance), to 1.0 (100% chance to avoid attacks). -`HUNGER` | +`HUNGER` | Affects how fast you hunger level changes. Do not affect actual calorie burn, `METABOLISM` field respond for this `KNOCKBACK_RESIST` | The amount knockback effects you, 0 is the regular amount, -100 would be double effect, 100 would be no effect. `KNOCKDOWN_RESIST` | The amount knockdown effects you, currently *only* having 100 or greater knockdown_resist makes you immune to knockdown. `LEARNING_FOCUS` | Amount of bonus focus you have for learning purposes. @@ -838,14 +838,19 @@ Character status value | Description `MAX_STAMINA` | `MELEE_DAMAGE` | `RANGED_DAMAGE` | Adds damage to ranged attacks. -`METABOLISM` | +`METABOLISM` | Affects your bmr `MOD_HEALTH` | If this is anything other than zero (which it defaults to) you will to mod your health to a max/min of `MOD_HEALTH_CAP` every half hour. `MOD_HEALTH_CAP` | If this is anything other than zero (which it defaults to) you will cap your `MOD_HEALTH` gain/loss at this every half hour. -`MOVE_COST` | +`MOVE_COST` | How much moves you spend to move 1 tile (doesn't affect any another actions); default 100; `"add": 100` would make you spend twice as much moves to move 1 tile +`MOVECOST_SWIM_MOD` | How much moves you spend to move 1 tile in water; not shown in UI +`MOVECOST_OBSTACLE_MOD` | How much moves you spend to move 1 tile, if this tile has movecost more than 105 moves; not shown in UI +`MOVECOST_FLATGROUND_MOD`| How much moves you spend to move 1 tile at flat ground; shown in UI `OVERKILL_DAMAGE` | multiplies or contributes to the damage to an enemy corpse after death. The lower the number, the more damage caused. `PAIN` | When gaining pain the amount gained will be modified by this much. You will still always gain at least 1 pain. `PAIN_REMOVE` | When pain naturally decreases every five minutes the chance of pain removal will be modified by this much. You will still always have at least a chance to reduce pain. -`SHOUT_NOISE` | +`SHOUT_NOISE` | Formula for shout noise level is `noise = base + (str_cur * shout_multiplier)`; `SHOUT_NOISE` modifies `noise`, after all calculations are done +`SHOUT_NOISE_BASE` | `SHOUT_NOISE_BASE` modifies `base` +`SHOUT_NOISE_STR_MULT` | `SHOUT_NOISE_STR_MULT` modifies the `shout_multiplier`, that affect how much your strength affects the noise level `SIGHT_RANGE_ELECTRIC` | How many tiles away is_electric() creatures are visible from. `SIGHT_RANGE_FAE` | How many tiles away creatures with the FAE_CREATURE monster flag or FAERIECREATURE trait are visible from. `SIGHT_RANGE_NETHER` | How many tiles away is_nether() creatures are visible from. @@ -865,6 +870,13 @@ Character status value | Description `REGEN_STAMINA` | `THIRST` | `WEAPON_DISPERSION` | Positive value increase the dispersion, negative decrease one. +`NIGHT_VIS` | How good you can see in the darkness. +`HEARING_MULT` | How good you can hear. Remember that increased hearing means you would have a bigger "noise" written in UI; default step noise of 6, multiplied 10 times, would show it as 60 +`BANDAGE_BONUS` | Affects the `bandages_power` you have when apply the medicine. +`DISINFECTANT_BONUS` | Affects the `disinfectant_power` you have when apply the medicine. +`BLEED_STOP_BONUS` | Affects the `bleed` level when apply the medicine. +`UGLINESS` | Affects your `ugliness` stat, that respond for NPCs opinion about you. +`VOMIT_MUL` | Affects your chances to vomit. `OVERMAP_SIGHT` | Increases the amount of overmap tiles you can see around. `STEALTH_MODIFIER` | Same as mutation `stealth_modifier` value, amount to be subtracted from player's visibility range, capped to 60. Negative values work, but are not very effective due to the way vision ranges are capped. `MENDING_MODIFIER` | Changes the speed of your limb mend. Since it's a percent, using `multiply` is recommended. @@ -872,7 +884,7 @@ Character status value | Description `VITAMIN_ABSORB_MOD` | Increases amount of vitamins obtained from the food `READING_SPEED_MULTIPLIER` | Changes how fast you can read books; Lesser value means faster book reading, with cap of 1 second. `MELEE_STAMINA_CONSUMPTION` | Changes amount of stamina used when swing in melee; stamina consumption is a negative value, so `"add": 100` decreases amount of stamina consumed, when `"add": -100` increases it; `"multiply": 1` increases, `"multiply": -0.5` decreases it. Can't be bigger than -50. -`OBTAIN_COST_MULTIPLIER` | same as `obtain_cost_multiplier`, modifier for pulling an item from a container and storing it back, as a handling penalty. `"add": 100` add 100 additional moves to item wield (1 second) +`OBTAIN_COST_MULTIPLIER` | Same as `obtain_cost_multiplier`, modifier for pulling an item from a container and storing it back, as a handling penalty. `"add": 100` add 100 additional moves to item wield (1 second) `STOMACH_SIZE_MULTIPLIER` | Same as mutation `stomach_size_multiplier` field, changes how much food you can consume at once. `"add": 1000` adds 1 L to stomach size `CASTING_TIME_MULTIPLIER` | Same as mutation `casting_time_multiplier` field, changes your casting speed. Since it's a percent, using `multiply` is recommended. `"multiply": 2"` triples the casting speed `CRAFTING_SPEED_MULTIPLIER` | Same as mutation `crafting_speed_multiplier` field, changes your crafting speed. Since it's a percent, using `multiply` is recommended. Positive values decrease crafting time, negative values increase it. diff --git a/src/activity_actor.cpp b/src/activity_actor.cpp index 06c63df3f3405..60e78acb15782 100644 --- a/src/activity_actor.cpp +++ b/src/activity_actor.cpp @@ -197,7 +197,7 @@ static const itype_id itype_stick_long( "stick_long" ); static const itype_id itype_water( "water" ); static const itype_id itype_water_clean( "water_clean" ); -static const json_character_flag json_flag_SUPER_HEARING( "SUPER_HEARING" ); +static const json_character_flag json_flag_SAFECRACK_NO_TOOL( "SAFECRACK_NO_TOOL" ); static const move_mode_id move_mode_prone( "prone" ); static const move_mode_id move_mode_walk( "walk" ); @@ -3361,7 +3361,7 @@ void safecracking_activity_actor::start( player_activity &act, Character &who ) void safecracking_activity_actor::do_turn( player_activity &act, Character &who ) { - bool can_crack = who.has_flag( json_flag_SUPER_HEARING ); + bool can_crack = who.has_flag( json_flag_SAFECRACK_NO_TOOL ); // short-circuit to avoid the more expensive iteration over items can_crack = can_crack || who.cache_has_item_with( flag_SAFECRACK ); diff --git a/src/character.cpp b/src/character.cpp index 381498b4e2a30..8396b938a981c 100644 --- a/src/character.cpp +++ b/src/character.cpp @@ -219,7 +219,6 @@ static const efftype_id effect_disinfected( "disinfected" ); static const efftype_id effect_disrupted_sleep( "disrupted_sleep" ); static const efftype_id effect_downed( "downed" ); static const efftype_id effect_drunk( "drunk" ); -static const efftype_id effect_earphones( "earphones" ); static const efftype_id effect_fearparalyze( "fearparalyze" ); static const efftype_id effect_flu( "flu" ); static const efftype_id effect_foodpoison( "foodpoison" ); @@ -266,7 +265,6 @@ static const efftype_id effect_subaquatic_sonar( "subaquatic_sonar" ); static const efftype_id effect_tapeworm( "tapeworm" ); static const efftype_id effect_tied( "tied" ); static const efftype_id effect_transition_contacts( "transition_contacts" ); -static const efftype_id effect_weed_high( "weed_high" ); static const efftype_id effect_winded( "winded" ); static const faction_id faction_no_faction( "no_faction" ); @@ -329,7 +327,6 @@ static const json_character_flag json_flag_SEESLEEP( "SEESLEEP" ); static const json_character_flag json_flag_STEADY( "STEADY" ); static const json_character_flag json_flag_STOP_SLEEP_DEPRIVATION( "STOP_SLEEP_DEPRIVATION" ); static const json_character_flag json_flag_SUPER_CLAIRVOYANCE( "SUPER_CLAIRVOYANCE" ); -static const json_character_flag json_flag_SUPER_HEARING( "SUPER_HEARING" ); static const json_character_flag json_flag_TOUGH_FEET( "TOUGH_FEET" ); static const json_character_flag json_flag_UNCANNY_DODGE( "UNCANNY_DODGE" ); static const json_character_flag json_flag_WALK_UNDERWATER( "WALK_UNDERWATER" ); @@ -404,7 +401,6 @@ static const trait_id trait_ANTENNAE( "ANTENNAE" ); static const trait_id trait_AQUEOUS( "AQUEOUS" ); static const trait_id trait_BADBACK( "BADBACK" ); static const trait_id trait_BIRD_EYE( "BIRD_EYE" ); -static const trait_id trait_BOOMING_VOICE( "BOOMING_VOICE" ); static const trait_id trait_CANNIBAL( "CANNIBAL" ); static const trait_id trait_CENOBITE( "CENOBITE" ); static const trait_id trait_CEPH_VISION( "CEPH_VISION" ); @@ -1435,8 +1431,10 @@ int Character::swim_speed() const ( usable.test( body_part_hand_r ) ? 0.5f : 0.0f ); // base swim speed. - ret = ( 440 * mutation_value( "movecost_swim_modifier" ) ) + weight_carried() / - ( 60_gram / mutation_value( "movecost_swim_modifier" ) ) - 50 * get_skill_level( skill_swimming ); + float swim_speed_mult = enchantment_cache->modify_value( enchant_vals::mod::MOVECOST_SWIM_MOD, + mutation_value( "movecost_swim_modifier" ) ); + ret = ( 440 * swim_speed_mult ) + weight_carried() / + ( 60_gram / swim_speed_mult ) - 50 * get_skill_level( skill_swimming ); /** @EFFECT_STR increases swim speed bonus from PAWS */ if( has_trait( trait_PAWS ) ) { ret -= hand_bonus_mult * ( 20 + str_cur * 3 ); @@ -2653,6 +2651,8 @@ float Character::get_vision_threshold( float light_level ) const range++; } + range = enchantment_cache->modify_value( enchant_vals::mod::NIGHT_VIS, range ); + // Clamp range to 1+, so that we can always see where we are range = std::max( 1.0f, range * get_limb_score( limb_score_night_vis ) ); @@ -7538,17 +7538,9 @@ int Character::get_shout_volume() const int base = 10; int shout_multiplier = 2; - // Mutations make shouting louder, they also define the default message - if( has_trait( trait_SHOUT3 ) ) { - shout_multiplier = 4; - base = 20; - } else if( has_trait( trait_SHOUT2 ) ) { - base = 15; - shout_multiplier = 3; - } - if( has_trait( trait_BOOMING_VOICE ) ) { - base += 10; - } + base = enchantment_cache->modify_value( enchant_vals::mod::SHOUT_NOISE_BASE, base ); + shout_multiplier = enchantment_cache->modify_value( enchant_vals::mod::SHOUT_NOISE_STR_MULT, + shout_multiplier ); // You can't shout without your face if( has_trait( trait_PROF_FOODP ) && !( is_wearing( itype_foodperson_mask ) || @@ -10421,8 +10413,9 @@ std::vector Character::run_cost_effects( float &movecost ) cons } if( movecost > 105 ) { - run_cost_effect_mul( mutation_value( "movecost_obstacle_modifier" ), - _( "Obstacle Muts" ) ); + float obstacle_mult = enchantment_cache->modify_value( enchant_vals::mod::MOVECOST_OBSTACLE_MOD, + mutation_value( "movecost_obstacle_modifier" ) ); + run_cost_effect_mul( obstacle_mult, _( "Obstacle Muts." ) ); if( has_proficiency( proficiency_prof_parkour ) ) { run_cost_effect_mul( 0.5, _( "Parkour" ) ); @@ -10452,8 +10445,9 @@ std::vector Character::run_cost_effects( float &movecost ) cons run_cost_effect_mul( mutation_value( "movecost_modifier" ), _( "Mutations" ) ); if( flatground ) { - run_cost_effect_mul( mutation_value( "movecost_flatground_modifier" ), - _( "Flat Ground Mut." ) ); + float flatground_mult = enchantment_cache->modify_value( enchant_vals::mod::MOVECOST_FLATGROUND_MOD, + mutation_value( "movecost_flatground_modifier" ) ); + run_cost_effect_mul( flatground_mult, _( "Flat Ground Mut." ) ); } if( has_trait( trait_PADDED_FEET ) && is_barefoot() ) { @@ -10873,28 +10867,16 @@ float Character::hearing_ability() const { float volume_multiplier = 1.0f; - // Mutation/Bionic volume modifiers - if( has_flag( json_flag_SUPER_HEARING ) ) { - volume_multiplier *= 3.5f; - } - if( has_trait( trait_PER_SLIME ) ) { - // Random hearing :-/ - // (when it's working at all, see player.cpp) - // changed from 0.5 to fix Mac compiling error - volume_multiplier *= rng( 1, 2 ); - } - volume_multiplier *= Character::mutation_value( "hearing_modifier" ); + volume_multiplier = enchantment_cache->modify_value( enchant_vals::mod::HEARING_MULT, + volume_multiplier ); + if( has_effect( effect_deaf ) ) { // Scale linearly up to 30 minutes volume_multiplier *= ( 30_minutes - get_effect_dur( effect_deaf ) ) / 30_minutes; } - if( has_effect( effect_earphones ) ) { - volume_multiplier *= 0.25f; - } - return volume_multiplier; } @@ -11448,10 +11430,11 @@ void Character::stagger() double Character::vomit_mod() { - double mod = mutation_value( "vomit_multiplier" ); - if( has_effect( effect_weed_high ) ) { - mod *= .1; - } + double mod = 1; + mod *= mutation_value( "vomit_multiplier" ); + + mod = enchantment_cache->modify_value( enchant_vals::mod::VOMIT_MUL, mod ); + // If you're already nauseous, any food in your stomach greatly // increases chance of vomiting. Liquids don't provoke vomiting, though. if( stomach.contains() != 0_ml && has_effect( effect_nausea ) ) { diff --git a/src/iexamine.cpp b/src/iexamine.cpp index 6e1ba18a6ba84..9b0e89947e89e 100644 --- a/src/iexamine.cpp +++ b/src/iexamine.cpp @@ -177,7 +177,7 @@ static const json_character_flag json_flag_ATTUNEMENT( "ATTUNEMENT" ); static const json_character_flag json_flag_GLIDE( "GLIDE" ); static const json_character_flag json_flag_LEVITATION( "LEVITATION" ); static const json_character_flag json_flag_PAIN_IMMUNE( "PAIN_IMMUNE" ); -static const json_character_flag json_flag_SUPER_HEARING( "SUPER_HEARING" ); +static const json_character_flag json_flag_SAFECRACK_NO_TOOL( "SAFECRACK_NO_TOOL" ); static const json_character_flag json_flag_WING_GLIDE( "WING_GLIDE" ); static const material_id material_bone( "bone" ); @@ -1723,7 +1723,7 @@ void iexamine::pit_covered( Character &you, const tripoint &examp ) */ void iexamine::safe( Character &you, const tripoint &examp ) { - bool has_cracking_tool = you.has_flag( json_flag_SUPER_HEARING ); + bool has_cracking_tool = you.has_flag( json_flag_SAFECRACK_NO_TOOL ); // short-circuit to avoid the more expensive iteration over items has_cracking_tool = has_cracking_tool || you.cache_has_item_with( flag_SAFECRACK ); diff --git a/src/iuse_actor.cpp b/src/iuse_actor.cpp index 08b0c1d3526ad..7eee88c9ba190 100644 --- a/src/iuse_actor.cpp +++ b/src/iuse_actor.cpp @@ -3350,7 +3350,10 @@ int heal_actor::get_bandaged_level( const Character &healer ) const prof_bonus = healer.has_proficiency( proficiency_prof_wound_care_expert ) ? prof_bonus + 2 : prof_bonus; /** @EFFECT_FIRSTAID increases healing item effects */ - return round( bandages_power + bandages_scaling * prof_bonus ); + float total_bonus = bandages_power + bandages_scaling * prof_bonus; + total_bonus = healer.enchantment_cache->modify_value( enchant_vals::mod::BANDAGE_BONUS, + total_bonus ); + return round( total_bonus ); } return bandages_power; @@ -3365,7 +3368,10 @@ int heal_actor::get_disinfected_level( const Character &healer ) const prof_bonus + 1 : prof_bonus; prof_bonus = healer.has_proficiency( proficiency_prof_wound_care_expert ) ? prof_bonus + 2 : prof_bonus; - return round( disinfectant_power + disinfectant_scaling * prof_bonus ); + float total_bonus = disinfectant_power + disinfectant_scaling * prof_bonus; + total_bonus = healer.enchantment_cache->modify_value( enchant_vals::mod::DISINFECTANT_BONUS, + total_bonus ); + return round( total_bonus ); } return disinfectant_power; @@ -3380,7 +3386,10 @@ int heal_actor::get_stopbleed_level( const Character &healer ) const prof_bonus + 1 : prof_bonus; prof_bonus = healer.has_proficiency( proficiency_prof_wound_care_expert ) ? prof_bonus + 2 : prof_bonus; - return round( bleed + prof_bonus ); + float total_bonus = bleed * prof_bonus; + total_bonus = healer.enchantment_cache->modify_value( enchant_vals::mod::BLEED_STOP_BONUS, + total_bonus ); + return round( total_bonus ); } return bleed; diff --git a/src/magic_enchantment.cpp b/src/magic_enchantment.cpp index da36280f839f9..436263f04ce0f 100644 --- a/src/magic_enchantment.cpp +++ b/src/magic_enchantment.cpp @@ -163,6 +163,18 @@ namespace io case enchant_vals::mod::OVERKILL_DAMAGE: return "OVERKILL_DAMAGE"; case enchant_vals::mod::RANGE: return "RANGE"; case enchant_vals::mod::AVOID_FRIENDRY_FIRE: return "AVOID_FRIENDRY_FIRE"; + case enchant_vals::mod::MOVECOST_SWIM_MOD: return "MOVECOST_SWIM_MOD"; + case enchant_vals::mod::MOVECOST_OBSTACLE_MOD: return "MOVECOST_OBSTACLE_MOD"; + case enchant_vals::mod::MOVECOST_FLATGROUND_MOD: return "MOVECOST_FLATGROUND_MOD"; + case enchant_vals::mod::SHOUT_NOISE_BASE: return "SHOUT_NOISE_BASE"; + case enchant_vals::mod::SHOUT_NOISE_STR_MULT: return "SHOUT_NOISE_STR_MULT"; + case enchant_vals::mod::NIGHT_VIS: return "NIGHT_VIS"; + case enchant_vals::mod::HEARING_MULT: return "HEARING_MULT"; + case enchant_vals::mod::BANDAGE_BONUS: return "BANDAGE_BONUS"; + case enchant_vals::mod::DISINFECTANT_BONUS: return "DISINFECTANT_BONUS"; + case enchant_vals::mod::BLEED_STOP_BONUS: return "BLEED_STOP_BONUS"; + case enchant_vals::mod::UGLINESS: return "UGLINESS"; + case enchant_vals::mod::VOMIT_MUL: return "VOMIT_MUL"; case enchant_vals::mod::NUM_MOD: break; } cata_fatal( "Invalid enchant_vals::mod" ); diff --git a/src/magic_enchantment.h b/src/magic_enchantment.h index ce1e60424e04a..99e2d33ac2235 100644 --- a/src/magic_enchantment.h +++ b/src/magic_enchantment.h @@ -141,6 +141,18 @@ enum class mod : int { OVERKILL_DAMAGE, RANGE, AVOID_FRIENDRY_FIRE, + MOVECOST_SWIM_MOD, + MOVECOST_OBSTACLE_MOD, + MOVECOST_FLATGROUND_MOD, + SHOUT_NOISE_BASE, + SHOUT_NOISE_STR_MULT, + NIGHT_VIS, + HEARING_MULT, + BANDAGE_BONUS, + DISINFECTANT_BONUS, + BLEED_STOP_BONUS, + UGLINESS, + VOMIT_MUL, NUM_MOD }; } // namespace enchant_vals diff --git a/src/npc.cpp b/src/npc.cpp index 19aa735b7efc3..5f837e775187e 100644 --- a/src/npc.cpp +++ b/src/npc.cpp @@ -1477,6 +1477,7 @@ npc_opinion npc::get_opinion_values( const Character &you ) const } u_ugly += bp->ugliness_mandatory; u_ugly += bp->ugliness - ( bp->ugliness * worn.get_coverage( bp ) / 100 ); + u_ugly = enchantment_cache->modify_value( enchant_vals::mod::UGLINESS, u_ugly ); } npc_values.fear += u_ugly / 2; npc_values.trust -= u_ugly / 3; diff --git a/tests/player_activities_test.cpp b/tests/player_activities_test.cpp index e3085530e7e6d..adc5d28221cf4 100644 --- a/tests/player_activities_test.cpp +++ b/tests/player_activities_test.cpp @@ -66,7 +66,7 @@ static const itype_id itype_test_shears_off( "test_shears_off" ); static const itype_id itype_test_weldtank( "test_weldtank" ); static const itype_id itype_water_clean( "water_clean" ); -static const json_character_flag json_flag_SUPER_HEARING( "SUPER_HEARING" ); +static const json_character_flag json_flag_SAFECRACK_NO_TOOL( "SAFECRACK_NO_TOOL" ); static const mtype_id mon_test_non_shearable( "mon_test_non_shearable" ); static const mtype_id mon_test_shearable( "mon_test_shearable" ); @@ -184,7 +184,7 @@ TEST_CASE( "safecracking", "[activity][safecracking]" ) GIVEN( "player without the required tools" ) { mp.furn_set( safe, f_safe_l ); REQUIRE( !dummy.cache_has_item_with( flag_SAFECRACK ) ); - REQUIRE( !dummy.has_flag( json_flag_SUPER_HEARING ) ); + REQUIRE( !dummy.has_flag( json_flag_SAFECRACK_NO_TOOL ) ); REQUIRE( dummy.activity.id() == ACT_CRACKING ); REQUIRE( mp.furn( safe ) == f_safe_l ); @@ -200,7 +200,7 @@ TEST_CASE( "safecracking", "[activity][safecracking]" ) dummy.i_add( item( "stethoscope" ) ); mp.furn_set( safe, f_safe_l ); REQUIRE( dummy.cache_has_item_with( flag_SAFECRACK ) ); - REQUIRE( !dummy.has_flag( json_flag_SUPER_HEARING ) ); + REQUIRE( !dummy.has_flag( json_flag_SAFECRACK_NO_TOOL ) ); REQUIRE( dummy.activity.id() == ACT_CRACKING ); REQUIRE( mp.furn( safe ) == f_safe_l ); @@ -218,7 +218,7 @@ TEST_CASE( "safecracking", "[activity][safecracking]" ) dummy.add_bionic( bio_ears ); mp.furn_set( safe, f_safe_l ); REQUIRE( !dummy.cache_has_item_with( flag_SAFECRACK ) ); - REQUIRE( dummy.has_flag( json_flag_SUPER_HEARING ) ); + REQUIRE( dummy.has_flag( json_flag_SAFECRACK_NO_TOOL ) ); REQUIRE( dummy.activity.id() == ACT_CRACKING ); REQUIRE( mp.furn( safe ) == f_safe_l ); @@ -235,7 +235,7 @@ TEST_CASE( "safecracking", "[activity][safecracking]" ) dummy.i_add( item( "stethoscope" ) ); mp.furn_set( safe, f_safe_l ); REQUIRE( dummy.cache_has_item_with( flag_SAFECRACK ) ); - REQUIRE( !dummy.has_flag( json_flag_SUPER_HEARING ) ); + REQUIRE( !dummy.has_flag( json_flag_SAFECRACK_NO_TOOL ) ); REQUIRE( dummy.activity.id() == ACT_CRACKING ); REQUIRE( mp.furn( safe ) == f_safe_l );