Components
Components are small, standalone and composable bits of code that usually do only one thing or small variations of that one thing.
The core of it all is the AbilityComponent which components inherit from and which handles some basic shared aspects
for all components such as its parent ability, tick rate, bonuses and such.
Some of these components are used purely as data storage, some as event triggers and some have more in-depth functionalities.
Here's a list of all currently available components and what they're used for:
CooldownComponent- handles cooldownsDisableComponent- disables the ability and all of its components, this is different from the generic component'sisDisabledwhich disables the component itselfContinuousComponent- handles continuity of an ability, which is to say holding it active for short to long periods of timeChargeComponent- handles charging of an abilityRepeaterComponent- used to trigger one specific action every N ticksAnimationComponent- used to change and keep track of the player's animation while an ability is usedHitTrackerComponent- tracks which entities got hitGaugeComponent- handles a GUI gauge on the left side of the ability bar handling arbitrary dataSkinOverlayComponent- used to add overlays on top of the player's skin for different parts of the bodyChangeStatsComponent- used to change a player's stats, aka attributes, via attribute modifiersSlotDecorationComponent- used to handle an ability slot's rendering, this is internally used to make slots red during cooldown for examplePoolComponent- handles the pool an ability is inBowTriggerComponent- used as an event trigger for when a bow is shotDamageTakenComponent- middleware for when the player takes damage, can block or change this incoming damageItemSpawnComponent- used to spawn items bound to the abilityStackComponent- handles stack data for an ability, which is fancy way for saying it handles a counterAltModeComponent- handles an ability's alternative modesDealDamageComponent- used to deal damage to a targetPauseTickComponent- pauses an ability's ticking, some components that don't have any ticking might not get influenced by thisHitTriggerComponent- used as an event trigger for when hitting a targetAnimeScreamComponent- handles the anime screaming of an ability, used but deprecated and probably brokenSwitchModeComponent- alternative toAltModeComponentexcept its unused and deprecatedSwingTriggerComponent- used as an event trigger for when swinging the arm, doesn't matter if it hit something or notRangeComponent- handles range related functionality such as getting nearby entities or blocksMorphComponent- handles a player's morph state (such as for zoans)GrabEntityComponent- used for grabbing targets, handles multiple ways of grabbing them and holding themProjectileComponent- used for projectiles, creating them, spawning them and so on, mostly used for convenience and to automatically handle certain edge cases such as the Hissatsu abilityHealComponent- heals the target, opposite ofDealDamageComponentRequireMorphComponent- checks if the player has the required morph in order to use this abilityRequireAbilityComponent- checks if the player has the required ability and if it is in the correct state or if it can be forced into said state (only used by Gear Fourth to check for or activate Busoshoku Haki)
All these components can be added to any ability via Ability::addComponents method, a minimal example would look like
this:
private final ContinuousComponent continuousComponent = new ContinuousComponent(this);
public TestAbility(AbilityCore<TestAbility> core) {
super(core);
this.addComponents(this.continuousComponent);
}
Due to this composeable system the modder is free to mix and match these components however they see fit or even create new components for their specialized needs.
Defaults
Ability and PassiveAbility classes have certain components builtin to them for convenience so you don't need to
reimplement them.
Ability uses DisableComponent, CooldownComponent, AnimeScreamComponent
PassiveAbility uses DisableComponent, CooldownComponent, PauseTickComponent
Other more high level archtypes make use of even more components as part of their default behavior, for example
MorphAbility implements ContinuousComponent, ChangeStatsComponent and MorphComponent all of which are needed for
most currently implemented morphs.