From 8ba9a744ef65b9dcffd473a822661639e35a6a2e Mon Sep 17 00:00:00 2001 From: Anton Simakov <67688115+GuardianDll@users.noreply.github.com> Date: Thu, 25 Jul 2024 10:25:49 +0200 Subject: [PATCH] add THROW_STR enchantment --- doc/MAGIC.md | 1 + src/character.cpp | 11 +++++------ src/magic_enchantment.cpp | 1 + src/magic_enchantment.h | 1 + 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/doc/MAGIC.md b/doc/MAGIC.md index 72b7a5db446cc..f56617f2b74c5 100644 --- a/doc/MAGIC.md +++ b/doc/MAGIC.md @@ -903,6 +903,7 @@ Character status value | Description `STRENGTH` | Affects the strength stat. Formula for all stat affecting enchantments are `(base_stat + enchantment_addition) * (enchantment_multiplier + 1)`. Str 8 with enchantment `add 2, multiply 1` result in `(8+2) * (1+1) = 10 * 2 =` 20 str `SWEAT_MULTIPLIER` | Affects how much your body can sweat. Affects all bodyparts at once. Since it's a percent, using `multiply` is recommended. `THIRST` | +`THROW_STR` | Increases your strength for throwing purposes. Not limited by your throwing skill (you still throw it as precise as your skill allows you, just further). Only additive. Rule of thumb: one additional point of strength allow you to throw 113 g object 10 tiles further, or 1130 g object 1 tile further, limited by [ str * 3 + skill ]. Full calculations are in Character::throw_range `UGLINESS` | Affects your `ugliness` stat, which affects NPCs' initial opinion of you. `VITAMIN_ABSORB_MOD` | Increases amount of vitamins obtained from the food `VOMIT_MUL` | Affects your chances to vomit. diff --git a/src/character.cpp b/src/character.cpp index add151daec9c0..034ff9683d4e8 100644 --- a/src/character.cpp +++ b/src/character.cpp @@ -5997,7 +5997,8 @@ int Character::throw_range( const item &it ) const tmp.charges = 1; } - int str = get_arm_str(); + int ench_bonus = enchantment_cache->get_value_add( enchant_vals::mod::THROW_STR ); + int str = get_arm_str() + ench_bonus; /** @ARM_STR determines maximum weight that can be thrown */ if( ( tmp.weight() / 113_gram ) > str * 15 ) { @@ -6019,12 +6020,10 @@ int Character::throw_range( const item &it ) const if( ret < 1 ) { return 1; } - // Cap at double our strength + skill - /** @EFFECT_STR caps throwing range */ - /** @EFFECT_THROW caps throwing range */ - if( ret > round( str * 3 + get_skill_level( skill_throw ) ) ) { - return round( str * 3 + get_skill_level( skill_throw ) ); + // Cap at triple of our strength + skill + if( ret > round( str * 3 + get_skill_level( skill_throw ) + ench_bonus ) ) { + return round( str * 3 + get_skill_level( skill_throw ) + ench_bonus ); } return ret; diff --git a/src/magic_enchantment.cpp b/src/magic_enchantment.cpp index 1b0be70dea650..26c5c362e0e3b 100644 --- a/src/magic_enchantment.cpp +++ b/src/magic_enchantment.cpp @@ -193,6 +193,7 @@ namespace io case enchant_vals::mod::VOMIT_MUL: return "VOMIT_MUL"; case enchant_vals::mod::SCENT_MASK: return "SCENT_MASK"; case enchant_vals::mod::CONSUME_TIME_MOD: return "CONSUME_TIME_MOD"; + case enchant_vals::mod::THROW_STR: return "THROW_STR"; case enchant_vals::mod::SWEAT_MULTIPLIER: return "SWEAT_MULTIPLIER"; case enchant_vals::mod::STAMINA_REGEN_MOD: return "STAMINA_REGEN_MOD"; case enchant_vals::mod::MOVEMENT_EXERTION_MODIFIER: return "MOVEMENT_EXERTION_MODIFIER"; diff --git a/src/magic_enchantment.h b/src/magic_enchantment.h index c3dd5daded64f..9d43bd96e45c6 100644 --- a/src/magic_enchantment.h +++ b/src/magic_enchantment.h @@ -170,6 +170,7 @@ enum class mod : int { VOMIT_MUL, SCENT_MASK, CONSUME_TIME_MOD, + THROW_STR, SWEAT_MULTIPLIER, STAMINA_REGEN_MOD, MOVEMENT_EXERTION_MODIFIER,