[
  {
    "type": "effect_on_condition",
    "id": "EOC_MOM_GAMESTART_TELEPORTATION_GATEWAY_UPDATE",
    "eoc_type": "EVENT",
    "required_event": "game_start",
    "effect": [ { "math": [ "u_teleportation_gateway_updated = 1" ] } ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_MOM_GAMELOAD_TELEPORTATION_GATEWAY_UPDATE_DONTKNOW",
    "eoc_type": "EVENT",
    "required_event": "game_load",
    "condition": {
      "and": [
        { "u_has_trait": "TELEPORTER" },
        { "math": [ "u_teleportation_gateway_updated != 1" ] },
        { "math": [ "u_spell_level('teleport_gateway') == -1" ] }
      ]
    },
    "effect": [ { "math": [ "u_teleportation_gateway_updated = 1" ] } ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_MOM_GAMELOAD_TELEPORTATION_GATEWAY_UPDATE_KNOW",
    "eoc_type": "EVENT",
    "required_event": "game_load",
    "condition": {
      "and": [
        { "u_has_trait": "TELEPORTER" },
        { "math": [ "u_teleportation_gateway_updated != 1" ] },
        { "math": [ "u_spell_level('teleport_gateway') >= 1" ] }
      ]
    },
    "effect": [
      { "math": [ "u_spell_level('teleport_area_attune') = -1" ] },
      { "math": [ "u_spell_level('teleport_gateway_legacy') = u_spell_level('teleport_gateway')" ] },
      {
        "u_message": "Your Gateway power has been updated.  Your saved locations have not been updated--you can use the Gateway (Obsolete) power to return to them and add them to the new Gateway power.",
        "popup": true
      },
      { "math": [ "u_teleportation_gateway_updated = 1" ] }
    ]
  },
  {
    "id": "telepathic_fear_self_effect",
    "type": "SPELL",
    "name": "[Ψ]Primal Terror Effect on self",
    "description": "Use a target's own inner fears against them, paralyzing them with overwhelming terror.  The effect will not last long, but is completely immobilizing while it does, and it leaves a lingering horror behind in the target.",
    "message": "",
    "teachable": false,
    "valid_targets": [ "self" ],
    "spell_class": "TELEPATH",
    "skill": "metaphysics",
    "flags": [ "PSIONIC", "CONCENTRATE", "SILENT", "NO_HANDS", "NO_LEGS", "RANDOM_DAMAGE", "NO_PROJECTILE", "IGNORE_WALLS" ],
    "difficulty": 6,
    "max_level": { "math": [ "int_to_level(1)" ] },
    "effect": "mod_moves",
    "shape": "blast",
    "//": "Complicated formula here is to produce diminishing returns, since mod_moves for too long might as well just kill the target.  Level 1 minimum is 46.5 moves lost, level 20 maximum is 625, all before Intelligence scaling",
    "min_damage": {
      "math": [
        "( ( ( (u_spell_level('telepathic_fear') * 0.25 ) * 6 ) /  ( (u_spell_level('telepathic_fear') * 0.25 ) + 3) ) * 100) * (scaling_factor(u_val('intelligence') ) ) * -1 * u_nether_attunement_power_scaling"
      ]
    },
    "max_damage": {
      "math": [
        "( ( ( (u_spell_level('telepathic_fear') * 0.25 ) * 10 ) /  ( (u_spell_level('telepathic_fear') * 0.25 ) + 3) ) * 100) * (scaling_factor(u_val('intelligence') ) ) * -1 * u_nether_attunement_power_scaling"
      ]
    }
  },
  {
    "id": "clair_astral_projection_passwall",
    "type": "SPELL",
    "name": "[Ψ]Pass Through Wall",
    "description": "Walls are no barrier to a body of pure spirit.",
    "message": "",
    "teachable": false,
    "valid_targets": [ "ground" ],
    "spell_class": "CLAIRSENTIENT",
    "skill": "metaphysics",
    "flags": [
      "PSIONIC",
      "NO_FAIL",
      "NON_MAGICAL",
      "SILENT",
      "NO_HANDS",
      "TARGET_TELEPORT",
      "IGNORE_WALLS",
      "NO_PROJECTILE",
      "NO_LEGS",
      "NO_EXPLOSION_SFX"
    ],
    "effect": "short_range_teleport",
    "shape": "blast",
    "min_range": 2,
    "max_range": 2,
    "energy_source": "STAMINA",
    "base_energy_cost": 100
  },
  {
    "id": "telepathic_fear_extra",
    "type": "SPELL",
    "name": "[Ψ]Primal Terror Effect",
    "description": "Applies a longer debuff when using Primal Terror.  It's a bug if you have it directly.",
    "message": "",
    "teachable": false,
    "flags": [ "PSIONIC", "SILENT", "RANDOM_DURATION", "NO_PROJECTILE", "IGNORE_WALLS" ],
    "max_level": { "math": [ "int_to_level(1)" ] },
    "valid_targets": [ "hostile", "ground" ],
    "effect": "attack",
    "effect_str": "effect_telepathic_primal_terror",
    "shape": "blast",
    "min_duration": {
      "math": [
        "( (u_spell_level('telepathic_fear') * 75) + 200) * (scaling_factor(u_val('intelligence') ) ) * u_nether_attunement_power_scaling"
      ]
    },
    "max_duration": {
      "math": [
        "( (u_spell_level('telepathic_fear') * 175) + 500) * (scaling_factor(u_val('intelligence') ) ) * u_nether_attunement_power_scaling"
      ]
    },
    "min_range": {
      "math": [
        "min( (( (u_spell_level('telepathic_fear') * 1.1) + 3) * (scaling_factor(u_val('intelligence') ) ) * u_nether_attunement_power_scaling), 80)"
      ]
    },
    "max_range": 80,
    "min_aoe": {
      "math": [
        "min( (( (u_spell_level('telepathic_fear') * 0.15) + 0) * (scaling_factor(u_val('intelligence') ) ) * u_nether_attunement_power_scaling), 4)"
      ]
    },
    "ignored_monster_species": [ "PSI_NULL" ]
  },
  {
    "id": "teleport_gateway_legacy",
    "type": "SPELL",
    "name": "[Ψ]Gateway (Obsolete)",
    "description": "This power is Obsolete, but you can still use it.  Teleport to an attuned location.",
    "message": "There is a long moment of darkness and terrible cold that seems like it will freeze your heart, and then you are somewhere else.",
    "teachable": false,
    "valid_targets": [ "self" ],
    "spell_class": "TELEPORTER",
    "skill": "metaphysics",
    "flags": [ "PSIONIC", "CONCENTRATE", "SILENT", "NO_HANDS", "NO_LEGS" ],
    "difficulty": 8,
    "max_level": { "math": [ "int_to_level(1)" ] },
    "effect": "translocate",
    "shape": "blast",
    "energy_source": "STAMINA",
    "base_energy_cost": 10000,
    "final_energy_cost": 6000,
    "energy_increment": -200,
    "base_casting_time": 200,
    "final_casting_time": 75,
    "casting_time_increment": -5.5
  },
  {
    "id": "teleport_area_attune",
    "type": "SPELL",
    "name": "[Ψ]Attune to Area",
    "description": "Attune to a location for later teleporting.",
    "message": "",
    "teachable": false,
    "valid_targets": [ "ground" ],
    "spell_class": "TELEPORTER",
    "skill": "metaphysics",
    "flags": [ "PSIONIC", "CONCENTRATE", "SILENT", "NO_HANDS", "NO_LEGS", "NO_FAIL" ],
    "difficulty": 1,
    "max_level": 1,
    "effect": "ter_transform",
    "effect_str": "ter_teleport_location_attune",
    "shape": "blast",
    "min_range": 1,
    "energy_source": "STAMINA",
    "base_energy_cost": 0,
    "base_casting_time": { "math": [ "2880000 - max(( u_spell_level('teleport_gateway') * 108000), 180000)" ] }
  },
  {
    "id": "vita_pain_split",
    "type": "SPELL",
    "name": "[Ψ]Damage Balancing Obsolete",
    "description": "By rerouting blood and stem cells from undamaged areas, you can lessen your most grievous wounds at the cost of weakness elsewhere.  You may also use this to control an asthma attack.\n\n\nThe power is OBSOLETE.",
    "message": "With a moment's concentration, your worst injuries heal, but you still don't feel well.",
    "teachable": false,
    "valid_targets": [ "self" ],
    "spell_class": "VITAKINETIC",
    "skill": "metaphysics",
    "flags": [ "PSIONIC", "CONCENTRATE", "SILENT", "NO_HANDS", "NO_LEGS", "NO_EXPLOSION_SFX" ],
    "difficulty": 5,
    "max_level": { "math": [ "int_to_level(1)" ] },
    "effect": "pain_split",
    "shape": "blast",
    "energy_source": "STAMINA",
    "base_energy_cost": 6500,
    "final_energy_cost": 1750,
    "energy_increment": -175,
    "base_casting_time": 200,
    "final_casting_time": 75,
    "casting_time_increment": -8
  },
  {
    "id": "vita_super_heal_healing",
    "type": "SPELL",
    "name": "Anabolic Rejuvenation Heal",
    "description": "The healing part of Anabolic Rejuvenation.",
    "valid_targets": [ "self" ],
    "teachable": false,
    "min_damage": { "math": [ "min((-1 * u_nether_attunement_power_scaling), -1)" ] },
    "max_damage": { "math": [ "min((-1 * u_nether_attunement_power_scaling), -1)" ] },
    "effect": "attack",
    "shape": "blast",
    "flags": [ "PSIONIC", "SILENT" ]
  },
  {
    "id": "vita_super_heal_drain",
    "type": "SPELL",
    "name": "Anabolic Rejuvenation draining",
    "description": "The draining part of Anabolic Rejuvenation.",
    "valid_targets": [ "self" ],
    "teachable": false,
    "effect": "effect_on_condition",
    "effect_str": "EOC_VITA_SUPER_HEAL_DRAIN",
    "shape": "blast",
    "flags": [ "PSIONIC", "SILENT" ]
  }
]
