mr:black_skull_item
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revision | |||
| mr:black_skull_item [2026/07/30 01:25] – Wiki maintenance: Fix broken links and update mr page with entity usage Bot | mr:black_skull_item [2026/07/30 01:27] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ====== Black Skull Item - Code References ====== | ||
| + | ===== Java Classes ===== | ||
| + | * [[https:// | ||
| + | * [[https:// | ||
| + | * [[https:// | ||
| + | * [[https:// | ||
| + | * [[https:// | ||
| + | * [[https:// | ||
| + | |||
| + | ===== Java Class: BlackSkull.java ===== | ||
| + | <code java> | ||
| + | package com.nyrds.pixeldungeon.items.necropolis; | ||
| + | |||
| + | import com.nyrds.Packable; | ||
| + | import com.nyrds.pixeldungeon.mechanics.NamedEntityKind; | ||
| + | import com.nyrds.pixeldungeon.ml.R; | ||
| + | import com.nyrds.platform.util.StringsManager; | ||
| + | import com.watabou.pixeldungeon.actors.Char; | ||
| + | import com.watabou.pixeldungeon.items.rings.Artifact; | ||
| + | import com.watabou.pixeldungeon.utils.GLog; | ||
| + | |||
| + | import java.util.Collection; | ||
| + | |||
| + | public class BlackSkull extends Artifact { | ||
| + | |||
| + | private static final int ACTIVATED_IMAGE = 20; | ||
| + | private static final int BASIC_IMAGE = 19; | ||
| + | |||
| + | private static final int RESURRECTION_COST = 10; | ||
| + | private static final int MAXIMUM_CHARGE = 10; | ||
| + | |||
| + | @Packable | ||
| + | public boolean activated = false; | ||
| + | |||
| + | @Packable | ||
| + | public int charge = 0; | ||
| + | |||
| + | public BlackSkull() { | ||
| + | imageFile = " | ||
| + | identify(); | ||
| + | image = BASIC_IMAGE; | ||
| + | } | ||
| + | |||
| + | @Override | ||
| + | public void charDied(Char mob, NamedEntityKind cause) { | ||
| + | Char hero = getOwner(); | ||
| + | |||
| + | Collection< | ||
| + | |||
| + | if (pets.contains(mob.getId())) { | ||
| + | return; | ||
| + | } | ||
| + | |||
| + | if (mob.canBePet()) { | ||
| + | if (activated) { | ||
| + | mob.resurrect(hero); | ||
| + | GLog.w(StringsManager.getVar(R.string.BlackSkull_Ressurrect)); | ||
| + | charge = charge - RESURRECTION_COST; | ||
| + | if (charge <= 0) { | ||
| + | GLog.w(StringsManager.getVar(R.string.BlackSkull_Deactivated)); | ||
| + | activated = false; | ||
| + | } | ||
| + | } else { | ||
| + | charge++; | ||
| + | if (charge >= MAXIMUM_CHARGE) { | ||
| + | GLog.w(StringsManager.getVar(R.string.BlackSkull_Activated)); | ||
| + | activated = true; | ||
| + | } | ||
| + | } | ||
| + | } | ||
| + | } | ||
| + | |||
| + | @Override | ||
| + | public int image() { | ||
| + | if (activated) { | ||
| + | return ACTIVATED_IMAGE; | ||
| + | } else { | ||
| + | return BASIC_IMAGE; | ||
| + | } | ||
| + | } | ||
| + | |||
| + | @Override | ||
| + | public String info() { | ||
| + | if (activated) { | ||
| + | return StringsManager.getVar(R.string.BlackSkull_Info_Awakened); | ||
| + | } else { | ||
| + | return StringsManager.getVar(R.string.BlackSkull_Info); | ||
| + | } | ||
| + | } | ||
| + | |||
| + | @Override | ||
| + | public String name() { | ||
| + | if (activated) { | ||
| + | return StringsManager.getVar(R.string.BlackSkull_Name_Awakened); | ||
| + | } else { | ||
| + | return StringsManager.getVar(R.string.BlackSkull_Name); | ||
| + | } | ||
| + | } | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ===== Java Usage Context ===== | ||
| + | ==== WndResurrect.java ==== | ||
| + | * Line 22: new BlackSkull() - Creates BlackSkull when hero dies and chooses to resurrect | ||
| + | * Line 22: new BlackSkull() - Creates BlackSkull instance for resurrection | ||
| + | |||
| + | ==== WndChooseWay.java ==== | ||
| + | * Line 114: new BlackSkull() - Creates BlackSkull when player chooses to keep humanity | ||
| + | * Line 114: new BlackSkull() - Instantiates BlackSkull item | ||
| + | |||
| + | ==== ItemFactory.java ==== | ||
| + | * Line 39: import com.nyrds.pixeldungeon.items.necropolis.BlackSkull; | ||
| + | * Line 394: registerItemClass(BlackSkull.class); | ||
| + | |||
| + | ==== Lich.java ==== | ||
| + | * Line 7: import com.nyrds.pixeldungeon.items.necropolis.BlackSkull; | ||
| + | * Line 91: collect(new BlackSkull()); | ||
| + | * Line 91: collect(new BlackSkull()); | ||
| + | |||
| + | ==== WndSadGhostNecro.java ==== | ||
| + | * Line 3: import com.nyrds.pixeldungeon.items.necropolis.BlackSkull; | ||
| + | * Line 28: new ItemSprite( new BlackSkull()) - Uses BlackSkull sprite in UI | ||
| + | * Line 28: new BlackSkull() - Creates BlackSkull for sprite display | ||
| + | |||
| + | ===== JSON Configuration ===== | ||
| + | This entity is implemented in Java, no JSON configuration exists | ||
| + | |||
| + | ===== String Resources ===== | ||
| + | <code xml> | ||
| + | <string name=" | ||
| + | <string name=" | ||
| + | <string name=" | ||
| + | <string name=" | ||
| + | <string name=" | ||
| + | <string name=" | ||
| + | <string name=" | ||
| + | </ | ||
| + | |||
| + | Additional string resources referenced: | ||
| + | * BlackSkullOfMastery_Name | ||
| + | * BlackSkullOfMastery_Info | ||
| + | * BlackSkullOfMastery_Lich | ||
| + | * BlackSkullOfMastery_Necromancer | ||
| + | * BlackSkullOfMastery_Title | ||
| + | * BlackSkullOfMastery_RemainHumanDesc | ||
| + | * BlackSkullOfMastery_BecomeLichDesc | ||
| + | |||
| + | ===== Lua Scripts ===== | ||
| + | This entity is implemented in Java, no Lua script exists | ||
| + | |||
| + | ===== Related mr Entities ===== | ||
| + | * [[mr: | ||
| + | * [[mr: | ||
| + | * [[mr: | ||
mr/black_skull_item.txt · Last modified: by 127.0.0.1
