Merging 1.9.1 source: level changes

Differences:
- Altar room turned off for now
- Keep the guaranteed transmutation well
This commit is contained in:
Evan Debenham 2015-11-09 15:23:22 -05:00 committed by Evan Debenham
parent d894c7297f
commit 648246641a
12 changed files with 109 additions and 18 deletions

View File

@ -615,13 +615,7 @@ public abstract class Level implements Bundlable {
for (int i=WIDTH; i < LENGTH - WIDTH; i++) {
if (water[i]) {
int t = Terrain.WATER_TILES;
for (int j=0; j < NEIGHBOURS4.length; j++) {
if ((Terrain.flags[map[i + NEIGHBOURS4[j]]] & Terrain.UNSTITCHABLE) != 0) {
t += 1 << j;
}
}
map[i] = t;
map[i] = getWaterTile( i );
}
if (pit[i]) {
@ -641,6 +635,37 @@ public abstract class Level implements Bundlable {
}
}
private int getWaterTile( int pos ) {
int t = Terrain.WATER_TILES;
for (int j=0; j < NEIGHBOURS4.length; j++) {
if ((Terrain.flags[map[pos + NEIGHBOURS4[j]]] & Terrain.UNSTITCHABLE) != 0) {
t += 1 << j;
}
}
return t;
}
public void destroy( int pos ) {
if ((Terrain.flags[map[pos]] & Terrain.UNSTITCHABLE) == 0) {
set( pos, Terrain.EMBERS );
} else {
boolean flood = false;
for (int j=0; j < NEIGHBOURS4.length; j++) {
if (water[pos + NEIGHBOURS4[j]]) {
flood = true;
break;
}
}
if (flood) {
set( pos, getWaterTile( pos ) );
} else {
set( pos, Terrain.EMBERS );
}
}
}
protected void cleanWalls() {
for (int i=0; i < LENGTH; i++) {

View File

@ -500,6 +500,7 @@ public abstract class RegularLevel extends Level {
break;
case HIDDEN:
map[door] = Terrain.SECRET_DOOR;
secretDoors++;
break;
case BARRICADE:
map[door] = Random.Int( 3 ) == 0 ? Terrain.BOOKSHELF : Terrain.BARRICADE;

View File

@ -69,6 +69,7 @@ public class Room extends Rect implements Graph.Node, Bundlable {
RAT_KING ( RatKingPainter.class ),
WEAK_FLOOR ( WeakFloorPainter.class ),
PIT ( PitPainter.class ),
ALTAR ( AltarPainter.class ),
//prison quests
MASS_GRAVE ( MassGravePainter.class ),

View File

@ -26,7 +26,6 @@ import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.ElmoParticle;
import com.shatteredpixel.shatteredpixeldungeon.levels.DeadEndLevel;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
@ -114,7 +113,7 @@ public class Sign {
if (index >= 21) {
Level.set( pos, Terrain.EMBERS );
Dungeon.level.destroy( pos );
GameScene.updateMap( pos );
GameScene.discoverTile( pos, Terrain.SIGN );

View File

@ -0,0 +1,64 @@
/*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2015 Evan Debenham
*
* 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.painters;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
//import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.SacrificialFire;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.levels.Room;
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
import com.watabou.utils.Point;
public class AltarPainter extends Painter {
public static void paint( Level level, Room room ) {
fill( level, room, Terrain.WALL );
fill( level, room, 1, Dungeon.bossLevel( Dungeon.depth + 1 ) ? Terrain.HIGH_GRASS : Terrain.CHASM );
Point c = room.center();
Room.Door door = room.entrance();
if (door.x == room.left || door.x == room.right) {
Point p = drawInside( level, room, door, Math.abs( door.x - c.x ) - 2, Terrain.EMPTY_SP );
for (; p.y != c.y; p.y += p.y < c.y ? +1 : -1) {
set( level, p, Terrain.EMPTY_SP );
}
} else {
Point p = drawInside( level, room, door, Math.abs( door.y - c.y ) - 2, Terrain.EMPTY_SP );
for (; p.x != c.x; p.x += p.x < c.x ? +1 : -1) {
set( level, p, Terrain.EMPTY_SP );
}
}
fill( level, c.x - 1, c.y - 1, 3, 3, Terrain.EMBERS );
set( level, c, Terrain.PEDESTAL );
//TODO: find some use for sacrificial fire... but not the vanilla one. scroll of wipe out is too strong.
/*SacrificialFire fire = (SacrificialFire)level.blobs.get( SacrificialFire.class );
if (fire == null) {
fire = new SacrificialFire();
}
fire.seed( c.x + c.y * Level.WIDTH, 5 + Dungeon.depth * 5 );
level.blobs.put( SacrificialFire.class, fire );*/
door.set( Room.Door.Type.EMPTY );
}
}

View File

@ -73,7 +73,7 @@ public class CryptPainter extends Painter {
for (int i=0; i < 3; i++) {
Item another = Generator.random( Generator.Category.ARMOR );
if (another.level > prize.level) {
if (another.level() > prize.level()) {
prize = another;
}
}

View File

@ -103,7 +103,7 @@ public class PoolPainter extends Painter {
Generator.Category.WEAPON,
Generator.Category.ARMOR
) );
if (another.level > prize.level) {
if (another.level() > prize.level()) {
prize = another;
}
}

View File

@ -234,11 +234,11 @@ public class ShopPainter extends Painter {
switch (Random.Int(10)){
case 0:
rare = Generator.random( Generator.Category.WAND );
if (rare.level > 0 ) rare.degrade( rare.level );
rare.level( 0 );
break;
case 1:
rare = Generator.random(Generator.Category.RING);
rare.level = 1;
rare.level( 1 );
break;
case 2:
rare = Generator.random( Generator.Category.ARTIFACT ).identify();

View File

@ -125,7 +125,7 @@ public class TrapsPainter extends Painter {
Generator.Category.WEAPON,
Generator.Category.ARMOR
) );
if (another.level > prize.level) {
if (another.level() > prize.level()) {
prize = another;
}
}

View File

@ -36,7 +36,8 @@ public class VaultPainter extends Painter {
public static void paint( Level level, Room room ) {
fill( level, room, Terrain.WALL );
fill( level, room, 1, Terrain.EMPTY );
fill( level, room, 1, Terrain.EMPTY_SP );
fill( level, room, 2, Terrain.EMPTY );
int cx = (room.left + room.right) / 2;
int cy = (room.top + room.bottom) / 2;

View File

@ -77,7 +77,7 @@ public class DisintegrationTrap extends Trap {
bag = (Bag)item;
item = Random.element(bag.items);
}
if (item.level > 0 || item.unique) return;
if (item.level() > 0 || item.unique) return;
if (!item.stackable){
item.detachAll(bag);
GLog.w("the trap disintegrates your " + item.name() + "!");

View File

@ -85,7 +85,7 @@ public class GuardianTrap extends Trap {
super();
weapon.enchant(null);
weapon.degrade(weapon.level);
weapon.degrade(weapon.level());
}
@Override