[Freeciv-Dev] (PR#12856) proliferation of BONUS effects
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://bugs.freeciv.org/Ticket/Display.html?id=12856 >
This patch proliferates the BONUS effects beyond all reason.
There are two levels (called priorities, got a better name?) of bonus
effects. Each of these has one bonus effect for each output type. This
gives 12 total effects (compared to the 4 we have now).
Secondly, it removes G_REDUCED_RESEARCH and uses EFT_SCIENCE_BONUS_2 to
replace it.
1. The TRADE and FOOD bonuses were on the FIXME list before, but now
they work.
2. The second priority is needed for G_REDUCED_RESEARCH. This must be
multiplicatively cumulative with the effects of the first priority. So
with a -50% effect here you get a 50% bonus meaning all research is
halved. By comparison just adding a -50 on in the first priority is
only additively cumulative with other effects, so once you have a +650%
bonus it really doesn't hurt you much.
I've also attached a patch which changes the ruleset to demonstrate the
effects in action. Play as Mordor and watch yoursef Win. Or play
against Mordor, if you want the challenge.
-jason
Index: ai/aicity.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/aicity.c,v
retrieving revision 1.211
diff -u -r1.211 aicity.c
--- ai/aicity.c 12 Apr 2005 14:44:35 -0000 1.211
+++ ai/aicity.c 20 Apr 2005 07:01:04 -0000
@@ -318,10 +318,18 @@
case EFT_PROD_ADD_TILE:
case EFT_FOOD_PER_TILE:
case EFT_FOOD_ADD_TILE:
+ case EFT_FOOD_BONUS:
case EFT_PROD_BONUS:
+ case EFT_TRADE_BONUS:
case EFT_TAX_BONUS:
case EFT_SCIENCE_BONUS:
case EFT_LUXURY_BONUS:
+ case EFT_FOOD_BONUS_2:
+ case EFT_PROD_BONUS_2:
+ case EFT_TRADE_BONUS_2:
+ case EFT_TAX_BONUS_2:
+ case EFT_SCIENCE_BONUS_2:
+ case EFT_LUXURY_BONUS_2:
case EFT_CORRUPT_PCT:
case EFT_WASTE_PCT:
break;
Index: client/citydlg_common.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/citydlg_common.c,v
retrieving revision 1.73
diff -u -r1.73 citydlg_common.c
--- client/citydlg_common.c 10 Apr 2005 19:27:34 -0000 1.73
+++ client/citydlg_common.c 20 Apr 2005 07:01:04 -0000
@@ -384,7 +384,7 @@
char *buf, size_t bufsz)
{
int total = 0;
- enum effect_type eft = get_output_bonus_effect(otype);
+ int priority;
int tax[O_COUNT];
buf[0] = '\0';
@@ -429,28 +429,32 @@
}
}
- if (eft != EFT_LAST) {
- int base = total, bonus = 100;
- struct effect_list *plist = effect_list_new();
-
- (void) get_city_bonus_effects(plist, pcity, eft);
-
- effect_list_iterate(plist, peffect) {
- char buf2[512];
- int new_total;
-
- get_effect_req_text(peffect, buf2, sizeof(buf2));
-
- bonus += peffect->value;
- new_total = bonus * base / 100;
- cat_snprintf(buf, bufsz,
- _("%+4d : Bonus from %s (%+d%%)\n"),
- (new_total - total), buf2,
- peffect->value);
- total = new_total;
- } effect_list_iterate_end;
- effect_list_unlink_all(plist);
- effect_list_free(plist);
+ for (priority = 0; priority < 2; priority++) {
+ enum effect_type eft = get_output_bonus_effect(otype, priority);
+
+ if (eft != EFT_LAST) {
+ int base = total, bonus = 100;
+ struct effect_list *plist = effect_list_new();
+
+ (void) get_city_bonus_effects(plist, pcity, eft);
+
+ effect_list_iterate(plist, peffect) {
+ char buf2[512];
+ int new_total;
+
+ get_effect_req_text(peffect, buf2, sizeof(buf2));
+
+ bonus += peffect->value;
+ new_total = bonus * base / 100;
+ cat_snprintf(buf, bufsz,
+ _("%+4d : Bonus from %s (%+d%%)\n"),
+ (new_total - total), buf2,
+ peffect->value);
+ total = new_total;
+ } effect_list_iterate_end;
+ effect_list_unlink_all(plist);
+ effect_list_free(plist);
+ }
}
if (pcity->waste[otype] != 0) {
Index: client/helpdata.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/helpdata.c,v
retrieving revision 1.102
diff -u -r1.102 helpdata.c
--- client/helpdata.c 18 Apr 2005 06:52:49 -0000 1.102
+++ client/helpdata.c 20 Apr 2005 07:01:05 -0000
@@ -1462,9 +1462,6 @@
_("* Buildings that normally confer "
"bonuses against unhappiness will instead give gold.\n"));
}
- if (government_has_flag(gov, G_REDUCED_RESEARCH)) {
- sprintf(buf + strlen(buf), _("* Research costs doubled.\n"));
- }
unit_type_iterate(ut) {
struct unit_type *utype = get_unit_type(ut);
Index: common/capstr.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/capstr.c,v
retrieving revision 1.232
diff -u -r1.232 capstr.c
--- common/capstr.c 18 Apr 2005 06:52:50 -0000 1.232
+++ common/capstr.c 20 Apr 2005 07:01:05 -0000
@@ -82,7 +82,7 @@
* as long as possible. We want to maintain network compatibility with
* the stable branch for as long as possible.
*/
-#define CAPABILITY "+Freeciv.Devel.2005.Apr.18"
+#define CAPABILITY "+Freeciv.Devel.2005.Apr.20"
void init_our_capability(void)
{
Index: common/city.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/city.c,v
retrieving revision 1.328
diff -u -r1.328 city.c
--- common/city.c 18 Apr 2005 06:52:50 -0000 1.328
+++ common/city.c 20 Apr 2005 07:01:05 -0000
@@ -272,24 +272,47 @@
/**************************************************************************
Return the effect for the production bonus for this output type.
**************************************************************************/
-inline enum effect_type get_output_bonus_effect(Output_type_id otype)
+inline enum effect_type get_output_bonus_effect(Output_type_id otype,
+ int priority)
{
- switch (otype) {
- case O_SHIELD:
- return EFT_PROD_BONUS;
- case O_GOLD:
- return EFT_TAX_BONUS;
- case O_LUXURY:
- return EFT_LUXURY_BONUS;
- case O_SCIENCE:
- return EFT_SCIENCE_BONUS;
- case O_FOOD:
- case O_TRADE:
- return EFT_LAST;
- case O_LAST:
+ switch (priority) {
+ case 0:
+ switch (otype) {
+ case O_FOOD:
+ return EFT_FOOD_BONUS;
+ case O_SHIELD:
+ return EFT_PROD_BONUS;
+ case O_TRADE:
+ return EFT_TRADE_BONUS;
+ case O_GOLD:
+ return EFT_TAX_BONUS;
+ case O_LUXURY:
+ return EFT_LUXURY_BONUS;
+ case O_SCIENCE:
+ return EFT_SCIENCE_BONUS;
+ case O_LAST:
+ break;
+ }
+ break;
+ case 1:
+ switch (otype) {
+ case O_FOOD:
+ return EFT_FOOD_BONUS_2;
+ case O_SHIELD:
+ return EFT_PROD_BONUS_2;
+ case O_TRADE:
+ return EFT_TRADE_BONUS_2;
+ case O_GOLD:
+ return EFT_TAX_BONUS_2;
+ case O_LUXURY:
+ return EFT_LUXURY_BONUS_2;
+ case O_SCIENCE:
+ return EFT_SCIENCE_BONUS_2;
+ case O_LAST:
+ break;
+ }
break;
}
-
assert(0);
return EFT_LAST;
}
@@ -1562,16 +1585,14 @@
**************************************************************************/
int get_city_output_bonus(const struct city *pcity, Output_type_id otype)
{
- enum effect_type eft = get_output_bonus_effect(otype);
- int bonus = 100;
+ int bonus = 100, i;
- if (eft != EFT_LAST) {
- bonus += get_city_bonus(pcity, eft);
- }
+ for (i = 0; i < 2; i++) {
+ enum effect_type eft = get_output_bonus_effect(otype, i);
- if (otype == O_SCIENCE
- && government_has_flag(get_gov_pcity(pcity), G_REDUCED_RESEARCH)) {
- bonus /= 2;
+ if (eft != EFT_LAST) {
+ bonus = bonus * (100 + get_city_bonus(pcity, eft)) / 100;
+ }
}
return bonus;
Index: common/city.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/city.h,v
retrieving revision 1.205
diff -u -r1.205 city.h
--- common/city.h 18 Apr 2005 06:52:50 -0000 1.205
+++ common/city.h 20 Apr 2005 07:01:05 -0000
@@ -361,7 +361,8 @@
const char *get_output_identifier(Output_type_id output);
const char *get_output_name(Output_type_id output);
-enum effect_type get_output_bonus_effect(Output_type_id otype);
+enum effect_type get_output_bonus_effect(Output_type_id otype,
+ int priority);
/* properties */
Index: common/effects.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/effects.c,v
retrieving revision 1.29
diff -u -r1.29 effects.c
--- common/effects.c 14 Apr 2005 04:49:13 -0000 1.29
+++ common/effects.c 20 Apr 2005 07:01:05 -0000
@@ -46,7 +46,7 @@
"Enable_Nuke",
"Enable_Space",
"Food_Add_Tile",
- /* TODO: "Food_Bonus", */
+ "Food_Bonus",
/* TODO: "Food_Pct", */
"Food_Inc_Tile",
"Food_Per_Tile",
@@ -92,10 +92,16 @@
"Tax_Bonus",
/* TODO: "Tax_Pct", */
"Trade_Add_Tile",
- /* TODO: "Trade_Bonus", */
+ "Trade_Bonus",
/* TODO: "Trade_Pct", */
"Trade_Inc_Tile",
"Trade_Per_Tile",
+ "Food_Bonus_2",
+ "Prod_Bonus_2",
+ "Trade_Bonus_2",
+ "Tax_Bonus_2",
+ "Luxury_Bonus_2",
+ "Science_Bonus_2",
"Sea_Move",
"Unit_No_Lose_Pop",
"Unit_Recover",
Index: common/effects.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/effects.h,v
retrieving revision 1.17
diff -u -r1.17 effects.h
--- common/effects.h 10 Apr 2005 00:50:37 -0000 1.17
+++ common/effects.h 20 Apr 2005 07:01:05 -0000
@@ -33,8 +33,8 @@
EFT_ENABLE_NUKE,
EFT_ENABLE_SPACE,
EFT_FOOD_ADD_TILE,
- /* TODO: EFT_FOOD_BONUS, */
- /* TODO: EFT_FOOD_PCT, */
+ EFT_FOOD_BONUS,
+ /*TODO: EFT_FOOD_PCT, */
EFT_FOOD_INC_TILE,
EFT_FOOD_PER_TILE,
EFT_FORCE_CONTENT,
@@ -79,10 +79,16 @@
EFT_TAX_BONUS,
/* TODO: EFT_TAX_PCT, */
EFT_TRADE_ADD_TILE,
- /* TODO: EFT_TRADE_BONUS, */
+ EFT_TRADE_BONUS,
/* TODO: EFT_TRADE_PCT, */
EFT_TRADE_INC_TILE,
EFT_TRADE_PER_TILE,
+ EFT_FOOD_BONUS_2,
+ EFT_PROD_BONUS_2,
+ EFT_TRADE_BONUS_2,
+ EFT_TAX_BONUS_2,
+ EFT_LUXURY_BONUS_2,
+ EFT_SCIENCE_BONUS_2,
EFT_SEA_MOVE,
EFT_UNIT_NO_LOSE_POP,
EFT_UNIT_RECOVER,
Index: common/government.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/government.c,v
retrieving revision 1.51
diff -u -r1.51 government.c
--- common/government.c 3 Apr 2005 20:19:52 -0000 1.51
+++ common/government.c 20 Apr 2005 07:01:05 -0000
@@ -32,8 +32,7 @@
static const char *flag_names[] = {
"Build_Veteran_Diplomats", "Revolution_When_Unhappy", "Has_Senate",
"Unbribable", "Inspires_Partisans", "Rapture_City_Growth",
- "Fanatic_Troops", "No_Unhappy_Citizens", "Convert_Tithes_To_Money",
- "Reduced_Research"
+ "Fanatic_Troops", "No_Unhappy_Citizens", "Convert_Tithes_To_Money"
};
/***************************************************************
Index: common/government.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/government.h,v
retrieving revision 1.42
diff -u -r1.42 government.h
--- common/government.h 8 Apr 2005 06:32:27 -0000 1.42
+++ common/government.h 20 Apr 2005 07:01:06 -0000
@@ -23,6 +23,7 @@
/* special values for free_* fields -- SKi */
#define G_CITY_SIZE_FREE G_MAGIC
+/* Changing these will break network compatibility. */
enum government_flag_id {
G_BUILD_VETERAN_DIPLOMAT=0, /* and Spies (in general: all F_DIPLOMAT) */
G_REVOLUTION_WHEN_UNHAPPY,
@@ -34,8 +35,6 @@
G_NO_UNHAPPY_CITIZENS, /* no unhappy citizen, needed by
fundamentism */
G_CONVERT_TITHES_TO_MONEY, /* tithes to money, needed by fundamentalism */
- G_REDUCED_RESEARCH, /* penalty for research, needed by
- fundamentalism */
G_LAST_FLAG
};
#define G_FIRST_FLAG G_BUILD_VETERAN_DIPLOMAT
Index: data/civ2/effects.ruleset
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/civ2/effects.ruleset,v
retrieving revision 1.4
diff -u -r1.4 effects.ruleset
--- data/civ2/effects.ruleset 24 Mar 2005 16:41:42 -0000 1.4
+++ data/civ2/effects.ruleset 20 Apr 2005 07:01:06 -0000
@@ -16,6 +16,14 @@
; /* <-- avoid gettext warnings
; */ <-- avoid gettext warnings
+[effect_fundamentalism]
+name = "Science_Bonus_2"
+value = -50
+reqs =
+ { "type", "name", "range"
+ "Government", "Fundamentalism", "Player"
+ }
+
[effect_airport]
name = "Air_Veteran"
value = 1
Index: data/civ2/governments.ruleset
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/civ2/governments.ruleset,v
retrieving revision 1.32
diff -u -r1.32 governments.ruleset
--- data/civ2/governments.ruleset 28 Mar 2005 17:14:58 -0000 1.32
+++ data/civ2/governments.ruleset 20 Apr 2005 07:01:06 -0000
@@ -412,7 +412,7 @@
graphic = "gov.fundamentalism"
graphic_alt = "-"
flags = "No_Unhappy_Citizens", "Convert_Tithes_To_Money",
- "Reduced_Research", "Fanatic_Troops"
+ "Fanatic_Troops"
martial_law_max = 0
martial_law_per = 0
Index: data/default/effects.ruleset
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/default/effects.ruleset,v
retrieving revision 1.5
diff -u -r1.5 effects.ruleset
--- data/default/effects.ruleset 10 Apr 2005 00:50:37 -0000 1.5
+++ data/default/effects.ruleset 20 Apr 2005 07:00:45 -0000
@@ -16,6 +16,31 @@
; /* <-- avoid gettext warnings
; */ <-- avoid gettext warnings
+[effect_i_win_1]
+name = "Prod_Bonus_2"
+value = 100
+reqs =
+ { "type", "name", "range"
+ "Nation", "Mordor", "Player"
+ }
+
+[effect_i_win_2]
+name = "Science_Bonus_2"
+value = 100
+reqs =
+ { "type", "name", "range"
+ "Nation", "Mordor", "Player"
+ }
+
+; Yes this one is the biggest...
+[effect_i_win_3]
+name = "Food_Bonus_2"
+value = 100
+reqs =
+ { "type", "name", "range"
+ "Nation", "Mordor", "Player"
+ }
+
[effect_airport]
name = "Air_Veteran"
value = 1
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Freeciv-Dev] (PR#12856) proliferation of BONUS effects,
Jason Short <=
|
|