From a19104fae733a81a3e2743802fa1e96ac21b7a33 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Tue, 3 Feb 2026 16:51:26 -0500 Subject: [PATCH] v3.3.5: added a 'vault rat' enemy for testing vault AI --- .../assets/messages/actors/actors.properties | 2 + .../actors/mobs/VaultMob.java | 6 +-- .../actors/mobs/VaultRat.java | 43 +++++++++++++++++++ .../items/wands/WandOfBlastWave.java | 2 + .../rooms/quest/vault/VaultRingRoom.java | 26 +++++++++++ 5 files changed, 76 insertions(+), 3 deletions(-) create mode 100644 core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/VaultRat.java diff --git a/core/src/main/assets/messages/actors/actors.properties b/core/src/main/assets/messages/actors/actors.properties index ba1f5f97b..7d299e669 100644 --- a/core/src/main/assets/messages/actors/actors.properties +++ b/core/src/main/assets/messages/actors/actors.properties @@ -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. diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/VaultMob.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/VaultMob.java index 782753404..f2e87c781 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/VaultMob.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/VaultMob.java @@ -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); } } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/VaultRat.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/VaultRat.java new file mode 100644 index 000000000..f75375fb3 --- /dev/null +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/VaultRat.java @@ -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(); + } +} diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfBlastWave.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfBlastWave.java index 655038582..a8edffd60 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfBlastWave.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfBlastWave.java @@ -283,6 +283,8 @@ public class WandOfBlastWave extends DamageWand { b.reset(pos, radius); if (hardLight != -1){ b.hardlight(hardLight); + } else { + b.resetColor(); } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/quest/vault/VaultRingRoom.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/quest/vault/VaultRingRoom.java index 8b22d4fa5..adbba3e3a 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/quest/vault/VaultRingRoom.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/quest/vault/VaultRingRoom.java @@ -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