v0.8.0a: fixed various errors caused by new imp shop
This commit is contained in:
parent
de448a0993
commit
0390b3dbad
|
@ -102,7 +102,9 @@ public class NewCityBossLevel extends Level {
|
||||||
public void restoreFromBundle( Bundle bundle ) {
|
public void restoreFromBundle( Bundle bundle ) {
|
||||||
super.restoreFromBundle( bundle );
|
super.restoreFromBundle( bundle );
|
||||||
impShop = (ImpShopRoom) bundle.get( IMP_SHOP );
|
impShop = (ImpShopRoom) bundle.get( IMP_SHOP );
|
||||||
if (map[topDoor] != Terrain.LOCKED_DOOR) impShop.onLevelLoad(this);
|
if (map[topDoor] != Terrain.LOCKED_DOOR && Imp.Quest.isCompleted() && !impShop.shopSpawned()){
|
||||||
|
spawnShop();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -157,9 +159,6 @@ public class NewCityBossLevel extends Level {
|
||||||
|
|
||||||
impShop = new ImpShopRoom();
|
impShop = new ImpShopRoom();
|
||||||
impShop.set(end.left+3, end.top+12, end.left+11, end.top+20);
|
impShop.set(end.left+3, end.top+12, end.left+11, end.top+20);
|
||||||
if (impShop.itemCount() > (7*7)){
|
|
||||||
impShop.bottom += 2;
|
|
||||||
}
|
|
||||||
Painter.set(this, impShop.center(), Terrain.PEDESTAL);
|
Painter.set(this, impShop.center(), Terrain.PEDESTAL);
|
||||||
|
|
||||||
Painter.set(this, impShop.left+2, impShop.top, Terrain.STATUE);
|
Painter.set(this, impShop.left+2, impShop.top, Terrain.STATUE);
|
||||||
|
@ -307,11 +306,18 @@ public class NewCityBossLevel extends Level {
|
||||||
GameScene.updateMap( topDoor );
|
GameScene.updateMap( topDoor );
|
||||||
|
|
||||||
if (Imp.Quest.isCompleted()) {
|
if (Imp.Quest.isCompleted()) {
|
||||||
impShop.spawnShop(this);
|
spawnShop();
|
||||||
}
|
}
|
||||||
Dungeon.observe();
|
Dungeon.observe();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void spawnShop(){
|
||||||
|
while (impShop.itemCount() >= 7*(impShop.height()-2)){
|
||||||
|
impShop.bottom++;
|
||||||
|
}
|
||||||
|
impShop.spawnShop(this);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String tileName( int tile ) {
|
public String tileName( int tile ) {
|
||||||
switch (tile) {
|
switch (tile) {
|
||||||
|
|
|
@ -31,6 +31,7 @@ import com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.special.ShopRoom;
|
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.special.ShopRoom;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
||||||
import com.watabou.utils.Bundle;
|
import com.watabou.utils.Bundle;
|
||||||
|
import com.watabou.utils.Point;
|
||||||
|
|
||||||
//shops probably shouldn't extend special room, because of cases like this.
|
//shops probably shouldn't extend special room, because of cases like this.
|
||||||
public class ImpShopRoom extends ShopRoom {
|
public class ImpShopRoom extends ShopRoom {
|
||||||
|
@ -76,6 +77,13 @@ public class ImpShopRoom extends ShopRoom {
|
||||||
|
|
||||||
int pos = level.pointToCell(center());
|
int pos = level.pointToCell(center());
|
||||||
|
|
||||||
|
for (Point p : getPoints()){
|
||||||
|
if (level.map[level.pointToCell(p)] == Terrain.PEDESTAL){
|
||||||
|
pos = level.pointToCell(p);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Mob shopkeeper = new ImpShopkeeper();
|
Mob shopkeeper = new ImpShopkeeper();
|
||||||
shopkeeper.pos = pos;
|
shopkeeper.pos = pos;
|
||||||
if (ShatteredPixelDungeon.scene() instanceof GameScene) {
|
if (ShatteredPixelDungeon.scene() instanceof GameScene) {
|
||||||
|
@ -98,6 +106,10 @@ public class ImpShopRoom extends ShopRoom {
|
||||||
placeItems(level);
|
placeItems(level);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean shopSpawned(){
|
||||||
|
return impSpawned;
|
||||||
|
}
|
||||||
|
|
||||||
private static final String IMP = "imp_spawned";
|
private static final String IMP = "imp_spawned";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue
Block a user