Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -4,11 +4,13 @@ import random
|
|
4 |
app = Flask(__name__)
|
5 |
|
6 |
# ---------------- Configuration ----------------
|
7 |
-
AIR_STRIKE_CHANCE = 0.
|
8 |
-
SELF_REVIVE_CHANCE = 0.10
|
9 |
-
EXTRA_LOST_PLATE_CHANCE = 0.
|
10 |
-
GULAG_WIN_THRESHOLD = 0.35
|
11 |
-
GULAG_ELIMINATED_THRESHOLD = 0.65
|
|
|
|
|
12 |
# ------------------------------------------------
|
13 |
|
14 |
game_states = {}
|
@@ -61,6 +63,7 @@ def fight():
|
|
61 |
if not user or user not in game_states:
|
62 |
return limit_response("Start game first with !start")
|
63 |
state = game_states[user]
|
|
|
64 |
if state["status"] != "active":
|
65 |
msg = f"Game over. Final Kills: {state['kills']}. "
|
66 |
if state["status"] == "won":
|
@@ -261,7 +264,7 @@ def fight():
|
|
261 |
state["players"] = max(state["players"] - kills, 1)
|
262 |
resp += f"Overpowered the ambushers and secured {kills} kill(s) with your {gun_used}! "
|
263 |
|
264 |
-
nat = random.randint(
|
265 |
state["players"] = max(state["players"] - nat, 1)
|
266 |
resp += f"Additionally, {nat} enemies were eliminated naturally. "
|
267 |
|
@@ -279,11 +282,9 @@ def gulag():
|
|
279 |
if not user or user not in game_states:
|
280 |
return limit_response("Start game first with !start")
|
281 |
state = game_states[user]
|
282 |
-
# If game is over (won or eliminated), just show final result.
|
283 |
if state["status"] in ["eliminated", "won"]:
|
284 |
msg = f"Game over. Final Kills: {state['kills']}. Use !start to play again."
|
285 |
return limit_response(msg)
|
286 |
-
# If not in gulag, inform the user.
|
287 |
if not state.get("in_gulag"):
|
288 |
return limit_response("You're not in Gulag. If downed, use !gulag to fight your opponent.")
|
289 |
|
|
|
4 |
app = Flask(__name__)
|
5 |
|
6 |
# ---------------- Configuration ----------------
|
7 |
+
AIR_STRIKE_CHANCE = 0.85 # Chance to call in an Air Strike if available
|
8 |
+
SELF_REVIVE_CHANCE = 0.10 # Chance to self-revive when downed
|
9 |
+
EXTRA_LOST_PLATE_CHANCE = 0.80 # Chance to lose an extra plate from enemy fire
|
10 |
+
GULAG_WIN_THRESHOLD = 0.45 # In Gulag: outcome <35% = win (return to battle)
|
11 |
+
GULAG_ELIMINATED_THRESHOLD = 0.55 # In Gulag: outcome >=35% and <65% = eliminated; >=65% = stalemate (lose a plate and try again)
|
12 |
+
NAT_MIN_DEATHS = 19 # Minimum natural enemy deaths per round
|
13 |
+
NAT_MAX_DEATHS = 35 # Maximum natural enemy deaths per round
|
14 |
# ------------------------------------------------
|
15 |
|
16 |
game_states = {}
|
|
|
63 |
if not user or user not in game_states:
|
64 |
return limit_response("Start game first with !start")
|
65 |
state = game_states[user]
|
66 |
+
|
67 |
if state["status"] != "active":
|
68 |
msg = f"Game over. Final Kills: {state['kills']}. "
|
69 |
if state["status"] == "won":
|
|
|
264 |
state["players"] = max(state["players"] - kills, 1)
|
265 |
resp += f"Overpowered the ambushers and secured {kills} kill(s) with your {gun_used}! "
|
266 |
|
267 |
+
nat = random.randint(NAT_MIN_DEATHS, NAT_MAX_DEATHS)
|
268 |
state["players"] = max(state["players"] - nat, 1)
|
269 |
resp += f"Additionally, {nat} enemies were eliminated naturally. "
|
270 |
|
|
|
282 |
if not user or user not in game_states:
|
283 |
return limit_response("Start game first with !start")
|
284 |
state = game_states[user]
|
|
|
285 |
if state["status"] in ["eliminated", "won"]:
|
286 |
msg = f"Game over. Final Kills: {state['kills']}. Use !start to play again."
|
287 |
return limit_response(msg)
|
|
|
288 |
if not state.get("in_gulag"):
|
289 |
return limit_response("You're not in Gulag. If downed, use !gulag to fight your opponent.")
|
290 |
|