当前位置: 首页>>代码示例>>Java>>正文


Java Dungeon类代码示例

本文整理汇总了Java中com.shatteredpixel.shatteredpixeldungeon.Dungeon的典型用法代码示例。如果您正苦于以下问题:Java Dungeon类的具体用法?Java Dungeon怎么用?Java Dungeon使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Dungeon类属于com.shatteredpixel.shatteredpixeldungeon包,在下文中一共展示了Dungeon类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: act

import com.shatteredpixel.shatteredpixeldungeon.Dungeon; //导入依赖的package包/类
@Override
public boolean act() {
	if (target.isAlive()) {
           if (Dungeon.depth > 4)
		    target.damage( Dungeon.depth/5, this );
           else if (Random.Int(2) == 0)
               target.damage( 1, this );
		if (!target.isAlive() && target == Dungeon.hero) {
			Dungeon.fail( ResultDescriptions.OOZE );
			GLog.n( TXT_HERO_KILLED, toString() );
		}
		spend( TICK );
	}
	if (Level.water[target.pos]) {
		detach();
	}
	return true;
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:19,代码来源:Ooze.java

示例2: update

import com.shatteredpixel.shatteredpixeldungeon.Dungeon; //导入依赖的package包/类
@Override
public void update() {
	super.update();
	
	if (lastEnabled != Dungeon.hero.ready) {
		lastEnabled = Dungeon.hero.ready;
		
		for (Gizmo tool : members) {
			if (tool instanceof Tool) {
				((Tool)tool).enable( lastEnabled );
			}
		}
	}
	
	//btnResume.visible = Dungeon.hero.lastAction != null;
	
	if (!Dungeon.hero.isAlive()) {
		btnInventory.enable( true );
	}

	//If we have 2 slots, and 2nd one isn't visible, or we have 1, and 2nd one is visible...
	if ((QuickSlots == 1) == btnQuick2.visible){
		layout();
	}
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:26,代码来源:Toolbar.java

示例3: affectCell

import com.shatteredpixel.shatteredpixeldungeon.Dungeon; //导入依赖的package包/类
public static void affectCell( int cell ) {
	
	Class<?>[] waters = {WaterOfHealth.class, WaterOfAwareness.class, WaterOfTransmutation.class};
	
	for (Class<?>waterClass : waters) {
		WellWater water = (WellWater)Dungeon.level.blobs.get( waterClass );
		if (water != null && 
			water.volume > 0 && 
			water.pos == cell && 
			water.affect()) {
			
			Level.set( cell, Terrain.EMPTY_WELL );
			GameScene.updateMap( cell );
			
			return;
		}
	}
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:19,代码来源:WellWater.java

示例4: respawner

import com.shatteredpixel.shatteredpixeldungeon.Dungeon; //导入依赖的package包/类
public Actor respawner() {
	return new Actor() {	
		@Override
		protected boolean act() {
			if (mobs.size() < nMobs()) {

				Mob mob = Bestiary.mutable( Dungeon.depth );
				mob.state = mob.WANDERING;
				mob.pos = randomRespawnCell();
				if (Dungeon.hero.isAlive() && mob.pos != -1) {
					GameScene.add( mob );
					if (Statistics.amuletObtained) {
						mob.beckon( Dungeon.hero.pos );
					}
				}
			}
			spend( Dungeon.level.feeling == Feeling.DARK || Statistics.amuletObtained ? TIME_TO_RESPAWN / 2 : TIME_TO_RESPAWN );
			return true;
		}
	};
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:22,代码来源:Level.java

示例5: actBuy

import com.shatteredpixel.shatteredpixeldungeon.Dungeon; //导入依赖的package包/类
private boolean actBuy( HeroAction.Buy action ) {
	int dst = action.dst;
	if (pos == dst || Level.adjacent( pos, dst )) {

		ready();
		
		Heap heap = Dungeon.level.heaps.get( dst );
		if (heap != null && heap.type == Type.FOR_SALE && heap.size() == 1) {
			GameScene.show( new WndTradeItem( heap, true ) );
		}

           return false;

	} else if (getCloser( dst )) {

           return true;

	} else {
		ready();
           return false;
	}
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:23,代码来源:Hero.java

示例6: actCook

import com.shatteredpixel.shatteredpixeldungeon.Dungeon; //导入依赖的package包/类
private boolean actCook( HeroAction.Cook action ) {
	int dst = action.dst;
	if (Dungeon.visible[dst]) {

		ready();
		AlchemyPot.operate( this, dst );
           return false;

	} else if (getCloser( dst )) {

           return true;

	} else {
		ready();
           return false;
	}
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:18,代码来源:Hero.java

示例7: act

import com.shatteredpixel.shatteredpixeldungeon.Dungeon; //导入依赖的package包/类
@Override
protected boolean act() {
	if (!Level.water[pos]) {
		die( null );
		return true;
	} else {
		//this causes pirahna to move away when a door is closed on them.
		Dungeon.level.updateFieldOfView( this );
		enemy = chooseEnemy();
		if (state == this.HUNTING && !(enemy.isAlive() && Level.fieldOfView[enemy.pos] && enemy.invisible <= 0)){
			state = this.WANDERING;
			int oldPos = pos;
			int i = 0;
			do {
				i++;
				target = Dungeon.level.randomDestination();
				if (i == 100) return true;
			} while (!getCloser(target));
			moveSprite( oldPos, pos );
			return true;
		}

		return super.act();
	}
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:26,代码来源:Piranha.java

示例8: getCloser

import com.shatteredpixel.shatteredpixeldungeon.Dungeon; //导入依赖的package包/类
protected boolean getCloser( int target ) {
	
	if (rooted) {
		return false;
	}
	
	int step = Dungeon.findPath( this, pos, target, 
		Level.passable, 
		Level.fieldOfView );
	if (step != -1) {
		move( step );
		return true;
	} else {
		return false;
	}
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:17,代码来源:Mob.java

示例9: onThrow

import com.shatteredpixel.shatteredpixeldungeon.Dungeon; //导入依赖的package包/类
@Override
protected void onThrow( int cell ) {
	Char enemy = Actor.findChar( cell );
	if (enemy == null || enemy == curUser) {
		if (Level.flamable[cell]) {
			GameScene.add( Blob.seed( cell, 4, Fire.class ) );
		} else {
			super.onThrow( cell );
		}
	} else {
		if (!curUser.shoot( enemy, this )) {
			Dungeon.level.drop( this, cell ).sprite.drop();
           } else {
               int bonus = 0;
               for (Buff buff : curUser.buffs(RingOfSharpshooting.Aim.class)) {
                   bonus += ((RingOfSharpshooting.Aim)buff).level;
               }
               if (Random.Float() > Math.pow(0.7, bonus))
                   Dungeon.level.drop( this, cell ).sprite.drop();
		}
	}
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:23,代码来源:IncendiaryDart.java

示例10: detachAll

import com.shatteredpixel.shatteredpixeldungeon.Dungeon; //导入依赖的package包/类
public final Item detachAll( Bag container ) {
	Dungeon.quickslot.clearItem( this );
	updateQuickslot();

	for (Item item : container.items) {
           if (item == this) {
               container.items.remove(this);
               item.onDetach();
               return this;
           } else if (item instanceof Bag) {
               Bag bag = (Bag)item;
               if (bag.contains( this )) {
                   return detachAll( bag );
               }
           }
       }
	
	return this;
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:20,代码来源:Item.java

示例11: activate

import com.shatteredpixel.shatteredpixeldungeon.Dungeon; //导入依赖的package包/类
@Override
public void activate( Char ch ) {
	super.activate( ch );
	
	if (ch != null) {
           int len = Random.Int( 5, 10 );
		Buff.prolong( ch, Blindness.class, len );
           Buff.prolong( ch, Cripple.class, len );
		if (ch instanceof Mob) {
			((Mob)ch).state = ((Mob)ch).WANDERING;
			((Mob)ch).beckon( Dungeon.level.randomDestination() );
		}
	}
	
	if (Dungeon.visible[pos]) {
		CellEmitter.get( pos ).burst( Speck.factory( Speck.LIGHT ), 4 );
	}
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:19,代码来源:Blindweed.java

示例12: dispel

import com.shatteredpixel.shatteredpixeldungeon.Dungeon; //导入依赖的package包/类
public static void dispel() {
	Invisibility buff = Dungeon.hero.buff( Invisibility.class );
	if (buff != null) {
		buff.detach();
	}
       CloakOfShadows.cloakStealth cloakBuff = Dungeon.hero.buff( CloakOfShadows.cloakStealth.class );
       if (cloakBuff != null) {
           cloakBuff.act();
           cloakBuff.detach();
       }
       //this isn't a form of invisibilty, but it is meant to dispel at the same time as it.
       TimekeepersHourglass.timeFreeze timeFreeze = Dungeon.hero.buff( TimekeepersHourglass.timeFreeze.class );
       if (timeFreeze != null) {
           timeFreeze.detach();
       }
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:17,代码来源:Invisibility.java

示例13: proc

import com.shatteredpixel.shatteredpixeldungeon.Dungeon; //导入依赖的package包/类
@Override
public boolean proc( Weapon weapon, Char attacker, Char defender, int damage ) {
	// lvl 0 - 20%
	// lvl 1 - 33%
	// lvl 2 - 43%
	int level = Math.max( 0, weapon.level );
	
	if (Random.Int( level + 5 ) >= 4) {

           if (defender == Dungeon.hero) {
               Buff.affect( defender, Vertigo.class, Vertigo.duration(defender) );
           } else {
               Buff.affect( defender, Terror.class, Terror.DURATION ).source = attacker;
           }
		
		return true;
	} else {
		return false;
	}
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:21,代码来源:Horror.java

示例14: spawnAt

import com.shatteredpixel.shatteredpixeldungeon.Dungeon; //导入依赖的package包/类
public static Wraith spawnAt( int pos ) {
	if (Level.passable[pos] && Actor.findChar( pos ) == null) {
		
		Wraith w = new Wraith();
		w.adjustStats( Dungeon.depth );
		w.pos = pos;
		w.state = w.HUNTING;
		GameScene.add( w, SPAWN_DELAY );
		
		w.sprite.alpha( 0 );
		w.sprite.parent.add( new AlphaTweener( w.sprite, 1, 0.5f ) );
		
		w.sprite.emitter().burst( ShadowParticle.CURSE, 5 );
		
		return w;
	} else {
		return null;
	}
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:20,代码来源:Wraith.java

示例15: placeItems

import com.shatteredpixel.shatteredpixeldungeon.Dungeon; //导入依赖的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 ) );
	}
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:27,代码来源:WndBag.java


注:本文中的com.shatteredpixel.shatteredpixeldungeon.Dungeon类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。