Skip to content

Commit

Permalink
EOC temp monsters don't drop items or corpses (#72718)
Browse files Browse the repository at this point in the history
Unless explicitly told to. Monsters with a lifespan are generally meant
to disappear without leaving behind drops, so as to prevent abuse.
  • Loading branch information
anothersimulacrum authored Mar 30, 2024
1 parent 34e41d0 commit 5a8cdec
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions doc/EFFECT_ON_CONDITION.md
Original file line number Diff line number Diff line change
Expand Up @@ -3761,6 +3761,7 @@ Spawn some monsters around you, NPC or `target_var`
| "target_range" | optional | int, [variable object](##variable-object) or value between two | if `_spawn_monster` is empty, pick a random hostile critter from this amount of tiles from target |
| "lifespan" | optional | int, duration, [variable object](##variable-object) or value between two | if used, critters would live that amount of time, and disappear in the end |
| "target_var" | optional | [variable object](##variable-object) | if used, the monster would spawn from this location instead of you or NPC |
| "temporary_drop_items" | optional | boolean | default false; if true, monsters summoned with a lifespan will still drop items and leave a corpse.
| "spawn_message", "spawn_message_plural" | optional | string or [variable object](##variable-object) | if you see monster or monsters that was spawned, related message would be printed |
| "true_eocs", "false_eocs" | optional | string, [variable object](##variable-object), inline EoC, or range of all of them | if at least 1 monster was spawned, all EoCs from `true_eocs` are run, otherwise all EoCs from `false_eocs` are run |

Expand Down
6 changes: 5 additions & 1 deletion src/npctalk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5730,6 +5730,7 @@ talk_effect_fun_t::func f_spawn_monster( const JsonObject &jo, std::string_view
jo.throw_error( "Cannot be outdoor_only and indoor_only at the same time." );
}
const bool open_air_allowed = jo.get_bool( "open_air_allowed", false );
const bool temporary_drop_items = jo.get_bool( "temporary_drop_items", false );
const bool friendly = jo.get_bool( "friendly", false );

duration_or_var dov_lifespan = get_duration_or_var( jo, "lifespan", false, 0_seconds );
Expand All @@ -5745,7 +5746,7 @@ talk_effect_fun_t::func f_spawn_monster( const JsonObject &jo, std::string_view
std::vector<effect_on_condition_id> false_eocs = load_eoc_vector( jo, "false_eocs" );
return [monster_id, dov_target_range, dov_hallucination_count, dov_real_count, dov_min_radius,
dov_max_radius, outdoor_only, indoor_only, group, single_target, dov_lifespan, target_var,
spawn_message, spawn_message_plural, true_eocs, false_eocs, open_air_allowed,
spawn_message, spawn_message_plural, true_eocs, false_eocs, open_air_allowed, temporary_drop_items,
friendly, is_npc]( dialogue & d ) {
monster target_monster;
std::vector<Creature *> target_monsters;
Expand Down Expand Up @@ -5871,6 +5872,9 @@ talk_effect_fun_t::func f_spawn_monster( const JsonObject &jo, std::string_view
lifespan = dov_lifespan.evaluate( d );
if( lifespan.value() > 0_seconds ) {
spawned->set_summon_time( lifespan.value() );
// Temporary monsters shouldn't drop items unless told to
spawned->no_extra_death_drops = !temporary_drop_items;
spawned->no_corpse_quiet = !temporary_drop_items;
}
}
}
Expand Down

0 comments on commit 5a8cdec

Please sign in to comment.