basic egg hatching simulator

import random
import time

eggs = {
“Mythic”: [“astraljyth”, “pandora”, “a.l.y.c.e”],
“Legendary”: [“cyclophia”, “doomgoo”, “moku”],
“Super Epic”: [“scarleguard”, “a.s myst”, “subzeropunch king”],
“Epic”: [“supershell”, “vanillawhelp”]
}

drop_rate_tables = {
“regular”: {
“Mythic”: 0.0750,
“Legendary”: 3.0,
“Super Epic”: 6.25,
“Epic”: 90.0
},
“super_rare”: {
“Mythic”: 1.0,
“Legendary”: 4.0,
“Super Epic”: 15.0,
“Epic”: 70.0
}
}

player_currency = {
“gems”: 0,
“super_rare_gems”: 0
}
egg_cost_regular = 4
egg_cost_super_rare = 5
pull_counter = 0
PITY_THRESHOLD = 30

hatched_creatures =

ascii_art = {
# Mythic
“astraljyth”: “”"
~~~~~~~
/ ^ \
/ (o o) \
( ^ )
\ \/ /
~~~
(Sea Dragon)
“”“,
“pandora”: “””
_______
/ \
| [ ] [] |
| \
/ |
| Girl |
\_______/
(Girl in a box)
“”“,
“a.l.y.c.e”: “””
[==|====]
| o o |
| - |
/|_____|\
(Cyborg Girl)
“”",

# Legendary
"cyclophia": """
   .----.
  /  O   \\
 |   |    |
  \\  |  /
   '--' 
(Cyclops Girl)
""",
"doomgoo": """
   .---.
  (  @ )  ~~
 (  --- ) /
  \\  |  /
   `---`
(Goo Dragon w/ Scythe)
""",
"moku": """
  (\\_._/)
  ( o o )
 ==\\o/==
(Derpy Mouse)
""",

# Super Epic
"scarleguard": """
   / \\  / \\
  /  Fire  \\
 |  Dragon  |
  \\ Knight /
   `-----`
""",
"a.s myst": """
  |\\  /|
 ( o  o )
  \\ -- /
  /|__|\\
(Abyss Soldier)
""",
"subzeropunch king": """
  .----.
 /      \\
|  Ice   |
|  Golem |
 \\______/ 
""",

# Epic
"supershell": """
   ____  
 /      \\
| Plant  |
|  Shell |
 \\______/ 
""",
"vanillawhelp": """
  .-""-.
 / .--. \\
| (o  o) |
 \\ '--' /
  `----`
(Baby White Dragon)
"""

}

def show_creature_art(name):
art = ascii_art.get(name.lower())
if art:
print(art)
else:
print(f"(No art available for {name})")

def top_up():
print(“\n💎 Top-Up Menu”)
print(f"Regular Gems: {player_currency[‘gems’]}")
print(“1. Add Regular Gems”)
print(“2. Back to Main Menu”)
choice = input("Choose an option: ")

if choice == "1":
    amount = input("Enter number of Regular Gems to add: ")
    if amount.isdigit() and int(amount) > 0:
        player_currency["gems"] += int(amount)
        print(f"Added {amount} Regular Gems.")
    else:
        print("Invalid amount.")
elif choice == "2":
    return
else:
    print("Invalid option.")

def pick_egg(rate_table, force_mythic=False):
global pull_counter
if force_mythic:
pull_counter = 0
return “Mythic”, random.choice(eggs[“Mythic”])
roll = random.uniform(0, 100)
cumulative = 0
for rarity in [“Mythic”, “Legendary”, “Super Epic”]:
cumulative += rate_table[rarity]
if roll < cumulative:
if rarity == “Mythic”:
pull_counter = 0
else:
pull_counter += 1
return rarity, random.choice(eggs[rarity])
pull_counter += 1
return “Epic”, random.choice(eggs[“Epic”])

def hatch_egg(rate_type=“regular”, silent=False):
global pull_counter
if rate_type == “regular”:
currency_key = “gems”
cost = egg_cost_regular
else:
currency_key = “super_rare_gems”
cost = egg_cost_super_rare

if player_currency[currency_key] < cost:
    if not silent:
        print(f"❌ Not enough {'Regular Gems' if rate_type == 'regular' else 'Super Rare Gems'}.")
    return None

player_currency[currency_key] -= cost
if not silent:
    print(f"💸 Used {cost} {'Regular Gems' if rate_type == 'regular' else 'Super Rare Gems'}.")
    print(f"{currency_key.replace('_', ' ').title()} left: {player_currency[currency_key]}")

time.sleep(0.05)
force_mythic = pull_counter >= PITY_THRESHOLD
rate_table = drop_rate_tables[rate_type]
rarity, creature = pick_egg(rate_table, force_mythic=force_mythic)

if rarity and creature:
    hatched_creatures.append((rarity, creature))

if not silent:
    print(f"🎉 Hatched a {rarity} creature: {creature}!")
    show_creature_art(creature)

return rarity, creature

def hatch_batch_of_10(rate_type):
results =
print(“\n— Hatching 10 Eggs —”)
for i in range(10):
print(f"\n🥚 Hatching Egg #{i+1}“)
result = hatch_egg(rate_type=rate_type, silent=True)
if result:
rarity, creature = result
print(f":tada: {rarity}: {creature}”)
show_creature_art(creature)
results.append((rarity, creature))
else:
print(“:cross_mark: Not enough gems.”)
break

if results:
    print("\n📦 Summary of Hatch Results:")
    tally = {key: 0 for key in eggs}
    for rarity, _ in results:
        tally[rarity] += 1
    for rarity in ["Mythic", "Legendary", "Super Epic", "Epic"]:
        print(f"{rarity}: {tally[rarity]}")

    if rate_type == "regular":
        player_currency["super_rare_gems"] += 1
        print("\n🎉 You earned 1 Super Rare Gem for hatching 10 Regular Eggs!")
        print(f"Total Super Rare Gems: {player_currency['super_rare_gems']}")
else:
    print("\nNo eggs were hatched.")

def regular_hatch_loop():
while True:
if player_currency[“gems”] < 10 * egg_cost_regular:
print(“:cross_mark: Not enough Regular Gems to hatch 10 eggs.”)
break

    hatch_batch_of_10("regular")
    again = input("\n🔁 Hatch another 10 using Regular Gems? (y/n): ").lower()
    if again != "y":
        break

def super_rare_hatch_loop():
while True:
if player_currency[“super_rare_gems”] < egg_cost_super_rare:
print(f":cross_mark: Not enough Super Rare Gems to hatch.")
break

    print("\n🥚 Hatching a Super Rare Egg")
    hatch_egg(rate_type="super_rare")
    again = input("\n🔁 Hatch another Super Rare Egg? (y/n): ").lower()
    if again != "y":
        break

def show_hatched():
if not hatched_creatures:
print(“\nNo creatures hatched yet.”)
return
print(“\n📜 All Hatched Creatures:”)
tally = {}
for rarity, creature in hatched_creatures:
tally.setdefault(rarity, ).append(creature)

for rarity in ["Mythic", "Legendary", "Super Epic", "Epic"]:
    if rarity in tally:
        print(f"\n{rarity} ({len(tally[rarity])}):")
        for c in tally[rarity]:
            print(f" - {c}")

def show_menu():
while True:
print(“\n📋 Main Menu”)
print(“1. Top-up Regular Gems”)
print(“2. Regular Hatch (uses Regular Gems, x10)”)
print(“3. Super Rare Gem Hatch (uses Super Rare Gems, single hatch costing 5 gems)”)
print(“4. Show Currencies & Pull Counter”)
print(“5. Show All Hatched Creatures”)
print(“6. Exit”)
choice = input("Choose an option: ")

    if choice == "1":
        top_up()
    elif choice == "2":
        regular_hatch_loop()
    elif choice == "3":
        super_rare_hatch_loop()
    elif choice == "4":
        print(f"Regular Gems: {player_currency['gems']} | Super Rare Gems: {player_currency['super_rare_gems']} | Pulls since last Mythic: {pull_counter}")
    elif choice == "5":
        show_hatched()
    elif choice == "6":
        print("Goodbye!")
        break
    else:
        print("Invalid option.")

if name == “main”:
print(“:hatching_chick: Welcome to the Neo Monsters Egg Hatcher!”)
show_menu()

1 Like

I am not sure that I am seeing, and I am sorry to ask, so I will assume that it is python, but the game is already scheduled in Java and C, the unity graphic engine is also used

Although I would like to see a neo monsters that runs in a script and be able to use it on Linux :hot_face:

1 Like

yeah no prob it is in python and its not really meant to be anything just if you want to do some egg hatching thats similar to neomonsters, it easily can be done via chatgpt and unfortunately python doesnt support the egg hatching animations and pictures so i used ascii art to represent a few monsters of each star tier

1 Like

My confusion is because the first part seems to be a JSON, I am not a programmer, I only read the basic course of Lua :laughing::laughing:

It’s Python. What you’re reading as a JSON is a dictionary with key-value pairs but the values are a list of strings.

A JSON is basically just a big dictionary anyway, so it’s not only the same formatting but also the same meaning in python. The difference is here they’re being assigned to variables: eggs, drop_rate_tables, etc.

1 Like

What seems strange to me is that league, because the name of the tables and lists, at least in Lua, do not go in quotes, unless in python some module or something is used or something

haha my error, python if loading without problems

@Killerdog
I think this thread can be closed, no one else is going to comment on anything, nor does it give much information.

Every language can support anything you want if you really try

2 Likes