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

Make weapon private #50286

Merged
merged 23 commits into from
Sep 12, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Merge branch 'master' into private_weapon
  • Loading branch information
Fris0uman authored Aug 26, 2021
commit 86f62af4535bd328a912a4eb147d2b1caba35021
4 changes: 2 additions & 2 deletions src/npc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1175,7 +1175,7 @@ void npc::invalidate_range_cache()

void npc::form_opinion( const Character &you )
{
const item *weapon = get_wielded_item();
const item *weapon = you.get_wielded_item();
// FEAR
if( weapon->is_gun() ) {
// TODO: Make bows not guns
Expand All @@ -1184,7 +1184,7 @@ void npc::form_opinion( const Character &you )
} else {
op_of_u.fear += 6;
}
} else if( u.weapon_value( *weapon ) > 20 ) {
} else if( you.weapon_value( *weapon ) > 20 ) {
op_of_u.fear += 2;
} else if( !you.is_armed() ) {
// Unarmed, but actually unarmed ("unarmed weapons" are not unarmed)
Expand Down
9 changes: 4 additions & 5 deletions src/npcmove.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,7 @@ void npc::assess_danger()
// update the threat cache
for( size_t i = 0; i < 8; i++ ) {
direction threat_dir = npc_threat_dir[i];
direction dir_right = npc_threat_dir[( i + 1 ) % 8];
direction dir_right = npc_thrhttps://discordapp.com/eat_dir[( i + 1 ) % 8];
Fris0uman marked this conversation as resolved.
Show resolved Hide resolved
direction dir_left = npc_threat_dir[( i + 7 ) % 8 ];
ai_cache.threat_map[threat_dir] = cur_threat_map[threat_dir] + 0.1f *
( cur_threat_map[dir_right] + cur_threat_map[dir_left] );
Expand All @@ -687,12 +687,11 @@ bool npc::is_safe() const

float npc::character_danger( const Character &uc ) const
{
const item weapon = get_wielded_item();
// TODO: Remove this when possible
float ret = 0.0f;
bool u_gun = weapon.is_gun();
bool my_gun = weapon.is_gun();
double u_weap_val = u.weapon_value( weapon );
bool u_gun = uc.get_wielded_item().is_gun();
bool my_gun = get_wielded_item().is_gun();
double u_weap_val = uc.weapon_value( uc.get_wielded_item() );
const double &my_weap_val = ai_cache.my_weapon_value;
if( u_gun && !my_gun ) {
u_weap_val *= 1.5f;
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.