当前位置: 首页>>代码示例>>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;未经允许,请勿转载。