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


Java Statue类代码示例

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


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

示例1: onZap

import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Statue; //导入依赖的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

示例2: paint

import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Statue; //导入依赖的package包/类
public void paint( Level level ) {

		Painter.fill( level, this, Terrain.WALL );
		Painter.fill( level, this, 1, Terrain.EMPTY );

		Point c = center();
		int cx = c.x;
		int cy = c.y;
		
		Door door = entrance();
		
		door.set( Door.Type.LOCKED );
		level.addItemToSpawn( new IronKey( Dungeon.depth ) );
		
		if (door.x == left) {
			
			Painter.fill( level, right - 1, top + 1, 1, height() - 2 , Terrain.STATUE );
			cx = right - 2;
			
		} else if (door.x == right) {
			
			Painter.fill( level, left + 1, top + 1, 1, height() - 2 , Terrain.STATUE );
			cx = left + 2;
			
		} else if (door.y == top) {
			
			Painter.fill( level, left + 1, bottom - 1, width() - 2, 1 , Terrain.STATUE );
			cy = bottom - 2;
			
		} else if (door.y == bottom) {
			
			Painter.fill( level, left + 1, top + 1, width() - 2, 1 , Terrain.STATUE );
			cy = top + 2;
			
		}
		
		Statue statue = new Statue();
		statue.pos = cx + cy * level.width();
		level.mobs.add( statue );
	}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon,代码行数:41,代码来源:StatueRoom.java

示例3: paint

import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Statue; //导入依赖的package包/类
public static void paint( Level level, Room room ) {

		fill( level, room, Terrain.WALL );
		fill( level, room, 1, Terrain.EMPTY );

		Point c = room.center();
		int cx = c.x;
		int cy = c.y;
		
		Room.Door door = room.entrance();
		
		door.set( Room.Door.Type.LOCKED );
		level.addItemToSpawn( new IronKey( Dungeon.depth ) );
		
		if (door.x == room.left) {
			
			fill( level, room.right - 1, room.top + 1, 1, room.height() - 1 , Terrain.STATUE );
			cx = room.right - 2;
			
		} else if (door.x == room.right) {
			
			fill( level, room.left + 1, room.top + 1, 1, room.height() - 1 , Terrain.STATUE );
			cx = room.left + 2;
			
		} else if (door.y == room.top) {
			
			fill( level, room.left + 1, room.bottom - 1, room.width() - 1, 1 , Terrain.STATUE );
			cy = room.bottom - 2;
			
		} else if (door.y == room.bottom) {
			
			fill( level, room.left + 1, room.top + 1, room.width() - 1, 1 , Terrain.STATUE );
			cy = room.top + 2;
			
		}
		
		Statue statue = new Statue();
		statue.pos = cx + cy * Level.WIDTH;
		level.mobs.add( statue );
		Actor.occupyCell( statue );
	}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:42,代码来源:StatuePainter.java


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