Skip to content

Commit

Permalink
Merge pull request #71216 from andrei8l/math-no-shim
Browse files Browse the repository at this point in the history
eoc/math: port all shimmed functions to native math
  • Loading branch information
Maleclypse authored Jan 27, 2024
2 parents cbc8b0b + 3d25d18 commit cdc3058
Show file tree
Hide file tree
Showing 32 changed files with 171 additions and 563 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"deactivate_condition": { "u_has_flag": "CHANGING" },
"effect": [
{
"weighted_list_eocs": [ [ "changing_failed", 2500 ], [ "changing_successful", { "u_val": "vitamin", "name": "mutagen" } ] ]
"weighted_list_eocs": [ [ "changing_failed", 2500 ], [ "changing_successful", { "math": [ "u_vitamin('mutagen')" ] } ] ]
}
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
},
"deactivate_condition": { "not": { "is_weather": "early_portal_storm" } },
"effect": {
"switch": { "distance": [ "u", { "global_val": "portal_storm_center" } ] },
"switch": { "math": [ "distance('u', portal_storm_center)" ] },
"cases": [
{
"case": 0,
Expand Down Expand Up @@ -396,7 +396,7 @@
"//": "This displays messages depending on the storms strength.",
"condition": { "and": [ "u_can_see", { "not": { "u_has_worn_with_flag": "PORTAL_PROOF" } } ] },
"effect": {
"switch": { "distance": [ "u", { "global_val": "portal_storm_center" } ] },
"switch": { "math": [ "distance('u', portal_storm_center)" ] },
"cases": [
{
"case": 0,
Expand Down
12 changes: 6 additions & 6 deletions data/json/effects_on_condition/npc_eocs/generic_npc_eocs.json
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,8 @@
"global": true,
"condition": {
"and": [
{ "math": [ "u_val('faction_like: hells_raiders')", "<", "-40" ] },
{ "math": [ "u_val('faction_like: hells_raiders')", ">", "-60" ] },
{ "math": [ "faction_like('hells_raiders')", "<", "-40" ] },
{ "math": [ "faction_like('hells_raiders')", ">", "-60" ] },
{ "math": [ "u_bandit_assassins_sent", "<=", "10" ] },
{ "math": [ "time_since('cataclysm', 'unit':'days') >= 9" ] },
{ "not": { "is_weather": "portal_storm" } },
Expand All @@ -259,8 +259,8 @@
"global": true,
"condition": {
"and": [
{ "math": [ "u_val('faction_like: hells_raiders')", "<", "-60" ] },
{ "math": [ "u_val('faction_like: hells_raiders')", ">", "-90" ] },
{ "math": [ "faction_like('hells_raiders')", "<", "-60" ] },
{ "math": [ "faction_like('hells_raiders')", ">", "-90" ] },
{ "math": [ "u_bandit_assassins_sent", "<=", "10" ] },
{ "math": [ "time_since('cataclysm', 'unit':'days') >= 15" ] },
{ "not": { "is_weather": "portal_storm" } },
Expand All @@ -283,7 +283,7 @@
"global": true,
"condition": {
"and": [
{ "math": [ "u_val('faction_like: hells_raiders')", "<", "-90" ] },
{ "math": [ "faction_like('hells_raiders')", "<", "-90" ] },
{ "math": [ "u_bandit_assassins_sent", "<=", "10" ] },
{ "math": [ "time_since('cataclysm', 'unit':'days') >= 21" ] },
{ "not": { "is_weather": "portal_storm" } },
Expand All @@ -306,7 +306,7 @@
"global": true,
"condition": {
"and": [
{ "math": [ "u_val('faction_like: old_guard')", "<", "-45" ] },
{ "math": [ "faction_like('old_guard')", "<", "-45" ] },
{ "math": [ "u_government_assassins_sent", "<=", "6" ] },
{ "math": [ "time_since('cataclysm', 'unit':'days') >= 9" ] },
{ "not": { "is_weather": "portal_storm" } },
Expand Down
2 changes: 1 addition & 1 deletion data/json/monster_special_attacks/spells.json
Original file line number Diff line number Diff line change
Expand Up @@ -791,7 +791,7 @@
"type": "effect_on_condition",
"id": "EOC_mon_reflection_attack",
"effect": {
"switch": { "distance": [ "u", "npc" ] },
"switch": { "math": [ "distance('u', 'npc')" ] },
"cases": [
{
"case": 0,
Expand Down
4 changes: 2 additions & 2 deletions data/mods/Magiclysm/Spells/animist.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
"type": "effect_on_condition",
"id": "EOC_SUMMON_ZOMBIE",
"effect": {
"switch": { "u_val": "spell_level", "spell": "summon_undead" },
"switch": { "math": [ "u_spell_level('summon_undead')" ] },
"cases": [
{ "case": 0, "effect": { "u_cast_spell": { "id": "summon_zombie" } } },
{ "case": 7, "effect": { "u_cast_spell": { "id": "summon_tough_zombie" } } },
Expand Down Expand Up @@ -235,7 +235,7 @@
"type": "effect_on_condition",
"id": "EOC_SUMMON_ZOMBIE_SWARM",
"effect": {
"switch": { "u_val": "spell_level", "spell": "summon_undead" },
"switch": { "math": [ "u_spell_level('summon_undead')" ] },
"cases": [
{ "case": 0, "effect": { "u_cast_spell": { "id": "summon_zombie_dog" } } },
{ "case": 5, "effect": { "u_cast_spell": { "id": "summon_dog_skeleton" } } },
Expand Down
4 changes: 2 additions & 2 deletions data/mods/Magiclysm/enchantments/Basic_Classes.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
{
"type": "enchantment",
"id": "KELVINIST",
"values": [ { "value": "ARMOR_HEAT", "add": { "math": [ "u_val('spell_level', 'school: KELVINIST') / -6" ] } } ]
"values": [ { "value": "ARMOR_HEAT", "add": { "math": [ "u_school_level('KELVINIST') / -6" ] } } ]
},
{
"type": "enchantment",
"id": "STORMSHAPER",
"values": [ { "value": "ARMOR_ELEC", "add": { "math": [ "u_val('spell_level', 'school: STORMSHAPER') / -6" ] } } ]
"values": [ { "value": "ARMOR_ELEC", "add": { "math": [ "u_school_level('STORMSHAPER') / -6" ] } } ]
}
]
56 changes: 18 additions & 38 deletions data/mods/Magiclysm/eoc_caster_level_boosts.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,10 @@
"condition": { "u_has_trait": "MAGUS" },
"effect": [
{
"math": [
"u_level_boost",
"=",
"u_val('item_count', 'item: magus_booster_1_active') + u_val('item_count', 'item: magus_booster_2_active') * 2"
]
"math": [ "u_level_boost", "=", "u_item_count('magus_booster_1_active') + u_item_count('magus_booster_2_active') * 2" ]
},
{
"math": [
"u_val('spell_level_adjustment', 'school: MAGUS')",
"=",
"limit_caster_level_boost(u_level_boost, u_val('spell_level', 'school: MAGUS') )"
]
"math": [ "u_school_level_adjustment('MAGUS')", "=", "limit_caster_level_boost(u_level_boost, u_school_level('MAGUS') )" ]
}
]
},
Expand All @@ -37,17 +29,13 @@
"condition": { "u_has_trait": "KELVINIST" },
"effect": [
{
"math": [
"u_level_boost",
"=",
"u_val('item_count', 'item: kelvinist_booster_1_active') + u_val('item_count', 'item: kelvinist_booster_2_active') * 2"
]
"math": [ "u_level_boost", "=", "u_item_count('kelvinist_booster_1_active') + u_item_count('kelvinist_booster_2_active') * 2" ]
},
{
"math": [
"u_val('spell_level_adjustment', 'school: KELVINIST')",
"u_school_level_adjustment('KELVINIST')",
"=",
"limit_caster_level_boost(u_level_boost, u_val('spell_level', 'school: KELVINIST') )"
"limit_caster_level_boost(u_level_boost, u_school_level('KELVINIST') )"
]
}
]
Expand All @@ -63,21 +51,21 @@
"math": [
"u_level_boost",
"=",
"max( 0, u_effect_intensity('technomancer_cl_booster_effect') ) + u_val('charge_count', 'item: technomancer_booster_2_active') / 5"
"max( 0, u_effect_intensity('technomancer_cl_booster_effect') ) + u_charge_count('technomancer_booster_2_active') / 5"
]
},
{
"math": [
"u_val('spell_level_adjustment', 'school: TECHNOMANCER')",
"u_school_level_adjustment('TECHNOMANCER')",
"=",
"limit_caster_level_boost(u_level_boost, u_val('spell_level', 'school: TECHNOMANCER') )"
"limit_caster_level_boost(u_level_boost, u_school_level('TECHNOMANCER') )"
]
},
{
"math": [
"u_doodad_boost",
"=",
"max( 0, limit_caster_level_boost(u_level_boost, u_val('spell_level', 'school: TECHNOMANCER') ) - max( 0, u_effect_intensity('technomancer_cl_booster_effect') ) )"
"max( 0, limit_caster_level_boost(u_level_boost, u_school_level('TECHNOMANCER') ) - max( 0, u_effect_intensity('technomancer_cl_booster_effect') ) )"
]
}
]
Expand Down Expand Up @@ -106,9 +94,9 @@
{ "math": [ "u_level_boost", "=", "max( 0, u_effect_intensity('biomancer_cl_booster_effect') )" ] },
{
"math": [
"u_val('spell_level_adjustment', 'school: BIOMANCER')",
"u_school_level_adjustment('BIOMANCER')",
"=",
"limit_caster_level_boost(u_level_boost, u_val('spell_level', 'school: BIOMANCER') )"
"limit_caster_level_boost(u_level_boost, u_school_level('BIOMANCER') )"
]
}
]
Expand All @@ -120,13 +108,9 @@
"required_event": "opens_spellbook",
"condition": { "u_has_trait": "ANIMIST" },
"effect": [
{ "math": [ "u_level_boost", "=", "u_val('field_strength', 'field: fd_blood')" ] },
{ "math": [ "u_level_boost", "=", "u_field_strength('fd_blood')" ] },
{
"math": [
"u_val('spell_level_adjustment', 'school: ANIMIST')",
"=",
"limit_caster_level_boost(u_level_boost, u_val('spell_level', 'school: ANIMIST') )"
]
"math": [ "u_school_level_adjustment('ANIMIST')", "=", "limit_caster_level_boost(u_level_boost, u_school_level('ANIMIST') )" ]
}
]
},
Expand All @@ -140,9 +124,9 @@
{ "math": [ "u_level_boost", "=", "weather('precipitation') * 2" ] },
{
"math": [
"u_val('spell_level_adjustment', 'school: STORMSHAPER')",
"u_school_level_adjustment('STORMSHAPER')",
"=",
"limit_caster_level_boost(u_level_boost, u_val('spell_level', 'school: STORMSHAPER') )"
"limit_caster_level_boost(u_level_boost, u_school_level('STORMSHAPER') )"
]
}
]
Expand Down Expand Up @@ -198,9 +182,9 @@
},
{
"math": [
"u_val('spell_level_adjustment', 'school: EARTHSHAPER')",
"u_school_level_adjustment('EARTHSHAPER')",
"=",
"limit_caster_level_boost(u_level_boost, u_val('spell_level', 'school: EARTHSHAPER') )"
"limit_caster_level_boost(u_level_boost, u_school_level('EARTHSHAPER') )"
]
}
]
Expand Down Expand Up @@ -266,11 +250,7 @@
]
},
{
"math": [
"u_val('spell_level_adjustment', 'school: DRUID')",
"=",
"limit_caster_level_boost(u_level_boost, u_val('spell_level', 'school: DRUID') )"
]
"math": [ "u_school_level_adjustment('DRUID')", "=", "limit_caster_level_boost(u_level_boost, u_school_level('DRUID') )" ]
}
]
}
Expand Down
2 changes: 1 addition & 1 deletion data/mods/MindOverMatter/NewPowerGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ When adding powers, keep the following in mind:

1) Choose a Difficulty, which is important for determining how much Nether Attunement the power causes.
2) Make sure to use the "extra_effects" field to apply drain
3) Make sure the power has some element of randomness--unlike magical spells, psionic powers are not completely predictable. The standard formula I've used is generally { "math": [ "( ( (u_val('spell_level', 'spell: [NAME]') * [LEVELED_VALUE]) + [BASE_VALUE]) * ( ( u_val('intelligence') + 10) / 20 ) )" ] }. This makes sure that the power scales appropriately with its level and also that its effects are modified by intelligence: +5% effectiveness for every point of intelligence above 10, -5% for every point below 10. Generally damage, duration, and range are all scaled this way, while maximum level is a simple 1.5 * intelligence.
3) Make sure the power has some element of randomness--unlike magical spells, psionic powers are not completely predictable. The standard formula I've used is generally { "math": [ "( ( (u_spell_level('[NAME]') * [LEVELED_VALUE]) + [BASE_VALUE]) * ( ( u_val('intelligence') + 10) / 20 ) )" ] }. This makes sure that the power scales appropriately with its level and also that its effects are modified by intelligence: +5% effectiveness for every point of intelligence above 10, -5% for every point below 10. Generally damage, duration, and range are all scaled this way, while maximum level is a simple 1.5 * intelligence.
4) Make sure the power has connections to other powers, either teaching them or being learned by them.
5) If the power is low-level enough that it should be a starting power, add it in to the EOC_Matrix_Awakening and EOC_Portal_Awakening EoCs to make sure that it's learned when awakening, as well as the appropriate professions.
6) Write a practice recipe for the power and add it to the appropriate EOC_learn_recipes EoC. Psionic practice recipes are found in recipes/practice. The numbers within are drawn from spellbook reading XP rates and teach Difficulty 1 2 3 and powers up to level 12, Difficulty 4 and 5 powers up to level 10, and Difficulty 6 and 7 powers up to level 7.
Expand Down
2 changes: 1 addition & 1 deletion data/mods/MindOverMatter/effectoncondition/eoc_items.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{
"type": "effect_on_condition",
"id": "EOC_ZENER_DECK",
"condition": { "math": [ "u_val('spell_level', 'school: CLAIRSENTIENT')", ">=", "10" ] },
"condition": { "math": [ "u_school_level('CLAIRSENTIENT')", ">=", "10" ] },
"effect": [
{
"switch": { "rand": 4 },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"required_event": "opens_spellbook",
"condition": { "not": { "u_has_effect": "effect_noetic_resilience" } },
"effect": {
"switch": { "u_val": "vitamin", "name": "vitamin_psionic_drain" },
"switch": { "math": [ "u_vitamin('vitamin_psionic_drain')" ] },
"cases": [
{ "case": 0, "effect": { "math": [ "u_nether_attunement_power_scaling", "=", "0.75" ] } },
{ "case": 15, "effect": { "math": [ "u_nether_attunement_power_scaling", "=", "1" ] } },
Expand Down Expand Up @@ -64,7 +64,7 @@
"effect": [
{ "math": [ "u_latest_channeled_power_difficulty", "=", "_difficulty" ] },
{
"switch": { "u_val": "vitamin", "name": "vitamin_psionic_drain" },
"switch": { "math": [ "u_vitamin('vitamin_psionic_drain')" ] },
"cases": [
{
"case": 15,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@
"global": true,
"condition": {
"and": [
{ "math": [ "u_val('faction_like: hells_raiders')", "<", "-40" ] },
{ "math": [ "u_val('faction_like: hells_raiders')", ">", "-60" ] },
{ "math": [ "faction_like('hells_raiders')", "<", "-40" ] },
{ "math": [ "faction_like('hells_raiders')", ">", "-60" ] },
{ "math": [ "u_bandit_assassins_sent", "<=", "10" ] },
{ "math": [ "time_since('cataclysm', 'unit':'days') >= 9" ] },
{ "not": { "is_weather": "portal_storm" } },
Expand Down Expand Up @@ -183,8 +183,8 @@
"global": true,
"condition": {
"and": [
{ "math": [ "u_val('faction_like: hells_raiders')", "<", "-60" ] },
{ "math": [ "u_val('faction_like: hells_raiders')", ">", "-90" ] },
{ "math": [ "faction_like('hells_raiders')", "<", "-60" ] },
{ "math": [ "faction_like('hells_raiders')", ">", "-90" ] },
{ "math": [ "u_bandit_assassins_sent", "<=", "10" ] },
{ "math": [ "time_since('cataclysm', 'unit':'days') >= 15" ] },
{ "not": { "is_weather": "portal_storm" } },
Expand Down Expand Up @@ -258,7 +258,7 @@
"global": true,
"condition": {
"and": [
{ "math": [ "u_val('faction_like: hells_raiders')", "<", "-90" ] },
{ "math": [ "faction_like('hells_raiders')", "<", "-90" ] },
{ "math": [ "u_bandit_assassins_sent", "<=", "10" ] },
{ "math": [ "time_since('cataclysm', 'unit':'days') >= 21" ] },
{ "not": { "is_weather": "portal_storm" } },
Expand Down Expand Up @@ -332,7 +332,7 @@
"global": true,
"condition": {
"and": [
{ "math": [ "u_val('faction_like: old_guard')", "<", "-45" ] },
{ "math": [ "faction_like('old_guard')", "<", "-45" ] },
{ "math": [ "u_government_assassins_sent", "<=", "6" ] },
{ "math": [ "time_since('cataclysm', 'unit':'days') >= 9" ] },
{ "not": { "is_weather": "portal_storm" } },
Expand Down
2 changes: 1 addition & 1 deletion data/mods/MindOverMatter/effects/effects_psionic.json
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@
"value": "SPEED",
"add": {
"math": [
"min( ( ( ( ( u_val('spell_level', 'spell: biokin_hurricane_blows') * 75) + 400 ) * (scaling_factor(u_val('intelligence') ) ) ) * u_nether_attunement_power_scaling), 1800)"
"min( ( ( ( ( u_spell_level('biokin_hurricane_blows') * 75) + 400 ) * (scaling_factor(u_val('intelligence') ) ) ) * u_nether_attunement_power_scaling), 1800)"
]
}
}
Expand Down
Loading

0 comments on commit cdc3058

Please sign in to comment.