diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/PrismaticGuard.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/PrismaticGuard.java index 4f16f075e..57282308e 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/PrismaticGuard.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/PrismaticGuard.java @@ -51,7 +51,7 @@ public class PrismaticGuard extends Buff { int v = hero.visibleEnemies(); for (int i=0; i < v; i++) { Mob mob = hero.visibleEnemy( i ); - if ( mob.isAlive() && mob.state != mob.PASSIVE && !hero.mindVisionEnemies.contains(mob) + if ( mob.isAlive() && mob.state != mob.PASSIVE && mob.state != mob.WANDERING && mob.state != mob.SLEEPING && !hero.mindVisionEnemies.contains(mob) && (closest == null || Dungeon.level.distance(hero.pos, mob.pos) < Dungeon.level.distance(hero.pos, closest.pos))) { closest = mob; } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Bee.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Bee.java index 9f0b8ee77..101262aa6 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Bee.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Bee.java @@ -46,6 +46,9 @@ public class Bee extends Mob { flying = true; state = WANDERING; + + //only applicable when the bee is charmed with elixir of honeyed healing + intelligentAlly = true; } private int level; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mob.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mob.java index 810af2780..abbae4254 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mob.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mob.java @@ -186,6 +186,9 @@ public abstract class Mob extends Char { return state.act( enemyInFOV, justAlerted ); } + //FIXME this is sort of a band-aid correction for allies needing more intelligent behaviour + protected boolean intelligentAlly = false; + protected Char chooseEnemy() { Terror terror = buff( Terror.class ); @@ -250,12 +253,14 @@ public abstract class Mob extends Char { //if the mob is an ally... } else if ( alignment == Alignment.ALLY ) { - //look for hostile mobs that are not passive to attack + //look for hostile mobs to attack for (Mob mob : Dungeon.level.mobs) - if (mob.alignment == Alignment.ENEMY - && fieldOfView[mob.pos] - && mob.state != mob.PASSIVE) - enemies.add(mob); + if (mob.alignment == Alignment.ENEMY && fieldOfView[mob.pos]) + //intelligent allies do not target mobs which are passive, wandering, or asleep + if (!intelligentAlly || + (mob.state != mob.SLEEPING && mob.state != mob.PASSIVE && mob.state != mob.WANDERING)) { + enemies.add(mob); + } //if the mob is an enemy... } else if (alignment == Alignment.ENEMY) { diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/PrismaticImage.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/PrismaticImage.java index bf3aba82d..424dba985 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/PrismaticImage.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/PrismaticImage.java @@ -51,6 +51,7 @@ public class PrismaticImage extends NPC { defenseSkill = 1; alignment = Alignment.ALLY; + intelligentAlly = true; state = HUNTING; WANDERING = new Wandering(); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/DriedRose.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/DriedRose.java index 7a45f60bb..dad8f6b39 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/DriedRose.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/DriedRose.java @@ -392,7 +392,7 @@ public class DriedRose extends Artifact { flying = true; alignment = Alignment.ALLY; - + intelligentAlly = true; WANDERING = new Wandering(); state = HUNTING;