From b7a1f2ed9b2186f30fa68488dd764d1edcd9ee84 Mon Sep 17 00:00:00 2001 From: GuardianDll Date: Sun, 28 Jul 2024 23:10:29 +0200 Subject: [PATCH] add THROW_DAMAGE enchantment --- doc/MAGIC.md | 1 + src/magic_enchantment.cpp | 1 + src/magic_enchantment.h | 1 + src/ranged.cpp | 3 +++ 4 files changed, 6 insertions(+) diff --git a/doc/MAGIC.md b/doc/MAGIC.md index f56617f2b74c5..c18de1a2174d8 100644 --- a/doc/MAGIC.md +++ b/doc/MAGIC.md @@ -904,6 +904,7 @@ Character status value | Description `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 +`THROW_DAMAGE` | Increases the damage of any thrown projectile. `add` adds this amount of damage to the projectile as bash damage, `multiply` would increase all projectile damage, not only bash type. `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/magic_enchantment.cpp b/src/magic_enchantment.cpp index 26c5c362e0e3b..35a34ba2ffc4d 100644 --- a/src/magic_enchantment.cpp +++ b/src/magic_enchantment.cpp @@ -194,6 +194,7 @@ namespace io 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::THROW_DAMAGE: return "THROW_DAMAGE"; 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 9d43bd96e45c6..88358310f89a0 100644 --- a/src/magic_enchantment.h +++ b/src/magic_enchantment.h @@ -171,6 +171,7 @@ enum class mod : int { SCENT_MASK, CONSUME_TIME_MOD, THROW_STR, + THROW_DAMAGE, SWEAT_MULTIPLIER, STAMINA_REGEN_MOD, MOVEMENT_EXERTION_MODIFIER, diff --git a/src/ranged.cpp b/src/ranged.cpp index 1a6d1843ecac8..4614d39204def 100644 --- a/src/ranged.cpp +++ b/src/ranged.cpp @@ -1374,6 +1374,9 @@ dealt_projectile_attack Character::throw_item( const tripoint &target, const ite impact.add_damage( damage_bash, std::min( weight / 100.0_gram, static_cast( thrown_item_adjusted_damage( thrown ) ) ) ); + impact.add_damage( damage_bash, + enchantment_cache->get_value_add( enchant_vals::mod::THROW_DAMAGE ) ); + impact.mult_damage( 1 + enchantment_cache->get_value_multiply( enchant_vals::mod::THROW_DAMAGE ) ); if( thrown.has_flag( flag_ACT_ON_RANGED_HIT ) ) { proj_effects.insert( ammo_effect_ACT_ON_RANGED_HIT ); thrown.active = true;