Template:Unit infobox

From Prismata Wiki
Jump to: navigation, search

This template defines the table "Units". View table.

Template-info.png Documentation

This template performs a number of functions:

  • It draws information about a unit from a data page if it finds one for the unit. It can also draw information directly from its parameters like a typical infobox.
  • It displays an infobox using that information by calling {{Unit infobox/layout}}. Note that the visual and layout code is in that template with the exception of the multiple data page warning.
  • It declares the Units table.
  • It sets fields in the Units table, which are used to create automated lists such as the one used by {{Unit table}}.
  • It performs some auto-categorization.
  • It also assigns property values, but automated list templates will shortly be converted to use the Units table, and this function will then be removed.

Finding the data page[edit source]

The template finds a data page for an item in one of four ways:

{{Unit infobox}}

When the name, datapage, and testdatapage parameters are not given values, the infobox looks for a data page in the Unit_data_pages table where the name field is the same as the name of the page the infobox is being used on.

{{Unit infobox
  |name=unit name
}}

When the name parameter is given a value but datapage is not, the infobox looks for a data page in in the Unit_data_pages table where the name field has that value.

{{Unit infobox
  |datapage=data subpage name
}}

When datapage is given a value, the infobox looks for that page, but will return it only if the page is in the Unit_data_pages table. When using this, specify only the subpage name of the data page. For example, for "Data:Units/EXAMPLE", just specify "EXAMPLE".

Note that an item data page should be set up with {{Unit data}}, and the name parameter on that template sets the value of Property:Has name. If the name parameter doesn't get a value, Property:Has name is set to the subpage name.

{{Unit infobox
  |testdatapage=full data page name
}}

testdatapage works the same as datapage except that it requires the full name of the data page, including the namespace. This is useful for testing data pages set up in a user namespace.

Other values[edit source]

Some information is not available from the imported data and must be supplied to the template separately, as shown below:

{{Unit infobox
  |ingame=yes or no
  |available=yes or no
}}

Setting ingame to no flags that a unit is not available in the game, even though it is in the game data. Setting available to no indicates that the unit is not available to players even if it is in the game, such as something only available to gamemasters or other staff.

This can be used with any of the other parameters.

When there is no data page[edit source]

If an item doesn't have a data page for some reason, you can treat this as a normal infobox and supply the values yourself.

{{Unit infobox
  |name=The standard name of the unit
  |plural=The plural name of the unit
  |article=The article used before the name, generally "a" or "an"
  |portrait=Filename of the portrait image, without the "File:" namespace prefix
  |panel=Filename of the panel image, without the "File:" namespace prefix
  |tooltip=Tooltip content
  |position=The position the unit takes on the field
  |health=The amount of health the unit has
  |supply=The available supply of the unit for play
  |stamina=The stamina value of the unit if it is limited
  |exhaust=The exhaust time for the unit's start-of-turn effect
  |ability_exhaust=The exhaust time of the unit on ability use if there is any
  |lifespan=The lifespan in number of turns if it is limited
  |build_time=The number of turns before the unit comes into play
  |cost_gold=Amount of gold needed to bring unit into play
  |cost_green=Amount of green resource needed to bring unit into play
  |cost_blue=Amount of blue resource needed to bring unit into play
  |cost_red=Amount of red resource needed to bring unit into play
  |cost_energy=Amount of energy needed to bring unit into play
  |cost_attack=Amount of attack needed to bring unit into play
  |max_attack=Maximum attack value of the unit
  |fragile=yes if the unit is fragile, no otherwise
  |blocker=yes if the unit can block, no otherwise
  |sacrificable=yes if the unit sacrifices itself, no otherwise
  |frontline=yes if the unit can always be directly attacked, no otherwise
  |spell=yes if the unit is a spell, no if it is a unit
  |created_units=content page names of units this unit creates, separated by line breaks
  |consumed_units=content page names of units this unit consumes, separated by line breaks
}}

Note that if a data page for the unit is imported later, the values of these parameters will be ignored.

Overriding data page values[edit source]

If necessary, it is possible to override the values pulled from the data page. When data is simply outdated, it's probably better to just change it on the data page itself, as it would probably have been corrected in the next data import anyway. But if for some reason imports seem to be consistently bringing in incorrect data, you can override it by using the force parameters:

{{Unit infobox
  |force_name=The standard name of the unit
  |force_plural=The plural name of the unit
  |force_article=The article used before the name, generally "a" or "an"
  |force_portrait=Filename of the portrait image, without the "File:" namespace prefix
  |force_panel=Filename of the panel image, without the "File:" namespace prefix
  |force_tooltip=Tooltip content
  |force_position=The position the unit takes on the field
  |force_health=The amount of health the unit has
  |force_supply=The available supply of the unit for play
  |force_stamina=The stamina value of the unit if it is limited
  |force_exhaust=The exhaust time for the unit's start-of-turn effect
  |force_ability_exhaust=The exhaust time of the unit on ability use if there is any
  |force_lifespan=The lifespan in number of turns if it is limited
  |force_build_time=The number of turns before the unit comes into play
  |force_cost_gold=Amount of gold needed to bring unit into play
  |force_cost_green=Amount of green resource needed to bring unit into play
  |force_cost_blue=Amount of blue resource needed to bring unit into play
  |force_cost_red=Amount of red resource needed to bring unit into play
  |force_cost_energy=Amount of energy needed to bring unit into play
  |force_cost_attack=Amount of attack needed to bring unit into play
  |force_max_attack=Maximum attack value of the unit
  |force_fragile=yes if the unit is fragile, no otherwise
  |force_blocker=yes if the unit can block, no otherwise
  |force_sacrificable=yes if the unit sacrifices itself, no otherwise
  |force_frontline=yes if the unit can always be directly attacked, no otherwise
  |force_spell=yes if the unit is a spell, no if it is a unit
  |force_created_units=content page names of units this unit creates, separated by line breaks
  |force_consumed_units=content page names of units this unit consumes, separated by line breaks
}}