Template:BonusDef: Difference between revisions

From Heroes of Might and Magic: Olden Era Official Wiki
obelisk-bot: uploading initial Cargo templates
obelisk-bot: Pushing translation table rework
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
<noinclude>
<noinclude>
A unified Cargo table for bonus effects across multiple parent entity types. Per D-031: hero specializations, hero sub-classes, artifacts, item-set tiers, and faction laws all carry the same
A unified Cargo table for bonus effects across multiple parent entity types. Hero specializations, hero sub-classes, artifacts, item-set tiers, and faction laws all share one Bonus table with <code>parent_type</code> + <code>parent_id</code> discriminator columns.
<code>(type, parameters, [activationLevel], [upgrade], [receivers], …)</code>
source pattern, so they share one Bonus table with <code>parent_type</code> +
<code>parent_id</code> discriminator columns instead of separate <code><Entity>Bonus</code>
tables.


The bot emits each row inline on the parent entity's wiki page. There are no individual <code>Data:Bonus/…</code> pages.
The bot emits each row inline on the parent entity's wiki page. There are no individual <code>Data:Bonus/…</code> pages.
Line 25: Line 21:
| fraction = String
| fraction = String
}}
}}
<pre><nowiki>
{{BonusDef
| parent_type = String          <!-- hero_specialization, hero_sub_class, artifact, item_set_tier, law_level -->
| parent_id = String            <!-- the parent entity's id -->
| ordinal = Integer              <!-- 0-based position in the source bonuses[] -->
| type = String                  <!-- bonus effect category (~30 distinct values once laws added) -->
| parameters = List (,) of String <!-- effect arguments; meaning depends on type -->
<!-- Sparse fields (omitted unless populated in source) -->
| activation_level = Integer
| upgrade_increment = Float
| upgrade_level_step = Integer
| receivers = List (,) of String
| battle_type = String
| receiver_role = String
| receiver_allegiance = String
| action_area = String          <!-- e.g. allied; law-bonus extension -->
| fraction = String              <!-- target faction filter; law-bonus extension -->
}}
</nowiki></pre>


== Field notes ==
== Field notes ==
* '''Primary key is <code>(parent_type, parent_id, ordinal)</code>'''.
* Primary key is <code>(parent_type, parent_id, ordinal)</code>.
* '''<code>parent_type</code>''' identifies the parent entity table:
* <code>parent_type</code> identifies the parent: <code>hero_specialization</code>, <code>hero_sub_class</code>, <code>artifact</code>, <code>item_set_tier</code>, <code>law_level</code>.
** <code>hero_specialization</code> — joined to <code>HeroSpecialization.id</code>
* <code>type</code> is the effect category (~13 distinct values; <code>heroStat</code>, <code>unitStat</code>, <code>heroBattleAbility</code> most common).
** <code>hero_sub_class</code> — joined to <code>HeroSubClass.id</code>
* <code>parameters</code> is comma-joined, type-dependent.
** <code>artifact</code> — joined to <code>Artifact.id</code>
* Sparse fields vary by parent type.
** <code>item_set_tier</code> — joined to <code>ItemSetTier.id</code>
* <code>action_area</code> (law-bonus only) qualifies which side an effect applies to.
** <code>law_level</code> — joined to <code>LawLevelDef</code> on <code>parent_id = law_id || '_L' || level</code> Add new values as new bonus-bearing entities come online.
* <code>fraction</code> (law-bonus only) is a target-faction filter; column name preserves the source JSON's misspelling.
* '''<code>type</code>''' is the effect category. ~13 distinct values across the 2026-05-03 corpus, with <code>heroStat</code> (~895), <code>unitStat</code> (~330), <code>heroBattleAbility</code> (~235) the most common. Artifacts add a few new ones (<code>heroMagicAddition</code> for spell scrolls, <code>heroTemporallyActiveSubSkills</code>).
* '''<code>parameters</code>''' is comma-joined, type-dependent. Same encoding as the original *Bonus tables. Wiki side parses by <code>type</code>.
* '''Sparse fields''' vary by parent type:
** Spec bonuses use the full schema.
** Sub-class bonuses don't carry <code>activation_level</code>, <code>upgrade_*</code>, <code>battle_type</code>, or <code>receiver_role</code> in the 2026-05-03 corpus.
** Artifact bonuses use most fields except <code>battle_type</code> and <code>receiver_role</code>.
** Law-level bonuses use <code>receivers</code>, <code>receiver_allegiance</code>, <code>action_area</code>, <code>fraction</code>. They never use <code>activation_level</code>, <code>upgrade_*</code>, <code>battle_type</code>, or <code>receiver_role</code>.
* '''<code>action_area</code>''' (law-bonus only so far) — qualifier for which side a <code>barrackUpgradeUnitsHiring</code> etc. effect applies to. Values observed: <code>allied</code>.
* '''<code>fraction</code>''' (law-bonus only so far) target faction filter for a bonus restricted to a single faction. Column name preserves the source JSON's misspelling (<code>fraction</code> ↔ canonical English "faction") for traceability with the raw data.


[[Category:Cargo Definitions]]
[[Category:Cargo Definitions]]
Line 81: Line 47:
| action_area = {{{action_area|}}}
| action_area = {{{action_area|}}}
| fraction = {{{fraction|}}}
| fraction = {{{fraction|}}}
}}</includeonly>
}}
Created <code>Bonus</code> entry: <code>{{{parent_type|}}}/{{{parent_id|}}} #{{{ordinal|}}}</code></includeonly>

Latest revision as of 20:47, 14 May 2026

A unified Cargo table for bonus effects across multiple parent entity types. Hero specializations, hero sub-classes, artifacts, item-set tiers, and faction laws all share one Bonus table with parent_type + parent_id discriminator columns.

The bot emits each row inline on the parent entity's wiki page. There are no individual Data:Bonus/… pages.

Schema

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

Field notes

  • Primary key is (parent_type, parent_id, ordinal).
  • parent_type identifies the parent: hero_specialization, hero_sub_class, artifact, item_set_tier, law_level.
  • type is the effect category (~13 distinct values; heroStat, unitStat, heroBattleAbility most common).
  • parameters is comma-joined, type-dependent.
  • Sparse fields vary by parent type.
  • action_area (law-bonus only) qualifies which side an effect applies to.
  • fraction (law-bonus only) is a target-faction filter; column name preserves the source JSON's misspelling.