v0.3.2a: fixed some bugs with corrupted prison guards
This commit is contained in:
parent
ff10fe618f
commit
f8ebf6e8ee
|
@ -65,9 +65,11 @@ public class Guard extends Mob {
|
||||||
Dungeon.level.updateFieldOfView( this );
|
Dungeon.level.updateFieldOfView( this );
|
||||||
|
|
||||||
if (state == HUNTING &&
|
if (state == HUNTING &&
|
||||||
|
enemy != null &&
|
||||||
Level.fieldOfView[enemy.pos] &&
|
Level.fieldOfView[enemy.pos] &&
|
||||||
Level.distance( pos, enemy.pos ) < 5 && !Level.adjacent( pos, enemy.pos ) &&
|
Level.distance( pos, enemy.pos ) < 5 && !Level.adjacent( pos, enemy.pos ) &&
|
||||||
Random.Int(3) == 0 &&
|
Random.Int(3) == 0 &&
|
||||||
|
|
||||||
chain(enemy.pos)) {
|
chain(enemy.pos)) {
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -83,7 +85,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 || Level.pit[chain.path.get(1)])
|
if (chain.collisionPos != enemy.pos || Level.pit[chain.path.get(1)])
|
||||||
return false;
|
return false;
|
||||||
else {
|
else {
|
||||||
int newPos = -1;
|
int newPos = -1;
|
||||||
|
@ -97,16 +99,18 @@ public class Guard extends Mob {
|
||||||
if (newPos == -1){
|
if (newPos == -1){
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
final int newHeroPos = newPos;
|
final int newPosFinal = newPos;
|
||||||
yell("get over here!");
|
yell("get over here!");
|
||||||
sprite.parent.add(new Chains(pos, Dungeon.hero.pos, new Callback() {
|
sprite.parent.add(new Chains(pos, enemy.pos, new Callback() {
|
||||||
public void call() {
|
public void call() {
|
||||||
Actor.addDelayed(new Pushing(Dungeon.hero, Dungeon.hero.pos, newHeroPos), -1);
|
Actor.addDelayed(new Pushing(enemy, enemy.pos, newPosFinal), -1);
|
||||||
Dungeon.hero.pos = newHeroPos;
|
enemy.pos = newPosFinal;
|
||||||
Dungeon.observe();
|
Dungeon.level.press(newPosFinal, enemy);
|
||||||
Dungeon.level.press(newHeroPos, Dungeon.hero);
|
Cripple.prolong(enemy, Cripple.class, 4f);
|
||||||
Cripple.prolong(Dungeon.hero, Cripple.class, 4f);
|
if (enemy == Dungeon.hero) {
|
||||||
Dungeon.hero.interrupt();
|
Dungeon.hero.interrupt();
|
||||||
|
Dungeon.observe();
|
||||||
|
}
|
||||||
next();
|
next();
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
Loading…
Reference in New Issue
Block a user