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

Added "shrub with bee hive" furniture #35323

Merged
merged 8 commits into from
Nov 22, 2019
10 changes: 10 additions & 0 deletions src/iexamine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3374,6 +3374,16 @@ void iexamine::shrub_wildveggies( player &p, const tripoint &examp )
}

add_msg( _( "You forage through the %s." ), g->m.tername( examp ) );

// Chance to disturb angry bees while foraging the shrub in non-winter seasons
// Survival skill reduces the chance
if( one_in( 100 + 5 * p.get_skill_level( skill_survival ) ) &&
season_of_year( calendar::turn ) != WINTER ) {
add_msg( m_bad, _( "You disturbed bees nest in the %s!" ), g->m.tername( examp ) );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
add_msg( m_bad, _( "You disturbed bees nest in the %s!" ), g->m.tername( examp ) );
add_msg( m_bad, _( "You disturbed a bees nest in the %s!" ), g->m.tername( examp ) );

g->m.add_field( examp, fd_bees, rng( 1, 3 ) );
return;
}

///\EFFECT_SURVIVAL speeds up foraging
int move_cost = 100000 / ( 2 * p.get_skill_level( skill_survival ) + 5 );
///\EFFECT_PER randomly speeds up foraging
Expand Down
60 changes: 18 additions & 42 deletions src/map_field.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1231,10 +1231,11 @@ bool map::process_fields_in_submap( submap *const current_submap,
// Kill them at the end of processing.
cur.set_field_intensity( 0 );
} else {
// Bees chase the player if in range, wander randomly otherwise.
// 50% chance for bees to chase the player if in range, wander randomly otherwise.
if( !g->u.is_underwater() &&
rl_dist( p, g->u.pos() ) < 10 &&
clear_path( p, g->u.pos(), 10, 0, 100 ) ) {
clear_path( p, g->u.pos(), 10, 1, 100 ) &&
one_in( 2 ) ) {

std::vector<point> candidate_positions =
squares_in_direction( p.xy(), point( g->u.posx(), g->u.posy() ) );
Expand Down Expand Up @@ -1632,47 +1633,22 @@ void map::player_in_field( player &u )
if( ft == fd_bees ) {
// Player is immune to bees while underwater.
if( !u.is_underwater() ) {
int times_stung = 0;
const int intensity = cur.get_field_intensity();
// If the bees can get at you, they cause steadily increasing pain.
// TODO: Specific stinging messages.
times_stung += one_in( 4 ) &&
u.add_env_effect( effect_stung, bp_torso, intensity, 9_minutes );
times_stung += one_in( 4 ) &&
u.add_env_effect( effect_stung, bp_torso, intensity, 9_minutes );
times_stung += one_in( 4 ) &&
u.add_env_effect( effect_stung, bp_torso, intensity, 9_minutes );
times_stung += one_in( 4 ) &&
u.add_env_effect( effect_stung, bp_torso, intensity, 9_minutes );
times_stung += one_in( 4 ) &&
u.add_env_effect( effect_stung, bp_torso, intensity, 9_minutes );
times_stung += one_in( 4 ) &&
u.add_env_effect( effect_stung, bp_torso, intensity, 9_minutes );
times_stung += one_in( 4 ) &&
u.add_env_effect( effect_stung, bp_torso, intensity, 9_minutes );
times_stung += one_in( 4 ) &&
u.add_env_effect( effect_stung, bp_torso, intensity, 9_minutes );
switch( times_stung ) {
case 0:
// Woo, unscathed!
break;
case 1:
u.add_msg_if_player( m_bad, _( "The bees sting you!" ) );
break;
case 2:
case 3:
u.add_msg_if_player( m_bad, _( "The bees sting you several times!" ) );
break;
case 4:
case 5:
u.add_msg_if_player( m_bad, _( "The bees sting you many times!" ) );
break;
case 6:
case 7:
case 8:
default:
u.add_msg_if_player( m_bad, _( "The bees sting you all over your body!" ) );
break;
// Bees will try to sting you in random body parts, up to 8 times.
for( int i = 0; i < rng( 1, 7 ); i++ ) {
body_part bp = random_body_part();
int sum_cover = 0;
for( const item &i : u.worn ) {
if( i.covers( bp ) ) {
sum_cover += i.get_coverage();
}
}
// Get stung if [clothing on a body part isn't thick enough (like t-shirt) OR clothing covers less than 100% of body part]
// AND clothing on affected body part has low environmental protection value
if( ( u.get_armor_cut( bp ) <= 1 || ( sum_cover < 100 && x_in_y( 100 - sum_cover, 100 ) ) ) &&
u.add_env_effect( effect_stung, bp, intensity, 9_minutes ) ) {
u.add_msg_if_player( m_bad, _( "The bees sting you in %s!" ), body_part_name_accusative( bp ) );
}
}
}
}
Expand Down