v3.3.5: added a 'vault rat' enemy for testing vault AI

This commit is contained in:
Evan Debenham
2026-02-03 16:51:26 -05:00
parent a6a26d7469
commit a19104fae7
5 changed files with 76 additions and 3 deletions

View File

@@ -1790,6 +1790,8 @@ actors.mobs.tormentedspirit.name=tormented spirit
actors.mobs.tormentedspirit.desc=Tormented spirits are otherwise good-natured spirits that have been afflicted by a curse. So long as they are cursed they will attack just like a wraith, and are more powerful as well!\n\nIt may be possible to cleanse the curse by using the right item while next to the spirit. If the curse is lifted the spirit will surely be grateful...
actors.mobs.tormentedspirit.thank_you=Thank you...
actors.mobs.vaultrat.desc=This rat has some behaviour changes to test out new vault enemy AI:\n_-_ Its movement can be 'heard' through walls\n_-_ It will wander along a pre-set patrol\n_-_ While wandering it has sharply reduced detection chance behind the direction it moves in.\n_-_ When it detects you it will 'investigate' before swapping to hunting. Investigating enemies move toward you but don't attack and are easier to lose behind doors and corners.
actors.mobs.warlock.name=dwarf warlock
actors.mobs.warlock.bolt_kill=The shadow bolt killed you...
actors.mobs.warlock.desc=As the dwarves' interests shifted from engineering to arcane arts, warlocks came to power in the city. They started with elemental magic, but soon switched to demonology and necromancy. The strongest of these warlocks seized the throne of the dwarven city, and his cohorts were allowed to continue practising their dark magic, so long as they surrendered their free will to him.\n\nThese warlocks possess powerful disruptive magic, and are able to temporarily hinder the upgrade magic applied to your equipment. The more upgraded an item is, the more strongly it will be affected.

View File

@@ -27,11 +27,11 @@ public class VaultMob extends Mob {
super.move(step, travelling);
if (travelling && !sprite.visible && Dungeon.level.distance(pos, Dungeon.hero.pos) <= 6){
if (state == HUNTING){
WandOfBlastWave.BlastWave.blast(pos, 1.5f, 0xFF0000);
WandOfBlastWave.BlastWave.blast(pos, 1f, 0xFF0000);
} else if (state == INVESTIGATING){
WandOfBlastWave.BlastWave.blast(pos, 1.5f, 0xFF8800);
WandOfBlastWave.BlastWave.blast(pos, 1f, 0xFF8800);
} else {
WandOfBlastWave.BlastWave.blast(pos, 1.5f);
WandOfBlastWave.BlastWave.blast(pos, 1f);
}
}
}

View File

@@ -0,0 +1,43 @@
package com.shatteredpixel.shatteredpixeldungeon.actors.mobs;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.RatSprite;
import com.watabou.utils.Random;
public class VaultRat extends VaultMob {
{
spriteClass = RatSprite.class;
HP = HT = 8;
defenseSkill = 2;
maxLvl = -2;
}
@Override
public int damageRoll() {
return 0;
}
@Override
public int attackSkill(Char target) {
return 8;
}
@Override
public int drRoll() {
return super.drRoll() + Random.NormalIntRange(0, 1);
}
@Override
public String name() {
return Messages.get(Rat.class, "name");
}
@Override
public String description() {
return Messages.get(Rat.class, "desc") + "\n\n" + super.description();
}
}

View File

@@ -283,6 +283,8 @@ public class WandOfBlastWave extends DamageWand {
b.reset(pos, radius);
if (hardLight != -1){
b.hardlight(hardLight);
} else {
b.resetColor();
}
}

View File

@@ -1,11 +1,13 @@
package com.shatteredpixel.shatteredpixeldungeon.levels.rooms.quest.vault;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.VaultRat;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
import com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter;
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.Room;
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.StandardRoom;
import com.watabou.utils.Point;
import com.watabou.utils.Random;
public class VaultRingRoom extends StandardRoom {
@@ -24,6 +26,30 @@ public class VaultRingRoom extends StandardRoom {
for (Door door : connected.values()) {
door.set( Door.Type.REGULAR );
}
VaultRat rat = new VaultRat();
do {
rat.pos = level.pointToCell(random(1));
} while (level.solid[rat.pos]);
if (Random.Int(2) == 0) {
rat.wanderPositions = new int[]{
level.pointToCell(new Point(left+2, top+2)),
level.pointToCell(new Point(right-2, top+2)),
level.pointToCell(new Point(right-2, bottom-2)),
level.pointToCell(new Point(left+2, bottom-2))
};
} else {
rat.wanderPositions = new int[]{
level.pointToCell(new Point(left+2, bottom-2)),
level.pointToCell(new Point(right-2, bottom-2)),
level.pointToCell(new Point(right-2, top+2)),
level.pointToCell(new Point(left+2, top+2))
};
}
rat.wanderPosIdx = Random.Int(4);
rat.state = rat.WANDERING;
level.mobs.add(rat);
}
@Override