• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java Plant类的典型用法和代码示例

java 1次浏览

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

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

示例1: affectItem

点赞 3

import com.watabou.pixeldungeon.plants.Plant; //导入依赖的package包/类
@Override
protected Item affectItem( Item item ) {
	
	if (item instanceof MeleeWeapon) {			
		item = changeWeapon( (MeleeWeapon)item );		
	} else if (item instanceof Scroll) {	
		item = changeScroll( (Scroll)item );	
	} else if (item instanceof Potion) {
		item = changePotion( (Potion)item );
	} else if (item instanceof Ring) {
		item = changeRing( (Ring)item );
	} else if (item instanceof Wand) {	
		item = changeWand( (Wand)item );
	} else if (item instanceof Plant.Seed) {
		item = changeSeed( (Plant.Seed)item );
	} else {
		item = null;
	}
	
	if (item != null) {
		Journal.remove( Feature.WELL_OF_TRANSMUTATION );
	}
	
	return item;
}
 

开发者ID:kurtyu,
项目名称:PixelDungeonTC,
代码行数:26,
代码来源:WaterOfTransmutation.java

示例2: WndInfoPlant

点赞 3

import com.watabou.pixeldungeon.plants.Plant; //导入依赖的package包/类
public WndInfoPlant( Plant plant ) {
	
	super();
	
	IconTitle titlebar = new IconTitle();
	titlebar.icon( new PlantSprite( plant.image ) );
	titlebar.label( plant.plantName );
	titlebar.setRect( 0, 0, WIDTH, 0 );
	add( titlebar );
	
	BitmapTextMultiline info = PixelScene.createMultiline( 6 );
	add( info );
	
	info.text( plant.desc() );
	info.maxWidth = WIDTH;
	info.measure();
	info.x = titlebar.left();
	info.y = titlebar.bottom() + GAP;
	
	resize( WIDTH, (int)(info.y + info.height()) );
}
 

开发者ID:kurtyu,
项目名称:PixelDungeonTC,
代码行数:22,
代码来源:WndInfoPlant.java

示例3: attackProc

点赞 3

import com.watabou.pixeldungeon.plants.Plant; //导入依赖的package包/类
@Override
public int attackProc(@NonNull Char enemy, int damage ) {
	
	try {
		Plant plant  = (Plant) PLantClasses[getKind()].newInstance();
		plant.pos = enemy.getPos();
		
		plant.effect(enemy.getPos(),enemy);
		
		die(this);
		
	} catch (Exception e) {
		throw new TrackedRuntimeException(e);
	} 
	return damage;
}
 

开发者ID:NYRDS,
项目名称:pixel-dungeon-remix,
代码行数:17,
代码来源:SpiderExploding.java

示例4: WndInfoPlant

点赞 3

import com.watabou.pixeldungeon.plants.Plant; //导入依赖的package包/类
public WndInfoPlant( Plant plant ) {
	
	super();
	
	IconTitle titlebar = new IconTitle();
	titlebar.icon( new PlantSprite( plant.image ) );
	titlebar.label( plant.plantName );
	titlebar.setRect( 0, 0, WIDTH, 0 );
	add( titlebar );
	
	Text info = PixelScene.createMultiline(GuiProperties.regularFontSize());
	add( info );
	
	info.text( plant.desc() );
	info.maxWidth(WIDTH);
	info.measure();
	info.x = titlebar.left();
	info.y = titlebar.bottom() + GAP;
	
	resize( WIDTH, (int)(info.y + info.height()) );
}
 

开发者ID:NYRDS,
项目名称:pixel-dungeon-remix,
代码行数:22,
代码来源:WndInfoPlant.java

示例5: reset

点赞 2

import com.watabou.pixeldungeon.plants.Plant; //导入依赖的package包/类
public void reset( Plant plant ) {
	
	revive();
	
	reset( plant.image );
	alpha( 1f );
	
	pos = plant.pos;
	x = (pos % Level.WIDTH) * DungeonTilemap.SIZE;
	y = (pos / Level.WIDTH) * DungeonTilemap.SIZE;
	
	state = State.GROWING;
	time = DELAY;
}
 

开发者ID:kurtyu,
项目名称:PixelDungeonTC,
代码行数:15,
代码来源:PlantSprite.java

示例6: reset

点赞 2

import com.watabou.pixeldungeon.plants.Plant; //导入依赖的package包/类
public void reset( Plant plant ) {
	
	revive();
	
	reset( plant.image );
	alpha( 1f );
	
	pos = plant.pos;
	PointF p = DungeonTilemap.tileToWorld( plant.pos );
	x = p.x;
	y = p.y;
	
	state = State.GROWING;
	time = DELAY;
}
 

开发者ID:NYRDS,
项目名称:pixel-dungeon-remix,
代码行数:16,
代码来源:PlantSprite.java

示例7: add

点赞 2

import com.watabou.pixeldungeon.plants.Plant; //导入依赖的package包/类
public static void add(Plant plant) {
	if (scene != null && Dungeon.level != null) {
		scene.addPlantSprite(plant);
	} else {
		EventCollector.logException(new Exception("add(Plant)"));
	}
}
 

开发者ID:NYRDS,
项目名称:pixel-dungeon-remix,
代码行数:8,
代码来源:GameScene.java

示例8: addPlantSprite

点赞 2

import com.watabou.pixeldungeon.plants.Plant; //导入依赖的package包/类
private void addPlantSprite( Plant plant ) {
	(plant.sprite = (PlantSprite)plants.recycle( PlantSprite.class )).reset( plant );
}
 

开发者ID:kurtyu,
项目名称:PixelDungeonTC,
代码行数:4,
代码来源:GameScene.java

示例9: add

点赞 2

import com.watabou.pixeldungeon.plants.Plant; //导入依赖的package包/类
public static void add( Plant plant ) {
	if (scene != null) {
		scene.addPlantSprite( plant );
	}
}
 

开发者ID:kurtyu,
项目名称:PixelDungeonTC,
代码行数:6,
代码来源:GameScene.java

示例10: onSelect

点赞 2

import com.watabou.pixeldungeon.plants.Plant; //导入依赖的package包/类
@Override
public void onSelect( Integer cell ) {
	
	if (cell == null) {
		return;
	}
	
	if (cell < 0 || cell > Level.LENGTH || (!Dungeon.level.visited[cell] && !Dungeon.level.mapped[cell])) {
		GameScene.show( new WndMessage( "You don't know what is there." ) ) ;
		return;
	}
	
	if (!Dungeon.visible[cell]) {
		GameScene.show( new WndInfoCell( cell ) );
		return;
	}
	
	if (cell == Dungeon.hero.pos) {
		GameScene.show( new WndHero() );
		return;
	}
	
	Mob mob = (Mob)Actor.findChar( cell );
	if (mob != null) {
		GameScene.show( new WndInfoMob( mob ) );
		return;
	}
	
	Heap heap = Dungeon.level.heaps.get( cell );
	if (heap != null && heap.type != Heap.Type.HIDDEN) {
		if (heap.type == Heap.Type.FOR_SALE && heap.size() == 1 && heap.peek().price() > 0) {
			GameScene.show( new WndTradeItem( heap, false ) );
		} else {
			GameScene.show( new WndInfoItem( heap ) );
		}
		return;
	}
	
	Plant plant = Dungeon.level.plants.get( cell );
	if (plant != null) {
		GameScene.show( new WndInfoPlant( plant ) );
		return;
	}
	
	GameScene.show( new WndInfoCell( cell ) );
}
 

开发者ID:kurtyu,
项目名称:PixelDungeonTC,
代码行数:47,
代码来源:Toolbar.java

示例11: create

点赞 2

import com.watabou.pixeldungeon.plants.Plant; //导入依赖的package包/类
public void create() {
	
	resizingNeeded = false;
	
	map = new int[LENGTH];
	visited = new boolean[LENGTH];
	Arrays.fill( visited, false );
	mapped = new boolean[LENGTH];
	Arrays.fill( mapped, false );
	
	mobs = new HashSet<Mob>();
	heaps = new SparseArray<Heap>();
	blobs = new HashMap<Class<? extends Blob>,Blob>();
	plants = new SparseArray<Plant>();
	
	if (!Dungeon.bossLevel()) {
		addItemToSpawn( Generator.random( Generator.Category.FOOD ) );
		if (Dungeon.posNeeded()) {
			addItemToSpawn( new PotionOfStrength() );
			Dungeon.potionOfStrength++;
		}
		if (Dungeon.souNeeded()) {
			addItemToSpawn( new ScrollOfUpgrade() );
			Dungeon.scrollsOfUpgrade++;
		}
		if (Dungeon.soeNeeded()) {
			addItemToSpawn( new ScrollOfEnchantment() );
			Dungeon.scrollsOfEnchantment++;
		}
		
		if (Dungeon.depth > 1) {
			switch (Random.Int( 10 )) {
			case 0:
				if (!Dungeon.bossLevel( Dungeon.depth + 1 )) {
					feeling = Feeling.CHASM;
				}
				break;
			case 1:
				feeling = Feeling.WATER;
				break;
			case 2:
				feeling = Feeling.GRASS;
				break;
			}
		}
	}
	
	boolean pitNeeded = Dungeon.depth > 1 && weakFloorCreated;
	
	do {
		Arrays.fill( map, feeling == Feeling.CHASM ? Terrain.CHASM : Terrain.WALL );
		
		pitRoomNeeded = pitNeeded;
		weakFloorCreated = false;
		
	} while (!build());
	decorate();
	
	buildFlagMaps();
	cleanWalls();
	
	createMobs();
	createItems();
}
 

开发者ID:kurtyu,
项目名称:PixelDungeonTC,
代码行数:65,
代码来源:Level.java

示例12: restoreFromBundle

点赞 2

import com.watabou.pixeldungeon.plants.Plant; //导入依赖的package包/类
@Override
public void restoreFromBundle( Bundle bundle ) {
	
	mobs = new HashSet<Mob>();
	heaps = new SparseArray<Heap>();
	blobs = new HashMap<Class<? extends Blob>, Blob>();
	plants = new SparseArray<Plant>();
	
	map		= bundle.getIntArray( MAP );
	visited	= bundle.getBooleanArray( VISITED );
	mapped	= bundle.getBooleanArray( MAPPED );
	
	entrance	= bundle.getInt( ENTRANCE );
	exit		= bundle.getInt( EXIT );
	
	weakFloorCreated = false;
	
	adjustMapSize();
	
	Collection<Bundlable> collection = bundle.getCollection( HEAPS );
	for (Bundlable h : collection) {
		Heap heap = (Heap)h;
		if (resizingNeeded) {
			heap.pos = adjustPos( heap.pos );
		}
		heaps.put( heap.pos, heap );
	}
	
	collection = bundle.getCollection( PLANTS );
	for (Bundlable p : collection) {
		Plant plant = (Plant)p;
		if (resizingNeeded) {
			plant.pos = adjustPos( plant.pos );
		}
		plants.put( plant.pos, plant );
	}
	
	collection = bundle.getCollection( MOBS );
	for (Bundlable m : collection) {
		Mob mob = (Mob)m;
		if (mob != null) {
			if (resizingNeeded) {
				mob.pos = adjustPos( mob.pos );
			}
			mobs.add( mob );
		}
	}
	
	collection = bundle.getCollection( BLOBS );
	for (Bundlable b : collection) {
		Blob blob = (Blob)b;
		blobs.put( blob.getClass(), blob );
	}
	
	buildFlagMaps();
	cleanWalls();
}
 

开发者ID:kurtyu,
项目名称:PixelDungeonTC,
代码行数:58,
代码来源:Level.java

示例13: mobPress

点赞 2

import com.watabou.pixeldungeon.plants.Plant; //导入依赖的package包/类
public void mobPress( Mob mob ) {

		int cell = mob.pos;
		
		if (pit[cell] && !mob.flying) {
			Chasm.mobFall( mob );
			return;
		}
		
		boolean trap = true;
		switch (map[cell]) {
		
		case Terrain.TOXIC_TRAP:
			ToxicTrap.trigger( cell,  mob );
			break;
			
		case Terrain.FIRE_TRAP:
			FireTrap.trigger( cell, mob );
			break;
			
		case Terrain.PARALYTIC_TRAP:
			ParalyticTrap.trigger( cell,  mob );
			break;
			
		case Terrain.POISON_TRAP:
			PoisonTrap.trigger( cell, mob );
			break;
			
		case Terrain.ALARM_TRAP:
			AlarmTrap.trigger( cell,  mob );
			break;
			
		case Terrain.LIGHTNING_TRAP:
			LightningTrap.trigger( cell, mob );
			break;
		
		case Terrain.GRIPPING_TRAP:
			GrippingTrap.trigger( cell, mob );
			break;
			
		case Terrain.SUMMONING_TRAP:
			SummoningTrap.trigger( cell, mob );
			break;
			
		case Terrain.DOOR:
			Door.enter( cell );
			
		default:
			trap = false;
		}
		
		if (trap) {
			if (Dungeon.visible[cell]) {
				Sample.INSTANCE.play( Assets.SND_TRAP );
			}
			set( cell, Terrain.INACTIVE_TRAP );
			GameScene.updateMap( cell );
		}
		
		Plant plant = plants.get( cell );
		if (plant != null) {
			plant.activate( mob );
		}
	}
 

开发者ID:kurtyu,
项目名称:PixelDungeonTC,
代码行数:65,
代码来源:Level.java

示例14: grab

点赞 2

import com.watabou.pixeldungeon.plants.Plant; //导入依赖的package包/类
@Override
public boolean grab( Item item ) {
	return item instanceof Plant.Seed;
}
 

开发者ID:kurtyu,
项目名称:PixelDungeonTC,
代码行数:5,
代码来源:SeedPouch.java

示例15: onSelect

点赞 2

import com.watabou.pixeldungeon.plants.Plant; //导入依赖的package包/类
@Override
public void onSelect( Integer cell ) {
	
	if (cell == null) {
		return;
	}
	
	if (cell < 0 || cell > Level.LENGTH || (!Dungeon.level.visited[cell] && !Dungeon.level.mapped[cell])) {
		GameScene.show( new WndMessage( "You don't know what is there." ) ) ;
		return;
	}
	
	if (!Dungeon.visible[cell]) {
		GameScene.show( new WndInfoCell( cell ) );
		return;
	}
	
	if (cell == Dungeon.hero.pos) {
		GameScene.show( new WndHero() );
		return;
	}
	
	Mob mob = (Mob)Actor.findChar( cell );
	if (mob != null) {
		GameScene.show( new WndInfoMob( mob ) );
		return;
	}
	
	Heap heap = Dungeon.level.heaps.get( cell );
	if (heap != null) {
		if (heap.type == Heap.Type.FOR_SALE && heap.size() == 1 && heap.peek().price() > 0) {
			GameScene.show( new WndTradeItem( heap, false ) );
		} else {
			GameScene.show( new WndInfoItem( heap ) );
		}
		return;
	}
	
	Plant plant = Dungeon.level.plants.get( cell );
	if (plant != null) {
		GameScene.show( new WndInfoPlant( plant ) );
		return;
	}
	
	GameScene.show( new WndInfoCell( cell ) );
}
 

开发者ID:skynet67,
项目名称:pixel-dungeon-rebirth,
代码行数:47,
代码来源:Toolbar.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)