Skip to content

Commit

Permalink
[MoM] Add hitting Nether Attunement 5 and Nether Attunement 11 to the…
Browse files Browse the repository at this point in the history
… list of things that call for concentration checks (#78770)

* Initial commit

* Remove debug message

* Add limit calculation EoC to base maintenance check

* Update src/creature.cpp

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Fix tests?

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
Standing-Storm and github-actions[bot] authored Dec 26, 2024
1 parent eeae732 commit 2a219fe
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 20 deletions.
14 changes: 13 additions & 1 deletion data/mods/MindOverMatter/effectoncondition/eoc_misc.json
Original file line number Diff line number Diff line change
Expand Up @@ -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" ] }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion doc/EFFECT_ON_CONDITION.md
Original file line number Diff line number Diff line change
Expand Up @@ -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` },<br/> { "itype", `itype_id` }, | character / NONE |
| character_finished_activity | Triggered when character finished or canceled activity | { "character", `character_id` },<br/> { "activity", `activity_id` },<br/> { "canceled", `bool` } | character / NONE |
| character_forgets_spell | | { "character", `character_id` },<br/> { "spell", `spell_id` } | character / NONE |
| character_gains_effect | | { "character", `character_id` },<br/> { "effect", `efftype_id` },<br/> { "bodypart", `bodypart_id` } | character / NONE |
| character_gains_effect | | { "character", `character_id` },<br/> { "effect", `efftype_id` },<br/> { "bodypart", `bodypart_id` }, { "intensity", `int` }</br> | character / NONE |
| character_gets_headshot | | { "character", `character_id` } | character / NONE |
| character_heals_damage | | { "character", `character_id` },<br/> { "damage", `int` }, | character / NONE |
| character_kills_character | | { "killer", `character_id` },<br/> { "victim", `character_id` },<br/> { "victim_name", `string` }, | character / NONE |
Expand Down
2 changes: 1 addition & 1 deletion src/creature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<event_type::character_gains_effect>( ch->getID(), bp.id(), eff_id );
get_event_bus().send<event_type::character_gains_effect>( ch->getID(), bp.id(), eff_id, intensity );
if( is_avatar() ) {
eff_id->add_apply_msg( e.get_intensity() );
}
Expand Down
3 changes: 2 additions & 1 deletion src/event.h
Original file line number Diff line number Diff line change
Expand Up @@ -339,10 +339,11 @@ struct event_spec<event_type::character_forgets_spell> {

template<>
struct event_spec<event_type::character_gains_effect> {
static constexpr std::array<std::pair<const char *, cata_variant_type>, 3> fields = {{
static constexpr std::array<std::pair<const char *, cata_variant_type>, 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_ }
}
};
};
Expand Down
2 changes: 1 addition & 1 deletion tests/memorial_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ TEST_CASE( "memorials", "[memorial]" )
m, b, "Caused a resonance cascade." );

check_memorial<event_type::character_gains_effect>(
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<event_type::character_kills_character>(
m, b, "Killed an innocent person, victim_name, in cold blood and felt terrible "
Expand Down

0 comments on commit 2a219fe

Please sign in to comment.