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


Java Imp類代碼示例

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


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

示例1: takeReward

import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.Imp; //導入依賴的package包/類
private void takeReward( Imp imp, DwarfToken tokens, Item reward ) {
	
	hide();
	
	tokens.detachAll( Dungeon.hero.belongings.backpack );

	reward.identify();
	if (reward.doPickUp( Dungeon.hero )) {
		GLog.i( Hero.TXT_YOU_NOW_HAVE, reward.name() );
	} else {
		Dungeon.level.drop( reward, imp.pos ).sprite.drop();
	}
	
	imp.flee();
	
	Imp.Quest.complete();
}
 
開發者ID:wolispace,項目名稱:soft-pixel-dungeon,代碼行數:18,代碼來源:WndImp.java

示例2: WndImp

import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.Imp; //導入依賴的package包/類
public WndImp( final Imp imp, final DwarfToken tokens ) {
	
	super();
	
	IconTitle titlebar = new IconTitle();
	titlebar.icon( new ItemSprite( tokens.image(), null ) );
	titlebar.label( Messages.titleCase( tokens.name() ) );
	titlebar.setRect( 0, 0, WIDTH, 0 );
	add( titlebar );
	
	RenderedTextMultiline message = PixelScene.renderMultiline( Messages.get(this, "message"), 6 );
	message.maxWidth(WIDTH);
	message.setPos(0, titlebar.bottom() + GAP);
	add( message );
	
	RedButton btnReward = new RedButton( Messages.get(this, "reward") ) {
		@Override
		protected void onClick() {
			takeReward( imp, tokens, Imp.Quest.reward );
		}
	};
	btnReward.setRect( 0, message.top() + message.height() + GAP, WIDTH, BTN_HEIGHT );
	add( btnReward );
	
	resize( WIDTH, (int)btnReward.bottom() );
}
 
開發者ID:00-Evan,項目名稱:shattered-pixel-dungeon,代碼行數:27,代碼來源:WndImp.java

示例3: takeReward

import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.Imp; //導入依賴的package包/類
private void takeReward( Imp imp, DwarfToken tokens, Item reward ) {
	
	hide();
	
	tokens.detachAll( Dungeon.hero.belongings.backpack );

	reward.identify();
	if (reward.doPickUp( Dungeon.hero )) {
		GLog.i( Messages.get(Dungeon.hero, "you_now_have", reward.name()) );
	} else {
		Dungeon.level.drop( reward, imp.pos ).sprite.drop();
	}
	
	imp.flee();
	
	Imp.Quest.complete();
}
 
開發者ID:00-Evan,項目名稱:shattered-pixel-dungeon,代碼行數:18,代碼來源:WndImp.java

示例4: paint

import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.Imp; //導入依賴的package包/類
@Override
public void paint(Level level) {
	Painter.fill( level, this, Terrain.WALL );
	Painter.fill( level, this, 1, Terrain.EMPTY_SP );
	Painter.fill( level, this, 3, Terrain.WATER);

	for (Door door : connected.values()) {
		door.set( Door.Type.REGULAR );
	}

	if (Imp.Quest.isCompleted()){
		impSpawned = true;
		placeItems(level);
		placeShopkeeper(level);
	} else {
		impSpawned = false;
	}

}
 
開發者ID:00-Evan,項目名稱:shattered-pixel-dungeon,代碼行數:20,代碼來源:ImpShopRoom.java

示例5: link

import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.Imp; //導入依賴的package包/類
@Override
public void link( Char ch ) {
	super.link( ch );
	
	if (ch instanceof Imp) {
		alpha( 0.4f );
	}
}
 
開發者ID:wolispace,項目名稱:soft-pixel-dungeon,代碼行數:9,代碼來源:ImpSprite.java

示例6: WndImp

import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.Imp; //導入依賴的package包/類
public WndImp( final Imp imp, final DwarfToken tokens ) {
	
	super();
	
	IconTitle titlebar = new IconTitle();
	titlebar.icon( new ItemSprite( tokens.image(), null ) );
	titlebar.label( Utils.capitalize( tokens.name() ) );
	titlebar.setRect( 0, 0, WIDTH, 0 );
	add( titlebar );
	
	BitmapTextMultiline message = PixelScene.createMultiline( TXT_MESSAGE, 6 );
	message.maxWidth = WIDTH;
	message.measure();
	message.y = titlebar.bottom() + GAP;
	add( message );
	
	RedButton btnReward = new RedButton( TXT_REWARD ) {
		@Override
		protected void onClick() {
			takeReward( imp, tokens, Imp.Quest.reward );
		}
	};
	btnReward.setRect( 0, message.y + message.height() + GAP, WIDTH, BTN_HEIGHT );
	add( btnReward );
	
	resize( WIDTH, (int)btnReward.bottom() );
}
 
開發者ID:wolispace,項目名稱:soft-pixel-dungeon,代碼行數:28,代碼來源:WndImp.java

示例7: decorate

import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.Imp; //導入依賴的package包/類
@Override
protected void decorate() {	
	
	for (int i=0; i < LENGTH; i++) {
		if (map[i] == Terrain.EMPTY && Random.Int( 10 ) == 0) { 
			
			map[i] = Terrain.EMPTY_DECO;
			
		} else if (map[i] == Terrain.WALL && Random.Int( 8 ) == 0) {
			
			map[i] = Terrain.WALL_DECO;
			
		} else if (map[i] == Terrain.SECRET_DOOR) {
			
			map[i] = Terrain.DOOR;
			
		}
	}
	
	if (Imp.Quest.isCompleted()) {
		while (true) {
			int pos = roomEntrance.random();
			if (pos != entrance) {
				map[pos] = Terrain.SIGN;
				break;
			}
		}
	}
}
 
開發者ID:wolispace,項目名稱:soft-pixel-dungeon,代碼行數:30,代碼來源:LastShopLevel.java

示例8: onLevelLoad

import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.Imp; //導入依賴的package包/類
@Override
public void onLevelLoad(Level level) {
	super.onLevelLoad(level);

	if (Imp.Quest.isCompleted() && !impSpawned){
		impSpawned = true;
		placeItems(level);
		placeShopkeeper(level);
	}
}
 
開發者ID:00-Evan,項目名稱:shattered-pixel-dungeon,代碼行數:11,代碼來源:ImpShopRoom.java

示例9: die

import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.Imp; //導入依賴的package包/類
@Override
public void die( Object cause ) {
	Imp.Quest.process( this );
	
	super.die( cause );
}
 
開發者ID:wolispace,項目名稱:soft-pixel-dungeon,代碼行數:7,代碼來源:Monk.java

示例10: createItems

import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.Imp; //導入依賴的package包/類
@Override
protected void createItems() {
	super.createItems();
	
	Imp.Quest.spawn( this );
}
 
開發者ID:wolispace,項目名稱:soft-pixel-dungeon,代碼行數:7,代碼來源:CityLevel.java

示例11: build

import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.Imp; //導入依賴的package包/類
@Override
protected boolean build() {

	feeling = Feeling.CHASM;
	viewDistance = 4;
	
	initRooms();
	
	int distance;
	int retry = 0;
	int minDistance = (int)Math.sqrt( rooms.size() );
	do {
		int innerRetry = 0;
		do {
			if (innerRetry++ > 10) {
				return false;
			}
			roomEntrance = Random.element( rooms );
		} while (roomEntrance.width() < 4 || roomEntrance.height() < 4);
		
		innerRetry = 0;
		do {
			if (innerRetry++ > 10) {
				return false;
			}
			roomExit = Random.element( rooms );
		} while (roomExit == roomEntrance || roomExit.width() < 6 || roomExit.height() < 6 || roomExit.top == 0);

		Graph.buildDistanceMap( rooms, roomExit );
		distance = Graph.buildPath( rooms, roomEntrance, roomExit ).size();
		
		if (retry++ > 10) {
			return false;
		}
		
	} while (distance < minDistance);
	
	roomEntrance.type = Type.ENTRANCE;
	roomExit.type = Type.EXIT;
	
	Graph.buildDistanceMap( rooms, roomExit );
	List<Room> path = Graph.buildPath( rooms, roomEntrance, roomExit );
	
	Graph.setPrice( path, roomEntrance.distance );
	
	Graph.buildDistanceMap( rooms, roomExit );
	path = Graph.buildPath( rooms, roomEntrance, roomExit );
	
	Room room = roomEntrance;
	for (Room next : path) {
		room.connect( next );
		room = next;
	}
	
	Room roomShop = null;
	int shopSquare = 0;
	for (Room r : rooms) {
		if (r.type == Type.NULL && r.connected.size() > 0) {
			r.type = Type.PASSAGE; 
			if (r.square() > shopSquare) {
				roomShop = r;
				shopSquare = r.square();
			}
		}
	}
	
	if (roomShop == null || shopSquare < 54) {
		return false;
	} else {
		roomShop.type = Imp.Quest.isCompleted() ? Room.Type.SHOP : Room.Type.STANDARD;
	}
	
	paint();
	
	paintWater();
	paintGrass();
	
	return true;
}
 
開發者ID:wolispace,項目名稱:soft-pixel-dungeon,代碼行數:80,代碼來源:LastShopLevel.java

示例12: saveGame

import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.Imp; //導入依賴的package包/類
public static void saveGame( String fileName ) throws IOException {
	try {
		Bundle bundle = new Bundle();

		version = Game.versionCode;
		bundle.put( VERSION, version );
		bundle.put( SEED, seed );
		bundle.put( CHALLENGES, challenges );
		bundle.put( HERO, hero );
		bundle.put( GOLD, gold );
		bundle.put( DEPTH, depth );

		for (int d : droppedItems.keyArray()) {
			bundle.put(Messages.format(DROPPED, d), droppedItems.get(d));
		}

		quickslot.storePlaceholders( bundle );

		Bundle limDrops = new Bundle();
		LimitedDrops.store( limDrops );
		bundle.put ( LIMDROPS, limDrops );
		
		int count = 0;
		int ids[] = new int[chapters.size()];
		for (Integer id : chapters) {
			ids[count++] = id;
		}
		bundle.put( CHAPTERS, ids );
		
		Bundle quests = new Bundle();
		Ghost		.Quest.storeInBundle( quests );
		Wandmaker	.Quest.storeInBundle( quests );
		Blacksmith	.Quest.storeInBundle( quests );
		Imp			.Quest.storeInBundle( quests );
		bundle.put( QUESTS, quests );
		
		SpecialRoom.storeRoomsInBundle( bundle );
		SecretRoom.storeRoomsInBundle( bundle );
		
		Statistics.storeInBundle( bundle );
		Notes.storeInBundle( bundle );
		Generator.storeInBundle( bundle );
		
		Scroll.save( bundle );
		Potion.save( bundle );
		Ring.save( bundle );

		Actor.storeNextID( bundle );
		
		Bundle badges = new Bundle();
		Badges.saveLocal( badges );
		bundle.put( BADGES, badges );
		
		OutputStream output = Game.instance.openFileOutput( fileName, Game.MODE_PRIVATE );
		Bundle.write( bundle, output );
		output.close();
		
	} catch (IOException e) {
		GamesInProgress.setUnknown( hero.heroClass );
		ShatteredPixelDungeon.reportException(e);
	}
}
 
開發者ID:00-Evan,項目名稱:shattered-pixel-dungeon,代碼行數:63,代碼來源:Dungeon.java

示例13: saveGame

import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.Imp; //導入依賴的package包/類
public static void saveGame( String fileName ) throws IOException {
	try {
		Bundle bundle = new Bundle();

		version = Game.versionCode;
		bundle.put( VERSION, version );
		bundle.put( SEED, seed );
		bundle.put( CHALLENGES, challenges );
		bundle.put( HERO, hero );
		bundle.put( GOLD, gold );
		bundle.put( DEPTH, depth );

		for (int d : droppedItems.keyArray()) {
			bundle.put(Messages.format(DROPPED, d), droppedItems.get(d));
		}

		quickslot.storePlaceholders( bundle );

		Bundle limDrops = new Bundle();
		LimitedDrops.store( limDrops );
		bundle.put ( LIMDROPS, limDrops );
		
		int count = 0;
		int ids[] = new int[chapters.size()];
		for (Integer id : chapters) {
			ids[count++] = id;
		}
		bundle.put( CHAPTERS, ids );
		
		Bundle quests = new Bundle();
		Ghost		.Quest.storeInBundle( quests );
		Wandmaker	.Quest.storeInBundle( quests );
		Blacksmith	.Quest.storeInBundle( quests );
		Imp			.Quest.storeInBundle( quests );
		bundle.put( QUESTS, quests );
		
		SpecialRoom.storeRoomsInBundle( bundle );
		SecretRoom.storeRoomsInBundle( bundle );
		
		Statistics.storeInBundle( bundle );
		Notes.storeInBundle( bundle );
		Generator.storeInBundle( bundle );
		
		Scroll.save( bundle );
		Potion.save( bundle );
		Ring.save( bundle );

		Actor.storeNextID( bundle );
		
		Bundle badges = new Bundle();
		Badges.saveLocal( badges );
		bundle.put( BADGES, badges );
		
		OutputStream output = Game.instance.openFileOutput( fileName );
		Bundle.write( bundle, output );
		output.close();
		
	} catch (IOException e) {
		GamesInProgress.setUnknown( hero.heroClass );
		ShatteredPixelDungeon.reportException(e);
	}
}
 
開發者ID:00-Evan,項目名稱:shattered-pixel-dungeon-gdx,代碼行數:63,代碼來源:Dungeon.java

示例14: init

import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.Imp; //導入依賴的package包/類
public static void init() {

        challenges = ShatteredPixelDungeon.challenges();

        Generator.initArtifacts();

		Actor.clear();
		
		PathFinder.setMapSize( Level.WIDTH, Level.HEIGHT );
		
		Scroll.initLabels();
		Potion.initColors();
		Wand.initWoods();
		Ring.initGems();
		
		Statistics.reset();
		Journal.reset();

		quickslot.reset();
		
		depth = 0;
		gold = 0;
		
		for (limitedDrops a : limitedDrops.values())
            a.count = 0;

		dewVial = true;
		transmutation = Random.IntRange( 6, 14 );
		
		chapters = new HashSet<Integer>();
		
		Ghost.Quest.reset();
		Wandmaker.Quest.reset();
		Blacksmith.Quest.reset();
		Imp.Quest.reset();
		
		Room.shuffleTypes();
		
		hero = new Hero();
		hero.live();
		
		Badges.reset();
		
		StartScene.curClass.initHero( hero );
	}
 
開發者ID:wolispace,項目名稱:soft-pixel-dungeon,代碼行數:46,代碼來源:Dungeon.java

示例15: init

import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.Imp; //導入依賴的package包/類
public static void init() {

		version = Game.versionCode;
		challenges = ShatteredPixelDungeon.challenges();

		seed = DungeonSeed.randomSeed();

		Actor.clear();
		Actor.resetNextID();
		
		Random.seed( seed );

			Scroll.initLabels();
			Potion.initColors();
			Ring.initGems();

			SpecialRoom.initForRun();
			SecretRoom.initForRun();

		Random.seed();
		
		Statistics.reset();
		Notes.reset();

		quickslot.reset();
		QuickSlotButton.reset();
		
		depth = 0;
		gold = 0;

		droppedItems = new SparseArray<ArrayList<Item>>();

		for (LimitedDrops a : LimitedDrops.values())
			a.count = 0;
		
		chapters = new HashSet<Integer>();
		
		Ghost.Quest.reset();
		Wandmaker.Quest.reset();
		Blacksmith.Quest.reset();
		Imp.Quest.reset();

		Generator.reset();
		Generator.initArtifacts();
		hero = new Hero();
		hero.live();
		
		Badges.reset();
		
		StartScene.curClass.initHero( hero );
	}
 
開發者ID:00-Evan,項目名稱:shattered-pixel-dungeon,代碼行數:52,代碼來源:Dungeon.java


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