本文整理汇总了Java中com.shatteredpixel.shatteredpixeldungeon.items.keys.IronKey类的典型用法代码示例。如果您正苦于以下问题:Java IronKey类的具体用法?Java IronKey怎么用?Java IronKey使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IronKey类属于com.shatteredpixel.shatteredpixeldungeon.items.keys包,在下文中一共展示了IronKey类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createItems
import com.shatteredpixel.shatteredpixeldungeon.items.keys.IronKey; //导入依赖的package包/类
@Override
protected void createItems() {
int keyPos = anteroom.random();
while (!passable[keyPos]) {
keyPos = anteroom.random();
}
drop( new IronKey( Dungeon.depth ), keyPos ).type = Heap.Type.CHEST;
Item item = Bones.get();
if (item != null) {
int pos;
do {
pos = roomEntrance.random();
} while (pos == entrance || map[pos] == Terrain.SIGN);
drop( item, pos ).type = Heap.Type.REMAINS;
}
}
示例2: paint
import com.shatteredpixel.shatteredpixeldungeon.items.keys.IronKey; //导入依赖的package包/类
public void paint( Level level ) {
Painter.fill( level, this, Terrain.WALL );
Painter.fill( level, this, 1, Terrain.EMPTY_SP );
Painter.fill( level, this, 2, Terrain.EMPTY );
int cx = (left + right) / 2;
int cy = (top + bottom) / 2;
int c = cx + cy * level.width();
Random.shuffle(prizeClasses);
Item i1, i2;
do {
i1 = prize( level );
i2 = prize( level );
} while (i1.getClass() == i2.getClass());
level.drop( i1, c ).type = Heap.Type.CRYSTAL_CHEST;
level.drop( i2, c + PathFinder.NEIGHBOURS8[Random.Int( 8 )]).type = Heap.Type.CRYSTAL_CHEST;
level.addItemToSpawn( new CrystalKey( Dungeon.depth ) );
entrance().set( Door.Type.LOCKED );
level.addItemToSpawn( new IronKey( Dungeon.depth ) );
}
示例3: countIronKeys
import com.shatteredpixel.shatteredpixeldungeon.items.keys.IronKey; //导入依赖的package包/类
public void countIronKeys() {
IronKey.curDepthQuantity = 0;
for (Item item : backpack) {
if (item instanceof IronKey && ((IronKey)item).depth == Dungeon.depth) {
IronKey.curDepthQuantity += item.quantity();
}
}
}
示例4: paint
import com.shatteredpixel.shatteredpixeldungeon.items.keys.IronKey; //导入依赖的package包/类
public static void paint( Level level, Room room ) {
fill( level, room, Terrain.WALL );
fill( level, room, 1, Terrain.EMPTY );
Point c = room.center();
int cx = c.x;
int cy = c.y;
Room.Door entrance = room.entrance();
entrance.set( Room.Door.Type.LOCKED );
level.addItemToSpawn( new IronKey( Dungeon.depth ) );
if (entrance.x == room.left) {
set( level, new Point( room.right-1, room.top+1 ), Terrain.STATUE );
set( level, new Point( room.right-1, room.bottom-1 ), Terrain.STATUE );
cx = room.right - 2;
} else if (entrance.x == room.right) {
set( level, new Point( room.left+1, room.top+1 ), Terrain.STATUE );
set( level, new Point( room.left+1, room.bottom-1 ), Terrain.STATUE );
cx = room.left + 2;
} else if (entrance.y == room.top) {
set( level, new Point( room.left+1, room.bottom-1 ), Terrain.STATUE );
set( level, new Point( room.right-1, room.bottom-1 ), Terrain.STATUE );
cy = room.bottom - 2;
} else if (entrance.y == room.bottom) {
set( level, new Point( room.left+1, room.top+1 ), Terrain.STATUE );
set( level, new Point( room.right-1, room.top+1 ), Terrain.STATUE );
cy = room.top + 2;
}
level.drop( prize( level ), cx + cy * Level.WIDTH ).type = Type.TOMB;
}
示例5: paint
import com.shatteredpixel.shatteredpixeldungeon.items.keys.IronKey; //导入依赖的package包/类
public static void paint( Level level, Room room ) {
fill( level, room, Terrain.WALL );
fill( level, room, 1, Terrain.EMPTY );
int cx = (room.left + room.right) / 2;
int cy = (room.top + room.bottom) / 2;
int c = cx + cy * Level.WIDTH;
switch (Random.Int( 3 )) {
case 0:
level.drop( prize( level ), c ).type = Type.LOCKED_CHEST;
level.addItemToSpawn( new GoldenKey( Dungeon.depth ) );
break;
case 1:
Item i1, i2;
do {
i1 = prize( level );
i2 = prize( level );
} while (i1.getClass() == i2.getClass());
level.drop( i1, c ).type = Type.CRYSTAL_CHEST;
level.drop( i2, c + Level.NEIGHBOURS8[Random.Int( 8 )]).type = Type.CRYSTAL_CHEST;
level.addItemToSpawn( new GoldenKey( Dungeon.depth ) );
break;
case 2:
level.drop( prize( level ), c );
set( level, c, Terrain.PEDESTAL );
break;
}
room.entrance().set( Room.Door.Type.LOCKED );
level.addItemToSpawn( new IronKey( Dungeon.depth ) );
}
示例6: onOperateComplete
import com.shatteredpixel.shatteredpixeldungeon.items.keys.IronKey; //导入依赖的package包/类
@Override
public void onOperateComplete() {
if (curAction instanceof HeroAction.Unlock) {
int doorCell = ((HeroAction.Unlock)curAction).dst;
int door = Dungeon.level.map[doorCell];
if (door == Terrain.LOCKED_DOOR){
Notes.remove(new IronKey(Dungeon.depth));
Level.set( doorCell, Terrain.DOOR );
} else {
Notes.remove(new SkeletonKey(Dungeon.depth));
Level.set( doorCell, Terrain.UNLOCKED_EXIT );
}
GameScene.updateKeyDisplay();
Level.set( doorCell, door == Terrain.LOCKED_DOOR ? Terrain.DOOR : Terrain.UNLOCKED_EXIT );
GameScene.updateMap( doorCell );
} else if (curAction instanceof HeroAction.OpenChest) {
Heap heap = Dungeon.level.heaps.get( ((HeroAction.OpenChest)curAction).dst );
if (heap.type == Type.SKELETON || heap.type == Type.REMAINS) {
Sample.INSTANCE.play( Assets.SND_BONES );
} else if (heap.type == Type.LOCKED_CHEST){
Notes.remove(new GoldenKey(Dungeon.depth));
} else if (heap.type == Type.CRYSTAL_CHEST){
Notes.remove(new CrystalKey(Dungeon.depth));
}
GameScene.updateKeyDisplay();
heap.open( this );
}
curAction = null;
super.onOperateComplete();
}
示例7: createItems
import com.shatteredpixel.shatteredpixeldungeon.items.keys.IronKey; //导入依赖的package包/类
@Override
protected void createItems() {
Item item = Bones.get();
if (item != null) {
drop( item, randomRespawnCell() ).type = Heap.Type.REMAINS;
}
drop(new IronKey(10), randomPrisonCell());
}
示例8: paint
import com.shatteredpixel.shatteredpixeldungeon.items.keys.IronKey; //导入依赖的package包/类
public void paint( Level level ) {
Painter.fill( level, this, Terrain.WALL );
Painter.fill( level, this, 1, Terrain.EMPTY_SP );
Door entrance = entrance();
Painter.fill( level, left + 1, top+1, width() - 2, 1 , Terrain.BOOKSHELF );
Painter.drawInside(level, this, entrance, 1, Terrain.EMPTY_SP );
int n = Random.IntRange( 2, 3 );
for (int i=0; i < n; i++) {
int pos;
do {
pos = level.pointToCell(random());
} while (level.map[pos] != Terrain.EMPTY_SP || level.heaps.get( pos ) != null);
Item item;
if (i == 0)
item = Random.Int(2) == 0 ? new ScrollOfIdentify() : new ScrollOfRemoveCurse();
else
item = prize( level );
level.drop( item, pos );
}
entrance.set( Door.Type.LOCKED );
level.addItemToSpawn( new IronKey( Dungeon.depth ) );
}
示例9: paint
import com.shatteredpixel.shatteredpixeldungeon.items.keys.IronKey; //导入依赖的package包/类
public void paint( Level level ) {
Door entrance = entrance();
entrance.set(Door.Type.LOCKED);
level.addItemToSpawn(new IronKey(Dungeon.depth));
Painter.fill(level, this, Terrain.WALL);
Painter.fill(level, this, 1, Terrain.GRASS);
int heartX = Random.IntRange(left+1, right-1);
int heartY = Random.IntRange(top+1, bottom-1);
if (entrance.x == left) {
heartX = right - 1;
} else if (entrance.x == right) {
heartX = left + 1;
} else if (entrance.y == top) {
heartY = bottom - 1;
} else if (entrance.y == bottom) {
heartY = top + 1;
}
placePlant(level, heartX + heartY * level.width(), new RotHeart());
int lashers = ((width()-2)*(height()-2))/8;
for (int i = 1; i <= lashers; i++){
int pos;
do {
pos = level.pointToCell(random());
} while (!validPlantPos(level, pos));
placePlant(level, pos, new RotLasher());
}
}
示例10: paint
import com.shatteredpixel.shatteredpixeldungeon.items.keys.IronKey; //导入依赖的package包/类
public void paint( Level level ) {
Painter.fill( level, this, Terrain.WALL );
Painter.fill( level, this, 1, Terrain.EMPTY );
Point c = center();
int cx = c.x;
int cy = c.y;
Door entrance = entrance();
entrance.set( Door.Type.LOCKED );
level.addItemToSpawn( new IronKey( Dungeon.depth ) );
if (entrance.x == left) {
Painter.set( level, new Point( right-1, top+1 ), Terrain.STATUE );
Painter.set( level, new Point( right-1, bottom-1 ), Terrain.STATUE );
cx = right - 2;
} else if (entrance.x == right) {
Painter.set( level, new Point( left+1, top+1 ), Terrain.STATUE );
Painter.set( level, new Point( left+1, bottom-1 ), Terrain.STATUE );
cx = left + 2;
} else if (entrance.y == top) {
Painter.set( level, new Point( left+1, bottom-1 ), Terrain.STATUE );
Painter.set( level, new Point( right-1, bottom-1 ), Terrain.STATUE );
cy = bottom - 2;
} else if (entrance.y == bottom) {
Painter.set( level, new Point( left+1, top+1 ), Terrain.STATUE );
Painter.set( level, new Point( right-1, top+1 ), Terrain.STATUE );
cy = top + 2;
}
level.drop( prize( level ), cx + cy * level.width() ).type = Heap.Type.TOMB;
}
示例11: update
import com.shatteredpixel.shatteredpixeldungeon.items.keys.IronKey; //导入依赖的package包/类
@Override
public void update() {
super.update();
float health = (float)Dungeon.hero.HP / Dungeon.hero.HT;
if (health == 0) {
avatar.tint( 0x000000, 0.6f );
blood.on = false;
} else if (health < 0.25f) {
avatar.tint( 0xcc0000, 0.4f );
blood.on = true;
} else {
avatar.resetColor();
blood.on = false;
}
hp.scale.x = health;
exp.scale.x = (width / exp.width) * Dungeon.hero.exp / Dungeon.hero.maxExp();
if (Dungeon.hero.lvl != lastLvl) {
if (lastLvl != -1) {
Emitter emitter = (Emitter)recycle( Emitter.class );
emitter.revive();
emitter.pos( 27, 27 );
emitter.burst( Speck.factory( Speck.STAR ), 12 );
}
lastLvl = Dungeon.hero.lvl;
level.text( Integer.toString( lastLvl ) );
level.measure();
level.x = PixelScene.align( 27.0f - level.width() / 2 );
level.y = PixelScene.align( 27.5f - level.baseLine() / 2 );
}
int k = IronKey.curDepthQuantity;
if (k != lastKeys) {
lastKeys = k;
keys.text( Integer.toString( lastKeys ) );
keys.measure();
keys.x = width - 8 - keys.width() - 18;
}
int tier = Dungeon.hero.tier();
if (tier != lastTier) {
lastTier = tier;
avatar.copy( HeroSprite.avatar( Dungeon.hero.heroClass, tier ) );
}
resume.setPos( width - resume.width(), (loot.visible ? loot.bottom() : danger.bottom()) + 2 );
}
示例12: restoreFromBundle
import com.shatteredpixel.shatteredpixeldungeon.items.keys.IronKey; //导入依赖的package包/类
public void restoreFromBundle( Bundle bundle ) {
//moving keys to Notes, for pre-0.6.1 saves
if (bundle.contains("ironKeys")) {
int[] ironKeys = bundle.getIntArray( "ironKeys" );
for (int i = 0; i < ironKeys.length; i++){
if (ironKeys[i] > 0){
Notes.add((Key) new IronKey(i).quantity(ironKeys[i]));
}
}
}
if (bundle.contains("specialKeys")) {
int[] specialKeys = bundle.getIntArray( "specialKeys" );
for (int i = 0; i < specialKeys.length; i++){
if (specialKeys[i] > 0){
if (i % 5 == 0){
Notes.add((Key) new SkeletonKey(i).quantity(specialKeys[i]));
} else {
Notes.add((Key) new GoldenKey(i).quantity(specialKeys[i]));
}
}
}
}
backpack.clear();
backpack.restoreFromBundle( bundle );
weapon = (KindOfWeapon) bundle.get(WEAPON);
if (weapon != null) {
weapon.activate(owner);
}
armor = (Armor)bundle.get( ARMOR );
if (armor != null){
armor.activate( owner );
}
misc1 = (KindofMisc)bundle.get(MISC1);
if (misc1 != null) {
misc1.activate( owner );
}
misc2 = (KindofMisc)bundle.get(MISC2);
if (misc2 != null) {
misc2.activate( owner );
}
}
示例13: actUnlock
import com.shatteredpixel.shatteredpixeldungeon.items.keys.IronKey; //导入依赖的package包/类
private boolean actUnlock( HeroAction.Unlock action ) {
int doorCell = action.dst;
if (Level.adjacent( pos, doorCell )) {
theKey = null;
int door = Dungeon.level.map[doorCell];
if (door == Terrain.LOCKED_DOOR) {
theKey = belongings.getKey( IronKey.class, Dungeon.depth );
} else if (door == Terrain.LOCKED_EXIT) {
theKey = belongings.getKey( SkeletonKey.class, Dungeon.depth );
}
if (theKey != null) {
spend( Key.TIME_TO_UNLOCK );
sprite.operate( doorCell );
Sample.INSTANCE.play( Assets.SND_UNLOCK );
} else {
GLog.w( TXT_LOCKED_DOOR );
ready();
}
return false;
} else if (getCloser( doorCell )) {
return true;
} else {
ready();
return false;
}
}
示例14: paint
import com.shatteredpixel.shatteredpixeldungeon.items.keys.IronKey; //导入依赖的package包/类
public void paint( Level level ) {
Painter.fill( level, this, Terrain.WALL );
Painter.fill( level, this, 1, Terrain.EMPTY );
Point c = center();
int cx = c.x;
int cy = c.y;
Door door = entrance();
door.set( Door.Type.LOCKED );
level.addItemToSpawn( new IronKey( Dungeon.depth ) );
if (door.x == left) {
Painter.fill( level, right - 1, top + 1, 1, height() - 2 , Terrain.STATUE );
cx = right - 2;
} else if (door.x == right) {
Painter.fill( level, left + 1, top + 1, 1, height() - 2 , Terrain.STATUE );
cx = left + 2;
} else if (door.y == top) {
Painter.fill( level, left + 1, bottom - 1, width() - 2, 1 , Terrain.STATUE );
cy = bottom - 2;
} else if (door.y == bottom) {
Painter.fill( level, left + 1, top + 1, width() - 2, 1 , Terrain.STATUE );
cy = top + 2;
}
Statue statue = new Statue();
statue.pos = cx + cy * level.width();
level.mobs.add( statue );
}
示例15: paint
import com.shatteredpixel.shatteredpixeldungeon.items.keys.IronKey; //导入依赖的package包/类
public static void paint( Level level, Room room ) {
fill( level, room, Terrain.WALL );
fill( level, room, 1, Terrain.EMPTY );
Point c = room.center();
int cx = c.x;
int cy = c.y;
Room.Door door = room.entrance();
door.set( Room.Door.Type.LOCKED );
level.addItemToSpawn( new IronKey( Dungeon.depth ) );
if (door.x == room.left) {
fill( level, room.right - 1, room.top + 1, 1, room.height() - 1 , Terrain.STATUE );
cx = room.right - 2;
} else if (door.x == room.right) {
fill( level, room.left + 1, room.top + 1, 1, room.height() - 1 , Terrain.STATUE );
cx = room.left + 2;
} else if (door.y == room.top) {
fill( level, room.left + 1, room.bottom - 1, room.width() - 1, 1 , Terrain.STATUE );
cy = room.bottom - 2;
} else if (door.y == room.bottom) {
fill( level, room.left + 1, room.top + 1, room.width() - 1, 1 , Terrain.STATUE );
cy = room.top + 2;
}
Statue statue = new Statue();
statue.pos = cx + cy * Level.WIDTH;
level.mobs.add( statue );
Actor.occupyCell( statue );
}