From 234fb5526725211c3d32a08b4514b62052cf13c4 Mon Sep 17 00:00:00 2001 From: Rolf van Kleef Date: Mon, 23 Apr 2018 21:28:02 +0200 Subject: [PATCH] Disabled creeper card display timer --- main.lua | 3 ++- scripts/helpers/gamerules.lua | 1 - scripts/states/addBuilding.lua | 2 ++ scripts/states/creeperNothingHappened.lua | 1 + scripts/states/dealHand.lua | 1 + scripts/states/drawCard.lua | 15 ++------------- scripts/states/endOfTurn.lua | 1 + scripts/states/playCards.lua | 1 + scripts/states/runCard.lua | 11 +++++++++-- scripts/states/showCard.lua | 1 + scripts/states/showCreepers.lua | 1 + scripts/states/shuffleDiscardPile.lua | 1 + 12 files changed, 22 insertions(+), 17 deletions(-) diff --git a/main.lua b/main.lua index 3f58681..a0baaaa 100644 --- a/main.lua +++ b/main.lua @@ -41,7 +41,8 @@ function love.load() require "lib.lovebird".monfn = function() return "Draw: " .. inspect(STATE.drawPile) .. "
Discard: " .. inspect(STATE.discardPile) .. - "
Hand: " .. inspect(STATE.hand) + "
Hand: " .. inspect(STATE.hand) .. + "
Gamestate: " .. Gamestate.current().name end end end diff --git a/scripts/helpers/gamerules.lua b/scripts/helpers/gamerules.lua index db945d6..73b722e 100644 --- a/scripts/helpers/gamerules.lua +++ b/scripts/helpers/gamerules.lua @@ -157,7 +157,6 @@ function gamerules.startTurn(state) end end state.currentTurnEffects = newEffects -print(state.population) state.properties.money = state.properties.money + gamerules.getMoneyPerTurn(state) + math.min ( -gamerules.getTotalResource(state, "work"), state.properties.population) beforeTurn.housing = gamerules.getTotalHousing(state) diff --git a/scripts/states/addBuilding.lua b/scripts/states/addBuilding.lua index bf3ca31..f02fa4f 100644 --- a/scripts/states/addBuilding.lua +++ b/scripts/states/addBuilding.lua @@ -6,6 +6,8 @@ -- To change this template use File | Settings | File Templates. -- local addBuilding = {} -- previously: Gamestate.new() +addBuilding.name = "addBuilding" + function addBuilding:enter(prev, state, building, card) addBuilding.prev = prev addBuilding.building = building diff --git a/scripts/states/creeperNothingHappened.lua b/scripts/states/creeperNothingHappened.lua index 0cb41de..6c9875e 100644 --- a/scripts/states/creeperNothingHappened.lua +++ b/scripts/states/creeperNothingHappened.lua @@ -15,6 +15,7 @@ -- local menu = {} -- previously: Gamestate.new() +menu.name = "creeperNothingHappened" function menu:enter(prev, state, cardIndex, card) menu.prev = prev diff --git a/scripts/states/dealHand.lua b/scripts/states/dealHand.lua index 7b04616..3a744da 100644 --- a/scripts/states/dealHand.lua +++ b/scripts/states/dealHand.lua @@ -7,6 +7,7 @@ -- HAND = 5 local menu = {} -- previously: Gamestate.new() +menu.name = "dealHand" function menu:enter(prev) menu.prev = prev menu.counter = 0 diff --git a/scripts/states/drawCard.lua b/scripts/states/drawCard.lua index 43556f4..a39fb5d 100644 --- a/scripts/states/drawCard.lua +++ b/scripts/states/drawCard.lua @@ -6,31 +6,21 @@ -- To change this template use File | Settings | File Templates. -- local menu = {} -- previously: Gamestate.new() +menu.name = "drawCard" 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] @@ -45,7 +35,6 @@ function menu:update(dt, bo) else STATE.hand[#STATE.hand + 1] = c table.remove(STATE.drawPile, 1) - menu.showCardDrawAnim = 0.5 end else @@ -63,7 +52,7 @@ function menu:update(dt, bo) end function menu:mousepressed(x, y, click) - scripts.rendering.renderUI.mousePressed(x, y, click) + Gamestate.pop() end function menu:mousereleased(x, y, mouse_btn) diff --git a/scripts/states/endOfTurn.lua b/scripts/states/endOfTurn.lua index 49e8318..1162c9b 100644 --- a/scripts/states/endOfTurn.lua +++ b/scripts/states/endOfTurn.lua @@ -6,6 +6,7 @@ -- To change this template use File | Settings | File Templates. -- local menu = {} -- previously: Gamestate.new() +menu.name = "endOfTurn" function menu:enter(prev) menu.prev = prev menu.changes, menu.creepers = scripts.helpers.gamerules.endTurn(STATE) diff --git a/scripts/states/playCards.lua b/scripts/states/playCards.lua index 79dabd0..e615d5d 100644 --- a/scripts/states/playCards.lua +++ b/scripts/states/playCards.lua @@ -8,6 +8,7 @@ LOWEST = 0 local menu = {} -- previously: Gamestate.new() +menu.name = "playCards" function menu:enter(prev) menu.prev = prev end diff --git a/scripts/states/runCard.lua b/scripts/states/runCard.lua index 1fd1e5e..22f8139 100644 --- a/scripts/states/runCard.lua +++ b/scripts/states/runCard.lua @@ -15,6 +15,7 @@ -- local menu = {} -- previously: Gamestate.new() +menu.name = "runCard" function menu:enter(prev, state, cardIndex, card) menu.prev = prev @@ -127,7 +128,9 @@ function menu:update(dt, wait) table.remove(STATE.hand, menu.card) end end - Gamestate.pop() + if not scripts.gameobjects.cards[menu.cardData].is_creeper then + Gamestate.pop() + end end end end @@ -148,7 +151,11 @@ function menu:draw() end function menu:mousepressed(x, y, click) - scripts.rendering.renderUI.mousePressed(x, y, click) + if scripts.gameobjects.cards[menu.cardData].is_creeper then + Gamestate.pop() + else + scripts.rendering.renderUI.mousePressed(x, y, click) + end end function menu:mousereleased(x, y, mouse_btn) diff --git a/scripts/states/showCard.lua b/scripts/states/showCard.lua index b022cee..0df70da 100644 --- a/scripts/states/showCard.lua +++ b/scripts/states/showCard.lua @@ -7,6 +7,7 @@ -- local menu = {} -- previously: Gamestate.new() +menu.name = "showCard" function menu:enter(prev, state, card) menu.state = state menu.card = card diff --git a/scripts/states/showCreepers.lua b/scripts/states/showCreepers.lua index 3c722a1..5943a13 100644 --- a/scripts/states/showCreepers.lua +++ b/scripts/states/showCreepers.lua @@ -1,4 +1,5 @@ local menu = {} -- previously: Gamestate.new() +menu.name = "showCreepers" function menu:enter(prev, cards) menu.prev = prev menu.cards = cards diff --git a/scripts/states/shuffleDiscardPile.lua b/scripts/states/shuffleDiscardPile.lua index b70275e..d47a400 100644 --- a/scripts/states/shuffleDiscardPile.lua +++ b/scripts/states/shuffleDiscardPile.lua @@ -6,6 +6,7 @@ -- To change this template use File | Settings | File Templates. -- local menu = {} -- previously: Gamestate.new() +menu.name = "shuffleDiscardPile" function menu:enter(prev) menu.prev = prev -- setup entities here