Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix temperature affecting bandages #25932

Merged
merged 1 commit into from
Oct 1, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/creature.h
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,8 @@ class Creature
body_part bp, int &damage, int &pain );
// directly decrements the damage. ONLY handles damage, doesn't
// increase pain, apply effects, etc
virtual void apply_damage( Creature *source, body_part bp, int amount ) = 0;
virtual void apply_damage( Creature *source, body_part bp, int amount,
const bool bypass_med = false ) = 0;

/**
* This creature just dodged an attack - possibly special/ranged attack - from source.
Expand Down
2 changes: 1 addition & 1 deletion src/field.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2458,7 +2458,7 @@ void map::monster_in_field( monster &z )
}

if( dam > 0 ) {
z.apply_damage( nullptr, bp_torso, dam );
z.apply_damage( nullptr, bp_torso, dam, true );
z.check_dead_state();
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/monster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1403,7 +1403,7 @@ void monster::set_hp( const int hp )
this->hp = hp;
}

void monster::apply_damage( Creature *source, body_part /*bp*/, int dam )
void monster::apply_damage( Creature *source, body_part /*bp*/, int dam, const bool /*bypass_med*/ )
{
if( is_dead_state() ) {
return;
Expand Down
3 changes: 2 additions & 1 deletion src/monster.h
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,8 @@ class monster : public Creature
bool print_messages = true ) override;
void deal_damage_handle_type( const damage_unit &du, body_part bp, int &damage,
int &pain ) override;
void apply_damage( Creature *source, body_part bp, int amount ) override;
void apply_damage( Creature *source, body_part bp, int amount,
const bool bypass_med = false ) override;
// create gibs/meat chunks/blood etc all over the place, does not kill, can be called on a dead monster.
void explode();
// Let the monster die and let its body explode into gibs
Expand Down
18 changes: 10 additions & 8 deletions src/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3636,7 +3636,7 @@ int player::reduce_healing_effect( const efftype_id &eff_id, int remove_med, bod
Where damage to player is actually applied to hit body parts
Might be where to put bleed stuff rather than in player::deal_damage()
*/
void player::apply_damage(Creature *source, body_part hurt, int dam)
void player::apply_damage(Creature *source, body_part hurt, int dam, const bool bypass_med )
{
if( is_dead_state() || has_trait( trait_DEBUG_NODMG ) ) {
// don't do any more damage if we're already dead
Expand Down Expand Up @@ -3671,13 +3671,15 @@ void player::apply_damage(Creature *source, body_part hurt, int dam)
on_hurt( source );
}

// remove healing effects if damaged
int remove_med = roll_remainder( dam / 5.0f );
if( remove_med > 0 && has_effect( effect_bandaged, hurt ) ) {
remove_med -= reduce_healing_effect( effect_bandaged , remove_med, hurt );
}
if( remove_med > 0 && has_effect( effect_disinfected, hurt ) ) {
remove_med -= reduce_healing_effect( effect_disinfected , remove_med, hurt );
if( !bypass_med ) {
// remove healing effects if damaged
int remove_med = roll_remainder( dam / 5.0f );
if( remove_med > 0 && has_effect( effect_bandaged, hurt ) ) {
remove_med -= reduce_healing_effect( effect_bandaged , remove_med, hurt );
}
if( remove_med > 0 && has_effect( effect_disinfected, hurt ) ) {
remove_med -= reduce_healing_effect( effect_disinfected , remove_med, hurt );
}
}
}

Expand Down
3 changes: 2 additions & 1 deletion src/player.h
Original file line number Diff line number Diff line change
Expand Up @@ -745,7 +745,8 @@ class player : public Character
/** Reduce healing effect intensity, return initial intensity of the effect */
int reduce_healing_effect( const efftype_id &eff_id, int remove_med, body_part hurt );
/** Actually hurt the player, hurts a body_part directly, no armor reduction */
void apply_damage( Creature *source, body_part bp, int amount ) override;
void apply_damage( Creature *source, body_part bp, int amount,
const bool bypass_med = false ) override;
/** Modifies a pain value by player traits before passing it to Creature::mod_pain() */
void mod_pain( int npain ) override;
/** Sets new intensity of pain an reacts to it */
Expand Down