mr:mob
Differences
This shows you the differences between two versions of the page.
| mr:mob [2026/07/09 13:42] – wiki: Add missing mr: namespace pages for mob system, pet mechanic, rotten food, and sewers level Qwen Assistant | mr:mob [2026/07/09 13:43] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ====== Mob System - Code References ====== | ||
| + | **Mob System** is the base entity system for all monsters, enemies, and NPCs in Remixed Dungeon. All mobs inherit from the base `Mob` class. | ||
| + | |||
| + | ===== Entity Type ===== | ||
| + | Base class for all mobile entities (enemies, NPCs, pets) | ||
| + | |||
| + | ===== Java Classes ===== | ||
| + | **Base Class**: [[https:// | ||
| + | * Package: `com.watabou.pixeldungeon.actors.mobs` | ||
| + | * Extends: `com.watabou.pixeldungeon.actors.Char` | ||
| + | * Implements: `com.nyrds.pixeldungeon.mechanics.NamedEntityKind` | ||
| + | |||
| + | **Key Methods**: | ||
| + | * `getEntityKind()` - Returns entity identifier (class name or JSON config) | ||
| + | * `isPet()` - Checks if mob is player' | ||
| + | * `makePet(Hero hero)` - Tames mob to player | ||
| + | * `canBePet()` - Returns `canBePet` from JSON config | ||
| + | * `hp()`, `ht()` - Current/max health | ||
| + | * `attackSkill`, | ||
| + | * `damageRoll()` - Damage calculation | ||
| + | |||
| + | **Factory**: | ||
| + | * `mobByName(String name)` - Creates mob instance by entityKind | ||
| + | * Registers all mob classes | ||
| + | * Handles custom/JSON mobs | ||
| + | |||
| + | **AI System**: [[https:// | ||
| + | * Abstract base class for mob behavior | ||
| + | * State machine: `Wandering`, | ||
| + | * `think()` - Main AI decision loop | ||
| + | |||
| + | **Common Mob Subclasses** (in `com.watabou.pixeldungeon.actors.mobs`): | ||
| + | * `Rat`, `Snail`, `Crab`, `Gnoll`, `Skeleton`, `Zombie`, `Wraith`, `Ghost` | ||
| + | * `Tengu` (Boss), `DM300` (Boss), `Yog` (Final Boss) | ||
| + | * `Goo`, `Tengu`, `King` (Gnoll King), `Yog` - Boss mobs | ||
| + | |||
| + | **NPC Classes** (in `com.watabou.pixeldungeon.actors.mobs.npcs`): | ||
| + | * `Shopkeeper`, | ||
| + | |||
| + | **Special**: | ||
| + | |||
| + | ===== JSON Configuration ===== | ||
| + | Individual mob configurations in `assets/ | ||
| + | * Each mob has a JSON file (e.g., `Rat.json`, `Snail.json`, | ||
| + | * Properties: | ||
| + | * `ht` - Max health | ||
| + | * `dmgMin`, `dmgMax` - Damage range | ||
| + | * `defenseSkill` - Dodge chance | ||
| + | * `attackSkill` - Hit chance | ||
| + | * `baseSpeed` - Turn speed multiplier | ||
| + | * `viewDistance` - Detection range | ||
| + | * `lootChance` - Drop probability | ||
| + | * `canBePet` - Tameable | ||
| + | * `flying` - Ignores ground hazards | ||
| + | * `friendly` - Non-hostile | ||
| + | * `spriteDesc` - Sprite config reference | ||
| + | |||
| + | **Spawn Configuration**: | ||
| + | * Defines mob spawn weights per depth | ||
| + | * Level-specific mob pools | ||
| + | |||
| + | ===== String Resources ===== | ||
| + | Common mob-related strings (values/ | ||
| + | <code xml> | ||
| + | <string name=" | ||
| + | <string name=" | ||
| + | <string name=" | ||
| + | <string name=" | ||
| + | <string name=" | ||
| + | <string name=" | ||
| + | <string name=" | ||
| + | <string name=" | ||
| + | <string name=" | ||
| + | <string name=" | ||
| + | <string name=" | ||
| + | <string name=" | ||
| + | <string name=" | ||
| + | <string name=" | ||
| + | <string name=" | ||
| + | </ | ||
| + | |||
| + | ===== Lua Scripts ===== | ||
| + | * **Common Classes**: `scripts/ | ||
| + | * **Possess Spell**: `scripts/ | ||
| + | * **Raise Dead**: `scripts/ | ||
| + | * **Exhumation**: | ||
| + | * **Plague Doctor NPC**: `scripts/ | ||
| + | |||
| + | ===== Related mr Entities ===== | ||
| + | * [[mr: | ||
| + | * [[mr: | ||
| + | * [[mr: | ||
| + | * [[mr: | ||
| + | * [[mr: | ||
| + | * [[mr: | ||
| + | * [[mr: | ||
| + | |||
| + | ===== Game Mechanics ===== | ||
| + | * **Entity Identification**: | ||
| + | * **Pet System**: Mobs with `canBePet: true` can be tamed via items/ | ||
| + | * **Level Spawning**: Bestiary.json controls spawn rates per depth | ||
| + | * **AI States**: Dynamic state machine based on distance, health, conditions | ||
| + | * **Loot System**: `lootChance` controls drop probability | ||
| + | * **Buff Interactions**: | ||
| + | * **Experience**: | ||
| + | * **Level Scaling**: Stats scale with dungeon depth | ||
| + | |||
| + | ===== Code Fragments ===== | ||
| + | Mob creation from JSON: | ||
| + | <code java> | ||
| + | // MobFactory.java | ||
| + | public static Mob mobByName(String name) { | ||
| + | if (mobClasses.containsKey(name)) { | ||
| + | return mobClasses.get(name).newInstance(); | ||
| + | } | ||
| + | // Fallback to CustomMob with JSON config | ||
| + | return new CustomMob(name); | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | Pet taming: | ||
| + | <code java> | ||
| + | // Mob.java | ||
| + | public void makePet(Hero hero) { | ||
| + | this.petMaster = hero.id(); | ||
| + | hero.pets.add(this); | ||
| + | } | ||
| + | |||
| + | // Possess spell (Lua) | ||
| + | RPD.Mob: | ||
| + | </ | ||
| + | |||
| + | AI state transition: | ||
| + | <code java> | ||
| + | // MobAi.java | ||
| + | public AiState getState() { return state; } | ||
| + | public void setState(AiState state) { this.state = state; } | ||
| + | |||
| + | // States: Wandering → Hunting → Fleeing/ | ||
| + | </ | ||
| + | |||
| + | {{tag> rpd mechanics mobs ai pets entities}} | ||
mr/mob.txt · Last modified: by 127.0.0.1
