Skip to content

Attribute Definitions

Attribute definition files are located in the attributes/ directory. Each YAML file can contain one or more attribute definitions.

YAML Format

yaml
id: physical_attack
display_name: "物理攻击"
value_kind: FLAT
target_type: DAMAGE
target_id: physical
default_value: 0.0
min_value: 0.0
max_value: 99999.0
allow_negative: false
priority: 100
lore_format_id: default_flat
lore_patterns:
  - "物理攻击: {value}"
  - "物理攻击力: {value}"
attribute_power: 1.0
description: "物理伤害的基础攻击力"

Field Descriptions

FieldTypeRequiredDefaultDescription
idStringYesUnique attribute identifier, automatically converted to lowercase underscore format
display_nameStringNoSame as idDisplay name
value_kindEnumNoFLATValue type, determines the semantics and calculation method of the attribute
target_typeEnumNoGENERICTarget type, determines the system category the attribute belongs to
target_idStringNo""Target ID; when target_type is DAMAGE or RESOURCE, points to the corresponding damage type or resource
default_valuedoubleNo0.0Default value
min_valueDoubleNonullMinimum value limit, null means no limit
max_valueDoubleNonullMaximum value limit, null means no limit
allow_negativebooleanNofalseWhether negative values are allowed
priorityintNo0Sort priority, higher values appear first
lore_format_idStringNo""Associated Lore format ID
lore_patternsListNo[]Lore matching pattern list, used to parse attribute values from item Lore
attribute_powerdoubleNo1.0Combat power score, used for combat power calculation
descriptionStringNo""Attribute description

mmoitems_stat_id

Attribute definitions also support the mmoitems_stat_id field (mmoItemsStatId in source code), used to map MMOItems Stat IDs. When the MMOItems bridge is enabled, the system automatically reads the corresponding Stat values from MMOItems items as attribute contributions.

value_kind Enum

ValueDescriptionTypical Usage
FLATFixed numeric valueAttack, defense, and other base attributes
PERCENTPercentage valueDamage bonus, percentage lifesteal
CHANCEProbability value (0–100)Crit rate, dodge chance
REGENRegeneration valueHealth regen, mana regen
RESOURCEResource valueHealth, mana cap
DERIVEDDerived valueAttributes calculated from other attributes

Percent-like Attributes

PERCENT and CHANCE type attributes return true for isPercentLike(), and the Lore formatter will automatically append a % suffix.

target_type Enum

ValueDescriptionTypical Usage
DAMAGEDamage-related attributePhysical attack, spell defense, etc.; target_id points to a damage type
RESOURCEResource-related attributeHealth, mana; target_id points to a resource ID
GENERICGeneric attributeDodge chance, lifesteal, and other attributes not belonging to a specific category
VANILLAVanilla mapping attributeAttributes mapped to Bukkit vanilla Attributes

Default Attribute List

Resource

IDDisplay Namevalue_kindtarget_typetarget_id
healthHealthRESOURCERESOURCEhealth
manaManaRESOURCERESOURCEmana
health_regenHealth RegenREGENRESOURCEhealth
mana_regenMana RegenREGENRESOURCEmana

Physical

IDDisplay Namevalue_kindtarget_typetarget_id
physical_attackPhysical AttackFLATDAMAGEphysical
physical_damage_bonusPhysical Damage BonusPERCENTDAMAGEphysical
physical_defensePhysical DefenseFLATDAMAGEphysical
physical_armor_penetrationPhysical Armor PenetrationFLATDAMAGEphysical
physical_crit_ratePhysical Crit RateCHANCEDAMAGEphysical
physical_crit_damagePhysical Crit DamageFLATDAMAGEphysical
physical_crit_evasionPhysical Crit EvasionCHANCEDAMAGEphysical
physical_crit_multiplier_resistancePhysical Crit Multiplier ResistancePERCENTDAMAGEphysical

Projectile

IDDisplay Namevalue_kindtarget_typetarget_id
projectile_attackProjectile AttackFLATDAMAGEprojectile
projectile_damage_bonusProjectile Damage BonusPERCENTDAMAGEprojectile
projectile_defenseProjectile DefenseFLATDAMAGEprojectile
projectile_armor_penetrationProjectile Armor PenetrationFLATDAMAGEprojectile
projectile_crit_rateProjectile Crit RateCHANCEDAMAGEprojectile
projectile_crit_damageProjectile Crit DamageFLATDAMAGEprojectile
projectile_crit_evasionProjectile Crit EvasionCHANCEDAMAGEprojectile
projectile_crit_multiplier_resistanceProjectile Crit Multiplier ResistancePERCENTDAMAGEprojectile

Spell

IDDisplay Namevalue_kindtarget_typetarget_id
spell_attackSpell AttackFLATDAMAGEspell
spell_damage_bonusSpell Damage BonusPERCENTDAMAGEspell
spell_defenseSpell DefenseFLATDAMAGEspell
spell_armor_penetrationSpell Armor PenetrationFLATDAMAGEspell
spell_crit_rateSpell Crit RateCHANCEDAMAGEspell
spell_crit_damageSpell Crit DamageFLATDAMAGEspell
spell_crit_evasionSpell Crit EvasionCHANCEDAMAGEspell
spell_crit_multiplier_resistanceSpell Crit Multiplier ResistancePERCENTDAMAGEspell

Spell Naming Convention

Spell crit rate and crit damage use spell_crit_rate / spell_crit_damage naming, consistent with the {category}_crit_rate / {category}_crit_damage pattern used by the physical and projectile categories.

Movement/Utility

IDDisplay Namevalue_kindtarget_type
speedSpeedFLATGENERIC
movement_speedMovement SpeedFLATGENERIC
attack_speedAttack SpeedFLATGENERIC
entity_scaleEntity ScaleFLATGENERIC
entity_interaction_rangeEntity Interaction RangeFLATGENERIC
block_interaction_rangeBlock Interaction RangeFLATGENERIC

Special Attributes

IDDisplay Namevalue_kindtarget_type
real_damageTrue DamageFLATGENERIC
lifestealLifestealFLATGENERIC
percentage_lifestealPercentage LifestealPERCENTGENERIC
lifesteal_resistanceLifesteal ResistancePERCENTGENERIC
dodge_chanceDodge ChanceCHANCEGENERIC
attribute_powerCombat PowerDERIVEDGENERIC

Vanilla Mapping

IDDisplay Namevalue_kindtarget_type
attack_speed_vanillaVanilla Attack SpeedFLATVANILLA
max_health_vanillaVanilla Max HealthFLATVANILLA

Vanilla Mapping Attributes

VANILLA type attributes are synchronized to the Bukkit vanilla Attribute system via VanillaAttributeSynchronizer. Modifying these attribute values will directly affect vanilla behavior.

attribute_balance.yml

The attribute balance configuration file defines attribute combat power score coefficients, used for the derived calculation of the attribute_power (Combat Power) attribute.

yaml
# Attribute groups and combat power scores
groups:
  physical_offense:
    score: 1.0
    attributes:
      - physical_attack
      - physical_crit_rate
      - physical_crit_damage
  physical_defense:
    score: 0.8
    attributes:
      - physical_defense
      - physical_armor_penetration
  projectile_offense:
    score: 1.0
    attributes:
      - projectile_attack
      - projectile_crit_rate
      - projectile_crit_damage
  spell_offense:
    score: 1.0
    attributes:
      - spell_attack
      - spell_crit_rate
      - spell_crit_damage
  survival:
    score: 0.6
    attributes:
      - health
      - dodge_chance
      - lifesteal

Combat Power Calculation

attribute_power is a DERIVED type attribute whose value is automatically calculated by AttributeBalanceRegistry based on group scores. Each attribute's contribution = attribute value × attribute definition's attribute_power × group score.

Released under the GPL-3.0 License