v0.5.0: depth-ified high grass

grass currently looks awful when items or characters are inside of it, so for now they all trample it.
This commit is contained in:
Evan Debenham 2017-02-08 17:40:23 -05:00
parent 122fe34c06
commit 8954fac2ba
14 changed files with 53 additions and 19 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 18 KiB

View File

@ -46,8 +46,9 @@ public class Regrowth extends Blob {
int c = Dungeon.level.map[cell];
int c1 = c;
if (c == Terrain.EMPTY || c == Terrain.EMBERS || c == Terrain.EMPTY_DECO) {
c1 = cur[cell] > 9 ? Terrain.HIGH_GRASS : Terrain.GRASS;
} else if (c == Terrain.GRASS && cur[cell] > 9 && Dungeon.level.plants.get(cell) == null ) {
c1 = (cur[cell] > 9 && Actor.findChar( cell ) == null)
? Terrain.HIGH_GRASS : Terrain.GRASS;
} else if (c == Terrain.GRASS && cur[cell] > 9 && Dungeon.level.plants.get(cell) == null && Actor.findChar( cell ) == null ) {
c1 = Terrain.HIGH_GRASS;
}

View File

@ -277,6 +277,8 @@ public abstract class Level implements Bundlable {
createMobs();
createItems();
buildFlagMaps();
Random.seed();
}
@ -861,6 +863,10 @@ public abstract class Level implements Bundlable {
if (plant != null) {
plant.trigger();
}
if ( map[cell] == Terrain.HIGH_GRASS){
HighGrass.trample( this, cell, mob );
}
}
public void updateFieldOfView( Char c, boolean[] fieldOfView ) {

View File

@ -602,6 +602,8 @@ public abstract class RegularLevel extends Level {
if (findMob(mob.pos) == null && Level.passable[mob.pos]) {
mobsToSpawn--;
mobs.add(mob);
if (map[mob.pos] == Terrain.HIGH_GRASS)
map[mob.pos] = Terrain.GRASS;
//TODO: perhaps externalize this logic into a method. Do I want to make mobs more likely to clump deeper down?
if (mobsToSpawn > 0 && Random.Int(4) == 0){
@ -611,6 +613,8 @@ public abstract class RegularLevel extends Level {
if (findMob(mob.pos) == null && Level.passable[mob.pos]) {
mobsToSpawn--;
mobs.add(mob);
if (map[mob.pos] == Terrain.HIGH_GRASS)
map[mob.pos] = Terrain.GRASS;
}
}
}
@ -691,7 +695,9 @@ public abstract class RegularLevel extends Level {
default:
type = Heap.Type.HEAP;
}
drop( Generator.random(), randomDropCell() ).type = type;
int cell = randomDropCell();
if (map[cell] == Terrain.HIGH_GRASS) map[cell] = Terrain.GRASS;
drop( Generator.random(), cell ).type = type;
}
for (Item item : itemsToSpawn) {
@ -710,11 +716,14 @@ public abstract class RegularLevel extends Level {
}
} while (traps.get(cell) instanceof ExplosiveTrap);
drop( item, cell ).type = Heap.Type.HEAP;
if (map[cell] == Terrain.HIGH_GRASS) map[cell] = Terrain.GRASS;
}
Item item = Bones.get();
if (item != null) {
drop( item, randomDropCell() ).type = Heap.Type.REMAINS;
int cell = randomDropCell();
if (map[cell] == Terrain.HIGH_GRASS) map[cell] = Terrain.GRASS;
drop( item, cell ).type = Heap.Type.REMAINS;
}
}

View File

@ -97,7 +97,8 @@ public class Chasm {
hero.sprite.burst( hero.sprite.blood(), 10 );
Camera.main.shake( 4, 0.2f );
Dungeon.level.press( hero.pos, hero );
Buff.prolong( hero, Cripple.class, Cripple.DURATION );
Buff.affect( hero, Bleeding.class).set( hero.HT / 6 );
hero.damage( Random.NormalIntRange( hero.HP / 4, hero.HT / 4 ), new Hero.Doom() {

View File

@ -75,6 +75,10 @@ public class DungeonTerrainTilemap extends DungeonTilemap {
return DungeonTileSheet.RAISED_STATUE_SP;
} else if (tile == Terrain.BARRICADE) {
return DungeonTileSheet.RAISED_BARRICADE;
} else if (tile == Terrain.HIGH_GRASS) {
return DungeonTileSheet.getVisualWithAlts(
DungeonTileSheet.RAISED_HIGH_GRASS,
pos);
} else {
return DungeonTileSheet.NULL_TILE;
}

View File

@ -49,19 +49,17 @@ public class DungeonTileSheet {
private static final int GROUND = xy(1, 1); //32 slots
public static final int FLOOR = GROUND +0;
public static final int FLOOR_DECO = GROUND +1;
public static final int HIGH_GRASS = GROUND +2;
public static final int GRASS = GROUND +3;
public static final int EMBERS = GROUND +4;
public static final int FLOOR_SP = GROUND +5;
public static final int GRASS = GROUND +2;
public static final int EMBERS = GROUND +3;
public static final int FLOOR_SP = GROUND +4;
public static final int FLOOR_ALT_1 = GROUND +7;
public static final int FLOOR_DECO_ALT = GROUND +8;
public static final int HIGH_GRASS_ALT = GROUND +9;
public static final int GRASS_ALT = GROUND +10;
public static final int EMBERS_ALT = GROUND +11;
public static final int FLOOR_SP_ALT = GROUND +12;
public static final int FLOOR_ALT_1 = GROUND +6;
public static final int FLOOR_DECO_ALT = GROUND +7;
public static final int GRASS_ALT = GROUND +8;
public static final int EMBERS_ALT = GROUND +9;
public static final int FLOOR_SP_ALT = GROUND +10;
public static final int FLOOR_ALT_2 = GROUND +14;
public static final int FLOOR_ALT_2 = GROUND +12;
public static final int ENTRANCE = GROUND +16;
public static final int EXIT = GROUND +17;
@ -173,6 +171,9 @@ public class DungeonTileSheet {
public static final int FLAT_STATUE = FLAT_OTHER+1;
public static final int FLAT_STATUE_SP = FLAT_OTHER+2;
public static final int FLAT_BARRICADE = FLAT_OTHER+3;
public static final int FLAT_HIGH_GRASS = FLAT_OTHER+4;
public static final int FLAT_HIGH_GRASS_ALT = FLAT_OTHER+6;
/**********************************************************************
@ -254,6 +255,9 @@ public class DungeonTileSheet {
public static final int RAISED_STATUE = RAISED_OTHER+1;
public static final int RAISED_STATUE_SP = RAISED_OTHER+2;
public static final int RAISED_BARRICADE = RAISED_OTHER+3;
public static final int RAISED_HIGH_GRASS = RAISED_OTHER+4;
public static final int RAISED_HIGH_GRASS_ALT = RAISED_OTHER+6;
@ -309,6 +313,9 @@ public class DungeonTileSheet {
public static final int STATUE_OVERHANG = WALL_OVERHANG+26;
public static final int BARRICADE_OVERHANG = WALL_OVERHANG+27;
public static final int HIGH_GRASS_OVERHANG = WALL_OVERHANG+28;
public static final int HIGH_GRASS_OVERHANG_ALT = WALL_OVERHANG+30;
/**********************************************************************
* Logic for the selection of tile visuals
@ -325,7 +332,6 @@ public class DungeonTileSheet {
directVisuals.put(Terrain.EMBERS, EMBERS);
directVisuals.put(Terrain.PEDESTAL, PEDESTAL);
directVisuals.put(Terrain.EMPTY_SP, FLOOR_SP);
directVisuals.put(Terrain.HIGH_GRASS, HIGH_GRASS);
directVisuals.put(Terrain.SECRET_TRAP, directVisuals.get(Terrain.EMPTY));
directVisuals.put(Terrain.TRAP, directVisuals.get(Terrain.EMPTY));
@ -352,6 +358,7 @@ public class DungeonTileSheet {
directFlatVisuals.put(Terrain.STATUE, FLAT_STATUE);
directFlatVisuals.put(Terrain.STATUE_SP, FLAT_STATUE_SP);
directFlatVisuals.put(Terrain.BARRICADE, FLAT_BARRICADE);
directFlatVisuals.put(Terrain.HIGH_GRASS, FLAT_HIGH_GRASS);
directFlatVisuals.put(Terrain.SECRET_DOOR, directFlatVisuals.get(Terrain.WALL));
}
@ -380,13 +387,17 @@ public class DungeonTileSheet {
commonAltVisuals.put(EMBERS, EMBERS_ALT);
commonAltVisuals.put(FLAT_WALL_DECO, FLAT_WALL_DECO_ALT);
commonAltVisuals.put(FLOOR_SP, FLOOR_SP_ALT);
commonAltVisuals.put(HIGH_GRASS, HIGH_GRASS_ALT);
commonAltVisuals.put(FLOOR_DECO, FLOOR_DECO_ALT);
commonAltVisuals.put(FLAT_BOOKSHELF, FLAT_BOOKSHELF_ALT);
commonAltVisuals.put(FLAT_HIGH_GRASS, FLAT_HIGH_GRASS_ALT);
commonAltVisuals.put(RAISED_WALL, RAISED_WALL_ALT);
commonAltVisuals.put(RAISED_WALL_DECO, RAISED_WALL_DECO_ALT);
commonAltVisuals.put(RAISED_WALL_BOOKSHELF, RAISED_WALL_BOOKSHELF_ALT);
commonAltVisuals.put(RAISED_HIGH_GRASS, RAISED_HIGH_GRASS_ALT);
commonAltVisuals.put(HIGH_GRASS_OVERHANG, HIGH_GRASS_OVERHANG_ALT);
}
//These alt visuals trigger 5% of the time (and also override common alts when they show up)

View File

@ -83,6 +83,8 @@ public class DungeonWallsTilemap extends DungeonTilemap {
return DungeonTileSheet.STATUE_OVERHANG;
} else if (pos + mapWidth < size && map[pos+mapWidth] == Terrain.BARRICADE){
return DungeonTileSheet.BARRICADE_OVERHANG;
} else if (pos + mapWidth < size && map[pos+mapWidth] == Terrain.HIGH_GRASS){
return DungeonTileSheet.getVisualWithAlts(DungeonTileSheet.HIGH_GRASS_OVERHANG, pos + mapWidth);
}
return -1;

View File

@ -24,7 +24,7 @@ public class GridTileMap extends DungeonTilemap {
protected int getTileVisual(int pos, int tile, boolean flat) {
if (gridSetting == -1 || pos % 2 != (pos / mapWidth) % 2){
return -1;
} else if (DungeonTileSheet.floorTile(tile)) {
} else if (DungeonTileSheet.floorTile(tile) || tile == Terrain.HIGH_GRASS) {
return gridSetting;
} else if (DungeonTileSheet.doorTile(tile)){
if (DungeonTileSheet.wallStitcheable(map[pos - mapWidth])){