Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
* Update npctalk.cpp

* Update npctalk.cpp

* Scope
  • Loading branch information
Procyonae authored Jan 19, 2024
1 parent 6324dc0 commit 685a518
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/npctalk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5714,6 +5714,7 @@ void talk_effect_fun_t::set_spawn_monster( const JsonObject &jo, std::string_vie
monster target_monster;
std::vector<Creature *> target_monsters;
mongroup_id target_mongroup;
bool use_target_monster = single_target;

if( group ) {
if( monster_id.evaluate( d ).empty() ) {
Expand Down Expand Up @@ -5756,16 +5757,18 @@ void talk_effect_fun_t::set_spawn_monster( const JsonObject &jo, std::string_vie
} else if( valid_monsters == 1 ) {
Creature *copy = monsters_in_range[0];
target_monster = *copy->as_monster();
use_target_monster = true;
} else {
target_monsters = monsters_in_range;
}
}
} else {
if( single_target ) {
debugmsg( "single_target should not be defined for a singlular monster_id. %s",
debugmsg( "single_target doesn't need to be defined for a singlular monster_id. %s",
d.get_callstack() );
}
target_monster = monster( mtype_id( monster_id.evaluate( d ) ) );
use_target_monster = true;
}
int min_radius = dov_min_radius.evaluate( d );
int max_radius = dov_max_radius.evaluate( d );
Expand All @@ -5780,7 +5783,7 @@ void talk_effect_fun_t::set_spawn_monster( const JsonObject &jo, std::string_vie
int spawns = 0;
for( int i = 0; i < hallucination_count; i++ ) {
tripoint spawn_point;
if( !single_target ) {
if( !use_target_monster ) {
if( group ) {
target_monster = monster( MonsterGroupManager::GetRandomMonsterFromGroup( target_mongroup ) );
} else {
Expand Down Expand Up @@ -5810,7 +5813,7 @@ void talk_effect_fun_t::set_spawn_monster( const JsonObject &jo, std::string_vie
}
for( int i = 0; i < real_count; i++ ) {
tripoint spawn_point;
if( !single_target ) {
if( !use_target_monster ) {
if( group ) {
target_monster = monster( MonsterGroupManager::GetRandomMonsterFromGroup( target_mongroup ) );
} else {
Expand Down

0 comments on commit 685a518

Please sign in to comment.