This repository has been archived by the owner on Sep 22, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathx_enemy.py
52 lines (47 loc) · 1.7 KB
/
x_enemy.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
import random
import copy
import y_helpers
class EnemyModel:
def __init__(self):
self.init_enemies()
self.get_parties_by_label()
def enemy_party(self, label):
enemy_types_list = random.choice(
self.parties_by_label[label])
enemy_p = []
for t in enemy_types_list:
prototype = y_helpers.find_by_id(t['id'], self.enemies)
for i in list(range(t['amount'])):
e = copy.deepcopy(prototype)
e['name'] += ' {}'.format(i+1)
enemy_p.append(e)
return enemy_p
def init_enemies(self):
self.enemies = [
# heaven ########################
{'id': 1,
'name': "Ramblin' Mushroom ",
'model': 'mush',
'hp': 30, 'max_hp': 30,
'xp': 5,
'attack': {'base': 5, 'buffAdd': 0, 'buffMult': 1},
'defense': {'base': 5, 'buffAdd': 0, 'buffMult': 1},
'speed': {'base': 5, 'buffAdd': 0, 'buffMult': 1},
'statusEffect': {'KO': False, 'POISONED': False, 'STUNNED': False, 'CONFUSED': False},
'statusImmunity': [],
'items': [],
'description': "regular one",
# 'strategy': 'twice',
'magic': [1, 2]},
]
def get_parties_by_label(self):
self.parties_by_label = {
'mush': [
[{'id': 1, 'amount': 1}],
[{'id': 1, 'amount': 2}],
[{'id': 1, 'amount': 3}],
# [{'id': 1, 'amount': 1}, {'id': 3, 'amount': 1}],
# [{'id': 1, 'amount': 1}, {'id': 3, 'amount': 2}],
# [{'id': 3, 'amount': 3}],
],
}