maxderopnl

MaxScape ios/andriod

Nov 20th, 2014
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.55 KB | None | 0 0
  1. health=200
  2. mana=1000
  3. money=0
  4.  
  5.  
  6.  
  7. local function game()
  8.    local function fight()
  9.       loss = math.random(200)
  10.       print('you fought with a Dwarf and lost '.. loss ..' health')
  11.       health=loss
  12.       game()
  13.    end
  14.  
  15.    local function fullmana()
  16.       print('you drank a full mana')
  17.       mana=1000
  18.       game()
  19.    end
  20.  
  21.    local function fullhealth()
  22.       print('you drank a full health')
  23.       health=200
  24.       game()
  25.    end
  26.  
  27.    local function eat()
  28.       if health == 200 then
  29.          print('max health!')
  30.       else
  31.          print('you ate and restored 17 health')
  32.          game()
  33.       end
  34.    end
  35.  
  36.    local function rest()
  37.       print('you are resting, please wait 5 seconds')
  38.       sys.sleep(5000)
  39.       print('your mana has been restored')
  40.       mana=1000
  41.       game()
  42.    end
  43.  
  44.    local function shop()
  45.       print('you searched for a merchant and found one!')
  46.       print('items you can buy:')
  47.       print('1. full mana Û250')
  48.       print('2. full health Û500')
  49.       print('3. nothing')
  50.       print('what do you want to buy? type the number in front of the item')
  51.       buying = io.read()
  52.       if buying == '1' then
  53.          fullmana()
  54.       elseif buying == '2' then
  55.          fullhealth()
  56.       elseif buying == '3' then
  57.          game()
  58.       end
  59.    end
  60.  
  61.    sys.print('I want to ')
  62.    input = io.read()
  63.    if input == 'eat' then
  64.       eat()
  65.    elseif input == 'store' then
  66.       shop()
  67.    elseif input == 'fight' then
  68.       fight()
  69.    elseif input == 'rest' then
  70.       rest()
  71.    end
  72.  
  73. end
  74.  
  75.  
  76.  
  77.  
  78.  
  79. game()
Advertisement
Add Comment
Please, Sign In to add comment