Author: jtn
Date: Sat Dec 19 11:04:28 2015
New Revision: 31091

URL: http://svn.gna.org/viewcvs/freeciv?rev=31091&view=rev
Log:
Allow Nuke_Proof effect to depend on diplomatic relationship between
unit and city owner (and also on properties of the specific tile it
attacks). Remove the hardcoded behaviour that it doesn't affect
allies/teammates/self.

In all supplied rulesets, use this ability to change the rules so that
SDI Defense now works against allies.

See gna patch #6693.

Modified:
    trunk/common/combat.c
    trunk/data/civ1/effects.ruleset
    trunk/data/civ2/effects.ruleset
    trunk/data/civ2civ3/effects.ruleset
    trunk/data/classic/effects.ruleset
    trunk/data/experimental/effects.ruleset
    trunk/data/multiplayer/effects.ruleset
    trunk/data/sandbox/effects.ruleset

Modified: trunk/common/combat.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/combat.c?rev=31091&r1=31090&r2=31091&view=diff
==============================================================================
--- trunk/common/combat.c       (original)
+++ trunk/common/combat.c       Sat Dec 19 11:04:28 2015
@@ -387,19 +387,23 @@
 }
 
 /**************************************************************************
-  Try defending against nuclear attack, if succed return a city which 
+  Try defending against nuclear attack; if successful, return a city which 
   had enough luck and EFT_NUKE_PROOF.
-  If the attack was succesful return NULL.
+  If the attack was successful return NULL.
 **************************************************************************/
 struct city *sdi_try_defend(const struct player *owner,
-                              const struct tile *ptile)
+                            const struct tile *ptile)
 {
   square_iterate(ptile, 2, ptile1) {
     struct city *pcity = tile_city(ptile1);
 
     if (pcity
-        && !pplayers_allied(city_owner(pcity), owner)
-        && fc_rand(100) < get_city_bonus(pcity, EFT_NUKE_PROOF)) {
+        && fc_rand(100) < get_target_bonus_effects(NULL,
+                                                   city_owner(pcity), owner,
+                                                   pcity, NULL, ptile,
+                                                   NULL, NULL,
+                                                   NULL, NULL, NULL,
+                                                   EFT_NUKE_PROOF)) {
       return pcity;
     }
   } square_iterate_end;

Modified: trunk/data/civ1/effects.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/civ1/effects.ruleset?rev=31091&r1=31090&r2=31091&view=diff
==============================================================================
--- trunk/data/civ1/effects.ruleset     (original)
+++ trunk/data/civ1/effects.ruleset     Sat Dec 19 11:04:28 2015
@@ -881,10 +881,12 @@
 
 [effect_sdi_defense]
 type    = "Nuke_Proof"
-value  = 100
-reqs   =
-    { "type", "name", "range"
-      "Building", "SDI Defense", "City"
+value   = 100
+reqs    =
+    { "type", "name", "range", "present"
+      "Building", "SDI Defense", "City", TRUE
+      "DiplRel", "Is foreign", "Local", TRUE
+      "DiplRel", "Team", "Local", FALSE
     }
 
 [effect_space_component]

Modified: trunk/data/civ2/effects.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/civ2/effects.ruleset?rev=31091&r1=31090&r2=31091&view=diff
==============================================================================
--- trunk/data/civ2/effects.ruleset     (original)
+++ trunk/data/civ2/effects.ruleset     Sat Dec 19 11:04:28 2015
@@ -1515,10 +1515,12 @@
 
 [effect_sdi_defense]
 type    = "Nuke_Proof"
-value  = 100
-reqs   =
-    { "type", "name", "range"
-      "Building", "SDI Defense", "City"
+value   = 100
+reqs    =
+    { "type", "name", "range", "present"
+      "Building", "SDI Defense", "City", TRUE
+      "DiplRel", "Is foreign", "Local", TRUE
+      "DiplRel", "Team", "Local", FALSE
     }
 
 [effect_sdi_defense_1]

Modified: trunk/data/civ2civ3/effects.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/civ2civ3/effects.ruleset?rev=31091&r1=31090&r2=31091&view=diff
==============================================================================
--- trunk/data/civ2civ3/effects.ruleset (original)
+++ trunk/data/civ2civ3/effects.ruleset Sat Dec 19 11:04:28 2015
@@ -2588,8 +2588,10 @@
 type    = "Nuke_Proof"
 value   = 100
 reqs    =
-    { "type", "name", "range"
-      "Building", "SDI Defense", "City"
+    { "type", "name", "range", "present"
+      "Building", "SDI Defense", "City", TRUE
+      "DiplRel", "Is foreign", "Local", TRUE
+      "DiplRel", "Team", "Local", FALSE
     }
 
 [effect_sdi_defense_1]

Modified: trunk/data/classic/effects.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/classic/effects.ruleset?rev=31091&r1=31090&r2=31091&view=diff
==============================================================================
--- trunk/data/classic/effects.ruleset  (original)
+++ trunk/data/classic/effects.ruleset  Sat Dec 19 11:04:28 2015
@@ -1489,10 +1489,12 @@
 
 [effect_sdi_defense]
 type    = "Nuke_Proof"
-value  = 100
-reqs   =
-    { "type", "name", "range"
-      "Building", "SDI Defense", "City"
+value   = 100
+reqs    =
+    { "type", "name", "range", "present"
+      "Building", "SDI Defense", "City", TRUE
+      "DiplRel", "Is foreign", "Local", TRUE
+      "DiplRel", "Team", "Local", FALSE
     }
 
 [effect_sdi_defense_1]

Modified: trunk/data/experimental/effects.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/experimental/effects.ruleset?rev=31091&r1=31090&r2=31091&view=diff
==============================================================================
--- trunk/data/experimental/effects.ruleset     (original)
+++ trunk/data/experimental/effects.ruleset     Sat Dec 19 11:04:28 2015
@@ -1696,10 +1696,12 @@
 
 [effect_sdi_defense]
 type    = "Nuke_Proof"
-value  = 100
-reqs   =
-    { "type", "name", "range"
-      "Building", "SDI Defense", "City"
+value   = 100
+reqs    =
+    { "type", "name", "range", "present"
+      "Building", "SDI Defense", "City", TRUE
+      "DiplRel", "Is foreign", "Local", TRUE
+      "DiplRel", "Team", "Local", FALSE
     }
 
 [effect_sdi_defense_1]

Modified: trunk/data/multiplayer/effects.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/multiplayer/effects.ruleset?rev=31091&r1=31090&r2=31091&view=diff
==============================================================================
--- trunk/data/multiplayer/effects.ruleset      (original)
+++ trunk/data/multiplayer/effects.ruleset      Sat Dec 19 11:04:28 2015
@@ -1496,10 +1496,12 @@
 
 [effect_sdi_defense]
 type    = "Nuke_Proof"
-value  = 100
-reqs   =
-    { "type", "name", "range"
-      "Building", "SDI Defense", "City"
+value   = 100
+reqs    =
+    { "type", "name", "range", "present"
+      "Building", "SDI Defense", "City", TRUE
+      "DiplRel", "Is foreign", "Local", TRUE
+      "DiplRel", "Team", "Local", FALSE
     }
 
 [effect_sdi_defense_1]

Modified: trunk/data/sandbox/effects.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/sandbox/effects.ruleset?rev=31091&r1=31090&r2=31091&view=diff
==============================================================================
--- trunk/data/sandbox/effects.ruleset  (original)
+++ trunk/data/sandbox/effects.ruleset  Sat Dec 19 11:04:28 2015
@@ -2588,8 +2588,10 @@
 type    = "Nuke_Proof"
 value   = 100
 reqs    =
-    { "type", "name", "range"
-      "Building", "SDI Defense", "City"
+    { "type", "name", "range", "present"
+      "Building", "SDI Defense", "City", TRUE
+      "DiplRel", "Is foreign", "Local", TRUE
+      "DiplRel", "Team", "Local", FALSE
     }
 
 [effect_sdi_defense_1]


_______________________________________________
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits

Reply via email to