Skip to content

Commit

Permalink
Add some more building values.
Browse files Browse the repository at this point in the history
  • Loading branch information
nanderv committed Apr 23, 2018
1 parent 88bf09e commit 1f072e6
Show file tree
Hide file tree
Showing 5 changed files with 107 additions and 23 deletions.
2 changes: 1 addition & 1 deletion main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ DEBUG = true
STATE = {
properties = { population = 0, money = 40 },
buildings = {
{ x = 1, y = 1, building = "tech_office" },
{ x = 1, y = 1, building = "large_office" },

},
hand = {},
Expand Down
106 changes: 87 additions & 19 deletions scripts/gameobjects/buildings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ buildings.small_generator = {
{
type = "resource",
resource = "money_per_turn",
value = -2,
value = -1,
},
{
type = "adjacent",
Expand All @@ -32,7 +32,6 @@ buildings.small_generator = {
resource = "nuisance",
value = 2,
},

},
},
},
Expand All @@ -53,17 +52,17 @@ buildings.medium_generator = {
resource = "work",
value = -4,
},
{
type = "resource",
resource = "money_per_turn",
value = -2,
},
{
type = "adjacent",
filter = {
"small_residential",
"medium_residential",
},
{
type = "resource",
resource = "money_per_turn",
value = -4,
},
effects = {
{
type = "resource",
Expand All @@ -83,13 +82,18 @@ buildings.wind_generator = {
{
type = "resource",
resource = "power",
value = 3,
value = 5,
},
{
type = "resource",
resource = "work",
value = -1,
},
{
type = "resource",
resource = "money_per_turn",
value = -1,
},
{
type = "adjacent",
filter = {
Expand Down Expand Up @@ -140,6 +144,21 @@ buildings.large_office = {
resource = "power",
value = -5,
},
{
type = "adjacent",
filter = {
"small_office",
"tech_office",
},
effects = {
{
type = "resource",
resource = "work",
value = -5,
},
},
},

},
}
buildings.tech_office = {
Expand All @@ -150,12 +169,12 @@ buildings.tech_office = {
{
type = "resource",
resource = "work",
value = -10,
value = -15,
},
{
type = "resource",
resource = "power",
value = -5,
value = -3,
},
},
}
Expand Down Expand Up @@ -200,6 +219,11 @@ buildings.small_park = {
size = { x = 1, y = 1 },
asset = "small_park",
effects = {
{
type = "resource",
resource = "money_per_turn",
value = -1,
},
{
type = "adjacent",
filter = {
Expand All @@ -210,7 +234,7 @@ buildings.small_park = {
{
type = "resource",
resource = "relaxation",
value = 12,
value = 4,
},
},
},
Expand All @@ -221,18 +245,60 @@ buildings.stadium = {
name = "Stadium",
size = { x = 1, y = 1 },
asset = "stadium",
effects = {},
effects = {
{
type = "resource",
resource = "money_per_turn",
value = -4,
},
{
type = "resource",
resource = "relaxation",
value = 30,
},
{
type = "resource",
resource = "power",
value = -6,
},
{
type = "adjacent",
filter = {
"small_residential",
"medium_residential",
},
effects = {
{
type = "resource",
resource = "nuisance",
value = 15,
},
},
},
},
}

buildings.university = {
name = "University",
size = { x = 1, y = 1 },
asset = "university",
effects = { {
type = "resource",
resource = "draw",
value = 1,
},},
effects = {
{
type = "resource",
resource = "draw",
value = 1,
},
{
type = "resource",
resource = "work",
value = -5,
},
{
type = "resource",
resource = "money_per_turn",
value = -5,
},
},
}

buildings.casino = {
Expand All @@ -242,7 +308,8 @@ buildings.casino = {
effects = {},
}

buildings.industrial_1 = {--
buildings.industrial_1 = {
--
name = "Steel mill",
size = { x = 1, y = 1 },
asset = "steelmill",
Expand All @@ -255,7 +322,8 @@ buildings.industrial_2 = {
asset = "factory",
effects = {},
}
buildings.start = {--
buildings.start = {
--
name = "Start",
size = { x = 1, y = 1 },
asset = "start",
Expand Down
1 change: 0 additions & 1 deletion scripts/states/dealHand.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ end
function menu:update(dt, bo)
scripts.rendering.renderUI.updateMove(dt)
if not bo then
if menu.counter > #STATE.hand then Gamestate.switch(scripts.states.playCards) end
if #STATE.hand >= scripts.helpers.gamerules.getCardDraw(STATE) then
Gamestate.switch(scripts.states.playCards)
return
Expand Down
16 changes: 14 additions & 2 deletions scripts/states/drawCard.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,32 @@
-- To change this template use File | Settings | File Templates.
--
local menu = {} -- previously: Gamestate.new()
menu.name = "drawCard"
menu.name="drawCards"
function menu:enter(prev)
menu.prev = prev
-- setup entities here
-- TODO: Make this take time.
menu.hasShuffled = false
menu.showCardDrawAnim = false
end

function menu:draw()
menu.prev:draw(true)

if menu.showCardDrawAnim then
end
end

function menu:update(dt, bo)
scripts.rendering.renderUI.updateMove(dt)
if not bo then
if menu.showCardDrawAnim then
menu.showCardDrawAnim = menu.showCardDrawAnim - dt
if menu.showCardDrawAnim < 0 then
Gamestate.pop()
end
return
end
local c = STATE.drawPile[1]
if c then
local card = scripts.gameobjects.cards[c]
Expand All @@ -35,6 +46,7 @@ function menu:update(dt, bo)
else
STATE.hand[#STATE.hand + 1] = c
table.remove(STATE.drawPile, 1)
menu.showCardDrawAnim = 0.5
end

else
Expand All @@ -52,7 +64,7 @@ function menu:update(dt, bo)
end

function menu:mousepressed(x, y, click)
Gamestate.pop()
scripts.rendering.renderUI.mousePressed(x, y, click)
end

function menu:mousereleased(x, y, mouse_btn)
Expand Down
5 changes: 5 additions & 0 deletions scripts/states/showCard.lua
Original file line number Diff line number Diff line change
Expand Up @@ -75,18 +75,22 @@ function menu:mousepressed(x, y, mouse_btn)
if mouse_btn == 1 then
local xg, yg = x / GLOBSCALE(), y / GLOBSCALE()
if xg > 750 and xg < 790 and yg > 455 and yg < 495 then
CAMERA.buildingFocus = nil
startCard(STATE, menu.card, false)
end
if xg > 710 and xg < 750 and yg > 455 and yg < 495 then
CAMERA.buildingFocus = nil
Gamestate.pop()
end
if xg > 670 and xg < 710 and yg > 455 and yg < 495 then
table.remove(STATE.hand, menu.card)
CAMERA.buildingFocus = nil
Gamestate.pop()
end

local k = scripts.helpers.calculations.getCardNumber(x, y, true)
if k then
CAMERA.buildingFocus = nil
Gamestate.pop()
Gamestate.push(scripts.states.showCard, STATE, k)
end
Expand All @@ -103,6 +107,7 @@ function menu:keypressed(key)
startCard(STATE, menu.card, false)
end
if love.keyboard.isDown("escape") then
CAMERA.buildingFocus = nil
Gamestate.pop()
end
end
Expand Down

0 comments on commit 1f072e6

Please sign in to comment.