Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local turn = 1
- local spaceP = {1, 1, 1, 1, 1, 1}
- local jailP = {[1] = false, [2] = false, [3] = false, [4] = false, [5] = false, [6] = false}
- local function player(num)
- while true do
- if num == turn then
- local d1 = math.random(6)
- local d2 = math.random(6)
- local moveCount = d1 + d2
- print("Player "..num.." rolled a "..d1.." and a "..d2.."...")
- if d1 == d2 then
- print("Doubles! Rolling again.")
- local d1 = math.random(6)
- local d2 = math.random(6)
- local moveCount = moveCount + d1 + d2
- if d1 == d2 then
- print("Doubles! Rolling again for a second time.")
- local d1 = math.random(6)
- local d2 = math.random(6)
- local moveCount = moveCount + d1 + d2
- if d1 == d2 then
- print("Uh-oh, three doubles! Player "..num.." is going to Jail!")
- jailP[num] = true
- end
- end
- end
- print("Moving "..moveCount.." spaces.")
- spaceP[num] = spaceP[num] + moveCount
- if spaceP[num] > 39 then
- spaceP[num] = 1 + moveCount
- end
- print("Player "..num.." landed on "..board[spaceP[num]].name..".")
- if board[spaceP[num]].owner == 0 then
- if (type == 1 or type == 2 or type == 7) and (bank >= price + 200) then
- local isBuying = math.random(4)
- if isBuying == 1 then
- isBuying = true
- end
- if isBuying == true then
- players[1].properties[#players[1].properties+1] = board[spaceP[num]].spaceNum
- players[1].bank = players[1].bank - board[spaceP[num]].price
- board[spaceP[num]].owner = 1
- print("Player "..num.." has bought "..board[spaceP[num]].name..".")
- end
- end
- end
- end
- if turn < 6 then
- turn = turn + 1
- elseif turn == 6 then
- turn = 1
- end
- print("End of Player "..num.."'s turn. It is now Player "..turn.."'s turn.")
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement