The syntax is the same than when injecting AI via an equipment piece. "modifiers" : - we can inject AI through buffs. URI of the effect that will run when the buff is added (for example, the stamina tonic makes an orange cloud of particles to appear on the hearthlings for a second when it is used). For example, we use a swimming buff to change the hearthling's posture when they're in water and make them move slower). if it just sets a flag for use in other scripts, etc. This is useful if what the buff does should not be conveyed to the player (e.g. When true, the buff will not appear in the unit frame when we select the entity. "invisible_to_player" - optional field, false by default. You can see an example in the hothead buff (furious/winded buffs). While the cooldown buff is active, you won't be able to reapply this buff. "cooldown_buff" - optional field, points to an URI of a buff that will get applied when this buff's duration expires. This is the maximum number of times that the buff can be stacked (each stack will reapply the modifiers on top of the current values). "max_stacks" - used only when "repeat_add_action" is "stack_and_refresh".
If this field is not included, the buff will continue with its current duration until it expires. It can be either "renew_duration", which will restart the duration, "extend_duration", which will sum the duration of the buff to the current time left, or "stack_and_refresh", which will add a stack to the buff and restart its duration.
"repeat_add_action" - what to do if the buff is readded when it hasn't finished its duration yet. When true, it will be reapplied automatically on load by the buff controller ( a). "persistent" - whether this buff should be stored when the game is saved or not leave it as false if the logic to add the buff is run by other scripts on load. If this field is not included, the buff will be permanent.
The buff will be automatically removed once this duration ends. "duration" - a time expression for the duration of the buff (in-game time). "description" - a localized description for the buff's tooltip. "display_name" - a localized name for the buff to display in its tooltip in the UI. This will positionate the buff icon in different rows in the unit frame when we select the hearthling. "axis" - either "buff", "neutral" or "debuff". "type" : "buff" - we declare that this file represents a buff. These are the properties that we can find in the buff's JSON file: Don't forget to add an alias for your buff in your manifest! We can easily create buffs that modify some attributes from the hearthlings with just JSON, or do some more complex things with a small Lua script. There might be some more in subfolders of stonehearth/jobs. The existing buffs can be found inside stonehearth/data/buffs. The buff data that we declare in a JSON file is then managed by the stonehearth/components/buffs/a controller. The buffs component is used to add, remove and keep track of all the buffs/debuffs that a hearthling currently has. For example, sleeping on the ground may add the groggy buff to a hearthling, causing them to be slower for a few hours after waking up. They are applied in response to a situation or event. Buffs (both positive and negative) are temporary changes to an entity's attributes.