Magic_Ling_Pixel_Dungeon/src/com/shatteredpixel/shatteredpixeldungeon/levels/LastLevel.java

177 lines
4.3 KiB
Java
Raw Normal View History

2014-07-27 13:39:07 +00:00
/*
* Pixel Dungeon
* Copyright (C) 2012-2014 Oleg Dolya
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.levels;
2014-07-27 13:39:07 +00:00
import java.util.Arrays;
import com.watabou.noosa.Scene;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.items.Amulet;
import com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter;
import com.watabou.utils.Bundle;
2014-07-27 13:39:07 +00:00
import com.watabou.utils.Random;
public class LastLevel extends Level {
2015-02-22 07:26:30 +00:00
private static final int SIZE = 30;
2014-07-27 13:39:07 +00:00
{
color1 = 0x801500;
color2 = 0xa68521;
2015-02-22 07:26:30 +00:00
viewDistance = 8;
2014-07-27 13:39:07 +00:00
}
2015-02-22 07:26:30 +00:00
2014-07-27 13:39:07 +00:00
private int pedestal;
2015-02-22 07:26:30 +00:00
2014-07-27 13:39:07 +00:00
@Override
public String tilesTex() {
return Assets.TILES_HALLS;
}
2015-02-22 07:26:30 +00:00
2014-07-27 13:39:07 +00:00
@Override
public String waterTex() {
return Assets.WATER_HALLS;
}
2015-02-22 07:26:30 +00:00
@Override
public void create() {
super.create();
for (int i=0; i < LENGTH; i++) {
int flags = Terrain.flags[map[i]];
if ((flags & Terrain.PIT) != 0){
passable[i] = avoid[i] = false;
solid[i] = true;
}
}
}
2014-07-27 13:39:07 +00:00
@Override
protected boolean build() {
2015-02-22 07:26:30 +00:00
Arrays.fill( map, Terrain.CHASM );
Painter.fill( this, 7, 31, 19, 1, Terrain.WALL );
Painter.fill( this, 15, 10, 3, 21, Terrain.EMPTY);
Painter.fill( this, 13, 30, 7, 1, Terrain.EMPTY);
Painter.fill( this, 14, 29, 5, 1, Terrain.EMPTY);
Painter.fill( this, 14, 9, 5, 7, Terrain.EMPTY);
Painter.fill( this, 13, 10, 7, 5, Terrain.EMPTY);
//Painter.fill( this, 2, 2, SIZE-2, SIZE-2, Terrain.EMPTY );
//Painter.fill( this, SIZE/2, SIZE/2, 3, 3, Terrain.EMPTY_SP );
2014-07-27 13:39:07 +00:00
entrance = SIZE * WIDTH + SIZE / 2 + 1;
map[entrance] = Terrain.ENTRANCE;
2015-02-22 07:26:30 +00:00
pedestal = (SIZE / 2 + 1) * (WIDTH + 1) - 4*WIDTH;
2014-07-27 13:39:07 +00:00
map[pedestal] = Terrain.PEDESTAL;
2015-02-22 07:26:30 +00:00
map[pedestal-1-WIDTH] = map[pedestal+1-WIDTH] = map[pedestal-1+WIDTH] = map[pedestal+1+WIDTH] = Terrain.STATUE_SP;
exit = pedestal;
int pos = pedestal;
map[pos-WIDTH] = map[pos-1] = map[pos+1] = map[pos-2] = map[pos+2] = Terrain.WATER;
pos+=WIDTH;
map[pos] = map[pos-2] = map[pos+2] = map[pos-3] = map[pos+3] = Terrain.WATER;
pos+=WIDTH;
map[pos-3] = map[pos-2] = map[pos-1] = map[pos] = map[pos+1] = map[pos+2] = map[pos+3] = Terrain.WATER;
pos+=WIDTH;
map[pos-2] = map[pos+2] = Terrain.WATER;
2014-07-27 13:39:07 +00:00
feeling = Feeling.NONE;
2015-02-22 07:26:30 +00:00
viewDistance = 8;
2014-07-27 13:39:07 +00:00
return true;
}
@Override
protected void decorate() {
for (int i=0; i < LENGTH; i++) {
2015-02-22 07:26:30 +00:00
if (map[i] == Terrain.EMPTY && Random.Int( 10 ) == 0) {
2014-07-27 13:39:07 +00:00
map[i] = Terrain.EMPTY_DECO;
}
}
}
@Override
protected void createMobs() {
}
@Override
protected void createItems() {
drop( new Amulet(), pedestal );
}
2015-02-22 07:26:30 +00:00
2014-07-27 13:39:07 +00:00
@Override
public int randomRespawnCell() {
return -1;
}
@Override
public String tileName( int tile ) {
switch (tile) {
case Terrain.WATER:
return "Cold lava";
case Terrain.GRASS:
return "Embermoss";
case Terrain.HIGH_GRASS:
return "Emberfungi";
case Terrain.STATUE:
case Terrain.STATUE_SP:
return "Pillar";
default:
return super.tileName( tile );
}
}
2015-02-22 07:26:30 +00:00
2014-07-27 13:39:07 +00:00
@Override
public String tileDesc(int tile) {
switch (tile) {
case Terrain.WATER:
return "It looks like lava, but it's cold and probably safe to touch.";
case Terrain.STATUE:
case Terrain.STATUE_SP:
2015-02-22 07:26:30 +00:00
return "The pillar is made of real humanoid skulls. Awesome.";
2014-07-27 13:39:07 +00:00
default:
return super.tileDesc( tile );
}
}
2015-02-22 07:26:30 +00:00
2014-07-27 13:39:07 +00:00
@Override
public void addVisuals( Scene scene ) {
2015-02-22 07:26:30 +00:00
super.addVisuals( scene );
2014-07-27 13:39:07 +00:00
HallsLevel.addVisuals( this, scene );
}
@Override
public void restoreFromBundle(Bundle bundle) {
super.restoreFromBundle(bundle);
for (int i=0; i < LENGTH; i++) {
int flags = Terrain.flags[map[i]];
if ((flags & Terrain.PIT) != 0){
passable[i] = avoid[i] = false;
solid[i] = true;
}
}
}
2014-07-27 13:39:07 +00:00
}