Merge: doc: fixed some typos and other misc. corrections
[nit.git] / tests / test_prog / rpg / careers.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 # Careers of the game.
16 #
17 # All characters can have a `Career`.
18 # A character can also quit its current career and start a new one.
19 #
20 # Available careers:
21 #
22 # * `Warrior`
23 # * `Magician`
24 # * `Alcoholic`
25 module careers
26
27 import platform
28
29 # A `Career` gives a characteristic bonus or malus to the character.
30 abstract class Career
31 var strength_bonus: Int
32 var endurance_bonus: Int
33 var intelligence_bonus: Int
34
35 init do end
36 end
37
38 # Warriors are good for fighting.
39 class Warrior
40 super Career
41
42 init do
43 self.strength_bonus = 10
44 self.endurance_bonus = 10
45 self.intelligence_bonus = 0
46 end
47 end
48
49 # Magicians know magic and how to use it.
50 class Magician
51 super Career
52
53 init do
54 self.strength_bonus = -5
55 self.endurance_bonus = 0
56 self.intelligence_bonus = 20
57 end
58 end
59
60 # Alcoholics are good to nothing escept taking punches.
61 class Alcoholic
62 super Career
63
64 init do
65 self.strength_bonus = -20
66 self.endurance_bonus = 20
67 self.intelligence_bonus = -40
68 end
69 end
70