Skip to content

Commit

Permalink
Translate weakpoint effect message
Browse files Browse the repository at this point in the history
  • Loading branch information
irwiss committed Oct 6, 2022
1 parent 3e27a15 commit ee1d118
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
9 changes: 7 additions & 2 deletions src/weakpoint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -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() );
}
}

Expand Down
4 changes: 3 additions & 1 deletion src/weakpoint.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,11 @@ struct weakpoint_effect {
// The range of damage, as a percentage of max health, required to the effect.
std::pair<float, float> 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 );
Expand Down

0 comments on commit ee1d118

Please sign in to comment.