diff --git a/data/mods/MindOverMatter/effectoncondition/eoc_misc.json b/data/mods/MindOverMatter/effectoncondition/eoc_misc.json index 580c49a235f52..c3f85fe1a5a40 100644 --- a/data/mods/MindOverMatter/effectoncondition/eoc_misc.json +++ b/data/mods/MindOverMatter/effectoncondition/eoc_misc.json @@ -183,7 +183,19 @@ { "compare_string": [ "dazed", { "context_val": "effect" } ] }, { "compare_string": [ "psi_dazed", { "context_val": "effect" } ] }, { "compare_string": [ "psi_dazed_zap", { "context_val": "effect" } ] }, - { "compare_string": [ "downed", { "context_val": "effect" } ] } + { "compare_string": [ "downed", { "context_val": "effect" } ] }, + { + "and": [ + { "compare_string": [ "effect_disease_psionic_drain", { "context_val": "effect" } ] }, + { "math": [ "_intensity == 5" ] } + ] + }, + { + "and": [ + { "compare_string": [ "effect_disease_psionic_drain", { "context_val": "effect" } ] }, + { "math": [ "_intensity == 11" ] } + ] + } ] }, { "math": [ "u_vitamin('vitamin_maintained_powers') >= 1" ] } diff --git a/data/mods/MindOverMatter/effectoncondition/eoc_on_power_use_events.json b/data/mods/MindOverMatter/effectoncondition/eoc_on_power_use_events.json index 00f4b032f17d9..6ce4728ae7d60 100644 --- a/data/mods/MindOverMatter/effectoncondition/eoc_on_power_use_events.json +++ b/data/mods/MindOverMatter/effectoncondition/eoc_on_power_use_events.json @@ -555,27 +555,39 @@ { "type": "effect_on_condition", "id": "EOC_POWER_MAINTENANCE_PLUS_ONE", - "condition": { "math": [ "u_vitamin('vitamin_maintained_powers') >= concentration_calculations()" ] }, "effect": [ - { - "u_message": "It's taking you a lot of concentration to maintain your powers. You're not sure you'll be able to do it for very long.", - "type": "bad" - }, - { "u_add_effect": "effect_psi_intense_concentration", "duration": "PERMANENT" }, - { "math": [ "u_vitamin('vitamin_maintained_powers')", "+=", "1" ] } - ], - "false_effect": [ { "math": [ "u_vitamin('vitamin_maintained_powers')", "+=", "1" ] } ] + { "math": [ "u_vitamin('vitamin_maintained_powers')", "+=", "1" ] }, + { "run_eocs": "EOC_CONCENTRATION_VS_LIMIT_CALCULATIONS" } + ] }, { "type": "effect_on_condition", "id": "EOC_POWER_MAINTENANCE_MINUS_ONE", - "condition": { "math": [ "u_vitamin('vitamin_maintained_powers') == concentration_calculations() + 1" ] }, "effect": [ - { "u_message": "As you stop concentrating, your mind clears a bit. It's easier to think now.", "type": "good" }, - { "u_lose_effect": "effect_psi_intense_concentration" }, - { "math": [ "u_vitamin('vitamin_maintained_powers')", "-=", "1" ] } + { "math": [ "u_vitamin('vitamin_maintained_powers')", "-=", "1" ] }, + { "run_eocs": "EOC_CONCENTRATION_VS_LIMIT_CALCULATIONS" } + ] + }, + { + "type": "effect_on_condition", + "id": "EOC_CONCENTRATION_VS_LIMIT_CALCULATIONS", + "condition": { "math": [ "u_vitamin('vitamin_maintained_powers') > concentration_calculations()" ] }, + "effect": [ + { + "u_message": "It's taking you a lot of concentration to maintain your powers. You're not sure you'll be able to do it for very long.", + "type": "bad" + }, + { "u_add_effect": "effect_psi_intense_concentration", "duration": "PERMANENT" } ], - "false_effect": [ { "math": [ "u_vitamin('vitamin_maintained_powers')", "-=", "1" ] } ] + "false_effect": [ + { + "if": { "u_has_effect": "effect_psi_intense_concentration" }, + "then": [ + { "u_message": "As you stop concentrating, your mind clears a bit. It's easier to think now.", "type": "good" }, + { "u_lose_effect": "effect_psi_intense_concentration" } + ] + } + ] }, { "type": "effect_on_condition", @@ -615,7 +627,8 @@ "EOC_CONCENTRATION_SUCCESS_PROFICIENCY", "EOC_CONCENTRATION_IN_NETHER_AREAS_ATTUNEMENT", "EOC_NETHER_ATTUNEMENT_FEEDBACK_CHECK_CONCENTRATION", - "EOC_CONCENTRATION_SUCCESS_REDUCE_FOCUS" + "EOC_CONCENTRATION_SUCCESS_REDUCE_FOCUS", + "EOC_CONCENTRATION_VS_LIMIT_CALCULATIONS" ] }, { diff --git a/doc/EFFECT_ON_CONDITION.md b/doc/EFFECT_ON_CONDITION.md index 91659547f023f..0cbdce03795bf 100644 --- a/doc/EFFECT_ON_CONDITION.md +++ b/doc/EFFECT_ON_CONDITION.md @@ -1479,7 +1479,7 @@ Every event EOC passes context vars with each of their key value pairs that the | character_eats_item | | { "character", `character_id` },
{ "itype", `itype_id` }, | character / NONE | | character_finished_activity | Triggered when character finished or canceled activity | { "character", `character_id` },
{ "activity", `activity_id` },
{ "canceled", `bool` } | character / NONE | | character_forgets_spell | | { "character", `character_id` },
{ "spell", `spell_id` } | character / NONE | -| character_gains_effect | | { "character", `character_id` },
{ "effect", `efftype_id` },
{ "bodypart", `bodypart_id` } | character / NONE | +| character_gains_effect | | { "character", `character_id` },
{ "effect", `efftype_id` },
{ "bodypart", `bodypart_id` }, { "intensity", `int` }
| character / NONE | | character_gets_headshot | | { "character", `character_id` } | character / NONE | | character_heals_damage | | { "character", `character_id` },
{ "damage", `int` }, | character / NONE | | character_kills_character | | { "killer", `character_id` },
{ "victim", `character_id` },
{ "victim_name", `string` }, | character / NONE | diff --git a/src/creature.cpp b/src/creature.cpp index ccab04ac3b078..2678ccda0ec00 100644 --- a/src/creature.cpp +++ b/src/creature.cpp @@ -1798,7 +1798,7 @@ void Creature::add_effect( const effect_source &source, const efftype_id &eff_id } ( *effects )[eff_id][bp] = e; if( Character *ch = as_character() ) { - get_event_bus().send( ch->getID(), bp.id(), eff_id ); + get_event_bus().send( ch->getID(), bp.id(), eff_id, intensity ); if( is_avatar() ) { eff_id->add_apply_msg( e.get_intensity() ); } diff --git a/src/event.h b/src/event.h index 646ca0f4a2696..a6b024c3be714 100644 --- a/src/event.h +++ b/src/event.h @@ -339,10 +339,11 @@ struct event_spec { template<> struct event_spec { - static constexpr std::array, 3> fields = {{ + static constexpr std::array, 4> fields = {{ { "character", cata_variant_type::character_id }, { "bodypart", cata_variant_type::body_part}, { "effect", cata_variant_type::efftype_id }, + { "intensity", cata_variant_type::int_ } } }; }; diff --git a/tests/memorial_test.cpp b/tests/memorial_test.cpp index 2b72b7def7bef..c251456f3ad1b 100644 --- a/tests/memorial_test.cpp +++ b/tests/memorial_test.cpp @@ -125,7 +125,7 @@ TEST_CASE( "memorials", "[memorial]" ) m, b, "Caused a resonance cascade." ); check_memorial( - m, b, "Caught on fire.", ch, bodypart_id( "arm_r" ), eff ); + m, b, "Caught on fire.", ch, bodypart_id( "arm_r" ), eff, 1 ); check_memorial( m, b, "Killed an innocent person, victim_name, in cold blood and felt terrible "