Skip to content

Commit

Permalink
Factory construction now takes account of upkeep rate
Browse files Browse the repository at this point in the history
And fixed the income per second was much too high
  • Loading branch information
SMUnlimited committed Nov 18, 2024
1 parent 5b5cc2a commit 301f2a3
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 12 deletions.
6 changes: 3 additions & 3 deletions REFORGED/Upkeep.txt
Original file line number Diff line number Diff line change
@@ -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
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
6 changes: 3 additions & 3 deletions ROC/Upkeep.txt
Original file line number Diff line number Diff line change
@@ -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
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
6 changes: 3 additions & 3 deletions TFT/Upkeep.txt
Original file line number Diff line number Diff line change
@@ -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
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
18 changes: 15 additions & 3 deletions common.eai
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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

//============================================================================
Expand Down

0 comments on commit 301f2a3

Please sign in to comment.