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


Java Yog類代碼示例

本文整理匯總了Java中com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Yog的典型用法代碼示例。如果您正苦於以下問題:Java Yog類的具體用法?Java Yog怎麽用?Java Yog使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Yog類屬於com.shatteredpixel.shatteredpixeldungeon.actors.mobs包,在下文中一共展示了Yog類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: press

import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Yog; //導入依賴的package包/類
@Override
public void press( int cell, Char hero ) {
	
	super.press( cell, hero );
	
	if (!enteredArena && hero == Dungeon.hero && cell != entrance) {
		
		enteredArena = true;
           locked = true;
		
		for (int i=ROOM_LEFT-1; i <= ROOM_RIGHT + 1; i++) {
			doMagic( (ROOM_TOP - 1) * WIDTH + i );
			doMagic( (ROOM_BOTTOM + 1) * WIDTH + i );
		}
		for (int i=ROOM_TOP; i < ROOM_BOTTOM + 1; i++) {
			doMagic( i * WIDTH + ROOM_LEFT - 1 );
			doMagic( i * WIDTH + ROOM_RIGHT + 1 );
		}
		doMagic( entrance );
		GameScene.updateMap();

		Dungeon.observe();
		
		Yog boss = new Yog();
		do {
			boss.pos = Random.Int( LENGTH );
		} while (
			!passable[boss.pos] ||
			Dungeon.visible[boss.pos]);
		GameScene.add( boss );
		boss.spawnFists();
		
		stairs = entrance;
		entrance = -1;
	}
}
 
開發者ID:wolispace,項目名稱:soft-pixel-dungeon,代碼行數:37,代碼來源:HallsBossLevel.java

示例2: press

import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Yog; //導入依賴的package包/類
@Override
public void press( int cell, Char hero ) {
	
	super.press( cell, hero );
	
	if (!enteredArena && hero == Dungeon.hero && cell != entrance) {
		
		enteredArena = true;
		seal();
		
		for (int i=ROOM_LEFT-1; i <= ROOM_RIGHT + 1; i++) {
			doMagic( (ROOM_TOP - 1) * width() + i );
			doMagic( (ROOM_BOTTOM + 1) * width() + i );
		}
		for (int i=ROOM_TOP; i < ROOM_BOTTOM + 1; i++) {
			doMagic( i * width() + ROOM_LEFT - 1 );
			doMagic( i * width() + ROOM_RIGHT + 1 );
		}
		doMagic( entrance );
		GameScene.updateMap();

		Dungeon.observe();
		
		Yog boss = new Yog();
		do {
			boss.pos = Random.Int( length() );
		} while (
			!passable[boss.pos] ||
			heroFOV[boss.pos]);
		GameScene.add( boss );
		boss.spawnFists();
		
		stairs = entrance;
		entrance = -1;
	}
}
 
開發者ID:00-Evan,項目名稱:shattered-pixel-dungeon,代碼行數:37,代碼來源:HallsBossLevel.java

示例3: attack

import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Yog; //導入依賴的package包/類
public boolean attack( Char enemy ) {
	
	boolean visibleFight = Dungeon.visible[pos] || Dungeon.visible[enemy.pos];
	
	if (hit( this, enemy, false )) {
		
		if (visibleFight) {
			GLog.i( TXT_HIT, name, enemy.name );
		}
		
		// FIXME
		int dr = this instanceof Hero && ((Hero)this).rangedWeapon != null && ((Hero)this).subClass ==
               HeroSubClass.SNIPER ? 0 : Random.IntRange( 0, enemy.dr() );
		
		int dmg = damageRoll();
		int effectiveDamage = Math.max( dmg - dr, 0 );;
		
		effectiveDamage = attackProc( enemy, effectiveDamage );
		effectiveDamage = enemy.defenseProc( this, effectiveDamage );
		enemy.damage( effectiveDamage, this );
		
		if (visibleFight) {
			Sample.INSTANCE.play( Assets.SND_HIT, 1, 1, Random.Float( 0.8f, 1.25f ) );
		}

		if (buff(FireImbue.class) != null)
			buff(FireImbue.class).proc(enemy);
		if (buff(EarthImbue.class) != null)
			buff(EarthImbue.class).proc(enemy);
		
		enemy.sprite.bloodBurstA( sprite.center(), effectiveDamage );
		enemy.sprite.flash();
		
		if (!enemy.isAlive() && visibleFight) {
			if (enemy == Dungeon.hero) {
				
				if (Dungeon.hero.killerGlyph != null) {
					
					Dungeon.fail( Utils.format( ResultDescriptions.GLYPH, Dungeon.hero.killerGlyph.name(), Dungeon.depth ) );
					GLog.n( TXT_KILL, Dungeon.hero.killerGlyph.name() );
					
				} else {
					if ( this instanceof Yog ) {
						Dungeon.fail( Utils.format( ResultDescriptions.NAMED, name) );
					} if (Bestiary.isUnique( this )) {
						Dungeon.fail( Utils.format( ResultDescriptions.UNIQUE, name) );
					} else {
						Dungeon.fail( Utils.format( ResultDescriptions.MOB, Utils.indefinite( name )) );
					}
					
					GLog.n( TXT_KILL, name );
				}
				
			} else {
				GLog.i( TXT_DEFEAT, name, enemy.name );
			}
		}
		
		return true;
		
	} else {
		
		if (visibleFight) {
			String defense = enemy.defenseVerb();
			enemy.sprite.showStatus( CharSprite.NEUTRAL, defense );
			if (this == Dungeon.hero) {
				GLog.i( TXT_YOU_MISSED, enemy.name, defense );
			} else {
				GLog.i( TXT_SMB_MISSED, enemy.name, defense, name );
			}
			
			Sample.INSTANCE.play( Assets.SND_MISS );
		}
		
		return false;
		
	}
}
 
開發者ID:wolispace,項目名稱:soft-pixel-dungeon,代碼行數:79,代碼來源:Char.java

示例4: onZap

import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Yog; //導入依賴的package包/類
@Override
protected void onZap(Ballistica bolt) {
	Char ch = Actor.findChar(bolt.collisionPos);

	if (ch != null){
		
		if (!(ch instanceof Mob) || ch instanceof NPC){
			return;
		}

		Mob enemy = (Mob) ch;

		float corruptingPower = 2 + level();
		
		//base enemy resistance is usually based on their exp, but in special cases it is based on other criteria
		float enemyResist = 1 + enemy.EXP;
		if (ch instanceof Mimic || ch instanceof Statue){
			enemyResist = 1 + Dungeon.depth;
		} else if (ch instanceof Piranha || ch instanceof Bee) {
			enemyResist = 1 + Dungeon.depth/2f;
		} else if (ch instanceof Wraith) {
			//this is so low because wraiths are always at max hp
			enemyResist = 1 + Dungeon.depth/5f;
		} else if (ch instanceof Yog.BurningFist || ch instanceof Yog.RottingFist) {
			enemyResist = 1 + 30;
		} else if (ch instanceof Yog.Larva || ch instanceof King.Undead){
			enemyResist = 1 + 5;
		} else if (ch instanceof Swarm){
			//child swarms don't give exp, so we force this here.
			enemyResist = 1 + 3;
		}
		
		//100% health: 3x resist   75%: 2.1x resist   50%: 1.5x resist   25%: 1.1x resist
		enemyResist *= 1 + 2*Math.pow(enemy.HP/(float)enemy.HT, 2);
		
		//debuffs placed on the enemy reduce their resistance
		for (Buff buff : enemy.buffs()){
			if (MAJOR_DEBUFFS.containsKey(buff.getClass()))         enemyResist *= MAJOR_DEBUFF_WEAKEN;
			else if (MINOR_DEBUFFS.containsKey(buff.getClass()))    enemyResist *= MINOR_DEBUFF_WEAKEN;
			else if (buff.type == Buff.buffType.NEGATIVE)           enemyResist *= MINOR_DEBUFF_WEAKEN;
		}
		
		//cannot re-corrupt or doom an enemy, so give them a major debuff instead
		if(enemy.buff(Corruption.class) != null || enemy.buff(Doom.class) != null){
			enemyResist = corruptingPower*.99f;
		}
		
		if (corruptingPower > enemyResist){
			corruptEnemy( enemy );
		} else {
			float debuffChance = corruptingPower / enemyResist;
			if (Random.Float() < debuffChance){
				debuffEnemy( enemy, MAJOR_DEBUFFS);
			} else {
				debuffEnemy( enemy, MINOR_DEBUFFS);
			}
		}

		processSoulMark(ch, chargesPerCast());
		
	} else {
		Dungeon.level.press(bolt.collisionPos, null);
	}
}
 
開發者ID:00-Evan,項目名稱:shattered-pixel-dungeon,代碼行數:65,代碼來源:WandOfCorruption.java


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