[
  {
    "type": "effect_on_condition",
    "id": "EOC_CONDITION_CHECK_ARVORE_IN_THE_WILD_ON_OMT_ENTER",
    "eoc_type": "EVENT",
    "required_event": "avatar_enters_omt",
    "condition": { "u_has_any_trait": [ "ARVORE", "FALSE_ARVORE_HATRED", "FAE_ENMITY" ] },
    "effect": [
      {
        "run_eocs": [
          {
            "id": "EOC_CONDITION_CHECK_ARVORE_IN_THE_WILD_ON_OMT_ENTER_2",
            "condition": { "not": { "u_near_om_location": "road", "range": 2 } },
            "effect": [ { "math": [ "u_arvore_is_in_wilderness = 1" ] } ],
            "false_effect": [ { "math": [ "u_arvore_is_in_wilderness = 0" ] } ]
          }
        ]
      }
    ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_CONDITION_CHECK_ARVORE_IS_IN_FOREST_ON_OMT_ENTER",
    "eoc_type": "EVENT",
    "required_event": "avatar_enters_omt",
    "condition": { "u_has_any_trait": [ "ARVORE", "FALSE_ARVORE_HATRED", "FAE_ENMITY" ] },
    "effect": [
      {
        "run_eocs": [
          {
            "id": "EOC_CONDITION_CHECK_ARVORE_IS_IN_FOREST_ON_OMT_ENTER_2",
            "condition": {
              "or": [
                { "u_at_om_location": "forest" },
                { "u_at_om_location": "forest_thick" },
                { "u_at_om_location": "arvore_genius_loci_NW" },
                { "u_at_om_location": "arvore_genius_loci_NE" },
                { "u_at_om_location": "arvore_genius_loci_SW" },
                { "u_at_om_location": "arvore_genius_loci_SE" },
                { "u_near_om_location": "great_tree_z0_nw", "range": 2 },
                { "u_near_om_location": "great_tree_z0_se", "range": 2 },
                { "u_near_om_location": "great_tree_z1_nw", "range": 2 },
                { "u_near_om_location": "great_tree_z1_se", "range": 2 },
                { "u_near_om_location": "great_tree_z2_nw", "range": 2 },
                { "u_near_om_location": "great_tree_z2_se", "range": 2 },
                { "u_near_om_location": "great_tree_z3_06", "range": 2 },
                { "u_near_om_location": "great_tree_z3_11", "range": 2 },
                { "u_near_om_location": "great_tree_z4_06", "range": 2 },
                { "u_near_om_location": "great_tree_z4_11", "range": 2 },
                { "u_near_om_location": "great_tree_z5_06", "range": 2 },
                { "u_near_om_location": "great_tree_z5_11", "range": 2 },
                { "u_near_om_location": "great_tree_z6_nw", "range": 2 },
                { "u_near_om_location": "great_tree_z6_se", "range": 2 },
                { "u_near_om_location": "great_tree_z6_n2", "range": 2 },
                { "u_near_om_location": "great_tree_z6_se", "range": 2 },
                { "u_near_om_location": "great_tree_z7_nw", "range": 2 },
                { "u_near_om_location": "great_tree_z7_se", "range": 2 },
                { "u_near_om_location": "great_tree_crown_06", "range": 2 },
                { "u_near_om_location": "great_tree_crown_11", "range": 2 },
                { "u_near_om_location": "great_tree_crown_top_01", "range": 2 },
                { "u_near_om_location": "great_tree_crown_top_04", "range": 2 },
                { "u_near_om_location": "great_tree_roots", "range": 2 },
                { "u_near_om_location": "great_tree_roots_se", "range": 2 },
                { "u_near_om_location": "great_tree_roots_nw", "range": 2 }
              ]
            },
            "effect": [ { "math": [ "u_arvore_is_in_forest = 1" ] } ],
            "false_effect": [ { "math": [ "u_arvore_is_in_forest = 0" ] } ]
          }
        ]
      }
    ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_CONDITION_CHECK_ARVORE_ON_NATURAL_TERRAIN",
    "condition": {
      "or": [
        { "u_is_on_terrain_with_flag": "SHRUB" },
        { "u_is_on_terrain_with_flag": "DIGGABLE" },
        { "u_is_on_terrain_with_flag": "YOUNG" }
      ]
    },
    "effect": [  ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_CONDITION_CHECK_ARVORE_IN_THE_FOREST",
    "condition": { "math": [ "u_arvore_is_in_forest == 1" ] }
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_CONDITION_CHECK_ARVORE_IN_THE_WILD",
    "condition": { "math": [ "u_arvore_is_in_wilderness == 1" ] }
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_ARVORE_LOSE_PACT_OF_GREEN_IF_ATTACKING_TRIFFID",
    "eoc_type": "EVENT",
    "required_event": "monster_takes_damage",
    "condition": { "and": [ { "u_has_species": "PLANT" }, "has_beta" ] },
    "effect": [
      {
        "run_eocs": [
          {
            "id": "EOC_ARVORE_LOSE_PACT_OF_GREEN_IF_ATTACKING_TRIFFID_2",
            "condition": {
              "and": [ { "npc_has_trait": "ARVORE_TRIFFID_NEUTRALITY" }, { "not": { "npc_has_trait": "effect_arvore_attacked_a_triffid" } } ]
            },
            "effect": [ { "npc_add_effect": "effect_arvore_attacked_a_triffid", "duration": { "math": [ "10800 + rand(43200)" ] } } ]
          }
        ]
      }
    ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_ARVORE_BRIARS_SELECTOR",
    "effect": [
      {
        "run_eoc_selector": [ "EOC_ARVORE_BRIARS_SELECTOR_ARC", "EOC_ARVORE_BRIARS_SELECTOR_LINE", "EOC_NONE" ],
        "names": [ "Thorny Arc", "Wall of Brambles", "Do nothing" ],
        "keys": [ "1", "2", "3" ],
        "descriptions": [ "Summon a spray of brambles to entrap an enemy.", "Summon a wall of thorns to fortify a location.", "Do nothing." ]
      }
    ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_ARVORE_BRIARS_SELECTOR_ARC",
    "effect": [ { "u_cast_spell": { "id": "arvore_summon_briars_arc" }, "targeted": true } ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_ARVORE_BRIARS_SELECTOR_LINE",
    "effect": [ { "u_cast_spell": { "id": "arvore_summon_briars_line" }, "targeted": true } ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_COMMUNE_WITH_NATURE",
    "condition": {
      "and": [
        "u_is_outside",
        { "test_eoc": "EOC_CONDITION_CHECK_ARVORE_ON_NATURAL_TERRAIN" },
        { "test_eoc": "EOC_CONDITION_CHECK_ARVORE_IN_THE_WILD" }
      ]
    },
    "effect": [
      {
        "u_add_effect": "natures_commune",
        "duration": {
          "math": [
            "( 600 + (u_spell_level('arvore_commune_with_nature') * 240)) * scaling_factor(u_val('perception') ) * paraclesian_post_threshold_doubler(1) "
          ]
        }
      },
      { "u_lose_morale": "morale_forest_unity" },
      {
        "u_add_morale": "morale_forest_unity",
        "bonus": {
          "math": [
            "(5 + u_spell_level('arvore_commune_with_nature') ) * scaling_factor(u_val('perception') ) * paraclesian_post_threshold_doubler(1)"
          ]
        },
        "max_bonus": 40,
        "duration": {
          "math": [
            "( 600 + (u_spell_level('arvore_commune_with_nature') * 240) ) * scaling_factor(u_val('perception') ) * paraclesian_post_threshold_doubler(1)"
          ]
        },
        "decay_start": {
          "math": [
            "(( 600 + (u_spell_level('arvore_commune_with_nature') * 240) ) * scaling_factor(u_val('perception') ) *  paraclesian_post_threshold_doubler(1)) / 2"
          ]
        }
      }
    ],
    "false_effect": [ { "u_message": "You must be surrounded by nature to commune with nature.", "type": "bad" } ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_APPLY_PARACLESIAN_DODGE_BONUS",
    "effect": {
      "switch": { "math": [ "u_spell_level('paraclesian_spell_dodge_bonus')" ] },
      "cases": [
        {
          "case": 0,
          "effect": [
            {
              "u_add_effect": "effect_paraclesian_dodge_bonus_1",
              "duration": {
                "math": [ "( (u_spell_level('paraclesian_spell_dodge_bonus') * 30) + 300) * (scaling_factor(u_val('perception') ) )" ]
              }
            }
          ]
        },
        {
          "case": 15,
          "effect": [
            {
              "u_add_effect": "effect_paraclesian_dodge_bonus_2",
              "duration": {
                "math": [ "( (u_spell_level('paraclesian_spell_dodge_bonus') * 30) + 300) * (scaling_factor(u_val('perception') ) )" ]
              }
            }
          ]
        },
        {
          "case": 25,
          "effect": [
            {
              "u_add_effect": "effect_paraclesian_dodge_bonus_3",
              "duration": {
                "math": [ "( (u_spell_level('paraclesian_spell_dodge_bonus') * 30) + 300) * (scaling_factor(u_val('perception') ) )" ]
              }
            }
          ]
        }
      ]
    }
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_ARVORE_TOXIC_FLESH_ON",
    "effect": [ { "u_add_trait": "TOXICFLESH" } ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_ARVORE_TOXIC_FLESH_OFF",
    "effect": [ { "u_lose_trait": "TOXICFLESH" } ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_ARVORE_POISON_POLLEN_ON",
    "effect": [ { "u_add_effect": "effect_arvore_poison_pollen", "duration": "PERMANENT" } ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_ARVORE_POISON_POLLEN_OFF",
    "effect": [ { "u_lose_effect": "effect_arvore_poison_pollen" } ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_ARVORE_JAGGED_CLAWS_ON",
    "condition": { "not": { "u_has_trait": "ARVORE_WOOD_CLAWS_active" } },
    "effect": [ { "u_add_trait": "ARVORE_WOOD_CLAWS_active" } ],
    "false_effect": [
      { "u_lose_trait": "ARVORE_WOOD_CLAWS_active" },
      { "u_message": "The jagged wood covering your hands recedes, leaving no trace behind.", "type": "neutral" }
    ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_ARVORE_THORNSKIN_ON",
    "condition": { "not": { "u_has_trait": "ARVORE_THORN_SKIN_ON" } },
    "effect": [ { "u_add_trait": "ARVORE_THORN_SKIN_ON" }, { "u_message": "Woody thorns push through your skin.", "type": "good" } ],
    "false_effect": [
      { "u_lose_trait": "ARVORE_THORN_SKIN_ON" },
      { "u_message": "Your thorns retract, leaving smooth unbroken skin behind.", "type": "neutral" }
    ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_ARVORE_WALK_WILDS_TELEPORT_CHECK",
    "effect": [
      {
        "u_map_run_eocs": [
          {
            "id": "EOC_ARVORE_WALK_WILDS_TELEPORT_ACTION",
            "effect": [
              {
                "u_query_tile": "line_of_sight",
                "target_var": { "context_val": "arvore_walk_wilds_location" },
                "range": {
                  "math": [ "( ( (u_spell_level('arvore_traverse_the_wilds') * 1.5) + 5) * (scaling_factor(u_val('perception') ) ) )" ]
                },
                "z_level": false,
                "message": "Select tree to step to."
              },
              {
                "if": { "math": [ "has_var(_arvore_walk_wilds_location)" ] },
                "then": {
                  "if": {
                    "or": [
                      { "map_terrain_with_flag": "TREE", "loc": { "context_val": "arvore_walk_wilds_location" } },
                      { "map_terrain_with_flag": "YOUNG", "loc": { "context_val": "arvore_walk_wilds_location" } }
                    ]
                  },
                  "then": [
                    { "u_teleport": { "context_val": "arvore_walk_wilds_location" }, "force": true },
                    { "u_message": "You step into the tree and step out of another one nearby.", "type": "neutral" }
                  ],
                  "else": { "u_message": "You must select a tree to step to." }
                },
                "else": { "u_message": "Canceled" }
              }
            ],
            "false_effect": { "u_message": "You need to be standing next to a tree to traverse the wilds.", "type": "bad" }
          }
        ],
        "range": 1,
        "store_coordinates_in": { "context_val": "arvore_walk_wilds_origin" },
        "stop_at_first": true,
        "condition": { "map_terrain_with_flag": "TREE", "loc": { "context_val": "arvore_walk_wilds_origin" } }
      }
    ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_ARVORE_SUMMON_FLORAL_BOAT_CHECK",
    "effect": [
      {
        "u_map_run_eocs": [
          {
            "id": "EOC_ARVORE_SUMMON_FLORAL_BOAT_ACTION",
            "effect": [ { "u_cast_spell": { "id": "arvore_summon_floral_boat_real" }, "targeted": true } ],
            "false_effect": { "u_message": "You need a nearby tree to transform it into the viridescent vessel.", "type": "bad" }
          }
        ],
        "range": 1,
        "store_coordinates_in": { "context_val": "arvore_floral_boat_tree" },
        "stop_at_first": true,
        "condition": { "map_terrain_with_flag": "TREE", "loc": { "context_val": "arvore_floral_boat_tree" } }
      },
      {
        "u_transform_radius": 0,
        "target_var": { "context_val": "arvore_floral_boat_tree" },
        "ter_furn_transform": "ter_arvore_tree_to_grass"
      }
    ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_ARVORE_SEED_BEARER_activated",
    "condition": {
      "and": [
        "u_is_outside",
        { "test_eoc": "EOC_CONDITION_CHECK_ARVORE_ON_NATURAL_TERRAIN" },
        { "test_eoc": "EOC_CONDITION_CHECK_ARVORE_IN_THE_WILD" }
      ]
    },
    "effect": [
      {
        "if": { "and": [ { "not": { "u_has_effect": "effect_arvore_seedbearer_cooldown" } }, { "not": { "is_season": "winter" } } ] },
        "then": [
          { "u_lose_effect": "effect_arvore_seedbearer_available" },
          { "u_message": "You bring forth seeds.", "type": "good" },
          {
            "math": [ "u_arvore_seedbearer_iterations", "=", "1 + ( u_sum_traits_of_category_char_has('ARVORE') / 5)" ]
          },
          {
            "run_eocs": "EOC_ARVORE_SEED_BEARER_GIVE_SEEDS",
            "iterations": { "math": [ "u_arvore_seedbearer_iterations" ] }
          },
          { "u_add_effect": "effect_arvore_seedbearer_cooldown", "duration": { "math": [ "432000 + rand(432000)" ] } }
        ],
        "else": {
          "if": { "is_season": "winter" },
          "then": { "u_message": "Your seeds slumber and dream of spring.", "type": "mixed" },
          "else": [ { "u_message": "You need more time before you can summon seeds again.", "type": "bad" } ]
        }
      }
    ],
    "false_effect": [ { "u_message": "You must be surrounded by the wild to call forth regional seeds.", "type": "bad" } ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_ARVORE_SEED_BEARER_GIVE_SEEDS",
    "effect": { "u_spawn_item": "farming_seeds", "use_item_group": true }
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_ARVORE_SEED_BEARER_SWITCH_EFFECTS",
    "eoc_type": "EVENT",
    "required_event": "character_loses_effect",
    "condition": { "compare_string": [ "effect_arvore_seedbearer_cooldown", { "context_val": "effect" } ] },
    "effect": {
      "if": { "is_season": "winter" },
      "then": { "run_eocs": "EOC_ARVORE_SEED_BEARER_SWITCH_EFFECTS_WINTER", "time_in_future": "24 hours" },
      "else": { "u_add_effect": "effect_arvore_seedbearer_available", "duration": "PERMANENT" }
    }
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_ARVORE_SEED_BEARER_SWITCH_EFFECTS_WINTER",
    "condition": { "is_season": "winter" },
    "effect": { "run_eocs": "EOC_ARVORE_SEED_BEARER_SWITCH_EFFECTS_WINTER", "time_in_future": "24 hours" },
    "false_effect": { "u_add_effect": "effect_arvore_seedbearer_available", "duration": "PERMANENT" }
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_ARVORE_GOBLIN_FRUIT",
    "condition": {
      "and": [
        "u_is_outside",
        { "test_eoc": "EOC_CONDITION_CHECK_ARVORE_ON_NATURAL_TERRAIN" },
        { "test_eoc": "EOC_CONDITION_CHECK_ARVORE_IN_THE_WILD" }
      ]
    },
    "effect": { "u_spawn_item": "spell_spawned_goblin_fruit_arvore", "use_item_group": true, "suppress_message": true },
    "false_effect": [ { "u_message": "You must be surrounded by the wild to call forth a goblin fruit.", "type": "bad" } ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_GROWING_WOOD_WALLS_SELECTOR",
    "effect": [
      {
        "run_eoc_selector": [
          "EOC_GROWING_WOOD_WALLS",
          "EOC_GROWING_WOOD_FLOORS",
          "EOC_GROWING_WOOD_DOORS",
          "EOC_GROWING_WOOD_BRANCHES",
          "EOC_NONE"
        ],
        "names": [ "Grow Wooden Wall", "Grow Wooden Floor", "Grow Wooden Door", "Grow Leafy Branch", "Do nothing" ],
        "keys": [ "1", "2", "3", "4", "5" ],
        "descriptions": [
          "Grow a wall of solid wood from the earth, grow or remove bark from a wall, or turn one of your wooden floors into a bark wall.",
          "Grow a floor of bark from the earth, roof over a bark floor, or turn one of your wooden walls into a bark floor.",
          "Grow a bramble door from a wooden wall or return the wall to solid wood.",
          "Grow a leafy branch.  It won't provide shelter but it helps it feel like home.",
          "Do nothing."
        ]
      }
    ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_GROWING_WOOD_WALLS",
    "effect": [ { "u_cast_spell": { "id": "arvore_growing_wood_walls_wall" }, "targeted": true } ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_GROWING_WOOD_FLOORS",
    "effect": [ { "u_cast_spell": { "id": "arvore_growing_wood_walls_floor" }, "targeted": true } ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_GROWING_WOOD_BRANCHES",
    "effect": [ { "u_cast_spell": { "id": "arvore_growing_wood_walls_branch" }, "targeted": true } ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_GROWING_WOOD_DOORS",
    "effect": [ { "u_cast_spell": { "id": "arvore_growing_wood_walls_door" }, "targeted": true } ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_MIND_CONTROL_POLLEN_ON",
    "effect": { "u_add_trait": "ARVORE_MIND_CONTROL_POLLEN_ON" }
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_MIND_CONTROL_POLLEN_OFF",
    "effect": { "u_lose_trait": "ARVORE_MIND_CONTROL_POLLEN_ON" }
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_ARVORE_VINE_DRAG_activated",
    "effect": [
      {
        "run_eocs": "EOC_GENERIC_SPELL_MUTATION",
        "variables": {
          "prep_time": "1",
          "spell_to_cast": "arvore_vine_drag_spell",
          "message_success": { "i18n": true, "str": "Vines lash out and drag your target in!" },
          "message_fail": { "i18n": true, "str": "You are too parched to lash out with any vines." }
        }
      }
    ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_ARVORE_SUMMON_PRESERVATION_CONTAINER_CHECK",
    "condition": {
      "and": [
        "u_is_outside",
        { "test_eoc": "EOC_CONDITION_CHECK_ARVORE_ON_NATURAL_TERRAIN" },
        { "test_eoc": "EOC_CONDITION_CHECK_ARVORE_IN_THE_WILD" }
      ]
    },
    "effect": [ { "u_cast_spell": { "id": "arvore_summon_preservation_container_real" } } ],
    "false_effect": [ { "u_message": "You must be surrounded by nature to cast To Oppose Decay.", "type": "bad" } ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_PERENNIAL_REBIRTH_INITIAL_CHECK",
    "condition": { "not": { "u_has_effect": "arvore_perennial_rebirth_cooldown" } },
    "effect": {
      "run_eocs": [
        {
          "id": "EOC_PERENNIAL_REBIRTH_INITIAL_CHECK_2",
          "condition": {
            "or": [
              { "u_at_om_location": "forest_thick" },
              { "u_at_om_location": "arvore_genius_loci_NW" },
              { "u_at_om_location": "arvore_genius_loci_NE" },
              { "u_at_om_location": "arvore_genius_loci_SW" },
              { "u_at_om_location": "arvore_genius_loci_SE" }
            ]
          },
          "effect": { "run_eocs": "EOC_PERENNIAL_REBIRTH_INITIAL" },
          "false_effect": {
            "u_message": "You need to be in the heart of the forest or at an attuned elemental altar to successfully bind your soul.",
            "type": "bad"
          }
        }
      ]
    },
    "false_effect": [
      {
        "u_message": "Your soul is still attaching itself to your new body.  You need to give it time before attempting to bind it to the forest again.",
        "type": "bad"
      }
    ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_PERENNIAL_REBIRTH_INITIAL",
    "effect": [
      { "u_location_variable": { "u_val": "arvore_perennial_rebirth_teleport" }, "min_radius": 0, "max_radius": 0 },
      { "u_add_trait": "ARVORE_PERENNIAL_REBIRTH_CASTED" },
      { "u_message": "You bind your soul to the abundance of nature around you.", "type": "good" }
    ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_PERENNIAL_REBIRTH",
    "eoc_type": "PREVENT_DEATH",
    "condition": { "u_has_trait": "ARVORE_PERENNIAL_REBIRTH_CASTED" },
    "effect": [
      {
        "u_message": "As your body dies, your fae spirit flies free and, drawn to the pull of the heart of the forest, rebirths itself from the bounty of nature.",
        "popup": true
      },
      { "run_eocs": [ "EOC_PERENNIAL_REBIRTH_START" ] }
    ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_PERENNIAL_REBIRTH_START",
    "effect": [
      { "u_add_effect": "incorporeal", "duration": 1 },
      { "u_add_effect": "downed", "duration": 1 },
      { "run_eocs": [ "EOC_PERENNIAL_REBIRTH_HEAL" ] },
      { "u_spawn_item": "corpse_painful" },
      { "run_eocs": "EOC_PERENNIAL_REBIRTH_FINALIZE", "time_in_future": "1 seconds" }
    ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_PERENNIAL_REBIRTH_HEAL",
    "effect": [
      { "math": [ "u_hp('ALL') = 999" ] },
      { "math": [ "u_hp('ALL_MAJOR') = 45" ] },
      { "math": [ "u_calories() = 70000" ] },
      { "math": [ "u_val('thirst') = 0" ] },
      { "math": [ "u_vitamin('redcells') = 0" ] },
      { "math": [ "u_vitamin('bad_food') = 0" ] },
      { "math": [ "u_vitamin('blood') = 0" ] },
      { "math": [ "u_vitamin('instability') = 0" ] },
      { "math": [ "u_pain() = 0" ] },
      { "math": [ "u_val('rad') = 0" ] },
      {
        "u_lose_effect": [
          "corroding",
          "onfire",
          "dazed",
          "stunned",
          "venom_blind",
          "formication",
          "blisters",
          "frostbite",
          "frostbite_recovery",
          "wet",
          "slimed",
          "migo_atmosphere",
          "fetid_goop",
          "sap",
          "nausea",
          "bleed"
        ]
      }
    ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_PERENNIAL_REBIRTH_FINALIZE",
    "//": "duration below of arvore_perennial_rebirth_cooldown is 28 days",
    "condition": { "u_has_trait": "ARVORE_PERENNIAL_REBIRTH_CASTED" },
    "effect": [
      { "u_teleport": { "u_val": "arvore_perennial_rebirth_teleport" } },
      { "u_lose_trait": "ARVORE_PERENNIAL_REBIRTH_CASTED" },
      { "u_add_effect": "arvore_perennial_rebirth_cooldown", "duration": 2419200 },
      { "math": [ "u_pain() = 0" ] },
      { "math": [ "u_calories() = 65000" ] },
      { "math": [ "u_val('thirst') = 0" ] },
      {
        "foreach": "ids",
        "var": { "context_val": "id" },
        "target": "vitamin",
        "effect": [ { "math": [ "u_vitamin(_id) = 0" ] } ]
      }
    ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_ARVORE_VINES_ON",
    "effect": [ { "u_add_trait": "VINES3" } ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_ARVORE_VINES_OFF",
    "effect": [ { "u_lose_trait": "VINES3" } ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_ARVORE_SUN_FOODS_ON_KCAL",
    "//": "Numbers here based on 8 hours of time in the sun.  480 minutes * 7 kcals per minute = 3360 kcals, up to 5760 kcals per 8 hours if you're low.",
    "recurrence": [ "1 minutes", "1 minutes" ],
    "condition": { "and": [ { "u_has_trait": "ARVORE_SUN_FOODS" }, "is_day", "u_is_outside" ] },
    "deactivate_condition": { "not": { "u_has_trait": "ARVORE_SUN_FOODS" } },
    "effect": [
      {
        "if": {
          "and": [ { "math": [ "u_calories('dont_affect_weariness': true) <= 179999" ] }, { "math": [ "u_calories() >= 75000" ] } ]
        },
        "then": { "math": [ "u_calories('dont_affect_weariness': true)", "+=", "7" ] },
        "else": { "if": { "math": [ "u_calories() <= 74999" ] }, "then": { "math": [ "u_calories()", "+=", "12" ] } }
      }
    ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_ARVORE_OVERGROWTH",
    "condition": "u_is_outside",
    "effect": {
      "run_eocs": [
        {
          "id": "EOC_ARVORE_OVERGROWTH_2",
          "condition": { "math": [ "u_val('pos_z') == 0" ] },
          "effect": [
            {
              "u_transform_radius": {
                "math": [
                  "( ( (u_spell_level('arvore_overgrowth_spell') * rng(0.8,1.2)) + rng(1.5,4)) * (scaling_factor(u_val('intelligence') ) ) )"
                ]
              },
              "ter_furn_transform": "ter_arvore_overgrowth"
            }
          ],
          "false_effect": { "u_message": "You must be on the surface and not on a building's upper stories to cast Overgrowth!", "type": "bad" }
        }
      ]
    },
    "false_effect": [ { "u_message": "You must be outside to cast Overgrowth!", "type": "bad" } ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_ARVORE_DAMAGE_ZOMBIES_HEAL_LIVING",
    "condition": "npc_is_outside",
    "effect": [
      { "npc_message": "Nature's power roars forth in an explosion of vital energy!", "type": "good" },
      {
        "if": "u_is_npc",
        "then": [
          {
            "math": [
              "u_hp('arm_l')",
              "+=",
              "rng((n_spell_level('arvore_damage_zombies_heal_living') * 0.75), (n_spell_level('arvore_damage_zombies_heal_living') * 2.5)) * scaling_factor(n_val('intelligence') )"
            ]
          },
          {
            "math": [
              "u_hp('arm_r')",
              "+=",
              "rng((n_spell_level('arvore_damage_zombies_heal_living') * 0.75), (n_spell_level('arvore_damage_zombies_heal_living') * 2.5)) * scaling_factor(n_val('intelligence') )"
            ]
          },
          {
            "math": [
              "u_hp('leg_l')",
              "+=",
              "rng((n_spell_level('arvore_damage_zombies_heal_living') * 0.75), (n_spell_level('arvore_damage_zombies_heal_living') * 2.5)) * scaling_factor(n_val('intelligence') )"
            ]
          },
          {
            "math": [
              "u_hp('leg_r')",
              "+=",
              "rng((n_spell_level('arvore_damage_zombies_heal_living') * 0.75), (n_spell_level('arvore_damage_zombies_heal_living') * 2.5)) * scaling_factor(n_val('intelligence') )"
            ]
          },
          {
            "math": [
              "u_hp('torso')",
              "+=",
              "rng((n_spell_level('arvore_damage_zombies_heal_living') * 0.75), (n_spell_level('arvore_damage_zombies_heal_living') * 2.5)) * scaling_factor(n_val('intelligence') )"
            ]
          },
          {
            "math": [
              "u_hp('head')",
              "+=",
              "rng((n_spell_level('arvore_damage_zombies_heal_living') * 0.75), (n_spell_level('arvore_damage_zombies_heal_living') * 2.5)) * scaling_factor(n_val('intelligence') )"
            ]
          }
        ],
        "else": [
          {
            "if": {
              "or": [
                { "u_has_species": "PLANT" },
                { "u_has_species": "ARVORE" },
                { "u_has_species": "FERAL" },
                { "u_has_species": "SPIDER" },
                { "u_has_species": "CENTIPEDE" },
                { "u_has_species": "WORM" },
                { "u_has_species": "INSECT_FLYING" },
                { "u_has_species": "INSECT" },
                { "u_has_species": "MOLLUSK" },
                { "and": [ { "u_has_species": "MAMMAL" }, { "not": { "u_has_species": "ZOMBIE" } } ] },
                { "and": [ { "u_has_species": "BIRD" }, { "not": { "u_has_species": "ZOMBIE" } } ] },
                { "and": [ { "u_has_species": "FISH" }, { "not": { "u_has_species": "ZOMBIE" } } ] },
                { "and": [ { "u_has_species": "AMPHIBIAN" }, { "not": { "u_has_species": "ZOMBIE" } } ] },
                { "and": [ { "u_has_species": "REPTILE" }, { "not": { "u_has_species": "ZOMBIE" } } ] },
                { "and": [ { "u_has_species": "HUMAN" }, { "not": { "u_has_species": "ZOMBIE" } } ] }
              ]
            },
            "then": {
              "math": [
                "u_hp('ALL')",
                "=",
                "( (n_spell_level('arvore_damage_zombies_heal_living') * rng(12,22)) + rng(50,120)) * scaling_factor(n_val('intelligence') )"
              ]
            },
            "else": {
              "u_deal_damage": "biological",
              "amount": {
                "math": [
                  "( (n_spell_level('arvore_damage_zombies_heal_living') * rng(12,22)) + rng(50,120)) * scaling_factor(n_val('intelligence') )"
                ]
              }
            }
          }
        ]
      }
    ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_ARVORE_TREE_SINGING",
    "effect": [
      {
        "u_choose_adjacent_highlight": { "context_val": "arvore_treesung_location" },
        "condition": { "map_terrain_with_flag": "TREE", "loc": { "context_val": "loc" } },
        "message": "Select nearby tree",
        "failure_message": "You must be near a tree to treesing to it"
      },
      {
        "if": { "math": [ "has_var(_arvore_treesung_location)" ] },
        "then": { "u_assign_activity": "ACT_ARVORE_TREESINGING", "duration": "45 minutes" }
      }
    ]
  },
  {
    "id": "ACT_ARVORE_TREESINGING",
    "type": "activity_type",
    "activity_level": "LIGHT_EXERCISE",
    "verb": "treesinging",
    "based_on": "time",
    "can_resume": false,
    "rooted": true,
    "completion_eoc": "EOC_ARVORE_TREE_SINGING_COMPLETE"
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_ARVORE_TREE_SINGING_COMPLETE",
    "effect": [
      {
        "u_message": "As your song fades, you open your eyes to find a large growth of wood lying on the ground in front of you, separated from the tree without violence.",
        "type": "good"
      },
      { "u_spawn_item": "log_treesung", "count": 1, "suppress_message": true }
    ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_ARVORE_TREE_SINGING_LEARN_RECIPES",
    "recurrence": [ "6 h", "36 h" ],
    "condition": {
      "and": [
        { "u_has_trait": "ARVORE" },
        { "math": [ "u_spell_level('arvore_tree_singing_spell') >= 1" ] },
        {
          "or": [
            { "not": { "u_know_recipe": "create_chair_wood_treesung" } },
            { "not": { "u_know_recipe": "create_wardrobe_wood_treesung" } },
            { "not": { "u_know_recipe": "create_table_wood_treesung" } },
            { "not": { "u_know_recipe": "create_bedframe_wood_treesung" } },
            { "not": { "u_know_recipe": "create_verdant_helm" } },
            { "not": { "u_know_recipe": "create_verdant_cuirass" } },
            { "not": { "u_know_recipe": "create_verdant_gauntlets" } },
            { "not": { "u_know_recipe": "create_verdant_leg_guards" } },
            { "not": { "u_know_recipe": "create_verdant_boots" } },
            { "not": { "u_know_recipe": "create_verdant_cloak" } },
            { "not": { "u_know_recipe": "create_shortbow_treesung" } },
            { "not": { "u_know_recipe": "create_greatbow_treesung" } },
            { "not": { "u_know_recipe": "create_arrow_treesung" } },
            { "not": { "u_know_recipe": "create_spear_treesung" } },
            { "not": { "u_know_recipe": "create_pike_treesung" } },
            { "not": { "u_know_recipe": "create_mace_treesung" } },
            { "not": { "u_know_recipe": "create_q_staff_treesung" } },
            { "not": { "u_know_recipe": "create_naginata_treesung" } },
            { "not": { "u_know_recipe": "create_baselard_treesung" } }
          ]
        },
        {
          "or": [
            {
              "and": [
                "u_is_outside",
                { "not": { "math": [ "u_val('pos_z') <= -1" ] } },
                { "u_near_om_location": "forest", "range": 2 },
                { "not": { "u_at_om_location": "field" } }
              ]
            },
            {
              "and": [
                "u_is_outside",
                { "not": { "math": [ "u_val('pos_z') <= -1" ] } },
                { "u_near_om_location": "forest_thick", "range": 2 },
                { "not": { "u_at_om_location": "field" } }
              ]
            },
            { "u_is_on_terrain": "t_barkfloor" },
            { "test_eoc": "EOC_CONDITION_CHECK_ARVORE_IN_THE_FOREST" }
          ]
        }
      ]
    },
    "deactivate_condition": { "not": { "u_has_trait": "ARVORE" } },
    "effect": [
      {
        "u_roll_remainder": [
          "create_chair_wood_treesung",
          "create_wardrobe_wood_treesung",
          "create_table_wood_treesung",
          "create_bedframe_wood_treesung",
          "create_verdant_helm",
          "create_verdant_cuirass",
          "create_verdant_gauntlets",
          "create_verdant_leg_guards",
          "create_verdant_boots",
          "create_verdant_cloak",
          "create_shortbow_treesung",
          "create_greatbow_treesung",
          "create_arrow_treesung",
          "create_spear_treesung",
          "create_pike_treesung",
          "create_mace_treesung",
          "create_q_staff_treesung",
          "create_naginata_treesung",
          "create_baselard_treesung"
        ],
        "type": "recipe"
      },
      { "u_message": "The trees whisper their knowledge of a recipe to you", "type": "good" }
    ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_ARVORE_TREE_FORM_ON",
    "condition": { "and": [ "u_is_outside", { "test_eoc": "EOC_CONDITION_CHECK_ARVORE_ON_NATURAL_TERRAIN" } ] },
    "effect": [ { "u_add_trait": "CHLOROMORPH" }, { "u_add_trait": "LEAVES3" }, { "u_add_trait": "ARVORE_TREE_FORM_TRAITS" } ],
    "false_effect": [ { "u_message": "You must be outside on diggable ground to become one with the forest.", "type": "bad" } ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_ARVORE_TREE_FORM_OFF",
    "effect": [
      { "u_lose_trait": "CHLOROMORPH" },
      { "u_lose_trait": "LEAVES3" },
      { "u_lose_trait": "ARVORE_TREE_FORM_TRAITS" },
      { "u_lose_effect": "effect_arvore_tree_immobility" }
    ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_ARVORE_TREE_FORM_IMMOBILE",
    "effect": [ { "u_add_effect": "effect_arvore_tree_immobility", "duration": 86400, "intensity": 50000 } ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_ARVORE_TREE_REDUCE_THIRST",
    "recurrence": [ "3 minutes", "3 minutes" ],
    "condition": { "u_has_trait": "ARVORE_TREE_FORM_TRAITS" },
    "deactivate_condition": { "not": { "u_has_trait": "ARVORE_TREE_FORM_TRAITS" } },
    "effect": [ { "if": { "math": [ "u_val('thirst') >= -50" ] }, "then": { "math": [ "u_val('thirst')", "-=", "1" ] } } ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_ARVORE_VERDANT_IMPRISONMENT",
    "condition": "u_is_outside",
    "effect": [ { "run_eocs": "EOC_ARVORE_VERDANT_IMPRISONMENT_2" } ],
    "false_effect": [ { "npc_message": "Your target must be outdoors to transform them into a tree." } ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_ARVORE_VERDANT_IMPRISONMENT_2",
    "condition": { "not": "u_is_npc" },
    "effect": [
      { "math": [ "u_arvore_turn_into_tree_intelligence = ( ( n_val('intelligence') + 10) / 20 )" ] },
      { "math": [ "u_arvore_turn_into_tree_spell_level = n_spell_level('arvore_turn_into_tree')" ] },
      {
        "u_location_variable": { "global_val": "arvore_tree_transform_target" },
        "x_adjust": 0,
        "y_adjust": 0,
        "z_adjust": 0
      },
      { "u_cast_spell": { "id": "arvore_turn_into_tree_banish", "message": "" } },
      {
        "run_eocs": "EOC_NONE",
        "beta_loc": { "global_val": "arvore_tree_transform_target" },
        "false_eocs": "EOC_ARVORE_VERDANT_IMPRISONMENT_SUCCESS"
      }
    ],
    "false_effect": [
      {
        "math": [
          "u_arvore_turn_into_tree_damage",
          "=",
          "rng(((25 + (n_spell_level('arvore_turn_into_tree') * 5)) * ( ( n_val('intelligence') + 10) / 20 )),((100 + (n_spell_level('arvore_turn_into_tree') * 15)) * ( ( n_val('intelligence') + 10) / 20 )))"
        ]
      },
      {
        "math": [
          "u_health_comparison",
          "=",
          "(u_hp('arm_l') + u_hp('arm_r') + u_hp('leg_l') + u_hp('leg_r') + u_hp('torso') + u_hp('head')) / 3"
        ]
      },
      {
        "u_location_variable": { "global_val": "arvore_tree_transform_target" },
        "x_adjust": 0,
        "y_adjust": 0,
        "z_adjust": 0
      },
      {
        "if": { "math": [ "u_arvore_turn_into_tree_damage > u_health_comparison" ] },
        "then": [
          "u_die",
          {
            "u_map_run_item_eocs": "all",
            "min_radius": 0,
            "max_radius": 0,
            "true_eocs": [ { "id": "EOC_ARVORE_VERDANT_IMPRISONMENT_DELETE_NPC_ITEMS", "effect": [ "npc_die" ] } ]
          },
          {
            "run_eocs": "EOC_NONE",
            "beta_loc": { "global_val": "arvore_tree_transform_target" },
            "false_eocs": "EOC_ARVORE_VERDANT_IMPRISONMENT_SUCCESS"
          }
        ]
      }
    ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_ARVORE_VERDANT_IMPRISONMENT_SUCCESS",
    "effect": [
      {
        "u_transform_radius": 0,
        "ter_furn_transform": "ter_arvore_verdant_tree_transform",
        "target_var": { "global_val": "arvore_tree_transform_target" }
      }
    ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_ARVORE_ROOT_TO_ROOT_TRANSLOCATE_CHECK",
    "condition": {
      "and": [
        "u_is_outside",
        { "test_eoc": "EOC_CONDITION_CHECK_ARVORE_IN_THE_FOREST" },
        { "not": { "u_at_om_location": "field" } }
      ]
    },
    "effect": [ { "u_cast_spell": { "id": "paraclesian_translocate" } } ],
    "false_effect": [ { "u_message": "You must be outdoors and within the depths of the forest to cast this spell.", "type": "mixed" } ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_ARVORE_ROOT_TO_ROOT_ATTUNEMENT_CHECK",
    "condition": {
      "and": [
        "u_is_outside",
        { "test_eoc": "EOC_CONDITION_CHECK_ARVORE_IN_THE_FOREST" },
        { "not": { "u_at_om_location": "field" } }
      ]
    },
    "effect": [ { "u_cast_spell": { "id": "arvore_forest_translocate_attune_real" }, "targeted": true } ],
    "false_effect": [ { "u_message": "You must be outdoors and within the depths of the forest to cast this spell.", "type": "mixed" } ]
  }
]
