Author: sveinung
Date: Tue Jul 28 15:28:40 2015
New Revision: 29256

URL: http://svn.gna.org/viewcvs/freeciv?rev=29256&view=rev
Log:
Unhardcode the rule that targeted sabotage is twice a difficult.

Support the actions "Sabotage City" and "Targeted Sabotage City" in the
Action_Odds_Pct effect. Use it move the rule that targeted sabotage city
is twice as difficult to the ruleset.

See patch #6142

Modified:
    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/doc/README.effects
    trunk/server/diplomats.c
    trunk/server/rscompat.c

Modified: trunk/data/civ2/effects.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/civ2/effects.ruleset?rev=29256&r1=29255&r2=29256&view=diff
==============================================================================
--- trunk/data/civ2/effects.ruleset     (original)
+++ trunk/data/civ2/effects.ruleset     Tue Jul 28 15:28:40 2015
@@ -2394,6 +2394,14 @@
       "DiplRel", "War", "Local", FALSE
     }
 
+[effect_tgt_sabotage_city_half_chance]
+type   = "Action_Odds_Pct"
+value  = -50
+reqs   =
+    { "type", "name", "range", "present"
+      "Action", "Targeted Sabotage City", "Local", TRUE
+    }
+
 [effect_incident_success_explode_nuke]
 type   = "Casus_Belli_Success"
 value  = 1

Modified: trunk/data/civ2civ3/effects.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/civ2civ3/effects.ruleset?rev=29256&r1=29255&r2=29256&view=diff
==============================================================================
--- trunk/data/civ2civ3/effects.ruleset (original)
+++ trunk/data/civ2civ3/effects.ruleset Tue Jul 28 15:28:40 2015
@@ -3955,6 +3955,14 @@
       "DiplRel", "War", "Local", FALSE
     }
 
+[effect_tgt_sabotage_city_half_chance]
+type   = "Action_Odds_Pct"
+value  = -50
+reqs   =
+    { "type", "name", "range", "present"
+      "Action", "Targeted Sabotage City", "Local", TRUE
+    }
+
 [effect_incident_success_explode_nuke]
 type   = "Casus_Belli_Success"
 value  = 1

Modified: trunk/data/classic/effects.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/classic/effects.ruleset?rev=29256&r1=29255&r2=29256&view=diff
==============================================================================
--- trunk/data/classic/effects.ruleset  (original)
+++ trunk/data/classic/effects.ruleset  Tue Jul 28 15:28:40 2015
@@ -2486,6 +2486,14 @@
       "DiplRel", "War", "Local", FALSE
     }
 
+[effect_tgt_sabotage_city_half_chance]
+type   = "Action_Odds_Pct"
+value  = -50
+reqs   =
+    { "type", "name", "range", "present"
+      "Action", "Targeted Sabotage City", "Local", TRUE
+    }
+
 [effect_incident_success_explode_nuke]
 type   = "Casus_Belli_Success"
 value  = 1

Modified: trunk/data/experimental/effects.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/experimental/effects.ruleset?rev=29256&r1=29255&r2=29256&view=diff
==============================================================================
--- trunk/data/experimental/effects.ruleset     (original)
+++ trunk/data/experimental/effects.ruleset     Tue Jul 28 15:28:40 2015
@@ -2825,6 +2825,14 @@
       "DiplRel", "War", "Local", FALSE
     }
 
+[effect_tgt_sabotage_city_half_chance]
+type   = "Action_Odds_Pct"
+value  = -50
+reqs   =
+    { "type", "name", "range", "present"
+      "Action", "Targeted Sabotage City", "Local", TRUE
+    }
+
 [effect_incident_success_explode_nuke]
 type   = "Casus_Belli_Success"
 value  = 1

Modified: trunk/data/multiplayer/effects.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/multiplayer/effects.ruleset?rev=29256&r1=29255&r2=29256&view=diff
==============================================================================
--- trunk/data/multiplayer/effects.ruleset      (original)
+++ trunk/data/multiplayer/effects.ruleset      Tue Jul 28 15:28:40 2015
@@ -2515,6 +2515,14 @@
       "DiplRel", "War", "Local", FALSE
     }
 
+[effect_tgt_sabotage_city_half_chance]
+type   = "Action_Odds_Pct"
+value  = -50
+reqs   =
+    { "type", "name", "range", "present"
+      "Action", "Targeted Sabotage City", "Local", TRUE
+    }
+
 [effect_incident_success_explode_nuke]
 type   = "Casus_Belli_Success"
 value  = 1

Modified: trunk/doc/README.effects
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/doc/README.effects?rev=29256&r1=29255&r2=29256&view=diff
==============================================================================
--- trunk/doc/README.effects    (original)
+++ trunk/doc/README.effects    Tue Jul 28 15:28:40 2015
@@ -248,7 +248,8 @@
 
 Action_Odds_Pct
     Modifies the odds of an action being successful. Currently supports the
-    actions "Incite City", "Steal Gold", "Steal Maps" and "Suitcase Nuke".
+    actions "Incite City", "Steal Gold", "Steal Maps", "Suitcase Nuke",
+    "Sabotage City" and "Targeted Sabotage City".
 
 Size_Adj
     Increase maximum size of a city by amount.

Modified: trunk/server/diplomats.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/diplomats.c?rev=29256&r1=29255&r2=29256&view=diff
==============================================================================
--- trunk/server/diplomats.c    (original)
+++ trunk/server/diplomats.c    Tue Jul 28 15:28:40 2015
@@ -852,7 +852,6 @@
   struct player *cplayer;
   struct impr_type *ptarget;
   int count, which;
-  int success_prob;
 
   /* Fetch target city's player.  Sanity checks. */
   if (!pcity) {
@@ -870,10 +869,6 @@
   }
 
   log_debug("sabotage: unit: %d", pdiplomat->id);
-
-  /* Twice as difficult if target is specified. */
-  success_prob = (improvement >= B_LAST ? game.server.diplchance 
-                  : game.server.diplchance / 2); 
 
   /* Check if the Diplomat/Spy succeeds against defending Diplomats/Spies. */
   if (!diplomat_infiltrate_tile(pplayer, cplayer,
@@ -886,7 +881,8 @@
   log_debug("sabotage: infiltrated");
 
   /* Check if the Diplomat/Spy succeeds with his/her task. */
-  if (fc_rand (100) >= success_prob) {
+  if (diplomat_was_caught(pplayer, pdiplomat, pcity, cplayer,
+                          action_by_number(action_id))) {
     notify_player(pplayer, city_tile(pcity),
                   E_MY_DIPLOMAT_FAILED, ftc_server,
                   _("Your %s was caught in the attempt"

Modified: trunk/server/rscompat.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/rscompat.c?rev=29256&r1=29255&r2=29256&view=diff
==============================================================================
--- trunk/server/rscompat.c     (original)
+++ trunk/server/rscompat.c     Tue Jul 28 15:28:40 2015
@@ -458,6 +458,12 @@
      peffect = effect_new(EFT_CASUS_BELLI_SUCCESS, 1, NULL);
      effect_req_append(peffect, req_from_str("Action", "Local", FALSE,
                                              TRUE, "Explode Nuclear"));
+
+     /* City sabotage is twice as difficult if target is specified. */
+     peffect = effect_new(EFT_ACTION_ODDS_PCT, -50, NULL);
+     effect_req_append(peffect,
+                       req_from_str("Action", "Local", FALSE,
+                                    TRUE, "Targeted Sabotage City"));
   }
 
   /* Upgrade existing effects. */


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

Reply via email to