Files
2026-03-25 04:35:20 +04:00

69 lines
2.2 KiB
Python

import requests, sys, getpass, time, random
def battle(player_hp, has_sword):
dragon_hp = 100
print("\n--- POKEMON STYLE BATTLE: VS THE BRAGEN ---")
while dragon_hp > 0 and player_hp > 0:
print(f"\nYour HP: {player_hp} | Bragen HP: {dragon_hp}")
action = input("Choose: [1] Attack [2] Heal: ")
# Player Turn
if action == "1":
dmg = random.randint(15, 25) if has_sword else random.randint(5, 10)
dragon_hp -= dmg
print(f"You dealt {dmg} damage!")
else:
heal = random.randint(10, 20)
player_hp += heal
print(f"You healed for {heal} HP!")
# Dragon Turn
if dragon_hp > 0:
d_dmg = random.randint(10, 20)
player_hp -= d_dmg
print(f"The Bragen used Fire Breath! You took {d_dmg} damage.")
if player_hp > 0:
print("\n🏆 THE BRAGEN IS SLAIN! You are a hero.")
else:
print("\n💀 You fainted... The Bragen wins.")
def start_adventure():
print("\n--- THE QUEST FOR THE BRAGEN ---")
inventory = []
# Step 1: The Puzzle
print("\nYou enter a dark cave. A stone door blocks your path.")
print("Riddle: I speak without a mouth and hear without ears. What am I?")
ans = input("Your answer: ").lower()
if "echo" in ans:
print("\nThe door creaks open!")
# Step 2: Item Finding
print("Inside, you find a 'Shiny Sword' on the ground. Pick it up? (y/n)")
if input().lower() == 'y':
inventory.append("sword")
print("Item added: Sword (+Attack Power!)")
# Step 3: The Boss
print("\nYou reach the inner sanctum. The Bragen awakes!")
battle(100, "sword" in inventory)
else:
print("The cave collapses. Wrong answer. GAME OVER.")
def check_access():
try:
pw = getpass.getpass("Server Password: ")
res = requests.get("http://localhost:6000/check", headers={"x-password": pw})
if res.status_code == 200 and res.json().get("run") == "yes":
start_adventure()
else:
print("Access Denied by Server.")
except:
print("Server Connection Failed.")
if __name__ == "__main__":
check_access()