-
Notifications
You must be signed in to change notification settings - Fork 0
/
Area.py
92 lines (84 loc) · 2.78 KB
/
Area.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
from Species import Species
from Encounter import Encounter
def choose_enemy_species_pool(biome):
if biome == "Desert":
return [[Species("Bunny"), 0.4],
[Species("Bullfrog"), 0.0],
[Species("Bat"), 0.2],
[Species("Rat"), 0.0],
[Species("Spider"), 0.4]]
if biome == "Cave":
return [[Species("Bunny"), 0.0],
[Species("Bullfrog"), 0.0],
[Species("Bat"), 0.4],
[Species("Rat"), 0.2],
[Species("Spider"), 0.4]]
if biome == "Swamp":
return [[Species("Bunny"), 0.0],
[Species("Bullfrog"), 0.4],
[Species("Bat"), 0.0],
[Species("Rat"), 0.4],
[Species("Spider"), 0.2]]
if biome == "Forest":
return [[Species("Bunny"), 0.2],
[Species("Bullfrog"), 0.2],
[Species("Bat"), 0.2],
[Species("Rat"), 0.2],
[Species("Spider"), 0.2]]
if biome == "Grassland":
return [[Species("Bunny"), 0.4],
[Species("Bullfrog"), 0.0],
[Species("Bat"), 0.0],
[Species("Rat"), 0.4],
[Species("Spider"), 0.2]]
else:
return [[Species("Bunny"), 0.2],
[Species("Bullfrog"), 0.2],
[Species("Bat"), 0.2],
[Species("Rat"), 0.2],
[Species("Spider"), 0.2]]
def choose_enemy_level_pool(area_num):
if area_num == 1:
return [[0, 0.75],
[1, 0.25],
[2, 0.00],
[3, 0.00]]
if area_num == 2:
return [[0, 0.25],
[1, 0.75],
[2, 0.00],
[3, 0.00]]
if area_num == 3:
return [[0, 0.00],
[1, 0.25],
[2, 0.75],
[3, 0.00]]
if area_num == 4:
return [[0, 0.00],
[1, 0.00],
[2, 0.75],
[3, 0.25]]
if area_num >= 5:
return [[0, 0.00],
[1, 0.00],
[2, 0.25],
[3, 0.75]]
class Area:
def __init__(self, num, biome):
self.num = num
self.biome = biome
self.encounter_num = 0
self.current_encounter = None
self.enemy_species_pool = choose_enemy_species_pool(biome)
self.enemy_level_pool = choose_enemy_level_pool(num)
def get_num(self):
return self.num
def get_biome(self):
return self.biome
def get_enemy_species_pool(self):
return self.enemy_species_pool
def get_enemy_level_pool(self):
return self.enemy_level_pool
def next_encounter(self, player, enemy):
self.current_encounter = Encounter(player, enemy)
self.encounter_num += 1