v0.9.2: fixed save/load errors with Yog vision reduction
This commit is contained in:
parent
943e316e31
commit
5f6285d3d2
|
@ -41,6 +41,7 @@ import com.shatteredpixel.shatteredpixeldungeon.effects.TargetedCell;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.PurpleParticle;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.ShadowParticle;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.DriedRose;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
||||
|
@ -315,11 +316,9 @@ public class YogDzewa extends Mob {
|
|||
|
||||
if (phase < 4 && HP <= HT - 300*phase){
|
||||
|
||||
Dungeon.level.viewDistance = Math.max(1, Dungeon.level.viewDistance-1);
|
||||
if (Dungeon.hero.buff(Light.class) == null){
|
||||
Dungeon.hero.viewDistance = Dungeon.level.viewDistance;
|
||||
}
|
||||
Dungeon.observe();
|
||||
phase++;
|
||||
|
||||
updateVisibility(Dungeon.level);
|
||||
GLog.n(Messages.get(this, "darkness"));
|
||||
sprite.showStatus(CharSprite.POSITIVE, Messages.get(this, "invulnerable"));
|
||||
|
||||
|
@ -344,7 +343,6 @@ public class YogDzewa extends Mob {
|
|||
|
||||
GameScene.add(fist, 4);
|
||||
Actor.addDelayed( new Pushing( fist, Dungeon.level.exit, fist.pos ), -1 );
|
||||
phase++;
|
||||
}
|
||||
|
||||
LockedFloor lock = Dungeon.hero.buff(LockedFloor.class);
|
||||
|
@ -352,6 +350,21 @@ public class YogDzewa extends Mob {
|
|||
|
||||
}
|
||||
|
||||
public void updateVisibility( Level level ){
|
||||
if (phase > 1 && isAlive()){
|
||||
level.viewDistance = 4 - (phase-1);
|
||||
} else {
|
||||
level.viewDistance = 4;
|
||||
}
|
||||
level.viewDistance = Math.max(1, level.viewDistance);
|
||||
if (Dungeon.hero != null) {
|
||||
if (Dungeon.hero.buff(Light.class) == null) {
|
||||
Dungeon.hero.viewDistance = level.viewDistance;
|
||||
}
|
||||
Dungeon.observe();
|
||||
}
|
||||
}
|
||||
|
||||
private YogFist findFist(){
|
||||
for ( Char c : Actor.chars() ){
|
||||
if (c instanceof YogFist){
|
||||
|
@ -385,10 +398,7 @@ public class YogDzewa extends Mob {
|
|||
}
|
||||
}
|
||||
|
||||
Dungeon.level.viewDistance = 4;
|
||||
if (Dungeon.hero.buff(Light.class) == null){
|
||||
Dungeon.hero.viewDistance = Dungeon.level.viewDistance;
|
||||
}
|
||||
updateVisibility(Dungeon.level);
|
||||
|
||||
GameScene.bossSlain();
|
||||
Dungeon.level.unseal();
|
||||
|
|
|
@ -26,6 +26,7 @@ import com.shatteredpixel.shatteredpixeldungeon.Bones;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.YogDzewa;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.FlameParticle;
|
||||
|
@ -38,6 +39,7 @@ import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.tiles.CustomTilemap;
|
||||
import com.watabou.noosa.Group;
|
||||
import com.watabou.noosa.Tilemap;
|
||||
import com.watabou.utils.Bundle;
|
||||
import com.watabou.utils.PathFinder;
|
||||
import com.watabou.utils.Random;
|
||||
|
||||
|
@ -230,6 +232,16 @@ public class NewHallsBossLevel extends Level {
|
|||
Dungeon.observe();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void restoreFromBundle(Bundle bundle) {
|
||||
super.restoreFromBundle(bundle);
|
||||
for (Mob m : mobs){
|
||||
if (m instanceof YogDzewa){
|
||||
((YogDzewa) m).updateVisibility(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String tileName( int tile ) {
|
||||
switch (tile) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user