mr:heart_of_darkness_buff
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revision | |||
| mr:heart_of_darkness_buff [2026/03/27 21:47] – Wiki maintenance: Fix broken links and improve mr: namespace page Qwen Assistant | mr:heart_of_darkness_buff [2026/03/27 21:47] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ====== Heart Of Darkness Buff - Code References ====== | ||
| + | |||
| + | ===== Java Classes ===== | ||
| + | Actual implementation found in: | ||
| + | * [[https:// | ||
| + | |||
| + | ===== Implementation Details ===== | ||
| + | Full class implementation: | ||
| + | |||
| + | <code java> | ||
| + | package com.nyrds.pixeldungeon.items.guts; | ||
| + | |||
| + | import com.nyrds.pixeldungeon.ml.R; | ||
| + | import com.nyrds.pixeldungeon.mobs.guts.SpiritOfPain; | ||
| + | import com.nyrds.platform.util.StringsManager; | ||
| + | import com.watabou.pixeldungeon.actors.Char; | ||
| + | import com.watabou.pixeldungeon.actors.mobs.Mob; | ||
| + | import com.watabou.pixeldungeon.items.rings.Artifact; | ||
| + | import com.watabou.pixeldungeon.items.rings.ArtifactBuff; | ||
| + | import com.watabou.pixeldungeon.ui.BuffIndicator; | ||
| + | |||
| + | public class HeartOfDarkness extends Artifact { | ||
| + | |||
| + | public HeartOfDarkness() { | ||
| + | imageFile = " | ||
| + | image = 18; | ||
| + | } | ||
| + | |||
| + | @Override | ||
| + | public boolean isIdentified() { | ||
| + | return true; | ||
| + | } | ||
| + | |||
| + | @Override | ||
| + | public ArtifactBuff buff() { | ||
| + | return new HeartOfDarknessBuff(); | ||
| + | } | ||
| + | |||
| + | public static class HeartOfDarknessBuff extends ArtifactBuff { | ||
| + | @Override | ||
| + | public int icon() { | ||
| + | return BuffIndicator.DARKVEIL; | ||
| + | } | ||
| + | |||
| + | @Override | ||
| + | public String name() { | ||
| + | return StringsManager.getVar(R.string.DarkVeilBuff_Name); | ||
| + | } | ||
| + | |||
| + | @Override | ||
| + | public String desc() { | ||
| + | return StringsManager.getVar(R.string.DarkVeilBuff_Info); | ||
| + | } | ||
| + | |||
| + | @Override | ||
| + | public int defenceProc(Char defender, Char enemy, int damage) { | ||
| + | int defenderPos = defender.getPos(); | ||
| + | int spiritPos = defender.level().getEmptyCellNextTo(defenderPos); | ||
| + | |||
| + | if (defender.level().cellValid(spiritPos)) { | ||
| + | SpiritOfPain spirit = new SpiritOfPain(); | ||
| + | spirit.setPos(spiritPos); | ||
| + | Mob.makePet(spirit, | ||
| + | defender.level().spawnMob(spirit, | ||
| + | } | ||
| + | return damage; | ||
| + | } | ||
| + | } | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ===== Key Methods ===== | ||
| + | * **icon()** - Returns BuffIndicator.DARKVEIL for the buff icon | ||
| + | * **name()** - Returns localized buff name from DarkVeilBuff_Name string resource | ||
| + | * **desc()** - Returns localized buff description from DarkVeilBuff_Info string resource | ||
| + | * **defenceProc()** - Called when the wearer takes damage; spawns a SpiritOfPain pet nearby | ||
| + | |||
| + | ===== Behavior ===== | ||
| + | The HeartOfDarknessBuff is automatically applied when the hero equips the Heart of Darkness artifact. Its primary function is: | ||
| + | |||
| + | * Triggers on damage taken (via defenceProc method) | ||
| + | * Spawns a SpiritOfPain mob as a pet adjacent to the defender | ||
| + | * The SpiritOfPain is allied with the hero (created via Mob.makePet()) | ||
| + | * Requires a valid empty cell next to the hero for spawning | ||
| + | |||
| + | ===== String Resources ===== | ||
| + | <code xml> | ||
| + | <!-- English (values/ | ||
| + | <string name=" | ||
| + | <string name=" | ||
| + | |||
| + | <!-- Russian (values-ru/ | ||
| + | <string name=" | ||
| + | <string name=" | ||
| + | </ | ||
| + | |||
| + | ===== Related Entities ===== | ||
| + | * [[https:// | ||
| + | * [[https:// | ||
| + | * [[https:// | ||
| + | * [[https:// | ||
| + | |||
| + | ===== JSON Configuration ===== | ||
| + | None - This buff is implemented purely in Java without JSON configuration. | ||
| + | |||
| + | ===== Lua Scripts ===== | ||
| + | None - This buff is implemented purely in Java without Lua scripting. | ||
mr/heart_of_darkness_buff.txt · Last modified: by 127.0.0.1
