Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ruleTweaks = {
- mortgageRate = .1,
- freeParkingNotSoFree = true,
- freeParkingTaxes = true,
- fuxTax = false,
- doubleGoOnHit = true,
- goAroundBeforeBuy = false,
- }
- properties = {}
- properties.balticAve = {
- --Used by all
- railroad = false,
- utility = false,
- property = true,
- --Basic info for properties. applies to anything that has a card for the property
- cost = 1,
- GUID = "",
- monopolyGUIDS = {"",""},
- mortgageValue = 1,
- --Following options are for regular properties only, not needed for railroads or utilities
- --rent - rentCost, 1house, 2 houses, 3 houses, 4 houses, hotel
- rent = {1,2,3,4,5,6},
- houseCost = 1,
- }
- function getPropertyData(tileID)
- if boardPoints[tileID][3] then
- return boardPoints[tileID][3]
- else
- return false
- end
- end
- function detectIfOwned(pData)
- for k,v in next, playerData do
- if hasProperty(v,pData.GUID) then
- return v
- end
- end
- end
- function hasProperty(player,guid)
- local objectsList = player.WalletZone.getObjects()
- for k,v in pairs, objectsList do
- if v.getGUID() == guid then
- return true
- end
- end
- end
- function ownedInSet(player, ids)
- local num = 0
- for i, #ids do
- if hasProperty(player,ids[i]) then
- num = num + 1
- end
- end
- return num
- end
- function mortgaged(guid)
- --detect if card is flipped z 180 is flipped
- local property = getObjectFromGUID(guid)
- local rotation = property.getRotation()
- if rotation.z > 170 and rotation.z <190 then
- return true
- else
- return false
- end
- end
- -- Start code for land detection
- local propertyData = getPropertyData(tileID)
- if propertyData then
- local owner = detectIfOwned(propertyData)
- if owner then
- if not mortgaged(propertyData.GUID) then
- local baseRent = 0
- broadcastToAll("Owned by player " .. owner.color)
- -- Calculate rent costs.
- othersInSet = ownedInSet(owner,propertyData.monopolyGUIDS)
- if propertyData.railroad then
- -- Calculate Railroad Rent
- elseif propertyData.utility then
- -- Calculate Utility Rent
- elseif propertyData.property then
- -- Calculate Rent for regular properties.
- local baseRent = playerData.rent[1]
- if othersInSet == #propertyData.monopolyGUIDS then
- -- player has a monopoly
- baseRent = baseRent * 2
- broadcastToAll(owner.color .. " has a monopoly on that property!")
- -- Check for houses/hotels here
- -- if hasHouses(tileID.houseGUID
- end
- broadcastToAll("You owe " .. owner.color .. " $"..baseRent)
- else
- -- property is currently mortgaged
- local cost = math.floor(propertyData.mortgageValue * 1.1)
- broadcastToAll("The property is mortgaged. No Rent Due. (Cost to un-mortgage: $" .. cost)
- end
- else
- broadcastToAll("Available to buy for " .. propertyData.cost)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment