Skip to content

Commit

Permalink
Use dialogue variables
Browse files Browse the repository at this point in the history
  • Loading branch information
John-Candlebury committed Nov 9, 2024
1 parent 405f6f2 commit e100653
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/item.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -343,8 +343,8 @@ item::item( const itype *type, time_point turn, int qty ) : type( type ), bday(

if( has_flag( flag_ENERGY_SHIELD ) ) {
const islot_armor *sh = find_armor_data();
set_var( "MAX_ENERGY_SHIELD_HP", sh->max_energy_shield_hp );
set_var( "ENERGY_SHIELD_HP", sh->max_energy_shield_hp );
set_var( "npctalk_var_MAX_ENERGY_SHIELD_HP", sh->max_energy_shield_hp );
set_var( "npctalk_var_ENERGY_SHIELD_HP", sh->max_energy_shield_hp );
}

if( has_flag( flag_COLLAPSE_CONTENTS ) ) {
Expand Down Expand Up @@ -9055,10 +9055,10 @@ item::armor_status item::damage_armor_durability( damage_unit &du, damage_unit &
{
//Energy shields aren't damaged by attacks but do get their health variable reduced. They are also only
//damaged by the damage types they actually protect against.
if( has_var( "ENERGY_SHIELD_HP" ) && resist( du.type, false, bp ) > 0.0f ) {
double shield_hp = get_var( "ENERGY_SHIELD_HP", 0.0 );
if( has_var( "npctalk_var_ENERGY_SHIELD_HP" ) && resist( du.type, false, bp ) > 0.0f ) {
double shield_hp = get_var( "npctalk_var_ENERGY_SHIELD_HP", 0.0 );
shield_hp -= premitigated.amount;
set_var( "ENERGY_SHIELD_HP", shield_hp );
set_var( "npctalk_var_ENERGY_SHIELD_HP", shield_hp );
if( shield_hp > 0 ) {
return armor_status::UNDAMAGED;
} else {
Expand Down

0 comments on commit e100653

Please sign in to comment.