Question:
I wish that when a monster spawns, I have to fight it, but instead it just deals damage and then disappears. If it’s easy to say - I want to be able to fight, but I don’t know how to do it.
Repl link:(https://replit.com/@kk284/Miner-Upgrade-Clicker)
import os as s
import random as r
import time as t
print("Miner Resource Upgrade")
print("----------")
print("s-shop l-lottery h-healshop hack-try to get password legitely:)")
power = 0
balance = 0
cost = 5
pickaxePower = 0
health = 100
input()
s.system("clear")
def resources2():
global balance
if power == 2:
resourceType = ["Coal", "Copper"]
resourceTypeChoice = r.choice(resourceType)
if resourceTypeChoice == "Copper":
balance += 1
else:
balance += 0.5
elif power == 5:
resourceType = ["Coal", "Copper", "Iron"]
resourceTypeChoice = r.choice(resourceType)
if resourceTypeChoice == "Copper":
balance += 1
elif resourceTypeChoice == "Iron":
balance += 2
else:
balance += 0.5
elif power == 8:
resourceType = ["Coal", "Copper", "Iron", "Gold"]
resourceTypeChoice = r.choice(resourceType)
if resourceTypeChoice == "Copper":
balance += 1
elif resourceTypeChoice == "Iron":
balance += 2
elif resourceTypeChoice == "Gold":
balance += 4
else:
balance += 0.5
elif power == 12:
resourceType = ["Coal", "Copper", "Iron", "Gold", "Titanum"]
resourceTypeChoice = r.choice(resourceType)
if resourceTypeChoice == "Copper":
balance += 1
elif resourceTypeChoice == "Iron":
balance += 2
elif resourceTypeChoice == "Gold":
balance += 4
elif resourceTypeChoice == "Titanium":
balance += 7
else:
balance += 0.5
elif power == 15:
resourceType = ["Coal", "Copper", "Iron", "Gold", "Titanium", "Diamond"]
resourceTypeChoice = r.choice(resourceType)
if resourceTypeChoice == "Copper":
balance += 1
elif resourceTypeChoice == "Iron":
balance += 2
elif resourceTypeChoice == "Gold":
balance += 4
elif resourceTypeChoice == "Titanium":
balance += 7
elif resourceTypeChoice == "Diamond":
balance += 10
else:
balance += 0.5
elif power == 20:
resourceType = [
"Coal",
"Copper",
"Iron",
"Gold",
"Titanium",
"Diamond",
"Uranium",
]
resourceTypeChoice = r.choice(resourceType)
if resourceTypeChoice == "Copper":
balance += 1
elif resourceTypeChoice == "Iron":
balance += 2
elif resourceTypeChoice == "Gold":
balance += 4
elif resourceTypeChoice == "Titanium":
balance += 7
elif resourceTypeChoice == "Diamond":
balance += 10
elif resourceTypeChoice == "Uranium":
balance += 50
else:
balance += 0.5
else:
resourceType = ["Coal"]
resourceTypeChoice = r.choice(resourceType)
balance += 0.5
def resources():
global balance
if power == 2:
resourceType = ["Coal", "Copper"]
resourceTypeChoice = r.choice(resourceType)
print(resourceTypeChoice)
if resourceTypeChoice == "Copper":
balance += 1
else:
balance += 0.5
elif power == 5:
resourceType = ["Coal", "Copper", "Iron"]
resourceTypeChoice = r.choice(resourceType)
print(resourceTypeChoice)
if resourceTypeChoice == "Copper":
balance += 1
elif resourceTypeChoice == "Iron":
balance += 2
else:
balance += 0.5
elif power == 8:
resourceType = ["Coal", "Copper", "Iron", "Gold"]
resourceTypeChoice = r.choice(resourceType)
print(resourceTypeChoice)
if resourceTypeChoice == "Copper":
balance += 1
elif resourceTypeChoice == "Iron":
balance += 2
elif resourceTypeChoice == "Gold":
balance += 4
else:
balance += 0.5
elif power == 12:
resourceType = ["Coal", "Copper", "Iron", "Gold", "Titanum"]
resourceTypeChoice = r.choice(resourceType)
print(resourceTypeChoice)
if resourceTypeChoice == "Copper":
balance += 1
elif resourceTypeChoice == "Iron":
balance += 2
elif resourceTypeChoice == "Gold":
balance += 4
elif resourceTypeChoice == "Titanium":
balance += 7
else:
balance += 0.5
elif power == 15:
resourceType = ["Coal", "Copper", "Iron", "Gold", "Titanium", "Diamond"]
resourceTypeChoice = r.choice(resourceType)
print(resourceTypeChoice)
if resourceTypeChoice == "Copper":
balance += 1
elif resourceTypeChoice == "Iron":
balance += 2
elif resourceTypeChoice == "Gold":
balance += 4
elif resourceTypeChoice == "Titanium":
balance += 7
elif resourceTypeChoice == "Diamond":
balance += 10
else:
balance += 0.5
elif power == 20:
resourceType = [
"Coal",
"Copper",
"Iron",
"Gold",
"Titanium",
"Diamond",
"Uranium",
]
resourceTypeChoice = r.choice(resourceType)
print(resourceTypeChoice)
if resourceTypeChoice == "Copper":
balance += 1
elif resourceTypeChoice == "Iron":
balance += 2
elif resourceTypeChoice == "Gold":
balance += 4
elif resourceTypeChoice == "Titanium":
balance += 7
elif resourceTypeChoice == "Diamond":
balance += 10
elif resourceTypeChoice == "Uranium":
balance += 50
else:
balance += 0.5
else:
resourceType = ["Coal"]
resourceTypeChoice = r.choice(resourceType)
print(resourceTypeChoice)
balance += 0.5
def pickaxe():
global balance
global power
global cost
global pickaxePower
pickaxeType = [
"Copper Pickaxe",
"Iron Pickaxe",
"Drill",
"Laser Drill",
"Nuke bomb",
"Destroyer",
]
pickaxeTypeChoice = r.choice(pickaxeType)
if pickaxeTypeChoice == "Copper Pickaxe":
cost = 10
pickaxePower = 2
elif pickaxeTypeChoice == "Iron Pickaxe":
cost = 50
pickaxePower = 5
elif pickaxeTypeChoice == "Drill":
cost = 150
pickaxePower = 8
elif pickaxeTypeChoice == "Laser Drill":
cost = 350
pickaxePower = 12
elif pickaxeTypeChoice == "Nuke bomb":
cost = 700
pickaxePower = 15
else:
cost = 8000
pickaxePower = 20
print(pickaxeTypeChoice, cost)
if cost <= balance:
costans = input("Buy?(yes/no)")
if costans == "yes":
balance -= cost
power = pickaxePower
if costans == "no":
s.system("clear")
def heal():
global health
print("Heal store")
if balance >= 20:
ans1 = input("Wanna buy a heal +15 for 20? (yes/no)")
if ans1 == "yes":
health += 15
if ans1 == "no":
s.system("clear")
if balance >= 50:
ans1 = input("Wanna buy a heal +60 for 50? (yes/no)")
if ans1 == "yes":
health += 60
if ans1 == "no":
s.system("clear")
if balance >= 125:
ans1 = input("Wanna buy a heal +200 for 125? (yes/no)")
if ans1 == "yes":
health += 60
if ans1 == "no":
s.system("clear")
def lottery():
global costs
global balance
costs = 100
if balance >= costs:
print()
print("Lottery cost", costs)
mult = input("Want to buy a lottery?(yes/no)")
if mult == "yes":
balance -= 100
lotteryType = [
"150",
"Drill",
"Nothing...",
"10",
"Nothing...",
"Nothing...",
"Nothing...",
"Nothing...",
"Nothing...",
"JACKPOT 777 coins!",
"gYqjso124%81j",
]
lotteryTypeChoice = r.choice(lotteryType)
if lotteryTypeChoice == "150":
print("You recieved 150 coins!")
balance += 150
costs *= 1.3
input()
s.system("clear")
if lotteryTypeChoice == "Drill":
print("You recieved Drill!")
power = 8
costs *= 1.5
input()
s.system("clear")
if lotteryTypeChoice == "Nothing...":
print("You recieved nothing...")
input()
s.system("clear")
if lotteryTypeChoice == "10":
print("You recieved 10 coins!")
balance += 10
costs *= 1.2
input()
s.system("clear")
if lotteryTypeChoice == "JACKPOT 777 coins!":
print("You recieved JACKPOT 777 coins!")
balance += 777
costs *= 3
input()
if lotteryTypeChoice == "gYqjso124%81j":
print("Use it as a password.")
input()
s.system("clear")
if balance >= 10000:
print()
ans1 = input("You recieved a mystery gift...(yes for open)")
if ans1 == "yes":
balance -= 10000
end = input("You recieved a password! Jy991NerLLa. Good luck!")
if end == "":
s.system("clear")
def gameLoop():
global balance
global power
global randomMonster
global health
global monsterTypeChoice
while True:
print("----------")
resources()
monsterType = ["Spider", "Goblin", "Zerk", "Bat", "Ghost", "Dragon"]
monsterTypeChoice = r.choice(monsterType)
randomMonster = r.randint(0, 10)
if randomMonster == 1:
print(monsterTypeChoice)
if monsterTypeChoice == "Spider":
mHP = 5
mP = 5
print("The spider is attacking you!", mHP, "HP", mP, "Power")
if mHP > 0:
health -= mP
if health <= 0:
print("You are dead...")
exit()
if monsterTypeChoice == "Bat":
mHP = 10
mP = 13
print("The bat is attacking you!", mHP, "HP", mP, "Power")
if mHP > 0:
health -= mP
if health <= 0:
print("You are dead...")
exit()
if monsterTypeChoice == "Dragon":
mHP = 100
mP = 20
print("The dragon is attacking you!", mHP, "HP", mP, "Power")
if mHP > 0:
health -= mP
if health <= 0:
print("You are dead...")
exit()
if monsterTypeChoice == "Ghost":
mHP = 999
mP = 1
print("The ghost is attacking you!", mHP, "HP", mP, "Power")
if mHP > 0:
health -= mP
if health <= 0:
print("You are dead...")
exit()
if monsterTypeChoice == "Goblin":
mHP = 20
mP = 10
print("The goblin is attacking you!", mHP, "HP", mP, "Power")
if mHP > 0:
health -= mP
if balance >= 50:
balance -= 50
if health <= 0:
print("You are dead...")
exit()
if monsterTypeChoice == "Zerk":
mHP = 120
mP = 40
print("The zerk is attacking you!", mHP, "HP", mP, "Power")
if mHP > 0:
health -= mP
health -= 5
if health <= 0:
print("You are dead...")
exit()
print("----------")
print("Health-", health)
print("Power-", power)
print("Balance-", balance)
print("----------")
shop = input()
if shop == "h":
heal()
if shop == "s":
pickaxe()
if shop == "l":
lottery()
s.system("clear")
if shop == "1":
for i in range(10):
resources2()
s.system("clear")
if shop == "10":
for i in range(100):
print("Wait...")
resources2()
s.system("clear")
if shop == "100":
for i in range(1000):
print("Wait...")
resources2()
s.system("clear")
if shop == "1000":
for i in range(10000):
print("Wait...")
resources2()
s.system("clear")
if shop == "hack":
s.system("clear")
ans2 = input("Login-")
if ans2 == "Miner" or ans2 == "miner":
print("Cheking.")
t.sleep(1)
s.system("clear")
print("Cheking..")
t.sleep(1)
s.system("clear")
print("Cheking...")
t.sleep(1)
s.system("clear")
print("Cheking.")
t.sleep(1)
s.system("clear")
print("Cheking..")
t.sleep(1)
s.system("clear")
print("succsesful!")
t.sleep(2)
s.system("clear")
ans = input("Write password...")
if ans == "Jy991NerLLa":
print("Cheking.")
t.sleep(1)
s.system("clear")
print("Cheking..")
t.sleep(1)
s.system("clear")
print("Cheking...")
t.sleep(1)
s.system("clear")
print("Cheking.")
t.sleep(1)
s.system("clear")
print("Cheking..")
t.sleep(1)
s.system("clear")
print("Done!")
t.sleep(2)
s.system("clear")
balance += 999999
health += 999999
elif ans == "gYqjso124%81j":
print("Cheking.")
t.sleep(1)
s.system("clear")
print("Cheking..")
t.sleep(1)
s.system("clear")
print("Cheking...")
t.sleep(1)
s.system("clear")
print("Cheking.")
t.sleep(1)
s.system("clear")
print("Cheking..")
t.sleep(1)
s.system("clear")
print("What? How? Cheater..")
t.sleep(2)
s.system("clear")
power = 20
else:
print("Cheking.")
t.sleep(1)
s.system("clear")
print("Cheking..")
t.sleep(1)
s.system("clear")
print("Cheking...")
t.sleep(1)
s.system("clear")
print("Cheking.")
t.sleep(1)
s.system("clear")
print("Cheking..")
t.sleep(1)
s.system("clear")
print("Cheking...")
t.sleep(2)
s.system("clear")
print("Inncorect!!:((")
t.sleep(3)
gameLoop()