mr:artifact_buff
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revision | |||
| mr:artifact_buff [2026/03/29 15:11] – Wiki standards compliance: Fix red links and missing images in selected pages Qwen Assistant | mr:artifact_buff [2026/03/29 15:15] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ====== Artifact Buff - Code References ====== | ||
| + | |||
| + | The **Artifact Buff** is a base class for all buffs that are applied by artifacts (rings, artifacts, and similar equipment). It extends the standard [[https:// | ||
| + | |||
| + | ===== Java Classes ===== | ||
| + | |||
| + | **Base Implementation: | ||
| + | * `com/ | ||
| + | * Extends: `com/ | ||
| + | * Package: `com.watabou.pixeldungeon.items.rings` | ||
| + | |||
| + | **Key Characteristics: | ||
| + | * Artifact buffs are tied to their source artifact through the source ID system | ||
| + | * They automatically detach when the source artifact is removed | ||
| + | * They use the `EntityIdSource` system to track their origin | ||
| + | |||
| + | **Key Methods:** | ||
| + | <code java> | ||
| + | // In ArtifactBuff.java | ||
| + | public class ArtifactBuff extends Buff { | ||
| + | @Override | ||
| + | public boolean act() { | ||
| + | if(getSourceId()==EntityIdSource.INVALID_ID) { // non-artifact source | ||
| + | detach(); | ||
| + | } | ||
| + | return super.act(); | ||
| + | } | ||
| + | |||
| + | public String getEntityKind() { | ||
| + | return " | ||
| + | } | ||
| + | |||
| + | @Override | ||
| + | public boolean dontPack() { | ||
| + | return getSourceId()!= EntityIdSource.INVALID_ID; | ||
| + | } | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ===== Key Behaviors ===== | ||
| + | |||
| + | **Source Tracking:** | ||
| + | * Artifact buffs maintain a reference to their source artifact via `getSourceId()` | ||
| + | * If the source becomes invalid (`EntityIdSource.INVALID_ID`), | ||
| + | * This ensures buffs don't persist after their source artifact is removed | ||
| + | |||
| + | **Serialization: | ||
| + | * The `dontPack()` method returns `true` for artifact buffs with valid sources | ||
| + | * This prevents unnecessary serialization of temporary buff state | ||
| + | |||
| + | **Entity Kind:** | ||
| + | * Artifact buffs prepend " | ||
| + | * This allows for easy identification and filtering of artifact-sourced buffs | ||
| + | |||
| + | ===== JSON Configuration ===== | ||
| + | |||
| + | Artifact buffs do not have separate JSON configuration files. They are: | ||
| + | * Defined entirely in Java code | ||
| + | * Registered through the buff factory system | ||
| + | * Associated with their parent artifacts | ||
| + | |||
| + | ===== String Resources ===== | ||
| + | |||
| + | Artifact buffs inherit their display names and descriptions from their parent artifacts. Individual buff implementations may override these in string resource files. | ||
| + | |||
| + | ===== Lua Scripts ===== | ||
| + | |||
| + | Artifact buffs are implemented entirely in Java. No Lua scripts are used for the base ArtifactBuff class. | ||
| + | |||
| + | ===== Related Entities ===== | ||
| + | |||
| + | **Base Classes:** | ||
| + | * [[https:// | ||
| + | * [[https:// | ||
| + | |||
| + | **Related Interfaces: | ||
| + | * [[https:// | ||
| + | * [[https:// | ||
| + | |||
| + | **Example Artifact Buffs:** | ||
| + | * [[mr: | ||
| + | * [[en: | ||
| + | * [[en: | ||
| + | |||
| + | ===== Code References ===== | ||
| + | * Java: [[https:// | ||
| + | * Java: [[https:// | ||
| + | * Java: [[https:// | ||
| + | |||
| + | {{tag> mr code reference buff artifact}} | ||
