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


Java BlandfruitBush類代碼示例

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


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

示例1: placePlants

import com.shatteredpixel.shatteredpixeldungeon.plants.BlandfruitBush; //導入依賴的package包/類
private void placePlants(float numPlants, float numDews, float numPods, float numStars){
	Iterator<Integer> cells = affectedCells.iterator();
	Level floor = Dungeon.level;

	while(cells.hasNext() && Random.Float() <= numPlants){
		Plant.Seed seed = (Plant.Seed) Generator.random(Generator.Category.SEED);

		if (seed instanceof BlandfruitBush.Seed) {
			if (Random.Int(5) - Dungeon.LimitedDrops.BLANDFRUIT_SEED.count >= 0) {
				floor.plant(seed, cells.next());
				Dungeon.LimitedDrops.BLANDFRUIT_SEED.count++;
			}
		} else
			floor.plant(seed, cells.next());

		numPlants --;
	}

	while (cells.hasNext() && Random.Float() <= numDews){
		floor.plant(new Dewcatcher.Seed(), cells.next());
		numDews --;
	}

	while (cells.hasNext() && Random.Float() <= numPods){
		floor.plant(new Seedpod.Seed(), cells.next());
		numPods --;
	}

	while (cells.hasNext() && Random.Float() <= numStars){
		floor.plant(new Starflower.Seed(), cells.next());
		numStars --;
	}

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

示例2: trample

import com.shatteredpixel.shatteredpixeldungeon.plants.BlandfruitBush; //導入依賴的package包/類
public static void trample( Level level, int pos, Char ch ) {
	
	Level.set( pos, Terrain.GRASS );
	GameScene.updateMap( pos );

	if (!Dungeon.isChallenged( Challenges.NO_HERBALISM )) {
		int naturalismLevel = 0;

		if (ch != null) {
			SandalsOfNature.Naturalism naturalism = ch.buff( SandalsOfNature.Naturalism.class );
			if (naturalism != null) {
				if (!naturalism.isCursed()) {
					naturalismLevel = naturalism.itemLevel() + 1;
					naturalism.charge();
				} else {
					naturalismLevel = -1;
				}
			}
		}

		if (naturalismLevel >= 0) {
			// Seed, scales from 1/16 to 1/4
			if (Random.Int(16 - ((int) (naturalismLevel * 3))) == 0) {
				Item seed = Generator.random(Generator.Category.SEED);

				if (seed instanceof BlandfruitBush.Seed) {
					if (Random.Int(5) - Dungeon.LimitedDrops.BLANDFRUIT_SEED.count >= 0) {
						level.drop(seed, pos).sprite.drop();
						Dungeon.LimitedDrops.BLANDFRUIT_SEED.count++;
					}
				} else
					level.drop(seed, pos).sprite.drop();
			}

			// Dew, scales from 1/6 to 1/3
			if (Random.Int(24 - naturalismLevel*3) <= 3) {
				level.drop(new Dewdrop(), pos).sprite.drop();
			}
		}
	}

	int leaves = 4;
	

	if (ch instanceof Hero) {
		Hero hero = (Hero)ch;

		// Barkskin
		if (hero.subClass == HeroSubClass.WARDEN) {
			Buff.affect(ch, Barkskin.class).level(ch.HT / 3);
			leaves += 4;
		}

		//Camouflage
		if (hero.belongings.armor != null && hero.belongings.armor.hasGlyph(Camouflage.class)){
			Buff.affect(hero, Camouflage.Camo.class).set(3 + hero.belongings.armor.level());
			leaves += 4;
		}
	}
	
	CellEmitter.get( pos ).burst( LeafParticle.LEVEL_SPECIFIC, leaves );
	if (Dungeon.level.heroFOV[pos]) Dungeon.observe();
}
 
開發者ID:00-Evan,項目名稱:shattered-pixel-dungeon,代碼行數:64,代碼來源:HighGrass.java


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