當前位置: 首頁>>代碼示例>>Java>>正文


Java Dungeon.fail方法代碼示例

本文整理匯總了Java中com.shatteredpixel.shatteredpixeldungeon.Dungeon.fail方法的典型用法代碼示例。如果您正苦於以下問題:Java Dungeon.fail方法的具體用法?Java Dungeon.fail怎麽用?Java Dungeon.fail使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.shatteredpixel.shatteredpixeldungeon.Dungeon的用法示例。


在下文中一共展示了Dungeon.fail方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: die

import com.shatteredpixel.shatteredpixeldungeon.Dungeon; //導入方法依賴的package包/類
@Override
public void die( Object cause ) {
	
	super.die( cause );
	
	boolean heroKilled = false;
	for (int i=0; i < Level.NEIGHBOURS8.length; i++) {
		Char ch = findChar( pos + Level.NEIGHBOURS8[i] );
		if (ch != null && ch.isAlive()) {
			int damage = Math.max( 0,  damageRoll() - Random.IntRange( 0, ch.dr() / 2 ) );
			ch.damage( damage, this );
			if (ch == Dungeon.hero && !ch.isAlive()) {
				heroKilled = true;
			}
		}
	}
	
	if (Dungeon.visible[pos]) {
		Sample.INSTANCE.play( Assets.SND_BONES );
	}
	
	if (heroKilled) {
		Dungeon.fail( Utils.format( ResultDescriptions.MOB, Utils.indefinite( name ) ) );
		GLog.n( TXT_HERO_KILLED );
	}
}
 
開發者ID:wolispace,項目名稱:soft-pixel-dungeon,代碼行數:27,代碼來源:Skeleton.java

示例2: zap

import com.shatteredpixel.shatteredpixeldungeon.Dungeon; //導入方法依賴的package包/類
private void zap() {
	spend( TIME_TO_ZAP );
	
	if (hit( this, enemy, true )) {
		if (enemy == Dungeon.hero && Random.Int( 2 ) == 0) {
			Buff.prolong( enemy, Weakness.class, Weakness.duration( enemy ) );
		}
		
		int dmg = Random.Int( 12, 18 );
		enemy.damage( dmg, this );
		
		if (!enemy.isAlive() && enemy == Dungeon.hero) {
			Dungeon.fail( Utils.format( ResultDescriptions.MOB, Utils.indefinite( name ) ) );
			GLog.n( TXT_SHADOWBOLT_KILLED, name );
		}
	} else {
		enemy.sprite.showStatus( CharSprite.NEUTRAL,  enemy.defenseVerb() );
	}
}
 
開發者ID:wolispace,項目名稱:soft-pixel-dungeon,代碼行數:20,代碼來源:Warlock.java

示例3: 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

示例4: onZap

import com.shatteredpixel.shatteredpixeldungeon.Dungeon; //導入方法依賴的package包/類
@Override
protected void onZap( int cell ) {
			
	Char ch = Actor.findChar( cell );
	if (ch != null) {	
		
		int level = level();
		
		ch.damage( Random.Int( 1, 6 + level * 2 ), this );
		
		ch.sprite.burst( 0xFF99CCFF, level / 2 + 2 );
		
		if (ch == curUser && !ch.isAlive()) {
			Dungeon.fail( Utils.format( ResultDescriptions.ITEM, name ) );
			GLog.n( "You killed yourself with your own Wand of Magic Missile..." );
		}
	}
}
 
開發者ID:wolispace,項目名稱:soft-pixel-dungeon,代碼行數:19,代碼來源:WandOfMagicMissile.java

示例5: onDeath

import com.shatteredpixel.shatteredpixeldungeon.Dungeon; //導入方法依賴的package包/類
@Override
public void onDeath() {
	
	Badges.validateDeathFromGas();
	
	Dungeon.fail( ResultDescriptions.GAS );
	GLog.n( "You died from a toxic gas.." );
}
 
開發者ID:wolispace,項目名稱:soft-pixel-dungeon,代碼行數:9,代碼來源:ToxicGas.java

示例6: attack

import com.shatteredpixel.shatteredpixeldungeon.Dungeon; //導入方法依賴的package包/類
@Override
public boolean attack( Char enemy ) {
	
	if (!Level.adjacent( pos, enemy.pos )) {
		spend( attackDelay() );
		
		if (hit( this, enemy, true )) {
			
			int dmg =  damageRoll();
			enemy.damage( dmg, this );
			
			enemy.sprite.bloodBurstA( sprite.center(), dmg );
			enemy.sprite.flash();
			
			if (!enemy.isAlive() && enemy == Dungeon.hero) {
				Dungeon.fail( Utils.format( ResultDescriptions.UNIQUE, name ) );
				GLog.n( TXT_KILL, name );
			}
			return true;
			
		} else {
			
			enemy.sprite.showStatus( CharSprite.NEUTRAL,  enemy.defenseVerb() );
			return false;
		}
	} else {
		return super.attack( enemy );
	}
}
 
開發者ID:wolispace,項目名稱:soft-pixel-dungeon,代碼行數:30,代碼來源:Yog.java

示例7: attack

import com.shatteredpixel.shatteredpixeldungeon.Dungeon; //導入方法依賴的package包/類
@Override
public boolean attack( Char enemy ) {
	
	for (int i=1; i < Ballistica.distance; i++) {
		
		int pos = Ballistica.trace[i];
		
		Char ch = Actor.findChar( pos );
		if (ch == null) {
			continue;
		}
		
		if (hit( this, ch, true )) {
			ch.damage( Random.NormalIntRange( 14, 20 ), this );
			
			if (Dungeon.visible[pos]) {
				ch.sprite.flash();
				CellEmitter.center( pos ).burst( PurpleParticle.BURST, Random.IntRange( 1, 2 ) );
			}
			
			if (!ch.isAlive() && ch == Dungeon.hero) {
				Dungeon.fail( Utils.format( ResultDescriptions.MOB, Utils.indefinite( name ) ) );
				GLog.n( TXT_DEATHGAZE_KILLED, name );
			}
		} else {
			ch.sprite.showStatus( CharSprite.NEUTRAL,  ch.defenseVerb() );
		}
	}
	
	return true;
}
 
開發者ID:wolispace,項目名稱:soft-pixel-dungeon,代碼行數:32,代碼來源:Eye.java

示例8: onDeath

import com.shatteredpixel.shatteredpixeldungeon.Dungeon; //導入方法依賴的package包/類
@Override
public void onDeath() {
	Badges.validateDeathFromPoison();
	
	Dungeon.fail( ResultDescriptions.POISON );
	GLog.n( "You died from poison..." );
}
 
開發者ID:wolispace,項目名稱:soft-pixel-dungeon,代碼行數:8,代碼來源:Poison.java

示例9: onDeath

import com.shatteredpixel.shatteredpixeldungeon.Dungeon; //導入方法依賴的package包/類
@Override
public void onDeath() {
	
	Badges.validateDeathFromHunger();
	
	Dungeon.fail( ResultDescriptions.HUNGER );
	GLog.n( TXT_DEATH );
}
 
開發者ID:wolispace,項目名稱:soft-pixel-dungeon,代碼行數:9,代碼來源:Hunger.java

示例10: onDeath

import com.shatteredpixel.shatteredpixeldungeon.Dungeon; //導入方法依賴的package包/類
@Override
public void onDeath() {
	
	Badges.validateDeathFromFire();
	
	Dungeon.fail( ResultDescriptions.BURNING );
	GLog.n( TXT_BURNED_TO_DEATH );
}
 
開發者ID:wolispace,項目名稱:soft-pixel-dungeon,代碼行數:9,代碼來源:Burning.java

示例11: act

import com.shatteredpixel.shatteredpixeldungeon.Dungeon; //導入方法依賴的package包/類
@Override
public boolean act() {
	if (target.isAlive()) {
		
		if ((level = Random.Int( level / 2, level )) > 0) {
			
			target.damage( level, this );
			if (target.sprite.visible) {
				Splash.at( target.sprite.center(), -PointF.PI / 2, PointF.PI / 6, 
						target.sprite.blood(), Math.min( 10 * level / target.HT, 10 ) );
			}
			
			if (target == Dungeon.hero && !target.isAlive()) {
				Dungeon.fail( ResultDescriptions.BLEEDING );
				GLog.n( "You bled to death..." );
			}
			
			spend( TICK );
		} else {
			detach();
		}
		
	} else {
		
		detach();
		
	}
	
	return true;
}
 
開發者ID:wolispace,項目名稱:soft-pixel-dungeon,代碼行數:31,代碼來源:Bleeding.java

示例12: trigger

import com.shatteredpixel.shatteredpixeldungeon.Dungeon; //導入方法依賴的package包/類
public static void trigger( int pos, Char ch ) {
	
	if (ch != null) {
		ch.damage( Math.max( 1, Random.Int( ch.HP / 3, 2 * ch.HP / 3 ) ), LIGHTNING );
		if (ch == Dungeon.hero) {
			
			Camera.main.shake( 2, 0.3f );
			
			if (!ch.isAlive()) {
				Dungeon.fail( Utils.format( ResultDescriptions.TRAP, name ) );
				GLog.n( "You were killed by a discharge of a lightning trap..." );
			} else {
				((Hero)ch).belongings.charge( false );
			}
		}
		
		int[] points = new int[2];
		
		points[0] = pos - Level.WIDTH;
		points[1] = pos + Level.WIDTH;
		ch.sprite.parent.add( new Lightning( points, 2, null ) );
		
		points[0] = pos - 1;
		points[1] = pos + 1;
		ch.sprite.parent.add( new Lightning( points, 2, null ) );
	}
	
	CellEmitter.center( pos ).burst( SparkParticle.FACTORY, Random.IntRange( 3, 4 ) );
	
}
 
開發者ID:wolispace,項目名稱:soft-pixel-dungeon,代碼行數:31,代碼來源:LightningTrap.java

示例13: act

import com.shatteredpixel.shatteredpixeldungeon.Dungeon; //導入方法依賴的package包/類
@Override
public boolean act() {
	if (target.isAlive()) {
		
		target.damage( 1, this );
		if (target == Dungeon.hero && !target.isAlive()) {
			// FIXME
			Glyph glyph = new Viscosity();
			Dungeon.fail( Utils.format( ResultDescriptions.GLYPH, glyph.name() ) );
			GLog.n( "%s killed you...", glyph.name() );
			
			Badges.validateDeathFromGlyph();
		}
		spend( TICK );
		
		if (--damage <= 0) {
			detach();
		}
		
	} else {
		
		detach();
		
	}
	
	return true;
}
 
開發者ID:wolispace,項目名稱:soft-pixel-dungeon,代碼行數:28,代碼來源:Viscosity.java

示例14: doRead

import com.shatteredpixel.shatteredpixeldungeon.Dungeon; //導入方法依賴的package包/類
@Override
protected void doRead() {
	
	GameScene.flash( 0xFFFFFF );
	
	Sample.INSTANCE.play( Assets.SND_BLAST );
	Invisibility.dispel();
	
	for (Mob mob : Dungeon.level.mobs.toArray( new Mob[0] )) {
		if (Level.fieldOfView[mob.pos]) {
			mob.damage(mob.HT, this );
		}
	}

	curUser.damage(Random.IntRange(curUser.HT/4, curUser.HT/2), this);
       Buff.prolong( curUser, Paralysis.class, Random.Int( 4, 6 ) );
	Buff.prolong( curUser, Blindness.class, Random.Int( 6, 9 ) );
	Dungeon.observe();
	
	setKnown();
	
	curUser.spendAndNext( TIME_TO_READ );

       if (!curUser.isAlive()) {
           Dungeon.fail( Utils.format(ResultDescriptions.ITEM, name ));
           GLog.n("The Psionic Blast tears your mind apart...");
       }
}
 
開發者ID:wolispace,項目名稱:soft-pixel-dungeon,代碼行數:29,代碼來源:ScrollOfPsionicBlast.java

示例15: prick

import com.shatteredpixel.shatteredpixeldungeon.Dungeon; //導入方法依賴的package包/類
private void prick(Hero hero){
    int damage = 3*(level*level);

    Earthroot.Armor armor = hero.buff(Earthroot.Armor.class);
    if (armor != null) {
        damage = armor.absorb(damage);
    }

    damage -= Random.IntRange(0, hero.dr());

    hero.sprite.operate( hero.pos );
    hero.busy();
    hero.spend(3f);
    if (damage <= 0){
        GLog.i("You prick yourself, and your blood drips into the chalice.");
    } else if (damage < 25){
        GLog.w("You prick yourself and the chalice feeds on you.");
        Sample.INSTANCE.play(Assets.SND_CURSED);
        hero.sprite.emitter().burst( ShadowParticle.CURSE, 6 );
    } else if (damage < 100){
        GLog.w("Your life essence drains into the chalice.");
        Sample.INSTANCE.play(Assets.SND_CURSED);
        hero.sprite.emitter().burst( ShadowParticle.CURSE, 12 );
    } else {
        GLog.w("The chalice devours your life energy.");
        Sample.INSTANCE.play(Assets.SND_CURSED);
        hero.sprite.emitter().burst( ShadowParticle.CURSE, 18 );
    }

    if (damage > 0)
        hero.damage(damage, this);

    if (!hero.isAlive()) {
        Dungeon.fail(Utils.format( ResultDescriptions.ITEM, name ));
        GLog.n("The Chalice sucks your life essence dry...");
    } else {
        upgrade();
    }
}
 
開發者ID:wolispace,項目名稱:soft-pixel-dungeon,代碼行數:40,代碼來源:ChaliceOfBlood.java


注:本文中的com.shatteredpixel.shatteredpixeldungeon.Dungeon.fail方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。