Complete.Org: Mailing Lists: Archives: freeciv-dev: September 2000:
[Freeciv-Dev] terrain/river defense bonus patch v2
Home

[Freeciv-Dev] terrain/river defense bonus patch v2

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: "freeciv-dev@xxxxxxxxxxx" <freeciv-dev@xxxxxxxxxxx>
Subject: [Freeciv-Dev] terrain/river defense bonus patch v2
From: peter jurcovic <hhg@xxxxxxxxxxxxxxxx>
Date: Sun, 10 Sep 2000 22:35:44 +0200

Hi,

here is my terrain/river defense bonus patch v2. It's written for Sept 9-th
cvs snapshot.

If you are not aware of features of this patch, I suggest you to read my
previous mail (with subj: More complex terrain advantages and disadvantages
patch, date: Aug 30), which I quote here in full length.

The most important new feature in v2 are new server options "terrainbonus"
and "riverbonus", which allow you to turn terrain/river antibonus on/off.

I decided to add these two server options instead of one, because I have seen
that some people welcome terrain bonus/antibonus, but don't like river
antibonus. Just FYI, the default setting of terrainbonus option is "2", what
means Armor_Type units get terrain disadvantage and the default setting of
riverbonus is "1", what means that it remains unchanged by default.

I would be really grateful for more replies than v1 gained. I would like to
know, how do you feel about these changes and what are your testing
experiences with this patch. I would be also extremely happy if somebody who
is responsible for adding patches into main development tree will tell me how
does he feel about these changes ;) and what should be added into the patch
before being officially accepted.


Many greetings,
    -Peter Jurcovic


TODO:

There is one more important thing to add and that are changes in help
entries, but that should be probably done after testing and official
accepting.


LIST OF CHANGED FILES AND FUNCTIONS:

server/stdinhand.c:
    - added terrainbonus and riverbonus server options

common/game.h:
    - added variables and MIN, MAX, DEFAULT values for terrainbonus and
riverbonus serv.opt.

common/game.c:
    - added initialization of terrainbonus and riverbonus serv.opt.

server/savegame.c:
    game_save();
    game_load();

server/unittools.c:
    get_defense_power();
    enemies_at();

server/unitfunc.c:
    get_simple_defense_power();
    get_virtual_defense_power();

server/settlers.c:
    city_desirability();

common/unittype.c, unittype.h:
    - added Armor_Type and Infantry_Type unit flags

data/default/units.ruleset:
    - added Armor_Type and Infantry_Type unit flags

ai/aiunit.c:
    find_beachhead();







peter jurcovic wrote:

> Hi again,
>
> as I posted recently, I admit that a lot of features in PG system are
> not very apropriate in freeciv. But more complex terrain advantages and
> disadvantages are very probably a Good Thing also for freeciv. And as
> far as I have seen, the replies on this feature were mostly very
> positive. So I made this patch today.
>
> The basic idea here is, that some units should have a terrain bonus, but
> some should have rather a "terrain antibonus" (or disadvantage). I have
> divided units to two groups according to this basic idea.
>
> The units in the first group are marked with flag Infantry_Type. They
> are:
>         alpine troopes
>         archers
>         barbabarian leader
>         diplomat
>         engineers
>         explorer
>         fanatics
>         legion
>         marines
>         musketeers
>         paratroopers
>         partisans
>         phalanx
>         pikemen
>         riflemen
>         settlers
>         spy
>         warriors
>
> The second units are marked as Armor_Type (well, it may sounds strange
> that both Knights and Armors are Armor_Type unit, but they both sure
> should have similar defense disadvantage in forrests, hills or
> mountains):
>         armor
>         artillery
>         cannon
>         caravan
>         catapult
>         cavalry
>         chariot
>         crusaders
>         dragoons
>         elephants
>         freight
>         horsemen
>         howitzer
>         knights
>         mech. inf.
>
> I hope you agree with these groups. If you have any doubts, just imagine
> how would for example catapults or howitzers or horsemen cope with deep
> bushy forrests or rough rocky mountains (kazachstan style would be the
> best ;)
>
> The defense bonus for Inf_Type units remains the same: they get *1.0 on
> plain, grass, etc, *3/2 in forrests, *2.0 on hills and *3.0 in
> mountains.
>
> The defense bonus for Arm_Type units is inverted: they get *1.0 on
> plain, grass, etc, *2/3 in forrests, *1/2 on hills and *1/3 in
> mountains.
>
> The second idea is, that all unit types should get disadvantage on river
> squares and not advantage - I hope you agree with this. I definitly
> think it's more logical and realistic - just imagine a group of
> riflemen, who are just crossing the wild, bad river ;) and they are
> being attacked (let's say) by another group of riflemen. Which units
> should have the advantage - the first ones, who are just swimming and
> hardly surviving in the water, or the second ones, who are quitely
> picknicking on the bank and from time to time comfortably shooting ;) ?
> (According to this image, I also think units should not have move bonus
> on river, but rather move disadvantage - but this patch does not take
> care about that).
>
> River defense disadvantage is implemented very simply - I just reverted
> +50% terrain river bonus to -50% terrain river bonus.
>
> Here is the list of changed files and functions:
>     server/unitfunc.c:
>             get_simple_defense_power();
>             get_virtual_defense_power();
>     server/unittools.c:
>             get_defense_power();
>             enemies_at();
>     server/settlers.c:
>             city_desirability();
>     ai/aiunit.c:
>             find_beachhead();
>     data/default/units.ruleset   (added F_ARM_TYPE and F_INF_TYPE flags)
>
>     common/unittype.c            (added Armor_Type and Infantry_Type
> names of flags)
>     common/unittype.h            (added F_ARM_TYPE and F_INF_TYPE flags)
>
> I have made some brief testing, and all seemed to work fine for me in 2
> (human) players game: some catapults survived attacks of warriors and
> phalanx on grass terrain, but were terribly smashed on hills and
> mountains.
>
> I think this require longer and deeper testing (are here any
> volunteers?). We also have to check, if the game balance was not changed
> too much. But I think it's right if Armors are wiped by Rifflemen in
> hills or mountains, etc.
>
> I think this feature is definitly positive. It force players to use more
> unit types and so makes game more variable.
>
> Note: This patch should also include a new server option, which would
> turn this advanced feature on/off and it should also change some help
> entries. I decided not to spend time with these changes untill this
> terrain feature is fully accepted and tested.
diff -r -u freeciv.orig/ai/aiunit.c freeciv.mod/ai/aiunit.c
--- freeciv.orig/ai/aiunit.c    Sun Sep 10 17:56:14 2000
+++ freeciv.mod/ai/aiunit.c     Sun Sep 10 22:01:29 2000
@@ -802,10 +802,20 @@
           if (is_my_zoc(punit, x1 + DIR_DX[l], y1 + DIR_DY[l])) ok++;
         }
       }
+
       if (ok) { /* accessible beachhead with zoc-ok water tile nearby */
-        ok = get_tile_type(t)->defense_bonus;
-       if (map_get_special(x1, y1) & S_RIVER)
-         ok += (ok * terrain_control.river_defense_bonus) / 100;
+       ok = (get_tile_type(t)->defense_bonus)/10;
+        if ((unit_flag(punit->type, F_ARM_TYPE)) && game.terrainbonus == 2)
+              ok = 1/ok;
+        ok *= 10;
+         
+        if (map_get_special(x1, y1) & S_RIVER) {
+             if (game.riverbonus == 1) 
+                 ok += (ok * terrain_control.river_defense_bonus) / 100;
+             if (game.riverbonus == 2)
+                 ok -= (ok * terrain_control.river_defense_bonus) / 100;
+       }
+
         if (get_tile_type(t)->movement_cost * 3 <
             unit_types[punit->type].move_rate) ok *= 8;
         ok += (6 * THRESHOLD - warmap.seacost[x1][y1]);
diff -r -u freeciv.orig/common/game.c freeciv.mod/common/game.c
--- freeciv.orig/common/game.c  Sun Sep 10 17:56:16 2000
+++ freeciv.mod/common/game.c   Sun Sep 10 22:01:29 2000
@@ -750,6 +750,8 @@
   game.foodbox     = GAME_DEFAULT_FOODBOX;
   game.aqueductloss= GAME_DEFAULT_AQUEDUCTLOSS;
   game.killcitizen = GAME_DEFAULT_KILLCITIZEN;
+  game.terrainbonus = GAME_DEFAULT_TERRAINBONUS;
+  game.riverbonus = GAME_DEFAULT_RIVERBONUS;
   game.scorelog    = GAME_DEFAULT_SCORELOG;
   game.techpenalty = GAME_DEFAULT_TECHPENALTY;
   game.civstyle    = GAME_DEFAULT_CIVSTYLE;
diff -r -u freeciv.orig/common/game.h freeciv.mod/common/game.h
--- freeciv.orig/common/game.h  Sun Sep 10 17:56:16 2000
+++ freeciv.mod/common/game.h   Sun Sep 10 22:01:29 2000
@@ -99,6 +99,8 @@
   int foodbox;
   int aqueductloss;
   int killcitizen;
+  int terrainbonus;
+  int riverbonus;
   int techpenalty;
   int razechance;
   int scorelog;
@@ -291,6 +293,14 @@
 #define GAME_DEFAULT_KILLCITIZEN     1
 #define GAME_MIN_KILLCITIZEN         0
 #define GAME_MAX_KILLCITIZEN         15
+
+#define GAME_DEFAULT_TERRAINBONUS    2
+#define GAME_MIN_TERRAINBONUS        1
+#define GAME_MAX_TERRAINBONUS        2
+
+#define GAME_DEFAULT_RIVERBONUS      1
+#define GAME_MIN_RIVERBONUS         1
+#define GAME_MAX_RIVERBONUS          2
 
 #define GAME_DEFAULT_TECHPENALTY     100
 #define GAME_MIN_TECHPENALTY         0
diff -r -u freeciv.orig/common/unittype.c freeciv.mod/common/unittype.c
--- freeciv.orig/common/unittype.c      Sun Sep 10 17:56:17 2000
+++ freeciv.mod/common/unittype.c       Sun Sep 10 22:01:29 2000
@@ -43,7 +43,8 @@
   "OneAttack", "Pikemen", "Horse", "IgWall", "FieldUnit", "AEGIS",
   "Fighter", "Marines", "Partial_Invis", "Settlers", "Diplomat",
   "Trireme", "Nuclear", "Spy", "Transform", "Paratroopers",
-  "Airbase", "Cities", "IgTired", "Missile_Carrier", "No_Land_Attack"
+  "Airbase", "Cities", "IgTired", "Missile_Carrier", "No_Land_Attack", 
+  "Infantry_Type", "Armor_Type"
 };
 static char *role_names[] = {
   "FirstBuild", "Explorer", "Hut", "HutTech", "Partisan",
diff -r -u freeciv.orig/common/unittype.h freeciv.mod/common/unittype.h
--- freeciv.orig/common/unittype.h      Sun Sep 10 17:56:17 2000
+++ freeciv.mod/common/unittype.h       Sun Sep 10 22:01:29 2000
@@ -103,6 +103,8 @@
   F_IGTIRED,          /* Ignore tired negative bonus when attacking */
   F_MISSILE_CARRIER,  /* Like F_CARRIER, but missiles only (Submarine) */
   F_NO_LAND_ATTACK,   /* Cannot attack vs land squares (Submarine) */
+  F_INF_TYPE,        /* Has advantage in hard terrain */
+  F_ARM_TYPE,        /* Has disadvantage in hard terrain */
   F_LAST
 };
 
diff -r -u freeciv.orig/data/default/units.ruleset 
freeciv.mod/data/default/units.ruleset
--- freeciv.orig/data/default/units.ruleset     Sun Sep 10 17:56:20 2000
+++ freeciv.mod/data/default/units.ruleset      Sun Sep 10 22:01:29 2000
@@ -80,7 +80,7 @@
 uk_shield     = 1
 uk_food       = 1
 uk_gold       = 0
-flags         = "Settlers", "NonMil", "Airbase", "Cities"
+flags         = "Settlers", "NonMil", "Airbase", "Cities", "Infantry_Type"
 roles         = ""
 helptext      = _("\
 Setters are one of the key units in the game.  They can be used to\
@@ -119,7 +119,7 @@
 uk_shield     = 1
 uk_food       = 1
 uk_gold       = 0
-flags         = "Settlers", "NonMil", "Transform", "Airbase", "Cities"
+flags         = "Settlers", "NonMil", "Transform", "Airbase", "Cities", 
"Infantry_Type"
 roles         = ""
 helptext      = _("\
 Engineers are similar to Settlers, but they work twice as fast and\
@@ -155,7 +155,7 @@
 uk_shield     = 1
 uk_food       = 0
 uk_gold       = 0
-flags         = ""
+flags         = "Infantry_Type"
 roles         = "DefendOk", "FirstBuild"
 helptext      = _("\
 This unit may be built from the start of the game.  It is the\
@@ -182,7 +182,7 @@
 uk_shield     = 1
 uk_food       = 0
 uk_gold       = 0
-flags         = ""
+flags         = "Infantry_Type"
 roles         = "DefendGood", "FirstBuild"
 
 [unit_archers]
@@ -205,7 +205,7 @@
 uk_shield     = 1
 uk_food       = 0
 uk_gold       = 0
-flags         = ""
+flags         = "Infantry_Type"
 roles         = "DefendOk"
 
 [unit_legion]
@@ -228,7 +228,7 @@
 uk_shield     = 1
 uk_food       = 0
 uk_gold       = 0
-flags         = ""
+flags         = "Infantry_Type"
 roles         = "DefendOk", "Hut", "BarbarianBuild", "BarbarianSea"
 
 [unit_pikemen]
@@ -251,7 +251,7 @@
 uk_shield     = 1
 uk_food       = 0
 uk_gold       = 0
-flags         = "Pikemen"
+flags         = "Pikemen", "Infantry_Type"
 roles         = "DefendGood", "FirstBuild"
 
 [unit_musketeers]
@@ -274,7 +274,7 @@
 uk_shield     = 1
 uk_food       = 0
 uk_gold       = 0
-flags         = ""
+flags         = "Infantry_Type"
 roles         = "DefendGood", "FirstBuild", "HutTech",
                 "BarbarianTech", "BarbarianBuildTech", "BarbarianSeaTech"
 
@@ -298,7 +298,7 @@
 uk_shield     = 1
 uk_food       = 0
 uk_gold       = 0
-flags         = ""
+flags         = "Infantry_Type"
 roles         = "DefendGood"
 
 [unit_partisan]
@@ -321,7 +321,7 @@
 uk_shield     = 1
 uk_food       = 0
 uk_gold       = 0
-flags         = "IgTer", "IgZOC"
+flags         = "IgTer", "IgZOC", "Infantry_Type"
 roles         = "DefendGood", "Partisan", "BarbarianTech"
 helptext      = _("\
 A number of Partisans are granted free when an enemy conquers your\
@@ -379,7 +379,7 @@
 uk_shield     = 1
 uk_food       = 0
 uk_gold       = 0
-flags         = ""
+flags         = "Infantry_Type"
 roles         = "DefendGood", "FirstBuild"
 
 [unit_marines]
@@ -402,7 +402,7 @@
 uk_shield     = 1
 uk_food       = 0
 uk_gold       = 0
-flags         = "Marines"
+flags         = "Marines", "Infantry_Type"
 roles         = "DefendOk", "BarbarianSeaTech"
 
 [unit_paratroopers]
@@ -425,7 +425,7 @@
 uk_shield     = 1
 uk_food       = 0
 uk_gold       = 0
-flags         = "Paratroopers"
+flags         = "Paratroopers", "Infantry_Type"
 roles         = "DefendOk"
 
 paratroopers_range = 10
@@ -452,7 +452,7 @@
 uk_shield     = 1
 uk_food       = 0
 uk_gold       = 0
-flags         = ""
+flags         = "Armor_Type"
 roles         = "DefendGood"
 helptext      = _("\
 Mechanized Infantry; this unit has the strongest defence strength\
@@ -480,7 +480,7 @@
 uk_shield     = 1
 uk_food       = 0
 uk_gold       = 0
-flags         = "Horse"
+flags         = "Horse", "Armor_Type"
 roles         = "AttackFast", "Hut", "Barbarian"
 
 [unit_chariot]
@@ -503,7 +503,7 @@
 uk_shield     = 1
 uk_food       = 0
 uk_gold       = 0
-flags         = "Horse"
+flags         = "Horse", "Armor_Type"
 roles         = "AttackFast", "Hut"
 
 [unit_elephants]
@@ -526,7 +526,7 @@
 uk_shield     = 1
 uk_food       = 0
 uk_gold       = 0
-flags         = ""
+flags         = "Armor_Type"
 roles         = "AttackFast"
 
 [unit_crusaders]
@@ -549,7 +549,7 @@
 uk_shield     = 1
 uk_food       = 0
 uk_gold       = 0
-flags         = "Horse"
+flags         = "Horse", "Armor_Type"
 roles         = "AttackFast"
 
 [unit_knights]
@@ -572,7 +572,7 @@
 uk_shield     = 1
 uk_food       = 0
 uk_gold       = 0
-flags         = "Horse"
+flags         = "Horse", "Armor_Type"
 roles         = "AttackFast", "HutTech", "BarbarianTech",
                 "BarbarianBuildTech", "BarbarianSeaTech"
 
@@ -596,7 +596,7 @@
 uk_shield     = 1
 uk_food       = 0
 uk_gold       = 0
-flags         = "Horse"
+flags         = "Horse", "Armor_Type"
 roles         = "AttackFast", "BarbarianBuildTech", "BarbarianSeaTech"
 
 [unit_cavalry]
@@ -619,7 +619,7 @@
 uk_shield     = 1
 uk_food       = 0
 uk_gold       = 0
-flags         = ""
+flags         = "Armor_Type"
 roles         = "AttackFast"
 
 [unit_armor]
@@ -642,7 +642,7 @@
 uk_shield     = 1
 uk_food       = 0
 uk_gold       = 0
-flags         = ""
+flags         = "Armor_Type"
 roles         = "AttackFast"
 
 [unit_catapult]
@@ -665,7 +665,7 @@
 uk_shield     = 1
 uk_food       = 0
 uk_gold       = 0
-flags         = ""
+flags         = "Armor_Type"
 roles         = "AttackStrong"
 
 [unit_cannon]
@@ -688,7 +688,7 @@
 uk_shield     = 1
 uk_food       = 0
 uk_gold       = 0
-flags         = ""
+flags         = "Armor_Type"
 roles         = "AttackStrong", "BarbarianTech", "BarbarianBuildTech"
 
 [unit_artillery]
@@ -711,7 +711,7 @@
 uk_shield     = 1
 uk_food       = 0
 uk_gold       = 0
-flags         = ""
+flags         = "Armor_Type"
 roles         = "AttackStrong"
 
 [unit_howitzer]
@@ -734,7 +734,7 @@
 uk_shield     = 1
 uk_food       = 0
 uk_gold       = 0
-flags         = "IgWall"
+flags         = "IgWall", "Armor_Type"
 roles         = "AttackStrong"
 
 [unit_fighter]
@@ -1245,7 +1245,7 @@
 uk_shield     = 0
 uk_food       = 0
 uk_gold       = 0
-flags         = "Diplomat", "IgZOC", "NonMil"
+flags         = "Diplomat", "IgZOC", "NonMil", "Infantry_Type"
 roles         = ""
 helptext      = _("\
 - A Diplomat can establish embassies with other civilizations\
@@ -1286,7 +1286,7 @@
 uk_shield     = 0
 uk_food       = 0
 uk_gold       = 0
-flags         = "Diplomat", "IgZOC", "NonMil", "Spy"
+flags         = "Diplomat", "IgZOC", "NonMil", "Spy", "Infantry_Type"
 roles         = ""
 helptext      = _("\
 A Spy is a full time professional and as such is much more\
@@ -1328,7 +1328,7 @@
 uk_shield     = 0
 uk_food       = 0
 uk_gold       = 0
-flags         = "Caravan", "IgZOC", "NonMil"
+flags         = "Caravan", "IgZOC", "NonMil", "Armor_Type"
 roles         = ""
 helptext      = _("\
 Every Caravan that is used to build a wonder will add 50 shields\
@@ -1359,7 +1359,7 @@
 uk_shield     = 0
 uk_food       = 0
 uk_gold       = 0
-flags         = "Caravan", "IgZOC", "NonMil"
+flags         = "Caravan", "IgZOC", "NonMil", "Armor_Type"
 roles         = ""
 helptext      = _("\
 The Freight unit replaces the Caravan, and moves at twice the speed.\
@@ -1385,7 +1385,7 @@
 uk_shield     = 0
 uk_food       = 0
 uk_gold       = 0
-flags         = "IgTer", "IgZOC", "NonMil"
+flags         = "IgTer", "IgZOC", "NonMil", "Infantry_Type"
 roles         = "Explorer"
 helptext      = _("\
 Explorers are very useful for mapping unknown territory.\
@@ -1411,7 +1411,7 @@
 uk_shield     = 0
 uk_food       = 0
 uk_gold       = 0
-flags         = "IgZOC", "NonMil"
+flags         = "IgZOC", "NonMil", "Infantry_Type"
 roles         = "BarbarianLeader"
 helptext      = _("\
 When barbarian leader is killed on a tile without any defending units, \
diff -r -u freeciv.orig/server/savegame.c freeciv.mod/server/savegame.c
--- freeciv.orig/server/savegame.c      Sun Sep 10 17:56:23 2000
+++ freeciv.mod/server/savegame.c       Sun Sep 10 22:01:29 2000
@@ -1630,6 +1630,11 @@
   game.randseed = secfile_lookup_int_default(file, game.randseed,
                                             "game.randseed");
   
+  game.terrainbonus = secfile_lookup_int_default(file, game.terrainbonus,
+                                                "game.terrainbonus");
+  game.riverbonus = secfile_lookup_int_default(file, game.riverbonus,
+                                              "game.riverbonus");
+  
   if (section_file_lookup(file, "random.index_J")) {
     RANDOM_STATE rstate;
     rstate.j = secfile_lookup_int(file,"random.index_J");
@@ -1933,6 +1938,8 @@
   } 
 
   secfile_insert_int(file, game.randseed, "game.randseed");
+  secfile_insert_int(file, game.terrainbonus, "game.terrainbonus");
+  secfile_insert_int(file, game.riverbonus, "game.riverbonus");
   
   if (myrand_is_init()) {
     RANDOM_STATE rstate = get_myrand_state();
diff -r -u freeciv.orig/server/settlers.c freeciv.mod/server/settlers.c
--- freeciv.orig/server/settlers.c      Sun Sep 10 17:56:22 2000
+++ freeciv.mod/server/settlers.c       Sun Sep 10 22:01:29 2000
@@ -326,8 +326,12 @@
   /* treating harbor as free to approximate advantage of
      building boats. -- Syela */
   db = get_tile_type(map_get_terrain(x, y))->defense_bonus;
-  if (map_get_special(x, y) & S_RIVER)
-    db += (db * terrain_control.river_defense_bonus) / 100;
+  if (map_get_special(x, y) & S_RIVER) {
+    if (game.riverbonus == 1)    
+      db += (db * terrain_control.river_defense_bonus) / 100;
+    if (game.riverbonus == 2)
+      db -= (db * terrain_control.river_defense_bonus) / 100;
+  }
   val += (4 * db - 40) * SHIELD_WEIGHTING;
   /* don't build cities in danger!! FIX! -- Syela */
   val += 8 * MORT; /* one science per city */
diff -r -u freeciv.orig/server/stdinhand.c freeciv.mod/server/stdinhand.c
--- freeciv.orig/server/stdinhand.c     Sun Sep 10 17:56:22 2000
+++ freeciv.mod/server/stdinhand.c      Sun Sep 10 22:01:29 2000
@@ -498,6 +498,21 @@
        "  4 = heli\n"
        "  8 = air") },
 
+  { "terrainbonus", &game.terrainbonus,
+    SSET_RULES, SSET_TO_CLIENT,
+    GAME_MIN_TERRAINBONUS, GAME_MAX_TERRAINBONUS, GAME_DEFAULT_TERRAINBONUS,
+    N_("Set terrain defense advantages and disadvantages"),
+    N_("If set to 1, all units will get terrain defense bonus (civ1/civ2 "
+       "style). If set to 2, units with flag Armor_Type (armor, cavalry, ...) "
+       "will get terrain defense \"antibonus\" (disadvantage).") },
+
+  { "riverbonus", &game.riverbonus,
+    SSET_RULES, SSET_TO_CLIENT,
+    GAME_MIN_RIVERBONUS, GAME_MAX_RIVERBONUS, GAME_DEFAULT_RIVERBONUS,
+    N_("Set river defense advantage or disadvantage"),
+    N_("If set to 1, units on river tiles will get +50% defense bonus. "
+       "If set to 2, units on river tiles will get -50% defense antibonus. ") 
},
+    
 /* Flexible rules: these can be changed after the game has started.
  *
  * The distinction between "rules" and "flexible rules" is not always
diff -r -u freeciv.orig/server/unittools.c freeciv.mod/server/unittools.c
--- freeciv.orig/server/unittools.c     Sun Sep 10 17:56:22 2000
+++ freeciv.mod/server/unittools.c      Sun Sep 10 22:01:29 2000
@@ -529,9 +529,16 @@
     power /= 2;
   }
   terra=map_get_terrain(punit->x, punit->y);
-  db = get_tile_type(terra)->defense_bonus;
-  if (map_get_special(punit->x, punit->y) & S_RIVER)
-    db += (db * terrain_control.river_defense_bonus) / 100;
+  db = (get_tile_type(terra)->defense_bonus)/10;
+  if ((unit_flag(punit->type, F_ARM_TYPE)) && game.terrainbonus == 2)
+    db = 1/db;
+  db *= 10;
+  if (map_get_special(punit->x, punit->y) & S_RIVER) {
+    if (game.riverbonus == 1)
+      db += (db * terrain_control.river_defense_bonus) / 100;
+    if (game.riverbonus == 2)
+      db -= (db * terrain_control.river_defense_bonus) / 100;
+  }
   power=(power*db)/10;
 
   return power;
@@ -746,9 +753,16 @@
   if (pcity && pcity->owner == punit->owner)
      return 0;
 
-  db = get_tile_type(map_get_terrain(x, y))->defense_bonus;
-  if (map_get_special(x, y) & S_RIVER)
-    db += (db * terrain_control.river_defense_bonus) / 100;
+  db = (get_tile_type(map_get_terrain(x, y))->defense_bonus)/10;
+  if ((unit_flag(punit->type, F_ARM_TYPE)) && game.terrainbonus == 2)
+    db = 1/db;
+  db *= 10;
+  if (map_get_special(x, y) & S_RIVER) {
+    if (game.riverbonus == 1)
+      db += (db * terrain_control.river_defense_bonus) / 100;
+    if (game.riverbonus == 2)
+      db -= (db * terrain_control.river_defense_bonus) / 100;
+  }
   d = unit_vulnerability_virtual(punit) * db;
   for (j = y - 1; j <= y + 1; j++) {
     if (j < 0 || j >= map.ysize) continue;

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] terrain/river defense bonus patch v2, peter jurcovic <=