Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local health = "100"
- local ehealth = "100"
- function eturn()
- local damage = math.random(25,60)
- term.clear()
- term.setCursorPos(2,2)
- print(damage)
- local health = health-damage
- sleep(1)
- turn()
- end
- function atk()
- local damage = math.random(30,50)
- local ehealth = ehealth-damage
- term.setCursorPos(2,2)
- write(damage)
- write("!")
- sleep(3)
- eturn()
- end
- function miss()
- term.setCursorPos(2,2)
- print("Miss!")
- sleep(3)
- eturn()
- end
- function crit()
- local damage = math.random(50,75)
- local ehealth = ehealth-damage
- term.setCursorPos(2,2)
- write(damage)
- write("!")
- sleep(3)
- eturn()
- end
- function fight()
- local crit = math.random(1,5)
- if crit == 1 then
- atk()
- elseif crit == 2 then
- atk()
- elseif crit == 3 then
- atk()
- elseif crit == 4 then
- crit()
- elseif crit == 5 then
- miss()
- end
- end
- function turn()
- term.clear()
- term.setCursorPos(2,7)
- write("Health:")
- write(health)
- term.setCursorPos(2,8)
- write("Enemy Health:")
- write(ehealth)
- term.setCursorPos(2,10)
- write("Fight")
- sleep(0.2)
- term.setCursorPos(8,10)
- write("Act")
- sleep(0.2)
- term.setCursorPos(12,10)
- write("Item")
- sleep(0.2)
- term.setCursorPos(17,10)
- write("Mercy")
- sleep(1)
- term.setCursorPos(2,12)
- print("Choose Option (Warning: Case Sensitive)")
- term.setCursorPos(2,13)
- local input = read()
- if input == "Fight" then
- fight()
- elseif input == "Act" then
- act()
- elseif input == "Item" then
- item()
- elseif input == "Mercy" then
- mercy()
- else
- turn()
- end
- end
- while true do
- turn()
- end
Advertisement
Add Comment
Please, Sign In to add comment