[
  {
    "type": "effect_on_condition",
    "id": "EOC_perk_blood_drinking_heal",
    "eoc_type": "EVENT",
    "required_event": "character_eats_item",
    "condition": {
      "and": [
        {
          "or": [
            { "compare_string": [ "blood", { "context_val": "itype" } ] },
            { "compare_string": [ "animal_blood", { "context_val": "itype" } ] },
            { "compare_string": [ "demihuman_blood", { "context_val": "itype" } ] },
            { "compare_string": [ "mutant_human_blood", { "context_val": "itype" } ] }
          ]
        },
        { "u_has_trait": "perk_blood_drinking_heal" }
      ]
    },
    "effect": [ { "math": [ "u_pain()", "-=", "2" ] }, { "run_eocs": "EOC_perk_blood_drinking_heal_hp_check" } ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_perk_blood_drinking_heal_hp_check",
    "condition": {
      "or": [
        { "math": [ "u_hp('arm_l') < u_hp_max('arm_l')" ] },
        { "math": [ "u_hp('arm_r') < u_hp_max('arm_r')" ] },
        { "math": [ "u_hp('leg_l') < u_hp_max('leg_l')" ] },
        { "math": [ "u_hp('leg_r') < u_hp_max('leg_r')" ] },
        { "math": [ "u_hp('torso') < u_hp_max('torso')" ] },
        { "math": [ "u_hp('head') < u_hp_max('head')" ] }
      ]
    },
    "effect": [
      {
        "switch": { "math": [ "rand(5)" ] },
        "cases": [
          { "case": 0, "effect": { "run_eocs": "EOC_perk_blood_drinking_heal_arm_l" } },
          { "case": 1, "effect": { "run_eocs": "EOC_perk_blood_drinking_heal_arm_r" } },
          { "case": 2, "effect": { "run_eocs": "EOC_perk_blood_drinking_heal_leg_l" } },
          { "case": 3, "effect": { "run_eocs": "EOC_perk_blood_drinking_heal_leg_r" } },
          { "case": 4, "effect": { "run_eocs": "EOC_perk_blood_drinking_heal_torso" } },
          { "case": 5, "effect": { "run_eocs": "EOC_perk_blood_drinking_heal_head" } }
        ]
      }
    ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_perk_blood_drinking_heal_arm_l",
    "condition": { "math": [ "u_hp('arm_l') < u_hp_max('arm_l')" ] },
    "effect": [ { "math": [ "u_hp('arm_l')", "+=", "2" ] } ],
    "false_effect": [ { "run_eocs": "EOC_perk_blood_drinking_heal_hp_check" } ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_perk_blood_drinking_heal_arm_r",
    "condition": { "math": [ "u_hp('arm_r') < u_hp_max('arm_r')" ] },
    "effect": [ { "math": [ "u_hp('arm_r')", "+=", "2" ] } ],
    "false_effect": [ { "run_eocs": "EOC_perk_blood_drinking_heal_hp_check" } ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_perk_blood_drinking_heal_leg_l",
    "condition": { "math": [ "u_hp('leg_l') < u_hp_max('leg_l')" ] },
    "effect": [ { "math": [ "u_hp('leg_l')", "+=", "2" ] } ],
    "false_effect": [ { "run_eocs": "EOC_perk_blood_drinking_heal_hp_check" } ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_perk_blood_drinking_heal_leg_r",
    "condition": { "math": [ "u_hp('leg_r') < u_hp_max('leg_r')" ] },
    "effect": [ { "math": [ "u_hp('leg_r')", "+=", "2" ] } ],
    "false_effect": [ { "run_eocs": "EOC_perk_blood_drinking_heal_hp_check" } ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_perk_blood_drinking_heal_torso",
    "condition": { "math": [ "u_hp('torso') < u_hp_max('torso')" ] },
    "effect": [ { "math": [ "u_hp('torso')", "+=", "2" ] } ],
    "false_effect": [ { "run_eocs": "EOC_perk_blood_drinking_heal_hp_check" } ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_perk_blood_drinking_heal_head",
    "condition": { "math": [ "u_hp('head') < u_hp_max('head')" ] },
    "effect": [ { "math": [ "u_hp('head')", "+=", "2" ] } ],
    "false_effect": [ { "run_eocs": "EOC_perk_blood_drinking_heal_hp_check" } ]
  }
]
