From 0652b079812d625b293d79b951cd1d2062820ccb Mon Sep 17 00:00:00 2001 From: xolatile Date: Sun, 16 Jun 2024 20:05:15 -0400 Subject: [PATCH] Updating recent changes... --- xerbia.c | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/xerbia.c b/xerbia.c index 5ff024b..64dd0d6 100644 --- a/xerbia.c +++ b/xerbia.c @@ -9,10 +9,9 @@ enum { replies }; -static int population = 0; -static int reputation = 0; -static int monthly_immigration = 0; -static int monthly_emigration = 0; +static int population = 0; +static int reputation = 0; +static int migration = 0; static int resource [resources] = { 0 }; static int construction [constructions] = { 0 }; @@ -116,10 +115,9 @@ static void print_constructions (void) { } static void print_statistics (void) { - print ("Reputation = %i\n", reputation); - print ("Monthly immigration = %i\n", monthly_immigration); - print ("Monthly emigration = %i\n", monthly_emigration); - print ("Population = %i\n", population); + print ("Reputation = %i\n", reputation); + print ("Migration = %i\n", migration); + print ("Population = %i\n", population); separate (); } @@ -179,6 +177,9 @@ static void compute_turn (void) { int index; + print ("Your strategy has been submitted to the council, now you can only wait...\n"); + print ("One month later, your advisor brings your short report on activities in your fortress.\n"); + for (index = 0; index < resources; ++index) { int gained = construction [index] * 20; int lost = random (1, 10); @@ -188,7 +189,14 @@ static void compute_turn (void) { print ("Your fortress gained /2%i/- units of %s, but lost /1%i/- due to %s.\n", gained, resource_name [index], lost, problem [index]); } - print ("Your strategy has been submitted to the council, now you can only wait...\n"); + reputation += random (-3, 3) + resource [gold] / 120 + resource [wheat] / 60; + migration = random (0, 6) - resource [wheat] / 120; + population += migration; + resource [wheat] -= population / 3; + resource [gold] -= ((reputation < 0) ? -reputation : reputation) / 3; + + print ("Beside that, /1%i/- units of wheat was spent on feeding the people.\n", population / 3); + print ("Also, only /1%i/- gold was spent inside castle.\n", ((reputation < 0) ? -reputation : reputation) / 3); separate (); } @@ -197,10 +205,9 @@ int main (void) { int index; int reply; - reputation = random (0, 10); - monthly_immigration = random (0, 10); - monthly_emigration = random (0, 10); - population = random (6, 12) * 20 + monthly_immigration - monthly_emigration; + reputation = random (0, 10); + migration = random (0, 10); + population = random (6, 12) * 20 + migration; for (index = 0; index < resources; ++index) { resource [index] = random (6, 12) * 20;