Skip to content

Commit

Permalink
[MOM] Adjust Electron Overflow EOC logic to allow charging values abo…
Browse files Browse the repository at this point in the history
…ve 5 (#77754)

* Rough Draft: Rework EOC algorithm to uncap power generation from 5

* remove old EOC code and fix some typos

* lint

* simplify eoc a bit

* remove debug prints

* rename sub eoc
  • Loading branch information
b3brodie authored Nov 12, 2024
1 parent dc1a524 commit 9ad377a
Showing 1 changed file with 100 additions and 56 deletions.
156 changes: 100 additions & 56 deletions data/mods/MindOverMatter/powers/electrokinesis_concentration_eocs.json
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@
"effect": [
{ "u_message": "The hair on your body stands up on end.", "type": "good" },
{ "u_add_effect": "effect_electrokin_personal_battery", "duration": "PERMANENT" },
{ "run_eocs": [ "EOC_POWER_MAINTENANCE_PLUS_ONE", "EOC_ELECTROKIN_PERSONAL_BATTERY_INV_SCANNER" ] },
{ "run_eocs": [ "EOC_POWER_MAINTENANCE_PLUS_ONE", "EOC_ELECTROKIN_PERSONAL_BATTERY_EFFECT_BEGIN" ] },
{
"queue_eocs": "EOC_ELECTROKIN_PERSONAL_BATTERY_DRAIN",
"time_in_future": [
Expand All @@ -308,11 +308,11 @@
},
{
"type": "effect_on_condition",
"id": "EOC_ELECTROKIN_PERSONAL_BATTERY_INV_SCANNER",
"id": "EOC_ELECTROKIN_PERSONAL_BATTERY_EFFECT_BEGIN",
"condition": { "u_has_effect": "effect_electrokin_personal_battery" },
"effect": [
{
"queue_eocs": "EOC_ELECTROKIN_PERSONAL_BATTERY_INV_SCANNER",
"queue_eocs": "EOC_ELECTROKIN_PERSONAL_BATTERY_EFFECT_BEGIN",
"time_in_future": [
{
"math": [
Expand All @@ -326,85 +326,130 @@
}
]
},
{ "math": [ "u_electrokin_personal_battery_count", "=", "0" ] },
{
"u_run_inv_eocs": "all",
"search_data": [ { "uses_energy": true } ],
"true_eocs": [
{
"id": "EOC_ELECTROKIN_PERSONAL_BATTERY_INV_SCANNER_COUNTER",
"condition": { "math": [ "n_val('power')", "<", "n_val('power_max')" ] },
"effect": [ { "math": [ "u_electrokin_personal_battery_count", "++" ] } ]
}
"math": [
"u_electrokin_personal_battery_power_count",
"=",
"( (u_spell_level('electrokinetic_personal_battery') / 5) + 1) * scaling_factor(u_val('intelligence') ) * u_nether_attunement_power_scaling"
]
},
{ "queue_eocs": "EOC_ELECTROKIN_PERSONAL_BATTERY_INV_SCANNER_FINALIZATION", "time_in_future": 1 }
{ "run_eocs": "EOC_ELECTROKIN_PERSONAL_BATTERY_EFFECT" }
]
},
{
"type": "effect_on_condition",
"id": "EOC_ELECTROKIN_PERSONAL_BATTERY_INV_SCANNER_FINALIZATION",
"//": "The one that actually does the charging",
"condition": { "u_has_effect": "effect_electrokin_personal_battery" },
"id": "EOC_ELECTROKIN_PERSONAL_BATTERY_EFFECT",
"//": "recursively runs until available power is < 1 or all items are charged",
"condition": { "math": [ "u_electrokin_personal_battery_power_count", ">=", "1" ] },
"effect": [
{ "math": [ "u_electrokin_personal_battery_item_count", "=", "0" ] },
{ "run_eocs": "EOC_ELECTROKIN_PERSONAL_BATTERY_EFFECT_GET_ITEM_COUNT" },
{ "run_eocs": "EOC_ELECTROKIN_PERSONAL_BATTERY_EFFECT_AMMEND_ITEM_COUNT" },
{
"math": [
"u_electrokin_personal_battery_max_indv_power",
"=",
"floor(u_electrokin_personal_battery_power_count / u_electrokin_personal_battery_item_count)"
]
},
{ "run_eocs": "EOC_ELECTROKIN_PERSONAL_BATTERY_EFFECT_POWER_ITEMS" }
]
},
{
"type": "effect_on_condition",
"id": "EOC_ELECTROKIN_PERSONAL_BATTERY_EFFECT_POWER_ITEMS",
"//": "power uncharged items and calls the main eoc to deal with any remaining power left over",
"condition": {
"and": [
{ "math": [ "u_electrokin_personal_battery_power_count", ">=", "1" ] },
{ "math": [ "u_electrokin_personal_battery_item_count", ">=", "1" ] }
]
},
"effect": [
{
"u_run_inv_eocs": "all",
"search_data": [ { "uses_energy": true } ],
"true_eocs": [
{
"id": "EOC_ELECTROKIN_PERSONAL_BATTERY_INV_SCANNER_VALUE_ADDED",
"condition": { "math": [ "n_val('power')", "<", "n_val('power_max')" ] },
"id": "EOC_ELECTROKIN_PERSONAL_BATTERY_EFFECT_POWER_ITEMS_DISTRIBUTION",
"condition": {
"and": [
{ "math": [ "n_val('power')", "<", "n_val('power_max')" ] },
{ "math": [ "u_electrokin_personal_battery_power_count", ">=", "1" ] }
]
},
"effect": [
{
"if": { "math": [ "u_electrokin_personal_battery_count", ">", "0" ] },
"if": { "math": [ "u_electrokin_personal_battery_max_indv_power", ">=", "1" ] },
"then": {
"math": [
"n_electrokin_charging_value_counter",
"+=",
"( ( (u_spell_level('electrokinetic_personal_battery') / 5) + 1) * scaling_factor(u_val('intelligence') ) * u_nether_attunement_power_scaling) / u_electrokin_personal_battery_count"
"u_electrokin_personal_battery_power_count_used",
"=",
"min( n_val('power_max') - n_val('power'), u_electrokin_personal_battery_max_indv_power )"
]
},
"else": {
"math": [
"u_electrokin_personal_battery_power_count_used",
"=",
"min( n_val('power_max') - n_val('power'), u_electrokin_personal_battery_power_count )"
]
}
}
]
},
{
"id": "EOC_ELECTROKIN_PERSONAL_BATTERY_INV_SCANNER_CHARGER",
"condition": { "math": [ "n_electrokin_charging_value_counter", ">=", "1" ] },
"effect": [
},
{
"if": { "math": [ "n_electrokin_charging_value_counter", ">=", "5" ] },
"then": [ { "math": [ "n_val('power')", "+=", "5" ] }, { "math": [ "n_electrokin_charging_value_counter", "-=", "5" ] } ],
"else": [
{
"if": { "math": [ "n_electrokin_charging_value_counter", ">=", "4" ] },
"then": [ { "math": [ "n_val('power')", "+=", "4" ] }, { "math": [ "n_electrokin_charging_value_counter", "-=", "4" ] } ],
"else": [
{
"if": { "math": [ "n_electrokin_charging_value_counter", ">=", "3" ] },
"then": [ { "math": [ "n_val('power')", "+=", "3" ] }, { "math": [ "n_electrokin_charging_value_counter", "-=", "3" ] } ],
"else": [
{
"if": { "math": [ "n_electrokin_charging_value_counter", ">=", "2" ] },
"then": [ { "math": [ "n_val('power')", "+=", "2" ] }, { "math": [ "n_electrokin_charging_value_counter", "-=", "2" ] } ],
"else": [
{
"if": { "math": [ "n_electrokin_charging_value_counter", ">=", "1" ] },
"then": [ { "math": [ "n_val('power')", "+=", "1" ] }, { "math": [ "n_electrokin_charging_value_counter", "-=", "1" ] } ]
}
]
}
]
}
]
}
"math": [
"u_electrokin_personal_battery_power_count_used",
"=",
"min( n_val('power_max') - n_val('power'), u_electrokin_personal_battery_max_indv_power )"
]
},
{ "math": [ "n_val('power')", "+=", "u_electrokin_personal_battery_power_count_used" ] },
{
"math": [ "u_electrokin_personal_battery_power_count", "-=", "u_electrokin_personal_battery_power_count_used" ]
}
]
}
]
},
{ "run_eocs": "EOC_ELECTROKIN_PERSONAL_BATTERY_EFFECT" }
]
},
{
"type": "effect_on_condition",
"id": "EOC_ELECTROKIN_PERSONAL_BATTERY_EFFECT_GET_ITEM_COUNT",
"//": "get total items without max power",
"effect": [
{
"u_run_inv_eocs": "all",
"search_data": [ { "uses_energy": true } ],
"true_eocs": [
{
"id": "EOC_ELECTROKIN_PERSONAL_BATTERY_GET_ITEM_COUNT_2",
"condition": { "math": [ "n_val('power')", "<", "n_val('power_max')" ] },
"effect": [ { "math": [ "u_electrokin_personal_battery_item_count", "++" ] } ]
}
]
}
]
},
{
"type": "effect_on_condition",
"id": "EOC_ELECTROKIN_PERSONAL_BATTERY_EFFECT_AMMEND_ITEM_COUNT",
"//": "Reduce item count if the total chargeable power / uncharged item count is less than 1.",
"condition": {
"and": [
{ "math": [ "u_electrokin_personal_battery_power_count", ">=", "1" ] },
{ "math": [ "u_electrokin_personal_battery_item_count", ">=", "1" ] },
{
"math": [ "u_electrokin_personal_battery_power_count / u_electrokin_personal_battery_item_count", "<", "1" ]
}
]
},
"effect": [
{ "math": [ "u_electrokin_personal_battery_item_count", "--" ] },
{ "run_eocs": "EOC_ELECTROKIN_PERSONAL_BATTERY_EFFECT_AMMEND_ITEM_COUNT" }
]
},
{
"type": "effect_on_condition",
"id": "EOC_ELECTROKIN_PERSONAL_BATTERY_DRAIN",
Expand All @@ -431,8 +476,7 @@
}
]
}
],
"false_effect": [ ]
]
},
{
"type": "effect_on_condition",
Expand Down

0 comments on commit 9ad377a

Please sign in to comment.