mr:hedgehog_npc
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| mr:hedgehog_npc [2026/02/21 10:28] – Wiki standards compliance: Fix hedgehog entity classification and improve pages Qwen Assistant | mr:hedgehog_npc [2026/02/21 10:32] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ====== Hedgehog NPC - Code References ====== | ||
| + | |||
| + | ===== Java Classes ===== | ||
| + | * [[https:// | ||
| + | |||
| + | ===== Java Class Content ===== | ||
| + | <code java> | ||
| + | package com.watabou.pixeldungeon.actors.mobs.npcs; | ||
| + | |||
| + | import com.nyrds.Packable; | ||
| + | import com.nyrds.pixeldungeon.ai.MobAi; | ||
| + | import com.nyrds.pixeldungeon.ai.Wandering; | ||
| + | import com.nyrds.pixeldungeon.mechanics.NamedEntityKind; | ||
| + | import com.nyrds.pixeldungeon.ml.R; | ||
| + | import com.nyrds.platform.util.StringsManager; | ||
| + | import com.watabou.pixeldungeon.Dungeon; | ||
| + | import com.watabou.pixeldungeon.actors.Actor; | ||
| + | import com.watabou.pixeldungeon.actors.Char; | ||
| + | import com.watabou.pixeldungeon.actors.buffs.Buff; | ||
| + | import com.watabou.pixeldungeon.items.food.Pasty; | ||
| + | import com.watabou.pixeldungeon.levels.RegularLevel; | ||
| + | |||
| + | import org.jetbrains.annotations.NotNull; | ||
| + | |||
| + | public class Hedgehog extends NPC { | ||
| + | |||
| + | { | ||
| + | setState(MobAi.getStateByClass(Wandering.class)); | ||
| + | } | ||
| + | |||
| + | @Override | ||
| + | public float speed() { | ||
| + | return speed; | ||
| + | } | ||
| + | |||
| + | @Override | ||
| + | public void damage(int dmg, @NotNull NamedEntityKind src ) { | ||
| + | } | ||
| + | |||
| + | @Override | ||
| + | public boolean add(Buff buff ) { | ||
| + | return false; | ||
| + | } | ||
| + | |||
| + | private static boolean spawned; | ||
| + | |||
| + | @Packable | ||
| + | public int action = 0; | ||
| + | @Packable | ||
| + | public float speed = 0.5f; | ||
| + | |||
| + | public static void spawn( RegularLevel level ) { | ||
| + | if (!spawned && Dungeon.depth == 23) { | ||
| + | int mobPos = level.randomRespawnCell(); | ||
| + | |||
| + | if(level.cellValid(mobPos)) { | ||
| + | Hedgehog hedgehog = new Hedgehog(); | ||
| + | hedgehog.setPos(mobPos); | ||
| + | level.mobs.add(hedgehog); | ||
| + | Actor.occupyCell(hedgehog); | ||
| + | |||
| + | spawned = true; | ||
| + | } | ||
| + | } | ||
| + | } | ||
| + | |||
| + | @Override | ||
| + | public boolean interact(final Char hero) { | ||
| + | getSprite().turnTo( getPos(), hero.getPos() ); | ||
| + | |||
| + | switch (action) | ||
| + | { | ||
| + | case 0: | ||
| + | say(StringsManager.getVar(R.string.Hedgehog_Info1)); | ||
| + | break; | ||
| + | |||
| + | case 1: | ||
| + | say(StringsManager.getVar(R.string.Hedgehog_Info2)); | ||
| + | break; | ||
| + | |||
| + | case 2: | ||
| + | say(StringsManager.getVar(R.string.Hedgehog_Info3)); | ||
| + | break; | ||
| + | |||
| + | case 3: | ||
| + | say(StringsManager.getVar(R.string.Hedgehog_Info4)); | ||
| + | new Pasty().doDrop(this); | ||
| + | break; | ||
| + | |||
| + | default: | ||
| + | say(StringsManager.getVar(R.string.Hedgehog_ImLate)); | ||
| + | action = 4; | ||
| + | speed | ||
| + | } | ||
| + | speed += 0.5f; | ||
| + | action++; | ||
| + | |||
| + | return true; | ||
| + | } | ||
| + | |||
| + | } | ||
| + | </ | ||
| + | |||
| + | ===== JSON Configuration ===== | ||
| + | * [[https:// | ||
| + | |||
| + | ===== String Resources ===== | ||
| + | <code xml> | ||
| + | <string name=" | ||
| + | <string name=" | ||
| + | <string name=" | ||
| + | <string name=" | ||
| + | <string name=" | ||
| + | <string name=" | ||
| + | <string name=" | ||
| + | </ | ||
| + | |||
| + | ===== Translated String Resources ===== | ||
| + | <code xml> | ||
| + | <!-- Russian --> | ||
| + | <string name=" | ||
| + | <string name=" | ||
| + | <string name=" | ||
| + | <string name=" | ||
| + | <string name=" | ||
| + | <string name=" | ||
| + | <string name=" | ||
| + | |||
| + | <!-- Chinese Simplified --> | ||
| + | <string name=" | ||
| + | <string name=" | ||
| + | |||
| + | <!-- French --> | ||
| + | <string name=" | ||
| + | <string name=" | ||
| + | |||
| + | <!-- German --> | ||
| + | <string name=" | ||
| + | <string name=" | ||
| + | |||
| + | <!-- Spanish --> | ||
| + | <string name=" | ||
| + | <string name=" | ||
| + | |||
| + | <!-- Portuguese --> | ||
| + | <string name=" | ||
| + | <string name=" | ||
| + | |||
| + | <!-- Italian --> | ||
| + | <string name=" | ||
| + | <string name=" | ||
| + | |||
| + | <!-- Japanese --> | ||
| + | <string name=" | ||
| + | <string name=" | ||
| + | |||
| + | <!-- Korean --> | ||
| + | <string name=" | ||
| + | <string name=" | ||
| + | |||
| + | <!-- Polish --> | ||
| + | <string name=" | ||
| + | <string name=" | ||
| + | |||
| + | <!-- Ukrainian --> | ||
| + | <string name=" | ||
| + | <string name=" | ||
| + | |||
| + | <!-- Turkish --> | ||
| + | <string name=" | ||
| + | <string name=" | ||
| + | |||
| + | <!-- Indonesian --> | ||
| + | <string name=" | ||
| + | <string name=" | ||
| + | |||
| + | <!-- Greek --> | ||
| + | <string name=" | ||
| + | <string name=" | ||
| + | </ | ||
| + | |||
| + | ===== Lua Scripts ===== | ||
| + | This entity is implemented in Java, no Lua script exists | ||
| + | |||
| + | ===== Behavior ===== | ||
| + | * Spawns on depth 23 (Halls level) | ||
| + | * Only one hedgehog spawns per game session (static spawned flag) | ||
| + | * Uses Wandering AI behavior | ||
| + | * Immune to damage (damage method does nothing) | ||
| + | * Immune to buffs (add method returns false) | ||
| + | * Has 4 interaction states before leaving | ||
| + | * Drops a [[mr: | ||
| + | * Speed increases with each interaction (starts at 0.5f, increases by 0.5f each time) | ||
| + | * On 5th+ interaction, | ||
| + | |||
| + | ===== Related mr Entities ===== | ||
| + | * [[mr: | ||
| + | * [[mr: | ||
| + | * [[mr: | ||
