Compare commits

..

No commits in common. "9da44817500a70527bf021b739a54e0194b2dca6" and "69027f0aeb68a77c8fbf676f696b5c89232c4ba0" have entirely different histories.

19
app.py
View file

@ -25,16 +25,13 @@ class Run:
self.outside_power = moon.outside_max_power
def find_spawnlist(remaining_power: int, creatures: list[Creature]) -> list[str]:
def find_spawnlist(run: Run, creatures: list[Creature]) -> list[str]:
"""
Given a run, return all possible spwns for location.
:param remaining_power: The remaining power in the current location.
:return: A list of all creatures that may still spawn.
:param run: The current run object.
:return: A list of all creatures that could still spawn.
"""
return sorted(
[creature.name for creature in creatures if creature.power <= remaining_power]
)
def main():
@ -100,6 +97,7 @@ def main():
with left_column:
st.markdown("### Outside")
st.info(f"Maximum power: {run.moon.outside_max_power}")
with st.form("outside"):
for creature in outside_creatures:
@ -128,10 +126,8 @@ def main():
outside_submit = st.form_submit_button("Calculate")
if outside_submit:
st.info(f"Maximum power: {run.moon.outside_max_power}")
if run.outside_power >= 0:
st.warning(f"🌳 Outside power remaining: {run.outside_power}")
st.write(find_spawnlist(run.outside_power, outside_creatures))
st.toast(f"🌳 Outside power remaining: {run.outside_power}")
else:
st.error(
f"Power level exceedes maximum possible for {run.moon.name}."
@ -139,6 +135,7 @@ def main():
with right_column:
st.markdown("### Inside")
st.info(f"Maximum power: {run.moon.inside_max_power}")
with st.form("inside"):
for creature in inside_creatures:
@ -167,10 +164,8 @@ def main():
inside_submit = st.form_submit_button("Calculate")
if inside_submit:
st.info(f"Maximum power: {run.moon.inside_max_power}")
if run.inside_power >= 0:
st.warning(f"🏭 Inside power remaining: {run.inside_power}")
st.write(find_spawnlist(run.inside_power, inside_creatures))
st.toast(f"🏭 Inside power remaining: {run.inside_power}")
else:
st.error(
f"Power level exceedes maximum possible for {run.moon.name}."