Merge: doc: fixed some typos and other misc. corrections
[nit.git] / tests / test_prog / rpg / races.nit
1 # This file is part of NIT ( http://www.nitlanguage.org ).
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 # http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14
15 # Races of the game.
16 #
17 # All characters belong to a `Race`.
18 #
19 # Available races:
20 #
21 # * `Human`
22 # * `Dwarf`
23 # * `Elf`
24 module races
25
26 import platform
27
28 # Race determines basic characteristics and what the character will be able to do in life.
29 #
30 # These are base characteristics, they cannot be changed
31 # but you can add new ones if needed using refinement.
32 # Objects and spells cannot change those characteristics.
33 abstract class Race
34
35 # Used to represents how strong the race is.
36 var base_strength: Int
37
38 # Used to represents how the race can absorb damage.
39 var base_endurance: Int
40
41 # Is this race smart?
42 var base_intelligence: Int
43
44 init do end
45 end
46
47 # Humans are able to do everithing.
48 class Human
49 super Race
50
51 init do
52 self.base_strength = 50
53 self.base_endurance = 50
54 self.base_intelligence = 50
55 end
56 end
57
58 # Dwarves make strong warriors.
59 class Dwarf
60 super Race
61
62 init do
63 self.base_strength = 60
64 self.base_endurance = 50
65 self.base_intelligence = 40
66 end
67 end
68
69 # Elves make good magicians.
70 class Elf
71 super Race
72
73 init do
74 self.base_strength = 40
75 self.base_endurance = 40
76 self.base_intelligence = 70
77 end
78 end
79