Affix ​
Inherits: DatabaseResource < Resource
A bonus an item can roll: "Heavy" (prefix, gives Strength), "of the Monkey" (suffix, gives Agility or Dodge), or a silent bonus with no name.
Description ​
An affix says WHAT it brings (which stats, which effects), never how much: the amount comes from the budget of the item (see ItemBudget), so the same affix is small on a level 5 item and large on a level 50 item. The display_name is the text in the name of the item ("Heavy", "of the Monkey"). See docs/systems/ability-ranks-and-item-generation.md.
Properties ​
Placement | placement | Placement.PREFIX |
int | weight | 100 |
String | exclusive_group | "" |
float | share | 1.0 |
Array[int] | allowed_equipment_types | [] |
Array[int] | allowed_weapon_classes | [] |
Array[int] | allowed_item_groups | [] |
int | min_item_level | 0 |
int | max_item_level | 0 |
int | min_quality_tier | 0 |
GrantMode | grant_mode | GrantMode.ALL |
int | pick_count | 1 |
Array[AffixStatGrant] | stat_grants | [] |
Array[AffixEffectGrant] | effect_grants | [] |
Methods ​
bool | is_effect_affix() |
bool | fits( item_definition: ItemDefinition, item_level: int, quality_tier: int ) |
Array | pick_grants( rng: RandomNumberGenerator ) |
Array[String] | validate() |
Enumerations ​
enum Placement ​
Where the name of the affix goes in the name of the item
- PREFIX =
0- Before the item name: "Heavy Great Axe" - SUFFIX =
1- After the item name: "Great Axe of the Monkey" - SILENT =
2- Not in the name: extra bonuses that only show in the tooltip
enum GrantMode ​
What the affix does with its list of grants
- ALL =
0- Every grant (Heavy gives Strength and Armor) - PICK_ONE =
1- One grant, picked by weight (of the Monkey gives Agility OR Dodge) - PICK_N =
2-pick_countdifferent grants, picked by weight
Property descriptions ​
Name
Placement placement = Placement.PREFIX ​
Prefix, suffix, or silent (no name)
Roll
int weight = 100 ​
The chance of this affix among the affixes that fit (higher = more common)
String exclusive_group = "" ​
Only one affix of a group can be on an item ("Attribute suffix": of the Monkey and of the Bear never roll together). Empty = no group
float share = 1.0 ​
How much of the budget this affix draws compared with the other bonuses of the item (2 = twice the share)
Where it can roll
Array[int] allowed_equipment_types = [] ​
Equipment types (and weapon types) it can roll on. Empty = any
Array[int] allowed_weapon_classes = [] ​
Weapon classes it can roll on (weapons only). Empty = any
Array[int] allowed_item_groups = [] ​
Item groups it can roll on (an item in any of them). Empty = any
int min_item_level = 0 ​
Lowest item level it can roll at (0 = any)
int max_item_level = 0 ​
Highest item level it can roll at (0 = no limit)
int min_quality_tier = 0 ​
Lowest quality tier the item must have (0 = any)
Grants
GrantMode grant_mode = GrantMode.ALL ​
How the grants below are used
int pick_count = 1 ​
How many grants to pick with the mode PICK_N
Array[AffixStatGrant] stat_grants = [] ​
The stats this affix can give. An affix with stat grants is a stat affix
Array[AffixEffectGrant] effect_grants = [] ​
The effects this affix can give. An affix with effect grants is an effect affix (it fills the effect slots of the quality)
Method descriptions ​
bool is_effect_affix() ​
Does this affix give effects (it uses the effect slots of the quality) rather than stats?
bool fits( item_definition: ItemDefinition, item_level: int, quality_tier: int ) ​
Can this affix roll on the item at that item level and quality tier? (Item definitions that are not equipment match only affixes without filters.)
Array pick_grants( rng: RandomNumberGenerator ) ​
The grants one roll of this affix gives (stat grants for a stat affix, effect grants for an effect affix), by the grant mode
Array[String] validate() ​
Configuration problems as readable messages (empty = fine)