-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRandomize.py
More file actions
38 lines (33 loc) · 1.1 KB
/
Randomize.py
File metadata and controls
38 lines (33 loc) · 1.1 KB
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
import os
import random
import sys
current_dir = ""
# Get keyblades ID
# determine if application is a script file or frozen exe
if getattr(sys, 'frozen', False):
current_dir = f"{os.path.dirname(sys.executable)}"
elif __file__:
current_dir = f"{os.path.dirname(__file__)}"
files = os.listdir(f"{current_dir}/obj")
random_list = []
keyblade_list = []
for file in files:
keyblade_list.append(file)
# Shuffle keyblades
random_list = keyblade_list.copy()
random.shuffle(random_list)
# Write the mod.yml
f = open(f"{current_dir}/mod.yml", 'w')
f.write('''title: Keyblade Effects Rando
originalAuthor: Rikysonic
game: kh2
description: A Keyblade Effects Randomizer for KH2. It will randomize every keyblade effects when swinging and hitting enemies. Make sure to run Randomizer.exe in openkh/mods/Rikysonic/Keyblade-Effects-Rando to generate a new rando.
''')
f.write('assets:\n')
for i in range(len(keyblade_list)):
old = keyblade_list[i]
new = random_list[i]
old = 'obj/' + old
new = 'obj/' + new
f.write('- name: ' + old + '\n method: copy\n source:\n - name: ' + new + '\n')
f.close()