Description

import random

import time

class Game:

def __init__(self):

self.day = 1

self.max_days = 99

self.health = 100

self.wood = 5

self.food = 3

self.fire_lit = True

def start(self):

print("=== 99 NIGHTS IN THE FOREST ===")

print("Survive 99 nights until rescue arrives.\n")

while self.day <= self.max_days and self.health > 0:

self.play_night()

self.day += 1

time.sleep(1)

self.end_game()

def play_night(self):

print(f"--- NIGHT {self.day} / {self.max_days} ---")

print(f"Health: {self.health} | Wood: {self.wood} | Food: {self.food}")

# Event trigger

event = random.choice(["quiet", "beast", "cold_snap", "found_supplies"])

if event == "quiet":

print("The forest is eerily calm tonight. You rest safely.")

elif event == "beast":

print("Glowing eyes emerge from the dark tree line!")

if self.wood >= 2:

self.wood -= 2

print("You stoke the campfire high. The creature retreats into the shadows.")

else:

damage = random.randint(15, 30)

self.health -= damage

print(f"You lacked wood for fire! The beast attacks. (-{damage} Health)")

elif event == "cold_snap":

print("A freezing wind sweeps through the canopy.")

if self.food > 0:

self.food -= 1

print("You eat a hot meal to stay warm.")

else:

self.health -= 10

print("You go to bed hungry and freezing. (-10 Health)")

elif event == "found_supplies":

found_wood = random.randint(1, 3)

found_food = random.randint(1, 2)

self.wood += found_wood

self.food += found_food

print(f"You scavenged nearby and found +{found_wood} Wood and +{found_food} Food!")

print("\n")

def end_game(self):

if self.health > 0:

print("=== DAWN OF DAY 100 ===")

print("A rescue helicopter cuts through the fog. You survived all 99 nights!")

else:

print("=== GAME OVER ===")

print(f"You succumbed to the forest on Night {self.day}.")

if __name__ == "__main__":

game = Game()

game.start()

Game Page

99 Nights in the Forest πŸ”¦

Roblox
Views
350
Likes
2
Dislikes
1
Posted
2d ago
Key System
No
Mobile
Supported