From 24c269f13e35899b7bf7ef9a045e75fdfe870cf9 Mon Sep 17 00:00:00 2001 From: Nander Voortman Date: Mon, 23 Apr 2018 21:34:21 +0200 Subject: [PATCH] Add loan, payback. --- main.lua | 2 +- scripts/gameobjects/cards.lua | 69 +++++++++++++++++++++++++---------- scripts/helpers/gamerules.lua | 1 + 3 files changed, 51 insertions(+), 21 deletions(-) diff --git a/main.lua b/main.lua index 3f58681..10cc185 100644 --- a/main.lua +++ b/main.lua @@ -13,7 +13,7 @@ STATE = { }, hand = {}, discardPile = { "small_office", "small_generator", "small_residential"}, - drawPile = {"blackout"}, + drawPile = {}, currentTurnEffects = {}, cars = {}, } diff --git a/scripts/gameobjects/cards.lua b/scripts/gameobjects/cards.lua index c4502b1..215a34f 100644 --- a/scripts/gameobjects/cards.lua +++ b/scripts/gameobjects/cards.lua @@ -26,15 +26,15 @@ cards.medium_generator = { effects = { { type = "add_card", - card = "medium_generator", + card = "industrial_1", }, { type = "place_building", - building = "industrial_1", + building = "medium_generator", }, }, requirements = {}, - costs = { type = "money", value = 8 }, + costs = { type = "money", value = 10 }, } cards.wind_generator = { @@ -46,7 +46,7 @@ cards.wind_generator = { }, }, requirements = {}, - costs = { type = "money", value = 10 }, + costs = { type = "money", value = 8 }, is_creeper = false, } @@ -63,7 +63,7 @@ cards.small_office = { } }, requirements = {}, - costs = {}, + costs = { type = "money", value = 6}, is_creeper = false, } @@ -81,7 +81,7 @@ cards.large_office = { }, requirements = {}, - costs = {}, + costs = { type = "money", value = 12}, is_creeper = false, } @@ -94,7 +94,7 @@ cards.tech_office = { } }, requirements = {}, - costs = {}, + costs = { type = "money", value = 25}, is_creeper = false, } @@ -116,7 +116,7 @@ cards.small_residential = { }, requirements = {}, - costs = {}, + costs = { type = "money", value = 5}, is_creeper = false, } @@ -133,7 +133,7 @@ cards.medium_residential = { }, }, requirements = {}, - costs = {}, + costs = { type = "money", value = 10}, is_creeper = false, } @@ -150,7 +150,7 @@ cards.small_park = { }, }, requirements = {}, - costs = { type = "money", value = 3 }, + costs = { type = "money", value = 8 }, is_creeper = false, } @@ -163,7 +163,7 @@ cards.stadium = { } }, requirements = {}, - costs = {}, + costs = { type = "money", value = 25}, is_creeper = false, } @@ -174,17 +174,13 @@ cards.university = { type = "add_card", card = "tech_office", -- Autoloads from `cards` }, - { - type = "add_card", - card = "industrial_2", -- Autoloads from `cards` - }, { type = "place_building", building = "university", }, }, requirements = {}, - costs = {}, + costs = { type = "money", value = 35}, is_creeper = false, } @@ -197,7 +193,7 @@ cards.casino = { } }, requirements = {}, - costs = {}, + costs = { type = "money", value = 25}, is_creeper = false, } @@ -214,7 +210,7 @@ cards.industrial_1 = { }, }, requirements = {}, - costs = {}, + costs = { type = "money", value = 12}, is_creeper = false, } @@ -227,7 +223,7 @@ cards.industrial_2 = { } }, requirements = {}, - costs = {}, + costs = { type = "money", value = 24}, is_creeper = false, } @@ -246,7 +242,40 @@ cards.blackout = { value = -10, }, }, - requirements = {{type="resource", property="power", relation="lt", value=30}}, + requirements = {{type="resource", property="power", relation="lt", value=0}}, + costs = {}, + autoadd=true, + is_creeper = true, +} + +cards.payback = { + name = "Payback", + effects = { + { + type = "resource", + resource="money", + value = -130, + }, + }, + requirements = {}, + costs = {}, + is_creeper = true, +} + +cards.loan = { + name = "Loan", + effects = { + { + type = "resource", + resource="money", + value = 100, + }, + { + type = "add_card", + card="payback", + }, + }, + requirements = {{type="resource", property="money", relation="lt", value=-10}}, costs = {}, autoadd=true, is_creeper = true, diff --git a/scripts/helpers/gamerules.lua b/scripts/helpers/gamerules.lua index 834d482..aa00556 100644 --- a/scripts/helpers/gamerules.lua +++ b/scripts/helpers/gamerules.lua @@ -231,6 +231,7 @@ gamerules.resources.happiness = gamerules.getHappiness gamerules.resources.relaxation = gamerules.getRelaxation gamerules.resources.nuisance = gamerules.getNuisance +gamerules.resources.money = function(state) return state.properties.money end return gamerules