Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -143,8 +143,9 @@ async def handle_action(request: Request):
|
|
| 143 |
return {"success": True, "message": f"Coup initiated by {player} targeting {target}."}
|
| 144 |
|
| 145 |
if action == 'assassin':
|
| 146 |
-
|
| 147 |
-
|
|
|
|
| 148 |
if game["turn"] != player:
|
| 149 |
return {"success": False, "message": "Not your turn."}
|
| 150 |
game["challenge"] = {
|
|
@@ -155,7 +156,7 @@ async def handle_action(request: Request):
|
|
| 155 |
"status": "pending",
|
| 156 |
"phase": "target_decision"
|
| 157 |
}
|
| 158 |
-
|
| 159 |
return {"success": True, "message": f"Assassin action initiated by {player} targeting {target}. Awaiting target's response."}
|
| 160 |
|
| 161 |
if action == 'duke':
|
|
|
|
| 143 |
return {"success": True, "message": f"Coup initiated by {player} targeting {target}."}
|
| 144 |
|
| 145 |
if action == 'assassin':
|
| 146 |
+
player_data = next((p for p in game["players"] if p["name"] == player), None)
|
| 147 |
+
if player_data["coins"] < 3:
|
| 148 |
+
return {"success": False, "message": "You don't have enough coins to assassinate another player."}
|
| 149 |
if game["turn"] != player:
|
| 150 |
return {"success": False, "message": "Not your turn."}
|
| 151 |
game["challenge"] = {
|
|
|
|
| 156 |
"status": "pending",
|
| 157 |
"phase": "target_decision"
|
| 158 |
}
|
| 159 |
+
player_data["coins"] -= 3
|
| 160 |
return {"success": True, "message": f"Assassin action initiated by {player} targeting {target}. Awaiting target's response."}
|
| 161 |
|
| 162 |
if action == 'duke':
|