1 Code for `test_prog::Character`:
4 # Characters can be played by both the human or the machine.
7 # The `Race` of the character.
10 # The current `Career` of the character.
11 # Returns `null` if character is unemployed.
12 var career: nullable Career = null is writable
22 # The actual strength of the character.
24 # Returns `race.base_strength + career.strength_bonus` or just `race.base_strength` is unemployed.
25 fun total_strengh: Int do
26 if career != null then return race.base_strength + career.strength_bonus
27 return race.base_strength
30 # The actual endurance of the character.
31 fun total_endurance: Int do
32 if career != null then return race.base_endurance + career.endurance_bonus
33 return race.base_endurance
36 # The acutal intelligence of the character.
37 fun total_intelligence: Int do
38 if career != null then return race.base_intelligence + career.intelligence_bonus
39 return race.base_intelligence
42 # Maximum health of the character.
44 # Based on `total endurance * 10`.
45 fun max_health: Int do return total_endurance * 10
47 # The current `health` of the character.
49 # Starts at `max_health`.
50 var health: Int = max_health