Basic Characters

version 1 by ShadowChaser

  • Home page
  • Beginning
  • Previous
  • Next



  • Section 4 - Health

    Table of Health_Level
    rank  
    "near to death"  
    "badly injured"  
    "injured"  
    "slightly injured"  
    "almost uninjured"  

    To say health_of (item - a thing):
        now BC_val is the health of the item;
        now BC_maxval is the max_health of the item;
        if the health of the item is 0 begin;
             say "dead";
        otherwise if the health of the item is the max_health of the item;
            say "healthy";
        otherwise;
            say "[EqualRankOf BC_val out_of BC_maxval from_table Table of Health_Level]";
        end if.

    A person has a number called health. A person has a number called max_health. A person has a number called heal_rate. A person has a number called heal_counter. A person can be either heal_safe or heal_unsafe. A person is usually heal_safe.

    The health of a person is usually 10. The max_health of a person is usually 10. The heal_rate of a person is usually 5. The heal_counter of a person is usually 0.

    An animal has a number called health. An animal has a number called max_health. An animal has a number called heal_rate. An animal has a number called heal_counter. An animal can be either heal_safe or heal_unsafe. An animal is usually heal_safe.

    The health of an animal is usually 10. The max_health of an animal is usually 10. The heal_rate of an animal is usually 5. The heal_counter of an animal is usually 0.

    To increase_health_of (person_to_heal - a thing) by (hp - a number):
        let vhp be the health of the person_to_heal;
        let vhp be vhp + hp;
        now the health of the person_to_heal is vhp;
        if the health of the person_to_heal > the max_health of the person_to_heal begin;
            now the health of the person_to_heal is the max_health of the person_to_heal;
        end if.

    To decrease_health_of (person_to_heal - a thing) by (hp - a number):
        let vhp be the health of the person_to_heal;
        let vhp be vhp - hp;
        now the health of the person_to_heal is vhp;
        if the health of the person_to_heal < 0 begin;
            now the health of the person_to_heal is 0;
        end if.

    To say report_healing:
        say "You feel a little healthier[if the health of the player >= the max_health of the player]; In fact you are fully healed[end if].";

    Requesting the health of the player is an action out of world.

    Report requesting the health of the player: say "You are [health_of the player].".

    Understand "health" as requesting the health of the player.

    Definition: a person (called the dying_actor) is dead if the health of the dying_actor is 0.
    Definition: an animal (called the dying_actor) is dead if the health of the dying_actor is 0.