本文整理汇总了Java中com.shatteredpixel.shatteredpixeldungeon.items.Gold类的典型用法代码示例。如果您正苦于以下问题:Java Gold类的具体用法?Java Gold怎么用?Java Gold使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Gold类属于com.shatteredpixel.shatteredpixeldungeon.items包,在下文中一共展示了Gold类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: drop
import com.shatteredpixel.shatteredpixeldungeon.items.Gold; //导入依赖的package包/类
public void drop() {
if (heap.isEmpty()) {
return;
}
dropInterval = DROP_INTERVAL;
speed.set( 0, -100 );
acc.set( 0, -speed.y / DROP_INTERVAL * 2 );
if (visible && heap != null && heap.peek() instanceof Gold) {
CellEmitter.center( heap.pos ).burst( Speck.factory( Speck.COIN ), 5 );
Sample.INSTANCE.play( Assets.SND_GOLD, 1, 1, Random.Float( 0.9f, 1.1f ) );
}
}
示例2: placeItems
import com.shatteredpixel.shatteredpixeldungeon.items.Gold; //导入依赖的package包/类
protected void placeItems( Bag container ) {
// Equipped items
Belongings stuff = Dungeon.hero.belongings;
placeItem( stuff.weapon != null ? stuff.weapon : new Placeholder( ItemSpriteSheet.WEAPON ) );
placeItem( stuff.armor != null ? stuff.armor : new Placeholder( ItemSpriteSheet.ARMOR ) );
placeItem( stuff.misc1 != null ? stuff.misc1 : new Placeholder( ItemSpriteSheet.RING ) );
placeItem( stuff.misc2 != null ? stuff.misc2 : new Placeholder( ItemSpriteSheet.RING ) );
// Unequipped items
for (Item item : container.items) {
placeItem( item );
}
// Empty slots
while (count-4 < container.size) {
placeItem( null );
}
// Gold
if (container == Dungeon.hero.belongings.backpack) {
row = ROWS - 1;
col = COLS - 1;
placeItem( new Gold( Dungeon.gold ) );
}
}
示例3: paintGraveyard
import com.shatteredpixel.shatteredpixeldungeon.items.Gold; //导入依赖的package包/类
private static void paintGraveyard( Level level, Room room ) {
fill( level, room.left + 1, room.top + 1, room.width() - 1, room.height() - 1 , Terrain.GRASS );
int w = room.width() - 1;
int h = room.height() - 1;
int nGraves = Math.max( w, h ) / 2;
int index = Random.Int( nGraves );
int shift = Random.Int( 2 );
for (int i=0; i < nGraves; i++) {
int pos = w > h ?
room.left + 1 + shift + i * 2 + (room.top + 2 + Random.Int( h-2 )) * Level.WIDTH :
(room.left + 2 + Random.Int( w-2 )) + (room.top + 1 + shift + i * 2) * Level.WIDTH;
level.drop( i == index ? Generator.random() : new Gold(), pos ).type = Heap.Type.TOMB;
}
}
示例4: drop
import com.shatteredpixel.shatteredpixeldungeon.items.Gold; //导入依赖的package包/类
public void drop() {
if (heap.isEmpty()) {
return;
} else if (heap.size() == 1){
// normally this would happen for any heap, however this is not applied to heaps greater than 1 in size
// in order to preserve an amusing visual bug/feature that used to trigger for heaps with size > 1
// where as long as the player continually taps, the heap sails up into the air.
place(heap.pos);
}
dropInterval = DROP_INTERVAL;
speed.set( 0, -100 );
acc.set(0, -speed.y / DROP_INTERVAL * 2);
if (heap != null && heap.seen && heap.peek() instanceof Gold) {
CellEmitter.center( heap.pos ).burst( Speck.factory( Speck.COIN ), 5 );
Sample.INSTANCE.play( Assets.SND_GOLD, 1, 1, Random.Float( 0.9f, 1.1f ) );
}
}
示例5: paint
import com.shatteredpixel.shatteredpixeldungeon.items.Gold; //导入依赖的package包/类
@Override
public void paint(Level level) {
Painter.fill( level, this, Terrain.WALL );
for (Door door : connected.values()) {
door.set( Door.Type.REGULAR );
}
Painter.fill( level, this, 1 , Terrain.GRASS );
int w = width() - 2;
int h = height() - 2;
int nGraves = Math.max( w, h ) / 2;
int index = Random.Int( nGraves );
int shift = Random.Int( 2 );
for (int i=0; i < nGraves; i++) {
int pos = w > h ?
left + 1 + shift + i * 2 + (top + 2 + Random.Int( h-2 )) * level.width() :
(left + 2 + Random.Int( w-2 )) + (top + 1 + shift + i * 2) * level.width();
level.drop( i == index ? Generator.random() : new Gold().random(), pos ).type = Heap.Type.TOMB;
}
}
示例6: paint
import com.shatteredpixel.shatteredpixeldungeon.items.Gold; //导入依赖的package包/类
@Override
public void paint(Level level) {
super.paint(level);
Item i = level.findPrizeItem();
if ( i == null ){
i = new Gold().random();
}
int center = level.pointToCell(center());
Painter.set(level, center, Terrain.PEDESTAL);
if (Random.Int(3) == 0) {
level.drop(i, center).type = Heap.Type.MIMIC;
} else {
level.drop(i, center).type = Heap.Type.CHEST;
}
}
示例7: createLoot
import com.shatteredpixel.shatteredpixeldungeon.items.Gold; //导入依赖的package包/类
@Override
protected Item createLoot(){
if (Dungeon.limitedDrops.armband.count == 0) {
Dungeon.limitedDrops.armband.count++;
return super.createLoot();
} else
return new Gold(Random.NormalIntRange(100, 250));
}
示例8: defenseProc
import com.shatteredpixel.shatteredpixeldungeon.items.Gold; //导入依赖的package包/类
@Override
public int defenseProc(Char enemy, int damage) {
if (state == FLEEING) {
Dungeon.level.drop( new Gold(), pos ).sprite.drop();
}
return damage;
}
示例9: ItemButton
import com.shatteredpixel.shatteredpixeldungeon.items.Gold; //导入依赖的package包/类
public ItemButton( Item item ) {
super( item );
this.item = item;
if (item instanceof Gold) {
bg.visible = false;
}
width = height = SLOT_SIZE;
}
示例10: sell
import com.shatteredpixel.shatteredpixeldungeon.items.Gold; //导入依赖的package包/类
private void sell( Item item ) {
Hero hero = Dungeon.hero;
if (item.isEquipped( hero ) && !((EquipableItem)item).doUnequip( hero, false )) {
return;
}
item.detachAll( hero.belongings.backpack );
int price = item.price();
new Gold( price ).doPickUp( hero );
GLog.i( TXT_SOLD, item.name(), price );
}
示例11: sellOne
import com.shatteredpixel.shatteredpixeldungeon.items.Gold; //导入依赖的package包/类
private void sellOne( Item item ) {
if (item.quantity() <= 1) {
sell( item );
} else {
Hero hero = Dungeon.hero;
item = item.detach( hero.belongings.backpack );
int price = item.price();
new Gold( price ).doPickUp( hero );
GLog.i( TXT_SOLD, item.name(), price );
}
}
示例12: createLoot
import com.shatteredpixel.shatteredpixeldungeon.items.Gold; //导入依赖的package包/类
@Override
protected Item createLoot(){
if (!Dungeon.LimitedDrops.THIEVES_ARMBAND.dropped()) {
Dungeon.LimitedDrops.THIEVES_ARMBAND.drop();
return new MasterThievesArmband().identify();
} else
return new Gold(Random.NormalIntRange(100, 250));
}
示例13: defenseProc
import com.shatteredpixel.shatteredpixeldungeon.items.Gold; //导入依赖的package包/类
@Override
public int defenseProc(Char enemy, int damage) {
if (state == FLEEING) {
Dungeon.level.drop( new Gold(), pos ).sprite.drop();
}
return super.defenseProc(enemy, damage);
}
示例14: ItemButton
import com.shatteredpixel.shatteredpixeldungeon.items.Gold; //导入依赖的package包/类
public ItemButton( Item item ) {
super( item );
this.item = item;
if (item instanceof Gold) {
bg.visible = false;
}
width = SLOT_WIDTH;
height = SLOT_HEIGHT;
}
示例15: sell
import com.shatteredpixel.shatteredpixeldungeon.items.Gold; //导入依赖的package包/类
private void sell( Item item ) {
Hero hero = Dungeon.hero;
if (item.isEquipped( hero ) && !((EquipableItem)item).doUnequip( hero, false )) {
return;
}
item.detachAll( hero.belongings.backpack );
new Gold( item.price() ).doPickUp( hero );
//selling items in the sell interface doesn't spend time
hero.spend(-hero.cooldown());
}