User Tools

Site Tools


mr:doom_interface

Doom Interface - Code References

The Doom interface marks buffs that trigger special effects when the hero dies. It is used for curse-type effects and doom-related mechanics that activate upon character death.

Java Classes

Interface Definition:

  • `com/watabou/pixeldungeon/actors/hero/Doom.java` - Interface for doom-type buffs
  • Extends: `com.nyrds.pixeldungeon.mechanics.NamedEntityKind`
  • Package: `com.watabou.pixeldungeon.actors.hero`

Key Method:

// In Doom.java
public interface Doom extends NamedEntityKind {
    void onHeroDeath();
}

Implementation Requirements:

  • Any class implementing `Doom` must implement the `onHeroDeath()` method
  • The `onHeroDeath()` method is called when the hero dies while affected by the buff
  • This allows for special death conditions, badges, and game-over scenarios

Example Implementation (StoneWalking):

// In RingOfStoneWalking.java
public static class StoneWalking extends ArtifactBuff implements Doom {
    @Override
    public int icon() {
        return BuffIndicator.STONEBLOOD;
    }
 
    @Override
    public String name() {
        return StringsManager.getVar(R.string.StoneBloodBuff_Name);
    }
 
    @Override
    public String desc() {
        return StringsManager.getVar(R.string.StoneBloodBuff_Info);
    }
 
    @Override
    public void onHeroDeath() {
        Badges.validateDeathInStone();
        Dungeon.fail(Utils.format(ResultDescriptions.getDescription(ResultDescriptions.Reason.IMMURED), Dungeon.depth));
        GLog.n(StringsManager.getVar(R.string.RingOfStoneWalking_ImmuredInStone));
    }
}

JSON Configuration

The Doom interface does not have JSON configuration. It is:

  • A Java interface implemented by specific buff classes
  • Registered through the buff factory system
  • Associated with artifacts or other buff sources

String Resources

Doom-type buffs use standard string resources for their display names and descriptions. The death messages may be customized per implementation.

Example String Resources (English):

<string name="StoneBloodBuff_Name">Stone Blood</string>
<string name="StoneBloodBuff_Info">Description of the buff effect</string>
<string name="RingOfStoneWalking_ImmuredInStone">You are immured in stone. Forever.</string>

Example String Resources (Russian):

<string name="StoneBloodBuff_Name">Каменная Кровь</string>
<string name="RingOfStoneWalking_ImmuredInStone">Замурован в камне. Навсегда.</string>

Lua Scripts

The Doom interface is implemented entirely in Java. No Lua scripts are used.

Base Interfaces:

Related Classes:

Example Doom Buffs:

Related Systems:

  • `Badges` - Unlocks badges on special deaths
  • `Dungeon.fail()` - Triggers game over with custom reason
  • `ResultDescriptions` - Provides death reason descriptions

Code References

mr/doom_interface.txt · Last modified: by 127.0.0.1