Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Standing-Storm committed Dec 25, 2024
1 parent 7ba4c09 commit 92c7781
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 19 deletions.
19 changes: 17 additions & 2 deletions data/mods/MindOverMatter/effectoncondition/eoc_misc.json
Original file line number Diff line number Diff line change
Expand Up @@ -183,13 +183,28 @@
{ "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" ] }
]
},
"effect": [ { "run_eocs": [ "EOC_POWER_MAINTENANCE_CONCENTRATION_CHECK" ] } ]
"effect": [
{ "message": "This is proof that the EoC works right." },
{ "run_eocs": [ "EOC_POWER_MAINTENANCE_CONCENTRATION_CHECK" ] }
]
},
{
"type": "effect_on_condition",
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
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

0 comments on commit 92c7781

Please sign in to comment.