====== Earth Elemental Mob - Code References ======
This page contains raw code references and configuration excerpts for the Earth Elemental mob entity.
==== Entity Kind ====
* **getEntityKind() value:** EarthElemental
==== Java Implementation ====
* **Class location:** [[code:RemixedDungeon/src/main/java/com/nyrds/pixeldungeon/mobs/elementals/EarthElemental.java|EarthElemental.java]]
* **Parent Class:** [[code:RemixedDungeon/src/main/java/com/nyrds/pixeldungeon/mobs/elementals/Elemental.java|Elemental]]
* **Interfaces:** IDepthAdjustable
==== Code Fragments ====
**Constructor:**
public EarthElemental() {
adjustStats(Dungeon.depth);
}
**Stats adjustment:**
@Override
public void adjustStats(int depth) {
super.adjustStats(depth);
hp(ht(depth * 10 + 1));
baseDefenseSkill = depth / 2 + 1;
baseAttackSkill = (baseDefenseSkill) / 2 + 1;
dmgMin = ht() / 5;
dmgMax = ht() / 5;
dr = depth + 1;
expForKill = depth + 1;
maxLvl = depth + 2;
// Add immunities
addImmunity(Burning.class);
addImmunity(ToxicGas.class);
addImmunity(Stun.class);
addImmunity(Paralysis.class);
addImmunity(Roots.class);
addImmunity(Bleeding.class);
}
**Speed modification:**
@Override
public float speed() {
return level().getWater(pos) ? super.speed() * 0.5f : super.speed();
}
**Attack processing with regrowth:**
@Override
public int attackProc(Char enemy, int damage) {
if (Random.Float() < 0.5f) {
int cell = pos;
var terrain = level().getTerrain(cell);
if (terrain == Terrain.EMPTY ||
terrain == Terrain.EMBERS ||
terrain == Terrain.EMPTY_DECO ||
terrain == Terrain.GRASS ||
terrain == Terrain.HIGH_GRASS) {
GameScene.add(Blob.seed(cell, 15, Regrowth.class).setStrength(Math.max(depth + 1, 10)));
}
}
return super.attackProc(enemy, damage);
}
**Kind calculation:**
@Override
public int getKind() {
return Math.min(depth / 5, 4);
}
==== Drop Information ====
@Override
protected Loot droppedLoot() {
return Random.Float() < 0.1f ? new Earthroot.Seed() : null;
}
==== Configuration ====
* **Spawn location:** GRASS areas, defined in [[code:RemixedDungeon/src/main/assets/levelsDesc/Bestiary.json|Bestiary.json]] as "GRASS":{"EarthElemental":1}
* **Entity Kind:** EarthElemental
==== String Resources ====
* **EarthElemental_Name:** earth elemental
* **EarthElemental_Desc:** A humanoid mass of living earth and stone, animated by primitive forces.