[
  {
    "type": "effect_on_condition",
    "id": "EOC_PROSTHETIC_RIGHT_WEAR",
    "condition": {
      "and": [
        { "u_has_trait": "NO_RIGHT_LEG" },
        { "or": [ { "u_has_trait": "RIGHT_PROSTHETIC_LEG" }, { "u_has_trait": "RIGHT_PEG_LEG" } ] }
      ]
    },
    "effect": [
      { "u_lose_trait": "NO_RIGHT_LEG" },
      { "u_add_var": "missing_right_leg", "type": "traits", "context": "limbs", "value": "yes" }
    ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_PROSTHETIC_RIGHT_REMOVE",
    "recurrence": 5,
    "condition": {
      "and": [
        { "not": { "u_has_trait": "RIGHT_PROSTHETIC_LEG" } },
        { "not": { "u_has_trait": "RIGHT_PEG_LEG" } },
        { "u_has_var": "missing_right_leg", "type": "traits", "context": "limbs", "value": "yes" }
      ]
    },
    "effect": [ { "u_add_trait": "NO_RIGHT_LEG" } ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_PROSTHETIC_LEFT_WEAR",
    "condition": {
      "and": [
        { "u_has_trait": "NO_LEFT_LEG" },
        { "or": [ { "u_has_trait": "LEFT_PROSTHETIC_LEG" }, { "u_has_trait": "LEFT_PEG_LEG" } ] }
      ]
    },
    "effect": [
      { "u_lose_trait": "NO_LEFT_LEG" },
      { "u_add_var": "missing_left_leg", "type": "traits", "context": "limbs", "value": "yes" }
    ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_PROSTHETIC_LEFT_REMOVE",
    "recurrence": 5,
    "condition": {
      "and": [
        { "not": { "u_has_trait": "LEFT_PROSTHETIC_LEG" } },
        { "not": { "u_has_trait": "LEFT_PEG_LEG" } },
        { "u_has_var": "missing_left_leg", "type": "traits", "context": "limbs", "value": "yes" }
      ]
    },
    "effect": [ { "u_add_trait": "NO_LEFT_LEG" } ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_PROSTHETIC_RIGHT_ARM_WEAR",
    "condition": {
      "and": [
        { "u_has_trait": "NO_RIGHT_ARM" },
        {
          "or": [
            { "u_has_trait": "RIGHT_PROSTHETIC_ARM" },
            { "u_has_trait": "RIGHT_NEUROPROSTHETIC_ARM" },
            { "u_has_trait": "RIGHT_COSMETIC_PROSTHETIC_ARM" }
          ]
        }
      ]
    },
    "effect": [
      { "u_lose_trait": "NO_RIGHT_ARM" },
      { "u_add_var": "missing_right_arm", "type": "traits", "context": "limbs", "value": "yes" }
    ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_PROSTHETIC_RIGHT_ARM_REMOVE",
    "recurrence": 5,
    "condition": {
      "and": [
        { "not": { "u_has_trait": "RIGHT_PROSTHETIC_ARM" } },
        { "not": { "u_has_trait": "RIGHT_NEUROPROSTHETIC_ARM" } },
        { "not": { "u_has_trait": "RIGHT_COSMETIC_PROSTHETIC_ARM" } },
        { "u_has_var": "missing_right_arm", "type": "traits", "context": "limbs", "value": "yes" }
      ]
    },
    "effect": [ { "u_add_trait": "NO_RIGHT_ARM" } ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_PROSTHETIC_LEFT_ARM_WEAR",
    "condition": {
      "and": [
        { "u_has_trait": "NO_LEFT_ARM" },
        {
          "or": [
            { "u_has_trait": "LEFT_PROSTHETIC_ARM" },
            { "u_has_trait": "LEFT_NEUROPROSTHETIC_ARM" },
            { "u_has_trait": "LEFT_COSMETIC_PROSTHETIC_ARM" }
          ]
        }
      ]
    },
    "effect": [
      { "u_lose_trait": "NO_LEFT_ARM" },
      { "u_add_var": "missing_left_arm", "type": "traits", "context": "limbs", "value": "yes" }
    ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_PROSTHETIC_LEFT_ARM_REMOVE",
    "recurrence": 5,
    "condition": {
      "and": [
        { "not": { "u_has_trait": "LEFT_PROSTHETIC_ARM" } },
        { "not": { "u_has_trait": "LEFT_NEUROPROSTHETIC_ARM" } },
        { "not": { "u_has_trait": "LEFT_COSMETIC_PROSTHETIC_ARM" } },
        { "u_has_var": "missing_left_arm", "type": "traits", "context": "limbs", "value": "yes" }
      ]
    },
    "effect": [ { "u_add_trait": "NO_LEFT_ARM" } ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_DUMMY_LIMB_LEFT_ARM_ADD",
    "eoc_type": "EVENT",
    "required_event": "game_begin",
    "condition": {
      "and": [
        { "not": { "u_has_trait": "NO_LEFT_ARM" } },
        { "not": { "u_has_trait": "LEFT_PROSTHETIC_ARM" } },
        { "not": { "u_has_trait": "LEFT_NEUROPROSTHETIC_ARM" } },
        { "not": { "u_has_trait": "LEFT_COSMETIC_PROSTHETIC_ARM" } }
      ]
    },
    "deactivate_condition": {
      "or": [
        { "u_has_trait": "NO_LEFT_ARM" },
        { "u_has_trait": "LEFT_PROSTHETIC_ARM" },
        { "u_has_trait": "LEFT_NEUROPROSTHETIC_ARM" },
        { "u_has_trait": "LEFT_COSMETIC_PROSTHETIC_ARM" },
        { "u_has_trait": "HAS_LEFT_ARM" }
      ]
    },
    "effect": [ { "u_add_trait": "HAS_LEFT_ARM" } ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_DUMMY_LIMB_RIGHT_ARM_ADD",
    "eoc_type": "EVENT",
    "required_event": "game_begin",
    "condition": {
      "and": [
        { "not": { "u_has_trait": "NO_RIGHT_ARM" } },
        { "not": { "u_has_trait": "RIGHT_PROSTHETIC_ARM" } },
        { "not": { "u_has_trait": "RIGHT_NEUROPROSTHETIC_ARM" } },
        { "not": { "u_has_trait": "RIGHT_COSMETIC_PROSTHETIC_ARM" } }
      ]
    },
    "deactivate_condition": {
      "or": [
        { "u_has_trait": "NO_RIGHT_ARM" },
        { "u_has_trait": "RIGHT_PROSTHETIC_ARM" },
        { "u_has_trait": "RIGHT_NEUROPROSTHETIC_ARM" },
        { "u_has_trait": "RIGHT_COSMETIC_PROSTHETIC_ARM" },
        { "u_has_trait": "HAS_RIGHT_ARM" }
      ]
    },
    "effect": [ { "u_add_trait": "HAS_RIGHT_ARM" } ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_DUMMY_LIMB_LEFT_LEG_ADD",
    "eoc_type": "EVENT",
    "required_event": "game_start",
    "condition": {
      "and": [
        { "not": { "u_has_trait": "NO_LEFT_LEG" } },
        { "not": { "u_has_trait": "LEFT_PROSTHETIC_LEG" } },
        { "not": { "u_has_trait": "LEFT_PEG_LEG" } }
      ]
    },
    "deactivate_condition": {
      "or": [ { "u_has_trait": "NO_LEFT_LEG" }, { "u_has_trait": "LEFT_PROSTHETIC_LEG" }, { "u_has_trait": "HAS_LEFT_LEG" } ]
    },
    "effect": [ { "u_add_trait": "HAS_LEFT_LEG" } ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_DUMMY_LIMB_RIGHT_LEG_ADD",
    "eoc_type": "EVENT",
    "required_event": "game_start",
    "condition": {
      "and": [
        { "not": { "u_has_trait": "NO_RIGHT_LEG" } },
        { "not": { "u_has_trait": "RIGHT_PROSTHETIC_LEG" } },
        { "not": { "u_has_trait": "RIGHT_PEG_LEG" } }
      ]
    },
    "deactivate_condition": {
      "or": [ { "u_has_trait": "NO_RIGHT_LEG" }, { "u_has_trait": "RIGHT_PROSTHETIC_LEG" }, { "u_has_trait": "HAS_RIGHT_LEG" } ]
    },
    "effect": [ { "u_add_trait": "HAS_RIGHT_LEG" } ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_PROSTHETIC_HIT",
    "eoc_type": "EVENT",
    "required_event": "character_takes_damage",
    "condition": {
      "or": [
        { "u_has_trait": "LEFT_PROSTHETIC_LEG" },
        { "u_has_trait": "LEFT_PEG_LEG" },
        { "u_has_trait": "RIGHT_PROSTHETIC_LEG" },
        { "u_has_trait": "RIGHT_PEG_LEG" },
        { "u_has_trait": "RIGHT_PROSTHETIC_ARM" },
        { "u_has_trait": "LEFT_PROSTHETIC_ARM" },
        { "u_has_trait": "RIGHT_NEUROPROSTHETIC_ARM" },
        { "u_has_trait": "LEFT_NEUROPROSTHETIC_ARM" },
        { "u_has_trait": "RIGHT_COSMETIC_PROSTHETIC_ARM" },
        { "u_has_trait": "LEFT_COSMETIC_PROSTHETIC_ARM" }
      ]
    },
    "effect": [
      {
        "u_run_inv_eocs": "random",
        "search_data": [ { "id": "left_leg_prosthetic", "worn_only": true } ],
        "true_eocs": [ "EOC_left_leg_hp_set" ]
      },
      {
        "u_run_inv_eocs": "random",
        "search_data": [ { "id": "right_leg_prosthetic", "worn_only": true } ],
        "true_eocs": [ "EOC_right_leg_hp_set" ]
      },
      {
        "u_run_inv_eocs": "random",
        "search_data": [ { "id": "left_peg_leg", "worn_only": true } ],
        "true_eocs": [ "EOC_left_peg_leg_hp_set" ]
      },
      {
        "u_run_inv_eocs": "random",
        "search_data": [ { "id": "right_peg_leg", "worn_only": true } ],
        "true_eocs": [ "EOC_right_peg_leg_hp_set" ]
      },
      {
        "u_run_inv_eocs": "random",
        "search_data": [ { "id": "left_arm_prosthetic", "worn_only": true } ],
        "true_eocs": [ "EOC_left_arm_hp_set" ]
      },
      {
        "u_run_inv_eocs": "random",
        "search_data": [ { "id": "right_arm_prosthetic", "worn_only": true } ],
        "true_eocs": [ "EOC_right_arm_hp_set" ]
      },
      {
        "u_run_inv_eocs": "random",
        "search_data": [ { "id": "left_arm_prosthetic_steel", "worn_only": true } ],
        "true_eocs": [ "EOC_left_arm_hp_set" ]
      },
      {
        "u_run_inv_eocs": "random",
        "search_data": [ { "id": "right_arm_prosthetic_steel", "worn_only": true } ],
        "true_eocs": [ "EOC_right_arm_hp_set" ]
      },
      {
        "u_run_inv_eocs": "random",
        "search_data": [ { "id": "left_arm_neuroprosthetic", "worn_only": true } ],
        "true_eocs": [ "EOC_left_neuroarm_hp_set" ]
      },
      {
        "u_run_inv_eocs": "random",
        "search_data": [ { "id": "right_arm_neuroprosthetic", "worn_only": true } ],
        "true_eocs": [ "EOC_right_neuroarm_hp_set" ]
      },
      {
        "u_run_inv_eocs": "random",
        "search_data": [ { "id": "left_arm_prosthetic_wood", "worn_only": true } ],
        "true_eocs": [ "EOC_left_cosmetic_arm_hp_set" ]
      },
      {
        "u_run_inv_eocs": "random",
        "search_data": [ { "id": "right_arm_prosthetic_wood", "worn_only": true } ],
        "true_eocs": [ "EOC_right_cosmetic_arm_hp_set" ]
      }
    ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_left_leg_hp_set",
    "effect": [ { "math": [ "n_hp('ALL')", "=", "u_hp('leg_prosthetic_l') * n_hp_max('bp_null') / u_hp_max('leg_prosthetic_l')" ] } ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_right_leg_hp_set",
    "effect": [ { "math": [ "n_hp('ALL')", "=", "u_hp('leg_prosthetic_r') * n_hp_max('bp_null') / u_hp_max('leg_prosthetic_r')" ] } ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_left_peg_leg_hp_set",
    "effect": [ { "math": [ "n_hp('ALL')", "=", "u_hp('leg_peg_l') * n_hp_max('bp_null') / u_hp_max('leg_peg_l')" ] } ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_right_peg_leg_hp_set",
    "effect": [ { "math": [ "n_hp('ALL')", "=", "u_hp('leg_peg_r') * n_hp_max('bp_null') / u_hp_max('leg_peg_r')" ] } ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_left_arm_hp_set",
    "effect": [ { "math": [ "n_hp('ALL')", "=", "u_hp('arm_prosthetic_l') * n_hp_max('bp_null') / u_hp_max('arm_prosthetic_l')" ] } ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_right_arm_hp_set",
    "effect": [ { "math": [ "n_hp('ALL')", "=", "u_hp('arm_prosthetic_r') * n_hp_max('bp_null') / u_hp_max('arm_prosthetic_r')" ] } ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_right_neuroarm_hp_set",
    "effect": [
      {
        "math": [ "n_hp('ALL')", "=", "u_hp('arm_neuroprosthetic_r') * n_hp_max('bp_null') / u_hp_max('arm_neuroprosthetic_r')" ]
      }
    ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_left_neuroarm_hp_set",
    "effect": [
      {
        "math": [ "n_hp('ALL')", "=", "u_hp('arm_neuroprosthetic_l') * n_hp_max('bp_null') / u_hp_max('arm_neuroprosthetic_l')" ]
      }
    ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_right_cosmetic_arm_hp_set",
    "effect": [
      {
        "math": [
          "n_hp('ALL')",
          "=",
          "u_hp('arm_prosthetic_cosmetic_r') * n_hp_max('bp_null') / u_hp_max('arm_prosthetic_cosmetic_r')"
        ]
      }
    ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_left_cosmetic_arm_hp_set",
    "effect": [
      {
        "math": [
          "n_hp('ALL')",
          "=",
          "u_hp('arm_prosthetic_cosmetic_l') * n_hp_max('bp_null') / u_hp_max('arm_prosthetic_cosmetic_l')"
        ]
      }
    ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_MUTATE_ARM_HEAL_TRIGGER_1",
    "eoc_type": "EVENT",
    "required_event": "gains_mutation",
    "effect": [ { "run_eocs": "EOC_MUTATE_ARM_HEAL" } ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_MUTATE_ARM_HEAL_TRIGGER_2",
    "eoc_type": "EVENT",
    "required_event": "evolves_mutation",
    "effect": [ { "run_eocs": "EOC_MUTATE_ARM_HEAL" } ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_MUTATE_ARM_HEAL",
    "condition": {
      "and": [
        {
          "or": [
            { "u_has_trait": "INSECT_ARMS" },
            { "u_has_trait": "INSECT_ARMS_OK" },
            { "u_has_trait": "ARACHNID_ARMS" },
            { "u_has_trait": "ARACHNID_ARMS_OK" },
            { "u_has_trait": "AMORPHOUS" },
            { "u_has_trait": "ARM_TENTACLES" },
            { "u_has_trait": "ARM_TENTACLES_4" },
            { "u_has_trait": "ARM_TENTACLES_8" }
          ]
        }
      ]
    },
    "effect": [
      { "u_lose_trait": "NO_LEFT_ARM" },
      { "u_lose_trait": "NO_RIGHT_ARM" },
      { "u_add_trait": "HAS_LEFT_ARM" },
      { "u_add_trait": "HAS_RIGHT_ARM" },
      { "u_lose_var": "missing_left_arm", "type": "traits", "context": "limbs" },
      { "u_lose_var": "missing_right_arm", "type": "traits", "context": "limbs" }
    ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_MUTATE_LEG_HEAL_TRIGGER_1",
    "eoc_type": "EVENT",
    "required_event": "gains_mutation",
    "effect": [ { "run_eocs": "EOC_MUTATE_LEG_HEAL" } ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_MUTATE_LEG_HEAL_TRIGGER_2",
    "eoc_type": "EVENT",
    "required_event": "evolves_mutation",
    "effect": [ { "run_eocs": "EOC_MUTATE_LEG_HEAL" } ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_MUTATE_LEG_HEAL",
    "condition": {
      "and": [
        {
          "or": [
            { "u_has_trait": "CRAB_LEGS" },
            { "u_has_trait": "GASTROPOD_FOOT" },
            { "u_has_trait": "AMORPHOUS" },
            { "u_has_trait": "ROOTS1" },
            { "u_has_trait": "LEG_TENTACLES" }
          ]
        }
      ]
    },
    "effect": [
      { "u_lose_trait": "NO_LEFT_LEG" },
      { "u_lose_trait": "NO_RIGHT_LEG" },
      { "u_add_trait": "HAS_LEFT_LEG" },
      { "u_add_trait": "HAS_RIGHT_LEG" },
      { "u_lose_var": "missing_left_leg", "type": "traits", "context": "limbs" },
      { "u_lose_var": "missing_right_leg", "type": "traits", "context": "limbs" }
    ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_PROSTHETIC_EFFECT_BLOCK_SETUP",
    "effect": [
      {
        "if": { "or": [ { "u_has_trait": "RIGHT_PROSTHETIC_LEG" }, { "u_has_trait": "RIGHT_PEG_LEG" } ] },
        "then": { "u_add_effect": "prosthetic_leg_r_fake_blocker", "duration": "PERMANENT", "target_part": "leg_prosthetic_r" },
        "else": {
          "if": { "and": [ { "not": { "u_has_trait": "RIGHT_PROSTHETIC_LEG" } }, { "not": { "u_has_trait": "RIGHT_PEG_LEG" } } ] },
          "then": { "u_lose_effect": "prosthetic_leg_r_fake_blocker" }
        }
      },
      {
        "if": { "or": [ { "u_has_trait": "LEFT_PROSTHETIC_LEG" }, { "u_has_trait": "LEFT_PEG_LEG" } ] },
        "then": { "u_add_effect": "prosthetic_leg_l_fake_blocker", "duration": "PERMANENT", "target_part": "leg_prosthetic_l" },
        "else": {
          "if": { "and": [ { "not": { "u_has_trait": "LEFT_PROSTHETIC_LEG" } }, { "not": { "u_has_trait": "LEFT_PEG_LEG" } } ] },
          "then": { "u_lose_effect": "prosthetic_leg_l_fake_blocker" }
        }
      },
      {
        "if": { "u_has_trait": "RIGHT_PROSTHETIC_ARM" },
        "then": { "u_add_effect": "prosthetic_arm_r_fake_blocker", "duration": "PERMANENT", "target_part": "arm_prosthetic_r" },
        "else": {
          "if": { "u_has_trait": "RIGHT_NEUROPROSTHETIC_ARM" },
          "then": { "u_add_effect": "prosthetic_arm_r_fake_blocker", "duration": "PERMANENT", "target_part": "arm_neuroprosthetic_r" },
          "else": {
            "if": { "u_has_trait": "RIGHT_COSMETIC_PROSTHETIC_ARM" },
            "then": { "u_add_effect": "prosthetic_arm_r_fake_blocker", "duration": "PERMANENT", "target_part": "arm_prosthetic_cosmetic_r" },
            "else": {
              "if": {
                "and": [
                  { "not": { "u_has_trait": "RIGHT_PROSTHETIC_ARM" } },
                  { "not": { "u_has_trait": "RIGHT_NEUROPROSTHETIC_ARM" } },
                  { "not": { "u_has_trait": "RIGHT_COSMETIC_PROSTHETIC_ARM" } }
                ]
              },
              "then": { "u_lose_effect": "prosthetic_arm_r_fake_blocker" }
            }
          }
        }
      },
      {
        "if": { "u_has_trait": "LEFT_PROSTHETIC_ARM" },
        "then": { "u_add_effect": "prosthetic_arm_l_fake_blocker", "duration": "PERMANENT", "target_part": "arm_prosthetic_l" },
        "else": {
          "if": { "u_has_trait": "LEFT_NEUROPROSTHETIC_ARM" },
          "then": { "u_add_effect": "prosthetic_arm_l_fake_blocker", "duration": "PERMANENT", "target_part": "arm_neuroprosthetic_l" },
          "else": {
            "if": { "u_has_trait": "LEFT_COSMETIC_PROSTHETIC_ARM" },
            "then": { "u_add_effect": "prosthetic_arm_l_fake_blocker", "duration": "PERMANENT", "target_part": "arm_prosthetic_cosmetic_l" },
            "else": {
              "if": {
                "and": [
                  { "not": { "u_has_trait": "LEFT_PROSTHETIC_ARM" } },
                  { "not": { "u_has_trait": "LEFT_NEUROPROSTHETIC_ARM" } },
                  { "not": { "u_has_trait": "LEFT_COSMETIC_PROSTHETIC_ARM" } }
                ]
              },
              "then": { "u_lose_effect": "prosthetic_arm_l_fake_blocker" }
            }
          }
        }
      }
    ]
  }
]
