本文整理汇总了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;
}
示例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);
}
示例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;
}
示例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 );
}
示例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();
}
示例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;
}
示例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 );
}
示例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 );
}
示例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();
}
示例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());
}
}
示例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());
}
}
示例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();
}