v1.1.0: fixed various rare errors with teleportation and vertigo

This commit is contained in:
Evan Debenham 2021-12-02 17:09:10 -05:00
parent d467032baa
commit b1b887f264
7 changed files with 21 additions and 16 deletions

View File

@ -791,8 +791,13 @@ public abstract class Char extends Actor {
} }
public void move( int step ) { public void move( int step ) {
move( step, true );
}
if (Dungeon.level.adjacent( step, pos ) && buff( Vertigo.class ) != null) { //travelling may be false when a character is moving instantaneously, such as via teleportation
public void move( int step, boolean travelling ) {
if (travelling && Dungeon.level.adjacent( step, pos ) && buff( Vertigo.class ) != null) {
sprite.interruptMotion(); sprite.interruptMotion();
int newPos = pos + PathFinder.NEIGHBOURS8[Random.Int( 8 )]; int newPos = pos + PathFinder.NEIGHBOURS8[Random.Int( 8 )];
if (!(Dungeon.level.passable[newPos] || Dungeon.level.avoid[newPos]) if (!(Dungeon.level.passable[newPos] || Dungeon.level.avoid[newPos])

View File

@ -1773,12 +1773,12 @@ public class Hero extends Char {
} }
@Override @Override
public void move( int step ) { public void move(int step, boolean travelling) {
boolean wasHighGrass = Dungeon.level.map[step] == Terrain.HIGH_GRASS; boolean wasHighGrass = Dungeon.level.map[step] == Terrain.HIGH_GRASS;
super.move( step ); super.move( step, travelling);
if (!flying) { if (!flying && travelling) {
if (Dungeon.level.water[pos]) { if (Dungeon.level.water[pos]) {
Sample.INSTANCE.play( Assets.Sounds.WATER, 1, Random.Float( 0.8f, 1.25f ) ); Sample.INSTANCE.play( Assets.Sounds.WATER, 1, Random.Float( 0.8f, 1.25f ) );
} else if (Dungeon.level.map[pos] == Terrain.EMPTY_SP) { } else if (Dungeon.level.map[pos] == Terrain.EMPTY_SP) {

View File

@ -308,10 +308,10 @@ public class DM300 extends Mob {
} }
@Override @Override
public void move(int step) { public void move(int step, boolean travelling) {
super.move(step); super.move(step);
Camera.main.shake( supercharged ? 3 : 1, 0.25f ); if (travelling) Camera.main.shake( supercharged ? 3 : 1, 0.25f );
if (Dungeon.level.map[step] == Terrain.INACTIVE_TRAP && state == HUNTING) { if (Dungeon.level.map[step] == Terrain.INACTIVE_TRAP && state == HUNTING) {

View File

@ -96,11 +96,11 @@ public class Monk extends Mob {
} }
@Override @Override
public void move( int step ) { public void move( int step, boolean travelling) {
// moving reduces cooldown by an additional 0.67, giving a total reduction of 1.67f. // moving reduces cooldown by an additional 0.67, giving a total reduction of 1.67f.
// basically monks will become focused notably faster if you kite them. // basically monks will become focused notably faster if you kite them.
focusCooldown -= 0.67f; if (travelling) focusCooldown -= 0.67f;
super.move( step ); super.move( step, travelling);
} }
@Override @Override

View File

@ -35,11 +35,11 @@ public class Senior extends Monk {
} }
@Override @Override
public void move( int step ) { public void move( int step, boolean travelling) {
// on top of the existing move bonus, senior monks get a further 1.66 cooldown reduction // on top of the existing move bonus, senior monks get a further 1.66 cooldown reduction
// for a total of 3.33, double the normal 1.67 for regular monks // for a total of 3.33, double the normal 1.67 for regular monks
focusCooldown -= 1.66f; if (travelling) focusCooldown -= 1.66f;
super.move( step ); super.move( step, travelling);
} }
@Override @Override

View File

@ -354,7 +354,7 @@ public class Ghost extends NPC {
} }
public static boolean completed(){ public static boolean completed(){
return processed() && weapon == null && armor == null; return true;
} }
} }
} }

View File

@ -276,7 +276,7 @@ public class ScrollOfTeleportation extends Scroll {
Sample.INSTANCE.play(Assets.Sounds.TELEPORT); Sample.INSTANCE.play(Assets.Sounds.TELEPORT);
} }
ch.move( pos ); ch.move( pos, false );
if (ch.pos == pos) ch.sprite.place( pos ); if (ch.pos == pos) ch.sprite.place( pos );
if (ch.invisible == 0) { if (ch.invisible == 0) {