Skip to content

Commit

Permalink
feat: friendly wildlife mammals spawn friendly offspring
Browse files Browse the repository at this point in the history
Players usually tame wildlife that can be considered 'farm-animals'.
It's tedious to require the player to keep taming offspring of the
animals they have already tamed in the first place so this change
addresses that. Mostly meant as QoL change for farm players.
  • Loading branch information
ekaratzas committed Mar 3, 2024
1 parent 8cb1c17 commit 5edce19
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/monster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -507,10 +507,14 @@ void monster::try_reproduce()
}

chance += 2;

// wildlife creatures that are friendly to the player will spawn friendly offspring
const bool friendly_parent = type->in_category( "WILDLIFE" ) &&
attitude_to( get_player_character() ) == Attitude::A_FRIENDLY;
if( season_match && female && one_in( chance ) ) {
int spawn_cnt = rng( 1, type->baby_count );
if( type->baby_monster ) {
g->m.add_spawn( type->baby_monster, spawn_cnt, pos() );
g->m.add_spawn( type->baby_monster, spawn_cnt, pos(), friendly_parent );
} else {
g->m.add_item_or_charges( pos(), item::spawn( type->baby_egg, *baby_timer, spawn_cnt ), true );
}
Expand Down

0 comments on commit 5edce19

Please sign in to comment.