From 301f2a389c063b7f07cd15d550a0bd435811fca4 Mon Sep 17 00:00:00 2001 From: SMUnlimited Date: Mon, 18 Nov 2024 11:59:10 +0000 Subject: [PATCH] Factory construction now takes account of upkeep rate And fixed the income per second was much too high --- REFORGED/Upkeep.txt | 6 +++--- ROC/Upkeep.txt | 6 +++--- TFT/Upkeep.txt | 6 +++--- common.eai | 18 +++++++++++++++--- 4 files changed, 24 insertions(+), 12 deletions(-) diff --git a/REFORGED/Upkeep.txt b/REFORGED/Upkeep.txt index 2744961ee..b64c91fc3 100644 --- a/REFORGED/Upkeep.txt +++ b/REFORGED/Upkeep.txt @@ -1,3 +1,3 @@ -Upkeep Food value border Resistance Save time Mines needed -LOW 50 500 30+GetRandomInt(0, 60) 2 -HIGH 80 2000 100+GetRandomInt(0, 300) 2 \ No newline at end of file +Upkeep Food value border Resistance Save time Mines needed GoldChange +LOW 50 500 30+GetRandomInt(0, 60) 2 0.7 +HIGH 80 2000 100+GetRandomInt(0, 300) 2 0.4 \ No newline at end of file diff --git a/ROC/Upkeep.txt b/ROC/Upkeep.txt index 95aa99371..765e6af06 100644 --- a/ROC/Upkeep.txt +++ b/ROC/Upkeep.txt @@ -1,3 +1,3 @@ -Upkeep Food value border Resistance Save time Mines needed -LOW 40 500 30+GetRandomInt(0, 60) 2 -HIGH 70 2000 100+GetRandomInt(0, 300) 2 \ No newline at end of file +Upkeep Food value border Resistance Save time Mines needed GoldChange +LOW 40 500 30+GetRandomInt(0, 60) 2 0.7 +HIGH 70 2000 100+GetRandomInt(0, 300) 2 0.4 \ No newline at end of file diff --git a/TFT/Upkeep.txt b/TFT/Upkeep.txt index 2744961ee..b64c91fc3 100644 --- a/TFT/Upkeep.txt +++ b/TFT/Upkeep.txt @@ -1,3 +1,3 @@ -Upkeep Food value border Resistance Save time Mines needed -LOW 50 500 30+GetRandomInt(0, 60) 2 -HIGH 80 2000 100+GetRandomInt(0, 300) 2 \ No newline at end of file +Upkeep Food value border Resistance Save time Mines needed GoldChange +LOW 50 500 30+GetRandomInt(0, 60) 2 0.7 +HIGH 80 2000 100+GetRandomInt(0, 300) 2 0.4 \ No newline at end of file diff --git a/common.eai b/common.eai index 1b28a0fcf..3d0184bad 100644 --- a/common.eai +++ b/common.eai @@ -479,7 +479,7 @@ globals integer total_food = 0 integer wood_buffer = 0 real gold_income = 0 - integer income_per_mine = 50 + integer income_per_mine = 10 // rate per second real gold_unit_percentage = 0.9 boolean take_all_ghouls_along = false @@ -538,6 +538,7 @@ globals integer array upkeep_allowed integer array last_upkeep_allowed integer array upkeep_border + real array upkeep_goldchange integer array upkeep_resistance integer array upkeep_save_time integer array upkeep_time @@ -8223,6 +8224,7 @@ function InitUpkeep takes nothing returns nothing set upkeep_save_time[UPKEEP_%1] = %4 set upkeep_mines_needed[UPKEEP_%1] = %5 set upkeep_time[UPKEEP_%1] = -1 + set upkeep_goldchange[UPKEEP_%1] = %6 #ENDINCLUDE endfunction @@ -9158,11 +9160,21 @@ endfunction //============================================================================ // Total expected income per second (plus spare gold) function GetGoldIncome takes nothing returns real - local integer inc = GetMinesHarvested()*income_per_mine + local real inc = I2R(GetMinesHarvested()*income_per_mine) + local integer i = 0 + local real upkeep = 1 + loop + exitwhen i >= UPKEEP_NUM + if FoodUsed() >= upkeep_border[i] then + set upkeep = upkeep_goldchange[i] + endif + set i = i + 1 + endloop + set inc = inc * upkeep if inc > GetGoldOwned() then set inc = GetGoldOwned() endif - return I2R(inc + GetGold()) * gold_unit_percentage + return inc + GetGold() * gold_unit_percentage endfunction //============================================================================