Freeciv
(Flag Fighter is not new, it just behaves differently)
(Descriptions for unit type flags)
Line 137: Line 137:
 
==Unit Type Flags==
 
==Unit Type Flags==
   
"TradeRoute"
+
"TradeRoute" - Unit can establish trade routes
   
  +
"HelpWonder" - Unit can be disbanded in city building Wonder to get full unit production cost towards finishing wonder
"HelpWonder"
 
   
  +
"IgZOC" - Ignores Zone of Control restrictions even if unit class has "ZOC" flag
"IgZOC"
 
   
  +
"NonMil" - Can enforce martial law. Can occupy empty enemy cities, if unit class is capable to that. In 2.1, units of classes "Land" and "Helicopter" can occupy. In 2.2, unit class must have flag "CanOccupy".
"NonMil"
 
   
  +
"IgTer" - Regardless of terrain, move speed is at least same as would be using roads. Takes advantage of railroads.
"IgTer"
 
   
  +
"OneAttack" - Unit can attack only once in a turn even if its move_rate is more than one.
"OneAttack"
 
   
  +
"Pikemen" - Unit gets double defense power against units flagged as "Horse".
"Pikemen"
 
   
  +
"Horse" - Units flagged as "Pikemen" get double defense against these units.
"Horse"
 
   
  +
"IgWall" - Defender's "Defend_Bonus" effects are ignored when this unit attacks. In default rules only buildings "City Walls" and "Great Wall" give "Defend_Bonus" effect against "Land" units. Units of other classes ignore those effects and so do "Land" units with "IgWall".
"IgWall"
 
   
  +
"FieldUnit" - Unit is considered aggressive - causing unhappiness - even if it's within home borders (and inside cities when server setting 'happyborders' is off)
"FieldUnit"
 
   
  +
"AEGIS" - Unit defensepower is multiplied by 5 when attacker is air unit. In 2.1 units from classes "Air", "Helicopter", "Missile" or "Nuclear" are considered air units. In 2.2, units with unit class flag "AirUnit" are considered air units.
"AEGIS"
 
   
  +
"AttackAny" '''New in 2.2''' - Unit can attack even units that have unit class flag "Unreachable". Default rules use "Unreachabel" for air units and "AttackAny" for Fighters.
"AttackAny" '''New in 2.2'''
 
   
  +
"Marines" - Unit can attack directly from non-native terrain. Typically this means that unit is in transport.
"Marines"
 
   
  +
"Partial_Invis" - Other players can see this unit only if they have unit or city center in adjacent tile.
"Partial_Invis"
 
   
  +
"Settlers" - Unit can irrigate, mine and build roads and railroads (when tech is known). In 2.1 they also can build Fortresses. In 2.2 this is controlled by base definitions in [[terrain.ruleset]].
"Settlers"
 
   
  +
"Diplomat" - Can establish embassies, steal random technologies, bribe enemy units, start revolution in enemy city, sabotage production, investigate cities. If unit does not have also "Spy" flag, it is always destroyed after mission.
"Diplomat"
 
   
  +
"Trireme" - Unit should stay adjacent to "Land" squares. In 2.1 unit can move away from coast, but might be lost if ends turn not adjacent to land. In 2.2 unit cannot move away from land at all.
"Trireme"
 
   
  +
"Nuclear" - Can only be built when "Enable_Nuke" effect is active. When this unit attacks, all units (including friendly ones) within 3x3 square area are destroyed. Size of the attacked city is halved. Attack might cause fallout to surrounding squares.
"Nuclear"
 
   
  +
"Spy" - This flag works correctly only if unit has also "Diplomat" flag. Can poison water, select what technology to steal, select what to sabotage, sabotage enemy units. This unit might survive mission.
"Spy"
 
   
  +
"Transform" - Unit can transform terrain as specified in [[terrain.ruleset]]
"Transform"
 
   
  +
"Paratroopers" - Unit can paradrop to native terrain. Paradrop can be initiated from city or base. In 2.1 paradrop is possible from "Airbase". In 2.2 paradrop is possible from base with flag "ParadropFrom".
"Paratroopers"
 
   
  +
"Airbase" - In 2.1 means that unit can build airbases. In 2.2 has no hardcoded meaning. Default rules mark "Settlers", "Worker" and "Engineer" unit with this flag and base "Airbase" has building requirement "UnitFlag" "Airbase"
"Airbase"
 
   
  +
"Cities" - Can found new city. Unit is destroyed in the process.
"Cities"
 
   
  +
"No_Land_Attack" - This flag affects "Sea" moving units only. Usually they can attack non-native terrains (shore bombardment), but units with this flag cannot.
"No_Land_Attack"
 
   
  +
"AddToCity" - Unit can inrease city size by population cost. Unit is destroyed in the process. City size cannot be increased if city is already larger than limit defined in [[cities.ruleset]]
"AddToCity"
 
   
  +
"Fanatic" - If effect "Fanatics" is active for player, units of this type have no upkeep cost. (According to some documentation, effect needs to be active in order to build these units. Looking at the source code this seems not to be true)
"Fanatic"
 
   
  +
"GameLoss" - If player loses unit of this type, he loses whole game.
"GameLoss"
 
   
  +
"Unique" - Player can have only one unit of this type at a time.
"Unique"
 
   
"Unbribable"
+
"Unbribable" - Unit cannot be bribed.
   
"Undisbandable"
+
"Undisbandable" - Player cannot disband this unit.
   
  +
"SuperSpy" - This unit always wins against regular "Diplomat" and "Spy" units.
"SuperSpy"
 
   
  +
"NoHome" - Unit has no home city assigned. This means that no city is paying upkeep for it and it cannot be killed by conquering its home city.
"NoHome"
 
   
  +
"NoVeteran" - Unit cannot gain veteran levels. It is always in the lowest defined level.
"NoVeteran"
 
   
"Bombarder"
+
"Bombarder" - Unit uses bombard attack.
   
  +
"CityBuster" - Unit's firepower is doubled when it attacks against city
"CityBuster"
 
   
  +
"NoBuild" - Unit cannot be built in cities. These units can only be available from start, appear from huts, appear as barbarians, or be created via scenario scripting.
"NoBuild"
 
   
  +
"BadWallAttacker" - If defender has "Defend_Bonus" effect when this unit attacks, firepower is considered to be 1.
"BadWallAttacker"
 
   
  +
"BadCityDefender" - When this unit is defender against attack to city, attacker firepower is doubled and this unit is considered to have firepower of one. Default rules use this flag for all ships. Note that native/non-native terrain does not affect defense capabilities.
"BadCityDefender"
 
   
  +
"Helicopter" '''New in 2.2''' When units flagged as "Fighter" attack this unit, defender's firepower is considered to be 1 and defense value is halved.
"Helicopter" '''New in 2.2'''
 
   
 
"AirUnit" '''New in 2.2'''
 
"AirUnit" '''New in 2.2'''
   
  +
"Fighter" - Good at attacking against helicopters. In 2.1 units of class "Helicopter" are considered helicopters. In 2.2 units with unit type flag "Helicopter" are considered helicopters. In 2.1 "Fighter" is also able to attack against air units (similar to 2.2 "AttackAny" flag)
"Fighter"
 
   
"BarbarianOnly" '''New in 2.2'''
+
"BarbarianOnly" '''New in 2.2''' - Unit can be built only by barbarian players. For other players this is similar to "NoBuild"
   
"Missile" '''Removed in 2.2'''
+
"Missile" '''Removed in 2.2''' - Unit is destroyed after it attacks even if it is victorious. In 2.2 this is unit class flag.
   
  +
"Carrier" '''Removed in 2.2''' - Unit can transport units of classes "Air", "Missile", "Helicopter" and "Nuclear", and no "Land" units. Unit is "Land" unit transport if it does not have this flag or "Missile_Carrier" flag. In 2.2 this implementation is replaced by unit type field "cargo".
"Carrier" '''Removed in 2.2'''
 
   
"Missile_Carrier" '''Removed in 2.2'''
+
"Missile_Carrier" '''Removed in 2.2''' - Unit can transport units of classes "Missile" and "Nuclear", but no others. See also "Carrier".
   
 
==Unit Type Roles==
 
==Unit Type Roles==

Revision as of 07:17, 17 March 2007

units.ruleset contains all the information about unit types in the game. In addition to unit type entries there is some generic information about how units gain veterancy and how it affects them. Starting from Freeciv version 2.2 there are also unit class entries. Each unit type belongs to some unit class.

Veteran System

Veteran system entries are quite well documented in default ruleset.

Note that individual unit types can have "NoVeteran" flag preventing it from becoming veteran no matter what generic veteran system definitions say. In default ruleset Settlers, Workers and Engineers all have "NoVeteran" flag, so changing veteran_work_raise_chance affects nothing.

Unit Classes

Unit classes are new concept in version 2.2

There can be maximum of 32 different unit classes. Do not add them without proper consideration if separate class is really needed. Considering all the cross-referencing from other ruleset files, big number of different unit class can prove difficult to maintain. For example typical effects.ruleset has effects with UnitClass requirements. If you want same effect to affect several classes, you need to provide separate effect for each.

[unitclass_sea]
name          = _("Sea")
move_type     = "Sea"
min_speed     = 2
hp_loss_pct   = 0
hut_behavior  = "Normal"
flags         = "TerrainSpeed", "DamageSlows"

Possible values for move_type are "Land", "Sea", "Both" and "Air". Terrain.ruleset defines exat limitations where units of this class can move, but move_type must be compatible with that. "Land" units cannot move at any oceanic terrain. "Sea" units can move only at oceanic terrains. "Air" units still have some special rules that makes them different from "Both". In theory you can have "Both" units that terrain.ruleset restricts to land terrains only, but you should not do that. AI does not use "Both" units. In default ruleset, Helicopters are "Both" units.

Some units are slowed down when damaged. No matter how much damage they have, speed never drops below min_speed. Neither do terrain slow units below min_speed.

Some units lose hitpoints when ever they end turn and are not in city, native base, or transport. hp_loss_pct tells how many percents of units total hitpoints is lost each turn. In default ruleset helicopters have non-zero hp_loss_pct.

hut_behavior controls what happens when unit enters tile with hut (minor tribe village). "Normal" means that hut disappears with random effect. "Nothing" means that nothing happens, hut even remains for other units to come. "Frighten" means that hut just disappear without any other effects. In default ruleset airplanes and missiles "Frighten"

Unit Class Flags

"TerrainSpeed" - Unit is not moving at constant speed, but terrain affects it. This includes effects from roads and railroads. In default ruleset all but flying units have this flag.

"DamageSlows" - Unit is slowed down when damaged. In default ruleset land and sea units have this flag and flying units do not.

"CanOccupy" - Units of this class can occupy empty enemy cities. Note that particular unit type must be also military unit in order to occupy cities. In default ruleset land units and helicopters have this flag.

"Missile" - Unit disappears after it has attacked even if it was victorious. In default ruleset missiles have this flag

"RoadNative" - Even if particular base terrain is listed as non-native for this unit class, tiles with road are still considered native. That is, units can move anywhere where is road. In default ruleset we have no such units as all land units can move at all land terrains anyway.

"BuildAnywhere" - Units can be built even if city is located in non-native terrain for unit. In default ruleset land units have this flag so theoretical ocean cities can build them. Most definitely sea units do not have this flag.

"Unreachable" - Only special units with unit type flag "AttackAny" can attack units of this class. In default ruleset airplanes and missiles have this flag and Fighters have "AttackAny".

"CollectRansom" - When unit of this class kills lone barbarian leader, player gains money. In default ruleset land units and helicopters have this flag.

"ZOC" - Units of this class are subject to Zone of Control rules. There is also unit type flag "IgZOC" that can be used to override this. In default ruleset land units class have this flag, but some individual unit types override it with "IgZOC".

"CanFortify" - Units of this class can fortify in land squares. In default ruleset land units have this flag, flying units cannot fortify even when over land.

Unit Types

This is written from development versions perspective. More documentation about 2.1 is needed.

[unit_warriors]
name          = _("Warriors")
class         = "Land"
tech_req      = "None"
obsolete_by   = "Pikemen"
graphic       = "u.warriors"
graphic_alt   = "-"
sound_move    = "m_warriors"
sound_move_alt = "m_generic"
sound_fight   = "f_warriors"
sound_fight_alt = "f_generic"
build_cost    = 10
pop_cost      = 0
attack        = 1
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         = ""
roles         = "DefendOk", "FirstBuild"
helptext      = _("\
This unit may be built from the start of the game.  It is the\
 weakest unit.\
")

class refers to unit class this unit type belongs to. In 2.2 this is one of the classes defined earlier in the units.ruleset. In 2.1 this is one of the predefined classes: "Missile", "Land", "Sea", "Helicopter", "Air" or "Nuclear".

tech_req is name of the tech that is required in order to build this unit. These are defined in Techs.ruleset. Special value "None" means that unit can be built without knowing any tech.

obsolete_by is name of the another unit type to which this unit type upgrades to.

graphic is graphic tag for this unit. Tileset should provide graphics for matching this tag.

graphic_alt is used as fallback tag if primary tag is not found from tileset.

sound_move, sound_move_alt, sound_fight and sound_fight_alt Sound tags similar to graphic tags.

build_cost is how much production is needed in order to build this unit.

pop_cost is how much city size will shrink once unit is finished. In default ruleset only Settlers have population cost.

attack is attack strength of unit.

defense is defense strength of unit.

hitpoints is number of hitpoints units of this type have when they are in full health.

firepower is unit firepower.

move_rate is unit speed. Here it is in full move points, not in 1/3 points.

vision_radius_sq' is how far unit sees. This is given as vision_radius_square in order to be able to see circular areas instead of square area.

transport_cap tells how many other units this unit type can transport.

cargo is new optional field in 2.2, applicable only for units that have transport_cap > 0. It is list of different unit classes this unit type can transport. In default ruleset Carrier has cargo = "Air", "Missile", "Helicopter". In 2.1 unit type flags define what other units unit can transport.

fuel is number of turns that unit can live without refueling. Value 0 means that unit never needs to refuel. Value 1 means that unit needs to refuel every turn or to crash. Value other than zero should be given only to air units, it does not work correctly with other kind of units.

uk_happy is how much unit causes unhappiness when aggressive.

uk_shield is unit upkeep in shields / turn.

uk_food is unit upkeep in food / turn.

uk_gold is unit upkeep in gold / turn.

helptext is shown in inline help in addition to automatically generated help.

Unit Type Flags

"TradeRoute" - Unit can establish trade routes

"HelpWonder" - Unit can be disbanded in city building Wonder to get full unit production cost towards finishing wonder

"IgZOC" - Ignores Zone of Control restrictions even if unit class has "ZOC" flag

"NonMil" - Can enforce martial law. Can occupy empty enemy cities, if unit class is capable to that. In 2.1, units of classes "Land" and "Helicopter" can occupy. In 2.2, unit class must have flag "CanOccupy".

"IgTer" - Regardless of terrain, move speed is at least same as would be using roads. Takes advantage of railroads.

"OneAttack" - Unit can attack only once in a turn even if its move_rate is more than one.

"Pikemen" - Unit gets double defense power against units flagged as "Horse".

"Horse" - Units flagged as "Pikemen" get double defense against these units.

"IgWall" - Defender's "Defend_Bonus" effects are ignored when this unit attacks. In default rules only buildings "City Walls" and "Great Wall" give "Defend_Bonus" effect against "Land" units. Units of other classes ignore those effects and so do "Land" units with "IgWall".

"FieldUnit" - Unit is considered aggressive - causing unhappiness - even if it's within home borders (and inside cities when server setting 'happyborders' is off)

"AEGIS" - Unit defensepower is multiplied by 5 when attacker is air unit. In 2.1 units from classes "Air", "Helicopter", "Missile" or "Nuclear" are considered air units. In 2.2, units with unit class flag "AirUnit" are considered air units.

"AttackAny" New in 2.2 - Unit can attack even units that have unit class flag "Unreachable". Default rules use "Unreachabel" for air units and "AttackAny" for Fighters.

"Marines" - Unit can attack directly from non-native terrain. Typically this means that unit is in transport.

"Partial_Invis" - Other players can see this unit only if they have unit or city center in adjacent tile.

"Settlers" - Unit can irrigate, mine and build roads and railroads (when tech is known). In 2.1 they also can build Fortresses. In 2.2 this is controlled by base definitions in terrain.ruleset.

"Diplomat" - Can establish embassies, steal random technologies, bribe enemy units, start revolution in enemy city, sabotage production, investigate cities. If unit does not have also "Spy" flag, it is always destroyed after mission.

"Trireme" - Unit should stay adjacent to "Land" squares. In 2.1 unit can move away from coast, but might be lost if ends turn not adjacent to land. In 2.2 unit cannot move away from land at all.

"Nuclear" - Can only be built when "Enable_Nuke" effect is active. When this unit attacks, all units (including friendly ones) within 3x3 square area are destroyed. Size of the attacked city is halved. Attack might cause fallout to surrounding squares.

"Spy" - This flag works correctly only if unit has also "Diplomat" flag. Can poison water, select what technology to steal, select what to sabotage, sabotage enemy units. This unit might survive mission.

"Transform" - Unit can transform terrain as specified in terrain.ruleset

"Paratroopers" - Unit can paradrop to native terrain. Paradrop can be initiated from city or base. In 2.1 paradrop is possible from "Airbase". In 2.2 paradrop is possible from base with flag "ParadropFrom".

"Airbase" - In 2.1 means that unit can build airbases. In 2.2 has no hardcoded meaning. Default rules mark "Settlers", "Worker" and "Engineer" unit with this flag and base "Airbase" has building requirement "UnitFlag" "Airbase"

"Cities" - Can found new city. Unit is destroyed in the process.

"No_Land_Attack" - This flag affects "Sea" moving units only. Usually they can attack non-native terrains (shore bombardment), but units with this flag cannot.

"AddToCity" - Unit can inrease city size by population cost. Unit is destroyed in the process. City size cannot be increased if city is already larger than limit defined in cities.ruleset

"Fanatic" - If effect "Fanatics" is active for player, units of this type have no upkeep cost. (According to some documentation, effect needs to be active in order to build these units. Looking at the source code this seems not to be true)

"GameLoss" - If player loses unit of this type, he loses whole game.

"Unique" - Player can have only one unit of this type at a time.

"Unbribable" - Unit cannot be bribed.

"Undisbandable" - Player cannot disband this unit.

"SuperSpy" - This unit always wins against regular "Diplomat" and "Spy" units.

"NoHome" - Unit has no home city assigned. This means that no city is paying upkeep for it and it cannot be killed by conquering its home city.

"NoVeteran" - Unit cannot gain veteran levels. It is always in the lowest defined level.

"Bombarder" - Unit uses bombard attack.

"CityBuster" - Unit's firepower is doubled when it attacks against city

"NoBuild" - Unit cannot be built in cities. These units can only be available from start, appear from huts, appear as barbarians, or be created via scenario scripting.

"BadWallAttacker" - If defender has "Defend_Bonus" effect when this unit attacks, firepower is considered to be 1.

"BadCityDefender" - When this unit is defender against attack to city, attacker firepower is doubled and this unit is considered to have firepower of one. Default rules use this flag for all ships. Note that native/non-native terrain does not affect defense capabilities.

"Helicopter" New in 2.2 When units flagged as "Fighter" attack this unit, defender's firepower is considered to be 1 and defense value is halved.

"AirUnit" New in 2.2

"Fighter" - Good at attacking against helicopters. In 2.1 units of class "Helicopter" are considered helicopters. In 2.2 units with unit type flag "Helicopter" are considered helicopters. In 2.1 "Fighter" is also able to attack against air units (similar to 2.2 "AttackAny" flag)

"BarbarianOnly" New in 2.2 - Unit can be built only by barbarian players. For other players this is similar to "NoBuild"

"Missile" Removed in 2.2 - Unit is destroyed after it attacks even if it is victorious. In 2.2 this is unit class flag.

"Carrier" Removed in 2.2 - Unit can transport units of classes "Air", "Missile", "Helicopter" and "Nuclear", and no "Land" units. Unit is "Land" unit transport if it does not have this flag or "Missile_Carrier" flag. In 2.2 this implementation is replaced by unit type field "cargo".

"Missile_Carrier" Removed in 2.2 - Unit can transport units of classes "Missile" and "Nuclear", but no others. See also "Carrier".

Unit Type Roles

Unit type can have multiple roles it fits in to.

"FirstBuild"

"Explorer"

"Hut"

"HutTech"

"Partisan"

"DefendOk"

"DefendGood"

"AttackFast"

"AttackStrong"

"FerryBoat"

"Barbarian"

"BarbarianTech"

"BarbarianBoat"

"BarbarianBuild"

"BarbarianBuildTech"

"BarbarianLeader"

"BarbarianSea"

"BarbarianSeaTech"

"Cities"

"Settlers"

"GameLoss"

"Diplomat"

"Hunter"