Skip to content

Commit

Permalink
Merge pull request #75230 from GuardianDll/ench_throwing_range
Browse files Browse the repository at this point in the history
add THROW_STR enchantment
  • Loading branch information
Maleclypse authored Jul 26, 2024
2 parents a1981d3 + 8ba9a74 commit ebf95c1
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
1 change: 1 addition & 0 deletions doc/MAGIC.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
11 changes: 5 additions & 6 deletions src/character.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) {
Expand All @@ -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;
Expand Down
1 change: 1 addition & 0 deletions src/magic_enchantment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
1 change: 1 addition & 0 deletions src/magic_enchantment.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit ebf95c1

Please sign in to comment.