-
Notifications
You must be signed in to change notification settings - Fork 0
/
genCards.py
32 lines (32 loc) · 1.23 KB
/
genCards.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
# print(__package__,'lalax') #TODO 为何输出3次
from hsClient.gameModules.Minions import *
from hsClient.gameModules.Spells import *
from hsClient.gameModules.Weapons import *
from hsClient.gameModules.Heros import *
professions = [
Druid, Hunter, Mage, Paladin, Priest, Rogue, Shaman, Warlock, Warrior,
Neutral
]
CardsStr = ''
for p in professions:
ts = list(set(p.__subclasses__()).difference(set(Derive.__subclasses__())))
ts.sort(key=lambda x: x.cost)
strs = ""
for t in ts:
strs += t.__name__ + ','
CardsStr += '[' + strs + '],\n'
CardsStr = 'Cards = [' + CardsStr + ']'
importStr = 'from .Minions import *\n'\
+'from .Spells import *\n'\
+'from .Heros import *\n'\
+'from .Weapons import *\n\n'\
+'openingHeros = [Malfurion, Rexxar, Jaina, Uther, Anduin, Valeera, Thrall, Guldan, Garrosh]\n'
import os
with open(
f'{os.path.dirname(__file__)}\\hsServer\\gameModules\\Cards4server.py',
'w') as f:
f.write(importStr + CardsStr)
importStr = importStr.replace('Server', 'Client')
with open(f'{os.path.dirname(__file__)}/hsClient/gameModules/Cards4client.py',
'w') as f:
f.write(importStr + CardsStr)