v0.3.2: tweaked prison guard behaviour, eliminated bugs, made chains a bit more random, disallowed guards pulling you into a chasm

This commit is contained in:
Evan Debenham 2015-11-03 19:59:17 -05:00
parent 6ec890da5a
commit 820ac85626

View File

@ -62,10 +62,13 @@ public class Guard extends Mob {
@Override @Override
protected boolean act() { protected boolean act() {
Dungeon.level.updateFieldOfView( this );
if (state == HUNTING && if (state == HUNTING &&
Level.fieldOfView[target] && Level.fieldOfView[enemy.pos] &&
Level.distance( pos, target ) < 4 && !Level.adjacent( pos, target ) && Level.distance( pos, enemy.pos ) < 5 && !Level.adjacent( pos, enemy.pos ) &&
chain(target)) { Random.Int(3) == 0 &&
chain(enemy.pos)) {
return false; return false;
@ -80,7 +83,7 @@ public class Guard extends Mob {
Ballistica chain = new Ballistica(pos, target, Ballistica.PROJECTILE); Ballistica chain = new Ballistica(pos, target, Ballistica.PROJECTILE);
if (chain.collisionPos != Dungeon.hero.pos) if (chain.collisionPos != Dungeon.hero.pos || Level.pit[chain.path.get(1)])
return false; return false;
else { else {
int newPos = -1; int newPos = -1;
@ -103,6 +106,7 @@ public class Guard extends Mob {
Dungeon.observe(); Dungeon.observe();
Dungeon.level.press(newHeroPos, Dungeon.hero); Dungeon.level.press(newHeroPos, Dungeon.hero);
Cripple.prolong(Dungeon.hero, Cripple.class, 4f); Cripple.prolong(Dungeon.hero, Cripple.class, 4f);
Dungeon.hero.interrupt();
next(); next();
} }
})); }));