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