v3.0.0: fixed surface scene counting a win every time it was reset

This commit is contained in:
Evan Debenham
2025-01-29 16:25:39 -05:00
parent 0b887a3ee4
commit d029c0d7d1
2 changed files with 16 additions and 9 deletions

View File

@@ -22,7 +22,9 @@
package com.shatteredpixel.shatteredpixeldungeon.levels; package com.shatteredpixel.shatteredpixeldungeon.levels;
import com.shatteredpixel.shatteredpixeldungeon.Assets; import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Badges;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.GamesInProgress;
import com.shatteredpixel.shatteredpixeldungeon.Statistics; import com.shatteredpixel.shatteredpixeldungeon.Statistics;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.Ghost; import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.Ghost;
@@ -152,7 +154,20 @@ public class SewerLevel extends RegularLevel {
return false; return false;
} else { } else {
Statistics.ascended = true; Statistics.ascended = true;
Game.switchScene( SurfaceScene.class ); Game.switchScene(SurfaceScene.class, new Game.SceneChangeCallback() {
@Override
public void beforeCreate() {
}
@Override
public void afterCreate() {
Badges.validateHappyEnd();
Dungeon.win( Amulet.class );
Dungeon.deleteGame( GamesInProgress.curSlot, true );
Badges.saveGlobal();
}
});
return true; return true;
} }
} else { } else {

View File

@@ -22,12 +22,9 @@
package com.shatteredpixel.shatteredpixeldungeon.scenes; package com.shatteredpixel.shatteredpixeldungeon.scenes;
import com.shatteredpixel.shatteredpixeldungeon.Assets; import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Badges;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.GamesInProgress;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroClass; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroClass;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.abilities.Ratmogrify; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.abilities.Ratmogrify;
import com.shatteredpixel.shatteredpixeldungeon.items.Amulet;
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.DriedRose; import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.DriedRose;
import com.shatteredpixel.shatteredpixeldungeon.items.remains.RemainsItem; import com.shatteredpixel.shatteredpixeldungeon.items.remains.RemainsItem;
import com.shatteredpixel.shatteredpixeldungeon.items.wands.WandOfLivingEarth; import com.shatteredpixel.shatteredpixeldungeon.items.wands.WandOfLivingEarth;
@@ -266,11 +263,6 @@ public class SurfaceScene extends PixelScene {
gameOver.setSize( SKY_WIDTH - FRAME_MARGIN_X * 2, BUTTON_HEIGHT ); gameOver.setSize( SKY_WIDTH - FRAME_MARGIN_X * 2, BUTTON_HEIGHT );
gameOver.setPos( frame.x + FRAME_MARGIN_X * 2, frame.y + frame.height + 4 ); gameOver.setPos( frame.x + FRAME_MARGIN_X * 2, frame.y + frame.height + 4 );
add( gameOver ); add( gameOver );
Badges.validateHappyEnd();
Dungeon.win( Amulet.class );
Dungeon.deleteGame( GamesInProgress.curSlot, true );
Badges.saveGlobal();
fadeIn(); fadeIn();
} }