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


Java Challenges类代码示例

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


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

示例1: spawnRoom

import com.shatteredpixel.shatteredpixeldungeon.Challenges; //导入依赖的package包/类
public static ArrayList<Room> spawnRoom( ArrayList<Room> rooms) {
	questRoomSpawned = false;
	if (!spawned && (type != 0 || (Dungeon.depth > 6 && Random.Int( 10 - Dungeon.depth ) == 0))) {
		
		// decide between 1,2, or 3 for quest type.
		// but if the no herbalism challenge is enabled, only pick 1 or 2, no rotberry.
		if (type == 0) type = Random.Int(Dungeon.isChallenged(Challenges.NO_HERBALISM) ? 2 : 3)+1;
		
		switch (type){
			case 1: default:
				rooms.add(new MassGraveRoom());
				break;
			case 2:
				rooms.add(new RitualSiteRoom());
				break;
			case 3:
				rooms.add(new RotGardenRoom());
				break;
		}

		questRoomSpawned = true;
		
	}
	return rooms;
}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon,代码行数:26,代码来源:Wandmaker.java

示例2: initForRun

import com.shatteredpixel.shatteredpixeldungeon.Challenges; //导入依赖的package包/类
public static void initForRun() {
	runSpecials = (ArrayList<Class<?extends Room>>)ALL_SPEC.clone();
	
	//remove special rooms disallowed by challenges
	if (Dungeon.isChallenged( Challenges.NO_ARMOR )){
		//no sense in giving an armor reward room on a run with no armor.
		runSpecials.remove( CryptRoom.class );
	}
	if (Dungeon.isChallenged( Challenges.NO_HERBALISM )){
		//Would be a bit mean to spawn these with no plants in them
		runSpecials.remove( GardenRoom.class );
	}
	
	pitNeededDepth = -1;
	guaranteedWellDepth = Random.IntRange( 6, 14 );
	Random.shuffle(runSpecials);
}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon,代码行数:18,代码来源:SpecialRoom.java

示例3: act

import com.shatteredpixel.shatteredpixeldungeon.Challenges; //导入依赖的package包/类
@Override
public boolean act( boolean enemyInFOV, boolean justAlerted ) {
    if (enemyInFOV && Random.Int( distance( enemy ) + enemy.stealth() + (enemy.flying ? 2 : 0) ) == 0) {

        enemySeen = true;

        notice();
        state = HUNTING;
        target = enemy.pos;

        if (Dungeon.isChallenged( Challenges.SWARM_INTELLIGENCE )) {
            for (Mob mob : Dungeon.level.mobs) {
                if (mob != Mob.this) {
                    mob.beckon( target );
                }
            }
        }

        spend( TIME_TO_WAKE_UP );

    } else {

        enemySeen = false;

        spend( TICK );

    }
    return true;
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:30,代码来源:Mob.java

示例4: WndChallenges

import com.shatteredpixel.shatteredpixeldungeon.Challenges; //导入依赖的package包/类
public WndChallenges( int checked, boolean editable ) {

        super();

        this.editable = editable;

        BitmapText title = PixelScene.createText( TITLE, 9 );
        title.hardlight( TITLE_COLOR );
        title.measure();
        title.x = PixelScene.align( camera, (WIDTH - title.width()) / 2 );
        add( title );

        boxes = new ArrayList<CheckBox>();

        float pos = title.height() + GAP;
        for (int i=0; i < Challenges.NAMES.length; i++) {

            CheckBox cb = new CheckBox( Challenges.NAMES[i] );
            cb.checked( (checked & Challenges.MASKS[i]) != 0 );
            cb.active = editable;

            if (i > 0) {
                pos += GAP;
            }
            cb.setRect( 0, pos, WIDTH, BTN_HEIGHT );
            pos = cb.bottom();

            add( cb );
            boxes.add( cb );
        }

        resize( WIDTH, (int)pos );
    }
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:34,代码来源:WndChallenges.java

示例5: onBackPressed

import com.shatteredpixel.shatteredpixeldungeon.Challenges; //导入依赖的package包/类
@Override
public void onBackPressed() {

    if (editable) {
        int value = 0;
        for (int i=0; i < boxes.size(); i++) {
            if (boxes.get( i ).checked()) {
                value |= Challenges.MASKS[i];
            }
        }
        ShatteredPixelDungeon.challenges( value );
    }

    super.onBackPressed();
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:16,代码来源:WndChallenges.java

示例6: act

import com.shatteredpixel.shatteredpixeldungeon.Challenges; //导入依赖的package包/类
@Override
public boolean act( boolean enemyInFOV, boolean justAlerted ) {
	if (enemyInFOV && Random.Int( distance( enemy ) + enemy.stealth() + (enemy.flying ? 2 : 0) ) == 0) {

		enemySeen = true;

		notice();
		state = HUNTING;
		target = enemy.pos;

		if (Dungeon.isChallenged( Challenges.SWARM_INTELLIGENCE )) {
			for (Mob mob : Dungeon.level.mobs) {
				if (mob != Mob.this) {
					mob.beckon( target );
				}
			}
		}

		spend( TIME_TO_WAKE_UP );

	} else {

		enemySeen = false;

		spend( TICK );

	}
	return true;
}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon,代码行数:30,代码来源:Mob.java

示例7: satisfy

import com.shatteredpixel.shatteredpixeldungeon.Challenges; //导入依赖的package包/类
public void satisfy( float energy ) {

		Artifact.ArtifactBuff buff = target.buff( HornOfPlenty.hornRecharge.class );
		if (buff != null && buff.isCursed()){
			energy *= 0.67f;
			GLog.n( Messages.get(this, "cursedhorn") );
		}

		if (!Dungeon.isChallenged(Challenges.NO_FOOD))
			reduceHunger( energy );
	}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon,代码行数:12,代码来源:Hunger.java

示例8: WndChallenges

import com.shatteredpixel.shatteredpixeldungeon.Challenges; //导入依赖的package包/类
public WndChallenges( int checked, boolean editable ) {

		super();

		this.editable = editable;

		RenderedText title = PixelScene.renderText( Messages.get(this, "title"), 9 );
		title.hardlight( TITLE_COLOR );
		title.x = (WIDTH - title.width()) / 2;
		title.y = (TTL_HEIGHT - title.height()) / 2;
		PixelScene.align(title);
		add( title );

		boxes = new ArrayList<>();

		float pos = TTL_HEIGHT;
		for (int i=0; i < Challenges.NAME_IDS.length; i++) {

			CheckBox cb = new CheckBox( Messages.get(Challenges.class, Challenges.NAME_IDS[i]) );
			cb.checked( (checked & Challenges.MASKS[i]) != 0 );
			cb.active = editable;

			if (i > 0) {
				pos += GAP;
			}
			cb.setRect( 0, pos, WIDTH, BTN_HEIGHT );
			pos = cb.bottom();

			add( cb );
			boxes.add( cb );
		}

		resize( WIDTH, (int)pos );
	}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon,代码行数:35,代码来源:WndChallenges.java

示例9: onBackPressed

import com.shatteredpixel.shatteredpixeldungeon.Challenges; //导入依赖的package包/类
@Override
public void onBackPressed() {

	if (editable) {
		int value = 0;
		for (int i=0; i < boxes.size(); i++) {
			if (boxes.get( i ).checked()) {
				value |= Challenges.MASKS[i];
			}
		}
		ShatteredPixelDungeon.challenges( value );
	}

	super.onBackPressed();
}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon,代码行数:16,代码来源:WndChallenges.java

示例10: WndSadGhost

import com.shatteredpixel.shatteredpixeldungeon.Challenges; //导入依赖的package包/类
public WndSadGhost( final Ghost ghost, final int type ) {
	
	super();
	
	IconTitle titlebar = new IconTitle();
       BitmapTextMultiline message;
       switch (type){
           case 1:default:
               titlebar.icon( new FetidRatSprite() );
               titlebar.label( "DEFEATED FETID RAT" );
               message = PixelScene.createMultiline( TXT_RAT+TXT_GIVEITEM, 6 );
               break;
           case 2:
               titlebar.icon( new GnollTricksterSprite() );
               titlebar.label( "DEFEATED GNOLL TRICKSTER" );
               message = PixelScene.createMultiline( TXT_GNOLL+TXT_GIVEITEM, 6 );
               break;
           case 3:
               titlebar.icon( new GreatCrabSprite());
               titlebar.label( "DEFEATED GREAT CRAB" );
               message = PixelScene.createMultiline( TXT_CRAB+TXT_GIVEITEM, 6 );
               break;

       }


	titlebar.setRect( 0, 0, WIDTH, 0 );
	add( titlebar );

	message.maxWidth = WIDTH;
	message.measure();
	message.y = titlebar.bottom() + GAP;
	add( message );
	
	RedButton btnWeapon = new RedButton( TXT_WEAPON ) {
		@Override
		protected void onClick() {
			selectReward( ghost, Ghost.Quest.weapon );
		}
	};
	btnWeapon.setRect( 0, message.y + message.height() + GAP, WIDTH, BTN_HEIGHT );
	add( btnWeapon );

       if (!Dungeon.isChallenged( Challenges.NO_ARMOR )) {
           RedButton btnArmor = new RedButton(TXT_ARMOR) {
               @Override
               protected void onClick() {
                   selectReward(ghost, Ghost.Quest.armor);
               }
           };
           btnArmor.setRect(0, btnWeapon.bottom() + GAP, WIDTH, BTN_HEIGHT);
           add(btnArmor);

           resize(WIDTH, (int) btnArmor.bottom());
       } else {
           resize(WIDTH, (int) btnWeapon.bottom());
       }
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:59,代码来源:WndSadGhost.java

示例11: WndSadGhost

import com.shatteredpixel.shatteredpixeldungeon.Challenges; //导入依赖的package包/类
public WndSadGhost( final Ghost ghost, final int type ) {
	
	super();
	
	IconTitle titlebar = new IconTitle();
	RenderedTextMultiline message;
	switch (type){
		case 1:default:
			titlebar.icon( new FetidRatSprite() );
			titlebar.label( Messages.get(this, "rat_title") );
			message = PixelScene.renderMultiline( Messages.get(this, "rat")+Messages.get(this, "give_item"), 6 );
			break;
		case 2:
			titlebar.icon( new GnollTricksterSprite() );
			titlebar.label( Messages.get(this, "gnoll_title") );
			message = PixelScene.renderMultiline( Messages.get(this, "gnoll")+Messages.get(this, "give_item"), 6 );
			break;
		case 3:
			titlebar.icon( new GreatCrabSprite());
			titlebar.label( Messages.get(this, "crab_title") );
			message = PixelScene.renderMultiline( Messages.get(this, "crab")+Messages.get(this, "give_item"), 6 );
			break;

	}

	titlebar.setRect( 0, 0, WIDTH, 0 );
	add( titlebar );

	message.maxWidth(WIDTH);
	message.setPos(0, titlebar.bottom() + GAP);
	add( message );
	
	RedButton btnWeapon = new RedButton( Messages.get(this, "weapon") ) {
		@Override
		protected void onClick() {
			selectReward( ghost, Ghost.Quest.weapon );
		}
	};
	btnWeapon.setRect( 0, message.top() + message.height() + GAP, WIDTH, BTN_HEIGHT );
	add( btnWeapon );

	if (!Dungeon.isChallenged( Challenges.NO_ARMOR )) {
		RedButton btnArmor = new RedButton( Messages.get(this, "armor") ) {
			@Override
			protected void onClick() {
				selectReward(ghost, Ghost.Quest.armor);
			}
		};
		btnArmor.setRect(0, btnWeapon.bottom() + GAP, WIDTH, BTN_HEIGHT);
		add(btnArmor);

		resize(WIDTH, (int) btnArmor.bottom());
	} else {
		resize(WIDTH, (int) btnWeapon.bottom());
	}
}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon,代码行数:57,代码来源:WndSadGhost.java

示例12: trample

import com.shatteredpixel.shatteredpixeldungeon.Challenges; //导入依赖的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.Challenges类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。