Changes in what a 2.6 rule set can do

Contribute, display and discuss rulesets and modpacks for use in Freeciv here.
sveinung
Elite
Posts: 548
Joined: Wed Feb 20, 2013 4:50 pm

Re: Changes in what a 2.6 rule set can do

Post by sveinung »

Changed in Freeciv 2.6/trunk: The caravan action "Help Wonder" can now be controlled by action enablers. See patch #5482

The "Help Wonder" caravan action disbands the actor unit and adds the shields used to build it to the target city.

At the moment all the action enabler control can do is to disable its action totally or to add new restrictions on top of those that already exist. All old restrictions, like the requirement that the actor unit must have the "HelpWonder" unit type flag and the requirement that it isn't possible to help a foreign city, still apply.

Example: Allow Help Wonder for non democracies.

Code: Select all

[actionenabler_help_build_wonder]
action = "Help Wonder"
actor_reqs    =
    { "type",   "name", "range", "present"
      "Gov", "Democracy", "Player", FALSE
    }
sveinung
Elite
Posts: 548
Joined: Wed Feb 20, 2013 4:50 pm

Re: Changes in what a 2.6 rule set can do

Post by sveinung »

Changed in Freeciv 2.6/trunk: Creating unit types that both can attack and can do action enabler controlled actions is now possible. See bug #23077

The example below adds a new unit type called Viking. It is able to attack another unit, steal tech, steal gold (up to 5%) and establish a trade route both from land and from a ship. Note that this only is an example. You should probably balance it (and maybe also adjust it for historical accuracy) before adding it to a ruleset used in a "serious" games.

Add the unit it self by adding the following to units.ruleset:

Code: Select all

[unit_vikings]
name          = _("Vikings")
class         = "Land"
tech_req      = "Iron Working"
obsolete_by   = "Marines"
graphic       = "u.vikings"
graphic_alt   = "u.pikemen"
sound_move    = "m_vikings"
sound_move_alt = "m_generic"
sound_fight   = "f_vikings"
sound_fight_alt = "f_generic"
build_cost    = 20
pop_cost      = 0
attack        = 3
defense       = 1
hitpoints     = 10
firepower     = 1
move_rate     = 1
vision_radius_sq = 2
transport_cap = 0
fuel          = 0
uk_happy      = 1
uk_shield     = 1
uk_food       = 0
uk_gold       = 0
flags         = "Marines", "TradeRoute"
roles         = "DefendOk", "BarbarianSeaTech"
helptext      = _("\
Vikings can trade, steal or kill.\
")
Allow the unit to establish trade routes, to steal gold and to steal techs by adding the following to game.ruleset:

Code: Select all

[actionenabler_viking_traderoute]
action = "Establish Trade Route"
actor_reqs    =
    { "type",   "name", "range", "present"
      "UnitType", "Vikings", "Local", TRUE
      "MinMoveFrags", "1", "Local", TRUE
    }

[actionenabler_viking_steal_gold]
action = "Steal Gold"
actor_reqs    =
    { "type",   "name", "range", "present"
      "UnitType", "Vikings", "Local", TRUE
      "MinMoveFrags", "1", "Local", TRUE
    }

[actionenabler_viking_steal_tech]
action = "Steal Tech"
actor_reqs    =
    { "type",   "name", "range", "present"
      "UnitType", "Vikings", "Local", TRUE
      "MinMoveFrags", "1", "Local", TRUE
    }
Let the viking (and other gold stealing units) to steal up to 5% of the victim's treasury.

Code: Select all

[effect_base_steal_gold]
type	= "Max_Stolen_Gold_Pct"
value	= 5
cazfi
Elite
Posts: 3077
Joined: Tue Jan 29, 2013 6:54 pm

Re: Changes in what a 2.6 rule set can do

Post by cazfi »

Maximum number of ruleset author defined unittype flags doubled to 32: patch #4904
sveinung
Elite
Posts: 548
Joined: Wed Feb 20, 2013 4:50 pm

Re: Changes in what a 2.6 rule set can do

Post by sveinung »

Changed in Freeciv 2.6/trunk: It is now possible to allow players to help foreigners build wonders. See patch #5569

Example: Allow units with the HelpWonder unit type flag help build domestic wonders and wonders being built by team mates.

Code: Select all

[actionenabler_help_build_wonder_self]
action = "Help Wonder"
actor_reqs    =
    { "type",   "name", "range", "present"
      "Unitflag", "HelpWonder", "Local", TRUE
      "DiplRel", "Is foreign", "Local", FALSE
    }

[actionenabler_help_build_wonder_team]
action = "Help Wonder"
actor_reqs    =
    { "type",   "name", "range", "present"
      "Unitflag", "HelpWonder", "Local", TRUE
      "DiplRel", "Team", "Local", TRUE
    }
cazfi
Elite
Posts: 3077
Joined: Tue Jan 29, 2013 6:54 pm

Re: Changes in what a 2.6 rule set can do

Post by cazfi »

sveinung wrote:Example: Allow units with the HelpWonder unit type flag help build domestic wonders and wonders being built by team mates.

Code: Select all

[actionenabler_help_build_wonder_self]
action = "Help Wonder"
actor_reqs    =
    { "type",   "name", "range", "present"
      "Unitflag", "HelpWonder", "Local", TRUE
      "DiplRel", "Is foreign", "Local", FALSE
    }

[actionenabler_help_build_wonder_team]
action = "Help Wonder"
actor_reqs    =
    { "type",   "name", "range", "present"
      "Unitflag", "HelpWonder", "Local", TRUE
      "DiplRel", "Team", "Local", TRUE
    }
Isn't the first enabler redundant? One would think that player is in his own team.
sveinung
Elite
Posts: 548
Joined: Wed Feb 20, 2013 4:50 pm

Re: Changes in what a 2.6 rule set can do

Post by sveinung »

cazfi wrote:Isn't the first enabler redundant? One would think that player is in his own team.
The check is if the player's relationship to himself it "Team". No diplomatic state check includes another. I have been wondering if this should change.
sveinung
Elite
Posts: 548
Joined: Wed Feb 20, 2013 4:50 pm

Re: Changes in what a 2.6 rule set can do

Post by sveinung »

Changed in Freeciv 2.6/trunk: The TradeRoute unit type flag is no longer hard coded. See patch #5624 and patch #5582

If you wish to continue using it like before define it as a user defined unit type flag in units.ruleset. Then require the unit flag in game.ruleset in the actor_reqs field of each action enabler that enables "Enter Marketplace" or "Establish Trade Route".
sveinung
Elite
Posts: 548
Joined: Wed Feb 20, 2013 4:50 pm

Re: Changes in what a 2.6 rule set can do

Post by sveinung »

The HelpWonder unit type flag is no longer hard coded. See patch #5639 and patch #5583

If you wish to continue using it like before define it as a user defined unit type flag in units.ruleset. Then require the unit flag in game.ruleset in the actor_reqs field of each action enabler that enables "Help Wonder".
sveinung
Elite
Posts: 548
Joined: Wed Feb 20, 2013 4:50 pm

Re: Changes in what a 2.6 rule set can do

Post by sveinung »

The rule that the incite cost of an empty city is halved is no longer hard coded. See patch #5634

The Incite_Cost_Pct effect and the MaxUnitsOnTile requirement type can be used to implement the rule in the ruleset in stead. This is done in the bundled rulesets.
Last edited by sveinung on Sun Jan 04, 2015 9:38 pm, edited 1 time in total.
User avatar
JTN
Elite
Posts: 473
Joined: Wed Jan 30, 2013 12:15 am

Re: Changes in what a 2.6 rule set can do

Post by JTN »

Couple of changes from October that I forgot to mention here:

Patch #5383 adds a new requirement type "NationGroup" testing whether the player's nation is a member of a particular group of nations; and nation groups can be marked as 'hidden' so they don't appear in the nation selection UI. As for ruleset-defined unit flags, etc, this allows disjunctive requirements, and more convenient specification of nation-specific effects.
cazfi wrote:- New requirement type "Age", can be checked from both units and cities patch #5305
"Player" range is also supported for this requirement as of patch #5380.
Post Reply