use of com.watabou.pixeldungeon.items.scrolls.ScrollOfEnchantment in project pixel-dungeon by watabou.
the class Level method create.
public void create() {
resizingNeeded = false;
map = new int[LENGTH];
visited = new boolean[LENGTH];
Arrays.fill(visited, false);
mapped = new boolean[LENGTH];
Arrays.fill(mapped, false);
mobs = new HashSet<Mob>();
heaps = new SparseArray<Heap>();
blobs = new HashMap<Class<? extends Blob>, Blob>();
plants = new SparseArray<Plant>();
if (!Dungeon.bossLevel()) {
addItemToSpawn(Generator.random(Generator.Category.FOOD));
if (Dungeon.posNeeded()) {
addItemToSpawn(new PotionOfStrength());
Dungeon.potionOfStrength++;
}
if (Dungeon.souNeeded()) {
addItemToSpawn(new ScrollOfUpgrade());
Dungeon.scrollsOfUpgrade++;
}
if (Dungeon.soeNeeded()) {
addItemToSpawn(new ScrollOfEnchantment());
Dungeon.scrollsOfEnchantment++;
}
if (Dungeon.depth > 1) {
switch(Random.Int(10)) {
case 0:
if (!Dungeon.bossLevel(Dungeon.depth + 1)) {
feeling = Feeling.CHASM;
}
break;
case 1:
feeling = Feeling.WATER;
break;
case 2:
feeling = Feeling.GRASS;
break;
}
}
}
boolean pitNeeded = Dungeon.depth > 1 && weakFloorCreated;
do {
Arrays.fill(map, feeling == Feeling.CHASM ? Terrain.CHASM : Terrain.WALL);
pitRoomNeeded = pitNeeded;
weakFloorCreated = false;
} while (!build());
decorate();
buildFlagMaps();
cleanWalls();
createMobs();
createItems();
}
use of com.watabou.pixeldungeon.items.scrolls.ScrollOfEnchantment in project pixel-dungeon by watabou.
the class Hero method actPickUp.
private boolean actPickUp(HeroAction.PickUp action) {
int dst = action.dst;
if (pos == dst) {
Heap heap = Dungeon.level.heaps.get(pos);
if (heap != null) {
Item item = heap.pickUp();
if (item.doPickUp(this)) {
if (item instanceof Dewdrop) {
// Do nothing
} else {
boolean important = ((item instanceof ScrollOfUpgrade || item instanceof ScrollOfEnchantment) && ((Scroll) item).isKnown()) || ((item instanceof PotionOfStrength || item instanceof PotionOfMight) && ((Potion) item).isKnown());
if (important) {
GLog.p(TXT_YOU_NOW_HAVE, item.name());
} else {
GLog.i(TXT_YOU_NOW_HAVE, item.name());
}
}
if (!heap.isEmpty()) {
GLog.i(TXT_SOMETHING_ELSE);
}
curAction = null;
} else {
Dungeon.level.drop(item, pos).sprite.drop();
ready();
}
} else {
ready();
}
return false;
} else if (getCloser(dst)) {
return true;
} else {
ready();
return false;
}
}
Aggregations