-
Notifications
You must be signed in to change notification settings - Fork 0
/
character_creation.py
154 lines (136 loc) · 4.88 KB
/
character_creation.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
import dialogue
import utility
class CharacterCreation:
def tell_me_your_name(self, player):
correct_name = False
dialogue.brewswig_tell_me_your_name()
player.name = input('\33[0m'"Answer: "'\33[35m')
utility.clear()
while not correct_name:
if player.name.strip() == "":
utility.clear()
dialogue.brewswig_no_name_given()
player.name = input('\33[0m'"Answer: "'\33[35m')
continue
utility.clear()
dialogue.brewswig_query_name(player)
answer = utility.confirm_option()
if answer == "1":
correct_name = True
else:
utility.clear()
dialogue.brewswig_incorrect_name()
print()
player.name = input('\33[0m'"Answer: "'\33[35m')
utility.clear()
continue
utility.clear()
return player.name
# Look at simplifying this code
def tell_me_your_race(self, player):
correct_race = False
dialogue.brewswig_tell_me_your_race(player)
while not correct_race:
dialogue.choose_race_options()
print()
race = input('\33[0m'"Answer: "'\33[35m').lower()
if race == "i" or race == "1":
dialogue.brewswig_human_details()
player_race = self.get_player_race_human(player)
elif race == "ii" or race == "2":
dialogue.brewswig_elf_details()
player_race = self.get_player_race_elf(player)
elif race == "iii" or race == "3":
dialogue.brewswig_dwarf_details()
player_race = self.get_player_race_dwarf(player)
else:
print("\n\33[31mInvalid Selection: Please try again\n")
utility.press_enter_to_continue()
utility.clear()
continue
answer = utility.confirm_option()
if answer == "1":
return player_race
else:
utility.clear()
continue
# ----- Character Race Options ----- #
@staticmethod
def get_player_race_human(player):
player.race = "Human"
player.health = 25
player.max_health = player.health
player.strength = 10
player.defense = 5
return player
@staticmethod
def get_player_race_elf(player):
player.race = "Elf"
player.health = 20
player.max_health = player.health
player.strength = 5
player.defense = 10
return player
@staticmethod
def get_player_race_dwarf(player):
player.race = "Dwarf"
player.health = 30
player.max_health = player.health
player.strength = 15
player.defense = 10
return player
def tell_me_your_profession(self, player):
utility.clear()
correct_profession = False
dialogue.brewswig_tell_me_your_specialty(player)
while not correct_profession:
dialogue.choose_class()
profession = input('\33[0m'"Answer: "'\33[35m').lower()
if profession == "i" or profession == "1":
dialogue.brewswig_fighter_details()
player_profession = self.get_player_profession_fighter(player)
elif profession == "ii" or profession == "2":
dialogue.brewswig_ranger_details()
player_profession = self.get_player_profession_ranger(player)
else:
print("\n\33[31mInvalid Selection: Please try again\n")
utility.press_enter_to_continue()
utility.clear()
continue
answer = utility.confirm_option()
if answer == "1":
return player_profession
else:
utility.clear()
continue
@staticmethod
def get_player_profession_fighter(player):
player.profession = "Fighter"
player.weapon = "Sword"
player.strength += 5
player.max_health += 5
player.health = player.max_health
player.gold += 50
player.health_potion = 1
return player
@ staticmethod
def get_player_profession_ranger(player):
player.profession = "Ranger"
player.weapon = "Bow"
player.defense += 2
player.max_health += 10
player.health = player.max_health
player.gold += 100
return player
# ----- CREATE CHARACTER ----- #
def create_character(player):
character_object = CharacterCreation()
character_object.tell_me_your_name(player)
utility.clear()
character_object.tell_me_your_race(player)
utility.clear()
character_object.tell_me_your_profession(player)
utility.clear()
dialogue.brewswig_quest_dialogue()
utility.press_enter_to_continue()
return player