v0.8.0a: Fixed the following bugs:

- water of health being used up when uncursable items are thrown into it
- rare crash bugs involving brutes, items dropping from alchemy, and character sprite movement
- golems being able to teleport immovable characters
- armored statues appearing in faith is my armor challenge
- Yog fight able to set viewdistance to 0 if into darkness is enabled
- large enemies being able to move into enclosed spaces when vertigoed
- infinite loop bug when attempting to teleport DM-300
- terrain being overridden at the end of Tengu's boss level
This commit is contained in:
Evan Debenham 2020-04-27 01:09:52 -04:00
parent bab229ec3d
commit ee87446c1e
10 changed files with 29 additions and 24 deletions

View File

@ -630,7 +630,9 @@ public abstract class Char extends Actor {
if (Dungeon.level.adjacent( step, pos ) && buff( Vertigo.class ) != null) { if (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]) || Actor.findChar( newPos ) != null) if (!(Dungeon.level.passable[newPos] || Dungeon.level.avoid[newPos])
|| (properties.contains(Property.LARGE) && !Dungeon.level.openSpace[pos])
|| Actor.findChar( newPos ) != null)
return; return;
else { else {
sprite.move(pos, newPos); sprite.move(pos, newPos);

View File

@ -70,15 +70,22 @@ public class WaterOfHealth extends WellWater {
if (item instanceof DewVial && !((DewVial)item).isFull()) { if (item instanceof DewVial && !((DewVial)item).isFull()) {
((DewVial)item).fill(); ((DewVial)item).fill();
CellEmitter.get( pos ).start( Speck.factory( Speck.HEALING ), 0.4f, 4 ); CellEmitter.get( pos ).start( Speck.factory( Speck.HEALING ), 0.4f, 4 );
} else if (ScrollOfRemoveCurse.uncurse( null, item )){ Sample.INSTANCE.play( Assets.SND_DRINK );
CellEmitter.get( pos ).start( ShadowParticle.UP, 0.05f, 10 ); return item;
} if ( item instanceof Ankh && !(((Ankh) item).isBlessed())){ } else if ( item instanceof Ankh && !(((Ankh) item).isBlessed())){
((Ankh) item).bless(); ((Ankh) item).bless();
CellEmitter.get( pos ).start(Speck.factory(Speck.LIGHT), 0.2f, 3); CellEmitter.get( pos ).start(Speck.factory(Speck.LIGHT), 0.2f, 3);
Sample.INSTANCE.play( Assets.SND_DRINK );
return item;
} else if (ScrollOfRemoveCurse.uncursable(item)) {
if (ScrollOfRemoveCurse.uncurse( null, item )){
CellEmitter.get( pos ).start( ShadowParticle.UP, 0.05f, 10 );
} }
Sample.INSTANCE.play( Assets.SND_DRINK ); Sample.INSTANCE.play( Assets.SND_DRINK );
return item; return item;
} }
return null;
}
@Override @Override
protected Landmark record() { protected Landmark record() {

View File

@ -79,7 +79,7 @@ public class Brute extends Mob {
} }
@Override @Override
public boolean isAlive() { public synchronized boolean isAlive() {
if (HP > 0){ if (HP > 0){
return true; return true;
} else { } else {

View File

@ -183,7 +183,8 @@ public class Golem extends Mob {
int oldPos = pos; int oldPos = pos;
if (enemyTeleCooldown <= 0 && Random.Int(100/distance(enemy)) == 0){ if (enemyTeleCooldown <= 0 && Random.Int(100/distance(enemy)) == 0
&& !Char.hasProp(enemy, Property.IMMOVABLE)){
if (sprite != null && (sprite.visible || enemy.sprite.visible)) { if (sprite != null && (sprite.visible || enemy.sprite.visible)) {
sprite.zap( enemy.pos ); sprite.zap( enemy.pos );
return false; return false;
@ -196,7 +197,7 @@ public class Golem extends Mob {
spend( 1 / speed() ); spend( 1 / speed() );
return moveSprite( oldPos, pos ); return moveSprite( oldPos, pos );
} else if (enemyTeleCooldown <= 0) { } else if (enemyTeleCooldown <= 0 && !Char.hasProp(enemy, Property.IMMOVABLE)) {
if (sprite != null && (sprite.visible || enemy.sprite.visible)) { if (sprite != null && (sprite.visible || enemy.sprite.visible)) {
sprite.zap( enemy.pos ); sprite.zap( enemy.pos );
return false; return false;

View File

@ -21,6 +21,7 @@
package com.shatteredpixel.shatteredpixeldungeon.actors.mobs; package com.shatteredpixel.shatteredpixeldungeon.actors.mobs;
import com.shatteredpixel.shatteredpixeldungeon.Challenges;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char; import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.items.Generator; import com.shatteredpixel.shatteredpixeldungeon.items.Generator;
@ -168,7 +169,7 @@ public class Statue extends Mob {
} }
public static Statue random(){ public static Statue random(){
if (Random.Int(10) == 0){ if (Random.Int(10) == 0 && !Dungeon.isChallenged(Challenges.NO_ARMOR)){
return new ArmoredStatue(); return new ArmoredStatue();
} else { } else {
return new Statue(); return new Statue();

View File

@ -290,7 +290,7 @@ public class YogDzewa extends Mob {
if (phase < 4 && HP <= HT - 300*phase){ if (phase < 4 && HP <= HT - 300*phase){
HP = HT - 300*phase; HP = HT - 300*phase;
Dungeon.level.viewDistance--; Dungeon.level.viewDistance = Math.max(1, Dungeon.level.viewDistance-1);
if (Dungeon.hero.buff(Light.class) == null){ if (Dungeon.hero.buff(Light.class) == null){
Dungeon.hero.viewDistance = Dungeon.level.viewDistance; Dungeon.hero.viewDistance = Dungeon.level.viewDistance;
} }

View File

@ -759,7 +759,7 @@ public abstract class Level implements Bundlable {
heap.drop(item); heap.drop(item);
} }
if (Dungeon.level != null) { if (Dungeon.level != null && ShatteredPixelDungeon.scene() instanceof GameScene) {
pressCell( cell ); pressCell( cell );
} }

View File

@ -183,6 +183,10 @@ public class NewCavesBossLevel extends Level {
@Override @Override
public int randomRespawnCell( Char ch ) { public int randomRespawnCell( Char ch ) {
//this check is mainly here for DM-300, to prevent an infinite loop
if (Char.hasProp(ch, Char.Property.LARGE) && map[entrance] != Terrain.ENTRANCE){
return -1;
}
int cell; int cell;
do { do {
cell = entrance + PathFinder.NEIGHBOURS8[Random.Int(8)]; cell = entrance + PathFinder.NEIGHBOURS8[Random.Int(8)];

View File

@ -134,17 +134,6 @@ public class NewPrisonBossLevel extends Level {
triggered = bundle.getBooleanArray(TRIGGERED); triggered = bundle.getBooleanArray(TRIGGERED);
//compatibility with pre-0.7.5a saves
if (state == State.WON){
int cell = pointToCell(endStart);
int i = 0;
while (cell < length()){
System.arraycopy(endMap, i, map, cell, 14);
i += 14;
cell += width();
}
exit = pointToCell(levelExit);
}
} }
@Override @Override

View File

@ -217,6 +217,7 @@ public class CharSprite extends MovieClip implements Tweener.Listener, MovieClip
//returns where the center of this sprite will be after it completes any motion in progress //returns where the center of this sprite will be after it completes any motion in progress
public PointF destinationCenter(){ public PointF destinationCenter(){
PosTweener motion = this.motion;
if (motion != null){ if (motion != null){
return new PointF(motion.end.x + width()/2f, motion.end.y + height()/2f); return new PointF(motion.end.x + width()/2f, motion.end.y + height()/2f);
} else { } else {