[
  {
    "type": "effect_on_condition",
    "id": "EOC_AFS_ELECTROKIN_SEE_ELECTRICITY_INITIATE",
    "condition": { "not": { "u_has_effect": "effect_afs_electrokin_see_electricity" } },
    "effect": [
      { "u_message": "You open your senses to the flow of current.", "type": "good" },
      { "run_eocs": "EOC_AFS_POWER_MAINTENANCE_PLUS_ONE" },
      { "u_add_effect": "effect_afs_electrokin_see_electricity", "duration": "PERMANENT" },
      {
        "run_eocs": "EOC_AFS_ELECTROKIN_SEE_ELECTRICITY_MAINTENANCE",
        "time_in_future": [
          {
            "math": [ "( (u_spell_level('afs_electrokinetic_see_electric') * 150) + 900) * (scaling_factor(u_val('intelligence') ) )" ]
          },
          {
            "math": [ "( (u_spell_level('afs_electrokinetic_see_electric') * 300) + 1800) * (scaling_factor(u_val('intelligence') ) )" ]
          }
        ]
      }
    ],
    "false_effect": [ { "run_eocs": "EOC_AFS_ELECTROKIN_REMOVE_SEE_ELECTRICITY" } ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_AFS_ELECTROKIN_REMOVE_SEE_ELECTRICITY",
    "condition": { "u_has_effect": "effect_afs_electrokin_see_electricity" },
    "effect": [ { "run_eocs": "EOC_AFS_POWER_MAINTENANCE_MINUS_ONE" }, { "u_lose_effect": "effect_afs_electrokin_see_electricity" } ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_AFS_ELECTROKIN_SEE_ELECTRICITY_MAINTENANCE",
    "condition": { "u_has_effect": "effect_afs_electrokin_see_electricity" },
    "effect": [
      { "math": [ "u_latest_channeled_power_difficulty = 2" ] },
      {
        "math": [ "u_spell_exp('afs_electrokinetic_see_electric')", "+=", "(maintenance_exp_factor(u_val('focus')))" ]
      },
      {
        "run_eocs": [
          "EOC_AFS_CONCENTRATION_SUCCESS_PROFICIENCY",
          "EOC_AFS_PSI_SKILL_INCREASE_ON_USE_FINALIZE",
          "EOC_AFS_CONCENTRATION_COSTS_FOCUS"
        ]
      },
      {
        "run_eocs": "EOC_AFS_ELECTROKIN_SEE_ELECTRICITY_MAINTENANCE",
        "time_in_future": [
          {
            "math": [ "( (u_spell_level('afs_electrokinetic_see_electric') * 150) + 900) * (scaling_factor(u_val('intelligence') ) )" ]
          },
          {
            "math": [ "( (u_spell_level('afs_electrokinetic_see_electric') * 300) + 1800) * (scaling_factor(u_val('intelligence') ) )" ]
          }
        ]
      }
    ],
    "false_effect": [  ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_AFS_ELECTROKIN_HACKING_INTERFACE_INITIATE",
    "condition": { "not": { "u_has_effect": "effect_afs_electrokin_hacking_interface" } },
    "effect": [
      { "u_message": "You now have the ability to hack into nearby electronics.", "type": "good" },
      { "run_eocs": [ "EOC_AFS_POWER_MAINTENANCE_MINUS_ONE", "EOC_AFS_ELECTROKIN_HACKING_INTERFACE_SWITCHER" ] },
      { "u_add_effect": "effect_afs_electrokin_hacking_interface", "duration": "PERMANENT" },
      {
        "run_eocs": "EOC_AFS_ELECTROKIN_HACKING_INTERFACE_MAINTENANCE",
        "time_in_future": [
          {
            "math": [
              "( ( (u_spell_level('afs_electrokinetic_hacking_interface') * 45 ) + 600) * (scaling_factor(u_val('intelligence') ) ) )"
            ]
          },
          {
            "math": [
              "( ( (u_spell_level('afs_electrokinetic_hacking_interface') * 90 ) + 1800) * (scaling_factor(u_val('intelligence') ) ) )"
            ]
          }
        ]
      }
    ],
    "false_effect": [ { "run_eocs": "EOC_AFS_ELECTROKIN_REMOVE_HACKING_INTERFACE" } ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_AFS_ELECTROKIN_REMOVE_HACKING_INTERFACE",
    "condition": { "u_has_effect": "effect_afs_electrokin_hacking_interface" },
    "effect": [
      { "u_remove_item_with": "electrokinetic_electrohack_1" },
      { "u_remove_item_with": "electrokinetic_electrohack_2" },
      { "u_remove_item_with": "electrokinetic_electrohack_3" },
      { "u_remove_item_with": "electrokinetic_electrohack_4" },
      { "u_remove_item_with": "electrokinetic_electrohack_5" },
      { "u_lose_effect": "effect_afs_electrokin_hacking_interface" },
      { "run_eocs": "EOC_AFS_POWER_MAINTENANCE_MINUS_ONE" }
    ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_AFS_ELECTROKIN_HACKING_INTERFACE_SWITCHER",
    "effect": {
      "switch": { "math": [ "u_spell_level('afs_electrokinetic_hacking_interface')" ] },
      "cases": [
        {
          "case": 0,
          "effect": [ { "u_spawn_item": "electrokinetic_electrohack_1", "suppress_message": true, "force_equip": true } ]
        },
        {
          "case": 5,
          "effect": [ { "u_spawn_item": "electrokinetic_electrohack_2", "suppress_message": true, "force_equip": true } ]
        },
        {
          "case": 10,
          "effect": [ { "u_spawn_item": "electrokinetic_electrohack_3", "suppress_message": true, "force_equip": true } ]
        },
        {
          "case": 15,
          "effect": [ { "u_spawn_item": "electrokinetic_electrohack_4", "suppress_message": true, "force_equip": true } ]
        },
        {
          "case": 20,
          "effect": [ { "u_spawn_item": "electrokinetic_electrohack_5", "suppress_message": true, "force_equip": true } ]
        }
      ]
    }
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_AFS_ELECTROKIN_HACKING_INTERFACE_MAINTENANCE",
    "condition": { "u_has_effect": "effect_afs_electrokin_hacking_interface" },
    "effect": [
      { "math": [ "u_latest_channeled_power_difficulty = 4" ] },
      {
        "math": [ "u_spell_exp('afs_electrokinetic_hacking_interface')", "+=", "(maintenance_exp_factor(u_val('focus')))" ]
      },
      {
        "run_eocs": [
          "EOC_AFS_CONCENTRATION_SUCCESS_PROFICIENCY",
          "EOC_AFS_PSI_SKILL_INCREASE_ON_USE_FINALIZE",
          "EOC_AFS_CONCENTRATION_COSTS_FOCUS"
        ]
      },
      {
        "run_eocs": "EOC_AFS_ELECTROKIN_HACKING_INTERFACE_MAINTENANCE",
        "time_in_future": [
          {
            "math": [
              "( ( (u_spell_level('afs_electrokinetic_hacking_interface') * 45 ) + 600) * (scaling_factor(u_val('intelligence') ) ) )"
            ]
          },
          {
            "math": [
              "( ( (u_spell_level('afs_electrokinetic_hacking_interface') * 90 ) + 1800) * (scaling_factor(u_val('intelligence') ) ) )"
            ]
          }
        ]
      }
    ],
    "false_effect": [  ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_AFS_ELECTROKIN_PERSONAL_BATTERY_INITIATE",
    "condition": { "not": { "u_has_effect": "effect_afs_electrokin_personal_battery" } },
    "effect": [
      { "u_message": "The hair on your body stands up on end.", "type": "good" },
      { "run_eocs": [ "EOC_AFS_POWER_MAINTENANCE_MINUS_ONE" ] },
      {
        "run_eocs": "EOC_AFS_ELECTROKIN_PERSONAL_BATTERY_INV_SCANNER",
        "time_in_future": [
          {
            "math": [
              "max( ( 60 - ( ( (u_spell_level('afs_electrokinetic_personal_battery') * 2.5 ) * scaling_factor(u_val('intelligence')  ) ) ) ), 5)"
            ]
          },
          {
            "math": [
              "max( ( 240 - ( (  (u_spell_level('afs_electrokinetic_personal_battery') * 5 ) * scaling_factor(u_val('intelligence') )  ) ) ), 10)"
            ]
          }
        ]
      },
      { "u_add_effect": "effect_afs_electrokin_personal_battery", "duration": "PERMANENT" },
      {
        "run_eocs": "EOC_AFS_ELECTROKIN_PERSONAL_BATTERY_MAINTENANCE",
        "time_in_future": [
          {
            "math": [
              "min( (( ( (u_spell_level('afs_electrokinetic_personal_battery') * 45 ) + 600) * (scaling_factor(u_val('intelligence') ) ) )), 14400)"
            ]
          },
          {
            "math": [
              "min( (( ( (u_spell_level('afs_electrokinetic_personal_battery') * 90 ) + 1800) * (scaling_factor(u_val('intelligence') ) ) )), 14400)"
            ]
          }
        ]
      }
    ],
    "false_effect": [ { "run_eocs": "EOC_AFS_ELECTROKIN_REMOVE_PERSONAL_BATTERY" } ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_AFS_ELECTROKIN_REMOVE_PERSONAL_BATTERY",
    "condition": { "u_has_effect": "effect_afs_electrokin_personal_battery" },
    "effect": [ { "u_lose_effect": "effect_afs_electrokin_personal_battery" }, { "run_eocs": "EOC_AFS_POWER_MAINTENANCE_MINUS_ONE" } ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_AFS_ELECTROKIN_PERSONAL_BATTERY_INV_SCANNER",
    "condition": { "u_has_effect": "effect_afs_electrokin_personal_battery" },
    "effect": [
      {
        "run_eocs": "EOC_AFS_ELECTROKIN_PERSONAL_BATTERY_INV_SCANNER",
        "time_in_future": [
          {
            "math": [
              "max( ( 60 - ( ( (u_spell_level('afs_electrokinetic_personal_battery') * 2.5 ) * scaling_factor(u_val('intelligence')  ) ) ) ), 5)"
            ]
          },
          {
            "math": [
              "max( ( 240 - ( (  (u_spell_level('afs_electrokinetic_personal_battery') * 5 ) * scaling_factor(u_val('intelligence') )  ) ) ), 10)"
            ]
          }
        ]
      },
      { "math": [ "u_afs_electrokin_personal_battery_count = 0" ] },
      {
        "u_run_inv_eocs": "all",
        "search_data": [ { "is_chargeable": true } ],
        "true_eocs": [
          {
            "id": "EOC_AFS_ELECTROKIN_PERSONAL_BATTERY_INV_SCANNER_COUNTER",
            "effect": [ { "math": [ "u_afs_electrokin_personal_battery_count++" ] } ]
          }
        ]
      },
      { "run_eocs": "EOC_AFS_ELECTROKIN_PERSONAL_BATTERY_INV_SCANNER_FINALIZATION", "time_in_future": 1 }
    ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_AFS_ELECTROKIN_PERSONAL_BATTERY_INV_SCANNER_FINALIZATION",
    "//": "The one that actually does the charging",
    "condition": { "u_has_effect": "effect_afs_electrokin_personal_battery" },
    "effect": [
      {
        "u_run_inv_eocs": "all",
        "search_data": [ { "is_chargeable": true } ],
        "true_eocs": [
          {
            "id": "EOC_AFS_ELECTROKIN_PERSONAL_BATTERY_INV_SCANNER_VALUE_ADDED",
            "effect": [
              {
                "if": { "math": [ "u_afs_electrokin_personal_battery_count > 0" ] },
                "then": {
                  "math": [
                    "n_afs_electrokin_charging_value_counter",
                    "+=",
                    "( (u_spell_level('afs_electrokinetic_personal_battery') / 5) + 1) * scaling_factor(u_val('intelligence') ) / u_afs_electrokin_personal_battery_count"
                  ]
                }
              }
            ]
          },
          {
            "id": "EOC_AFS_LECTROKIN_PERSONAL_BATTERY_INV_SCANNER_CHARGER",
            "condition": { "math": [ "n_afs_electrokin_charging_value_counter >= 1" ] },
            "effect": [
              {
                "if": { "math": [ "n_afs_electrokin_charging_value_counter >= 5" ] },
                "then": [ { "math": [ "n_val('power')", "+=", "5" ] }, { "math": [ "n_afs_electrokin_charging_value_counter", "-=", "5" ] } ],
                "else": [
                  {
                    "if": { "math": [ "n_afs_electrokin_charging_value_counter >= 4" ] },
                    "then": [ { "math": [ "n_val('power')", "+=", "4" ] }, { "math": [ "n_afs_electrokin_charging_value_counter", "-=", "4" ] } ],
                    "else": [
                      {
                        "if": { "math": [ "n_afs_electrokin_charging_value_counter >= 3" ] },
                        "then": [ { "math": [ "n_val('power')", "+=", "3" ] }, { "math": [ "n_afs_electrokin_charging_value_counter", "-=", "3" ] } ],
                        "else": [
                          {
                            "if": { "math": [ "n_afs_electrokin_charging_value_counter >= 2" ] },
                            "then": [ { "math": [ "n_val('power')", "+=", "2" ] }, { "math": [ "n_afs_electrokin_charging_value_counter", "-=", "2" ] } ],
                            "else": [
                              {
                                "if": { "math": [ "n_afs_electrokin_charging_value_counter >= 1" ] },
                                "then": [ { "math": [ "n_val('power')", "+=", "1" ] }, { "math": [ "n_afs_electrokin_charging_value_counter", "-=", "1" ] } ]
                              }
                            ]
                          }
                        ]
                      }
                    ]
                  }
                ]
              }
            ]
          }
        ]
      }
    ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_AFS_ELECTROKIN_PERSONAL_BATTERY_MAINTENANCE",
    "condition": { "u_has_effect": "effect_afs_electrokin_personal_battery" },
    "effect": [
      { "math": [ "u_latest_channeled_power_difficulty = 5" ] },
      {
        "math": [ "u_spell_exp('afs_electrokinetic_personal_battery')", "+=", "(maintenance_exp_factor(u_val('focus')))" ]
      },
      {
        "run_eocs": [
          "EOC_AFS_CONCENTRATION_SUCCESS_PROFICIENCY",
          "EOC_AFS_PSI_SKILL_INCREASE_ON_USE_FINALIZE",
          "EOC_AFS_CONCENTRATION_COSTS_FOCUS"
        ]
      },
      {
        "run_eocs": "EOC_AFS_ELECTROKIN_PERSONAL_BATTERY_MAINTENANCE",
        "time_in_future": [
          {
            "math": [
              "min( (( ( (u_spell_level('afs_electrokinetic_personal_battery') * 45 ) + 600) * (scaling_factor(u_val('intelligence') ) ) )), 14400)"
            ]
          },
          {
            "math": [
              "min( (( ( (u_spell_level('afs_electrokinetic_personal_battery') * 90 ) + 1800) * (scaling_factor(u_val('intelligence') ) ) )), 14400)"
            ]
          }
        ]
      }
    ],
    "false_effect": [  ]
  }
]
