Insert the following into the whole map iterate loop used for hydro:
Code: Select all
-- nef 2019/01/12
-- B. added code to allow swamp and jungle to be included
-- as potential grassland/shield 'i' transforms
-- nef 2019/01/10
-- A. code to create Civ I (and Civ II) style grassland
-- resource extra
-- Part A requires changes to the ruleset:
-- a. inclusion of a road/extra pair in terrain.ruleset
-- with the name "Shield". Add/change the following
-- fields in the extra section
-- graphic = "ts.grassland_resources"
-- buildable = FALSE
-- reqs =
-- { "type", "name", "range", "present", "quiet"
-- "Terrain", "Forest", "Local", FALSE, TRUE
-- }
-- Road section comprises:
-- extra = "Shield"
-- move_cost = -1
-- shield_incr = 1
-- b. in section [terrain_grassland] disable resources:
-- ; resources = "Resources"
-- and add/change:
-- road_shield_incr_pct = 100
-- d. adding to the [extras] section (styles =) in *.tilespec
-- e.g. amplio2 etc.:
-- "ts.grassland_resources", "Single1"
-- the extra name "Shield" throughout is user selectable
-- Part B requires changes to the ruleset:
-- inclusion of a road/extra pair in terrain.ruleset with
-- the name "Grass_Shield". Add/change the following
-- fields in the extra section:
-- graphic = "None"
-- buildable = FALSE
-- reqs =
-- { "type", "name", "range", "present", "quiet"
-- "Terrain", "Grassland", "Local", FALSE, TRUE
-- }
-- Road section comprises:
-- extra = "Grass_Shield"
-- move_cost = -1
-- the extra name "Grass_Shield" throughout is user selectable
if random(1, 100) <= 50 -- part A
then
if tname == "Grassland"
then edit.create_extra(tile,"Shield")
elseif tname == "Swamp" -- part B
or tname == "Jungle"
then
edit.create_extra(tile,"Grass_Shield")
edit.create_extra(tile,"Shield") -- end part B
end
end -- end part A
Include "ts.grassland_resources" into the [extras] section in any *.tilespec you may want to use:
Code: Select all
"ts.grassland_resources", "Single1"
Note that this introduces a slight glitch in graphics layering. Some might say the result is actually better.
The "specials" server option seems to have a fudge factor of 2, so the default value of 250 appears to give a density of 1/8 (not 1/4). Civ I (and Civ II) have a 'patch' density of 1/9 (for general resource extras) but there was some extra space between patches - suggesting a value of 1/10 might be more accurate - i.e. a "specials" value of 200. This reduction would be appropriate now that grassland resource density will be increased from 1/8 to 1/2. To put this into effect add the following to the section [settings] in game.ruleset
Change FALSE to TRUE if you want to insist on Civ I accuracy (along with those for most of the others).
The code I am supplying is for use in the civ1 ruleset. Extension to civ2 and other fc rulesets is problematic because of indefinite tranforms to/from grassland. The problem is to have a
simple general procedure for hiding the graphic for the grassland shield. The alternative is to use an end and/or start turn callback and do a whole map iterate each turn. For the moment, I will leave that to others. The actual shield bonus is no trouble - but may need a slightly more robust approach i.e. use the effect Output_Add_Tile.
Having said all that it appears to me that this procedure would work perfectly well in Civ II - except that when creating grassland using the "o" transform you would never get a 1 shield resource special. Even with these, some simple changes could be made to give you a one shot chance. Other rulesets such as classic would need yet more tinkering since there are typically other options for creating/destroying grasssland.
A callback for terrain transform would make this a breeze for all rulesets. And fc3.x would help too. Even better would be valid_resource_extra iterate on a terrain.