From ee1d118bac2f662fe09c4194cad1589f17554f1c Mon Sep 17 00:00:00 2001 From: Alexey Kim Date: Fri, 7 Oct 2022 00:11:36 +0300 Subject: [PATCH] Translate weakpoint effect message --- src/weakpoint.cpp | 9 +++++++-- src/weakpoint.h | 4 +++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/weakpoint.cpp b/src/weakpoint.cpp index 444f7556f44a3..61a4555438469 100644 --- a/src/weakpoint.cpp +++ b/src/weakpoint.cpp @@ -256,6 +256,11 @@ weakpoint_effect::weakpoint_effect() : intensity( 0, 0 ), damage_required( 0.0f, 100.0f ) {} +std::string weakpoint_effect::get_message() const +{ + return message.translated(); +} + void weakpoint_effect::apply_to( Creature &target, int total_damage, const weakpoint_attack &attack ) const { @@ -273,8 +278,8 @@ void weakpoint_effect::apply_to( Creature &target, int total_damage, time_duration::from_turns( rng( duration.first, duration.second ) ), permanent, rng( intensity.first, intensity.second ) ); - if( !message.empty() && attack.source != nullptr && attack.source->is_avatar() ) { - add_msg_if_player_sees( target, m_good, message, target.get_name() ); + if( !get_message().empty() && attack.source != nullptr && attack.source->is_avatar() ) { + add_msg_if_player_sees( target, m_good, get_message(), target.get_name() ); } } diff --git a/src/weakpoint.h b/src/weakpoint.h index 93cc7d1087315..c792fb026a163 100644 --- a/src/weakpoint.h +++ b/src/weakpoint.h @@ -68,9 +68,11 @@ struct weakpoint_effect { // The range of damage, as a percentage of max health, required to the effect. std::pair damage_required; // The message to print, if the player causes the effect. - std::string message; + translation message; weakpoint_effect(); + // Gets translated effect message + std::string get_message() const; // Maybe apply an effect to the target. void apply_to( Creature &target, int total_damage, const weakpoint_attack &attack ) const; void load( const JsonObject &jo );