v0.3.2: added in a painter for the mass grave room

This commit is contained in:
Evan Debenham 2015-10-06 02:35:36 -04:00
parent bcdba04d42
commit d668f6e587
4 changed files with 98 additions and 1 deletions
assets/custom_tiles
src/com/shatteredpixel/shatteredpixeldungeon

Binary file not shown.

Before

(image error) Size: 5.8 KiB

After

(image error) Size: 5.9 KiB

View File

@ -108,6 +108,7 @@ public class Assets {
public static final String WATER_HALLS = "water4.png";
public static final String WEAK_FLOOR = "custom_tiles/weak_floor.png";
public static final String PRISON_QUEST = "custom_tiles/prison_quests.png";
public static final String BUFFS_SMALL = "buffs.png";
public static final String BUFFS_LARGE = "large_buffs.png";

View File

@ -68,7 +68,12 @@ public class Room extends Rect implements Graph.Node, Bundlable {
POOL ( PoolPainter.class ),
RAT_KING ( RatKingPainter.class ),
WEAK_FLOOR ( WeakFloorPainter.class ),
PIT ( PitPainter.class );
PIT ( PitPainter.class ),
//prison quests
MASS_GRAVE ( MassGravePainter.class ),
ROT_GARDEN ( StandardPainter.class ),
RITUAL_SITE ( StandardPainter.class );
private Method paint;

View File

@ -0,0 +1,91 @@
/*
* 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.Assets;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Skeleton;
import com.shatteredpixel.shatteredpixeldungeon.items.Generator;
import com.shatteredpixel.shatteredpixeldungeon.items.Gold;
import com.shatteredpixel.shatteredpixeldungeon.items.Heap;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfLiquidFlame;
import com.shatteredpixel.shatteredpixeldungeon.items.quest.CorpseDust;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.levels.Room;
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
import com.shatteredpixel.shatteredpixeldungeon.ui.CustomTileVisual;
import com.watabou.utils.Random;
import java.util.ArrayList;
public class MassGravePainter extends Painter {
public static void paint( Level level, Room room){
Room.Door entrance = room.entrance();
entrance.set(Room.Door.Type.BARRICADE);
level.addItemToSpawn(new PotionOfLiquidFlame());
fill(level, room, Terrain.WALL);
fill(level, room, 1, Terrain.EMPTY_SP);
level.customTiles.addAll(Bones.CustomTilesForRoom(room, Bones.class));
//50% 1 skeleton, 50% 2 skeletons
for (int i = 0; i <= Random.Int(2); i++){
Skeleton skele = new Skeleton();
int pos;
do {
pos = room.random();
} while (level.map[pos] != Terrain.EMPTY_SP);
skele.pos = pos;
level.mobs.add( skele );
}
ArrayList<Item> items = new ArrayList<>();
//100% corpse dust, 2x100% 1 coin, 2x30% coins, 1x60% random item, 1x30% armor
items.add(new CorpseDust());
items.add(new Gold(1));
items.add(new Gold(1));
if (Random.Float() <= 0.3f) items.add(new Gold());
if (Random.Float() <= 0.3f) items.add(new Gold());
if (Random.Float() <= 0.6f) items.add(Generator.random());
if (Random.Float() <= 0.3f) items.add(Generator.randomArmor());
for (Item item : items){
int pos;
do {
pos = room.random();
} while (level.map[pos] != Terrain.EMPTY_SP || level.heaps.get(pos) != null);
Heap h = level.drop(item, pos);
h.type = Heap.Type.SKELETON;
}
}
public static class Bones extends CustomTileVisual {
{
tx = Assets.PRISON_QUEST;
txX = 3;
txY = 0;
}
}
}