v0.7.4: some allies are now 'intelligent', and will not attack wandering, sleeping, or passive enemies
This commit is contained in:
parent
bd3b0a487f
commit
6ca288c91c
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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)
|
||||
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) {
|
||||
|
|
|
@ -51,6 +51,7 @@ public class PrismaticImage extends NPC {
|
|||
defenseSkill = 1;
|
||||
|
||||
alignment = Alignment.ALLY;
|
||||
intelligentAlly = true;
|
||||
state = HUNTING;
|
||||
|
||||
WANDERING = new Wandering();
|
||||
|
|
|
@ -392,7 +392,7 @@ public class DriedRose extends Artifact {
|
|||
flying = true;
|
||||
|
||||
alignment = Alignment.ALLY;
|
||||
|
||||
intelligentAlly = true;
|
||||
WANDERING = new Wandering();
|
||||
|
||||
state = HUNTING;
|
||||
|
|
Loading…
Reference in New Issue
Block a user