Nova sorc trav update (#443)

This commit is contained in:
aeon0
2022-01-13 12:40:53 +01:00
committed by GitHub
parent bc24fea4e9
commit 28ca8d2ee7
4 changed files with 47 additions and 8 deletions

6
.gitignore vendored
View File

@@ -8,9 +8,9 @@ playground.py
*.spec
dist/
build/
run.build/
run.dist/
run.onefile-build/
main.build/
main.dist/
main.onefile-build/
generated/
botty_v*/
custom.ini

View File

@@ -4,6 +4,9 @@ from pathlib import Path
from src.version import __version__
import argparse
import getpass
import uuid
import random
parser = argparse.ArgumentParser(description="Build Botty")
@@ -18,11 +21,20 @@ parser.add_argument(
type=str,
help="Path to local conda e.g. C:\\Users\\USER\\miniconda3",
default=f"C:\\Users\\{getpass.getuser()}\\miniconda3")
parser.add_argument(
"-r", "--random_name",
action='store_true',
help="Will generate a random name for the botty exe")
parser.add_argument(
"-n", "--use_nuitka",
action='store_true',
help="Will use nuitka to build instead of pyinstaller")
args = parser.parse_args()
# clean up
def clean_up():
# pyinstaller
if os.path.exists("build"):
shutil.rmtree("build")
if os.path.exists("main.spec"):
@@ -31,6 +43,17 @@ def clean_up():
os.remove("health_manager.spec")
if os.path.exists("shopper.spec"):
os.remove("shopper.spec")
# nuitka
if os.path.exists("main.dist"):
shutil.rmtree("main.dist")
if os.path.exists("main.build"):
shutil.rmtree("main.build")
if os.path.exists("main.onefile"):
shutil.rmtree("main.onefile")
if os.path.exists("main.onefile-build"):
shutil.rmtree("main.onefile-build")
if os.path.exists("main.exe"):
os.remove("main.exe")
if __name__ == "__main__":
new_version_code = None
@@ -59,13 +82,19 @@ if __name__ == "__main__":
shutil.rmtree(path)
shutil.rmtree(botty_dir)
for exe in ["main.py", "shopper.py", "health_manager.py"]:
installer_cmd = f"pyinstaller --onefile --distpath {botty_dir} --exclude-module graphviz --paths .\\src --paths {args.conda_path}\\envs\\botty\\lib\\site-packages src\\{exe}"
if args.use_nuitka:
print("USE N")
installer_cmd = f"python -m nuitka --mingw64 --python-flag=-OO --remove-output --follow-imports --standalone --onefile --assume-yes-for-downloads --plugin-enable=numpy src/main.py"
os.system(installer_cmd)
os.system(f"mkdir {botty_dir}")
else:
for exe in ["main.py", "shopper.py"]:
installer_cmd = f"pyinstaller --onefile --distpath {botty_dir} --exclude-module graphviz --paths .\\src --paths {args.conda_path}\\envs\\botty\\lib\\site-packages src\\{exe}"
os.system(installer_cmd)
os.system(f"cd {botty_dir} && mkdir config && cd ..")
with open(f"{botty_dir}/config/custom.ini", "w") as f:
with open(f"{botty_dir}/config/custom.ini", "w") as f:
f.write("; Add parameters you want to overwrite from param.ini here")
shutil.copy("config/game.ini", f"{botty_dir}/config/")
shutil.copy("config/params.ini", f"{botty_dir}/config/")
@@ -73,8 +102,15 @@ if __name__ == "__main__":
shutil.copy("config/shop.ini", f"{botty_dir}/config/")
shutil.copy("README.md", f"{botty_dir}/")
shutil.copytree("assets", f"{botty_dir}/assets")
if os.path.exists("main.exe"):
shutil.copy("main.exe", f"{botty_dir}/")
clean_up()
if args.random_name:
print("Generate random names")
new_name = uuid.uuid4().hex[:random.randint(6, 32)]
os.rename(f'{botty_dir}/main.exe', f'{botty_dir}/{new_name}.exe')
if new_version_code is not None:
os.system(f'git add .')
os.system(f'git commit -m "Bump version to v{args.version}"')

View File

@@ -4,6 +4,7 @@ dependencies:
- pywin32
- pip
- pip:
- nuitka
- pyinstaller
- opencv-python
- transitions

View File

@@ -53,7 +53,7 @@ class NovaSorc(Sorceress):
def kill_council(self) -> bool:
# Check out the node screenshot in assets/templates/trav/nodes to see where each node is at
atk_len = self._char_config["atk_len_trav"] * 0.5
atk_len = self._char_config["atk_len_trav"] * 0.23
# change node to be further to the right
offset_229 = np.array([200, 100])
self._pather.offset_node(229, offset_229)
@@ -63,7 +63,7 @@ class NovaSorc(Sorceress):
self._nova(atk_len)
self._move_and_attack((-40, -20), atk_len)
self._move_and_attack((40, 20), atk_len)
self._move_and_attack((-40, -20), atk_len)
self._move_and_attack((40, 20), atk_len)
def clear_outside():
self._pather.traverse_nodes([226], self, time_out=0.8, force_tp=True)
self._cast_static(0.6)
@@ -72,6 +72,8 @@ class NovaSorc(Sorceress):
self._move_and_attack((-45, 20), atk_len)
clear_inside()
clear_outside()
clear_inside()
clear_outside()
# change back node as it is used in trav.py
self._pather.offset_node(229, -offset_229)
return True