idk made a simpel game
This commit is contained in:
1 parent
069c514bfa
commit
623c26bc85
3 files changed
+85
-1
No files matched your search
@@ -0,0 +1,68 @@
|
|||||||
|
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()
|
||||||
+1
-1
@@ -14,7 +14,7 @@ def start_calculator():
|
|||||||
print(f"Error: {e}")
|
print(f"Error: {e}")
|
||||||
|
|
||||||
def check_server():
|
def check_server():
|
||||||
url = "http://localhost:6000/status"
|
url = "http://10.0.0.119:6000/status"
|
||||||
|
|
||||||
print("--- Server Authentication ---")
|
print("--- Server Authentication ---")
|
||||||
password = getpass.getpass("Enter Server Password: ")
|
password = getpass.getpass("Enter Server Password: ")
|
||||||
|
|||||||
+16
@@ -0,0 +1,16 @@
|
|||||||
|
const express = require('express');
|
||||||
|
const app = express();
|
||||||
|
const PORT = 6000;
|
||||||
|
|
||||||
|
const PASS = "hi";
|
||||||
|
let gameActive = "yes"; // Change to "no" to lock the game
|
||||||
|
|
||||||
|
app.get('/check', (req, res) => {
|
||||||
|
if (req.headers['x-password'] === PASS) {
|
||||||
|
res.json({ run: gameActive });
|
||||||
|
} else {
|
||||||
|
res.status(401).json({ error: "Invalid Credentials" });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
app.listen(PORT, () => console.log(`Game Server active on port ${PORT}`));
|
||||||
Reference in new issue
Block a user