Merging Source v1.7.2: top-level class changes
This commit is contained in:
parent
6d177a163a
commit
92a17f392e
|
@ -39,6 +39,7 @@ public class Assets {
|
|||
public static final String ROGUE = "rogue.png";
|
||||
public static final String HUNTRESS = "ranger.png";
|
||||
public static final String AVATARS = "avatars.png";
|
||||
public static final String PET = "pet.png";
|
||||
|
||||
public static final String SURFACE = "surface.png";
|
||||
|
||||
|
|
|
@ -141,6 +141,7 @@ public class Badges {
|
|||
GAMES_PLAYED_3( "500 games played", 62, true ),
|
||||
GAMES_PLAYED_4( "2000 games played", 63, true ),
|
||||
HAPPY_END( "Happy end", 38 ),
|
||||
CHAMPION( "Challenge won", 39, true ),
|
||||
SUPPORTER( "Thanks for your support!", 31, true );
|
||||
|
||||
public boolean meta;
|
||||
|
@ -844,6 +845,10 @@ public class Badges {
|
|||
displayBadge( Badge.HAPPY_END );
|
||||
}
|
||||
|
||||
public static void validateChampion() {
|
||||
displayBadge(Badge.CHAMPION);
|
||||
}
|
||||
|
||||
private static void displayBadge( Badge badge ) {
|
||||
|
||||
if (badge == null) {
|
||||
|
|
42
src/com/shatteredpixel/shatteredpixeldungeon/Challenges.java
Normal file
42
src/com/shatteredpixel/shatteredpixeldungeon/Challenges.java
Normal file
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
* Pixel Dungeon
|
||||
* Copyright (C) 2012-2014 Oleg Dolya
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
package com.shatteredpixel.shatteredpixeldungeon;
|
||||
|
||||
public class Challenges {
|
||||
|
||||
public static final int NO_FOOD = 1;
|
||||
public static final int NO_ARMOR = 2;
|
||||
public static final int NO_HEALING = 4;
|
||||
public static final int NO_HERBALISM = 8;
|
||||
public static final int SWARM_INTELLIGENCE = 16;
|
||||
public static final int DARKNESS = 32;
|
||||
|
||||
public static final String[] NAMES = {
|
||||
"No food",
|
||||
"No armors",
|
||||
"No healing potions",
|
||||
"No dew, no seeds",
|
||||
"Swarm intelligence",
|
||||
"Darkness"
|
||||
};
|
||||
|
||||
public static final int[] MASKS = {
|
||||
NO_FOOD, NO_ARMOR, NO_HEALING, NO_HERBALISM, SWARM_INTELLIGENCE, DARKNESS
|
||||
};
|
||||
|
||||
}
|
|
@ -31,8 +31,7 @@ public class Chrome {
|
|||
SCROLL,
|
||||
TAB_SET,
|
||||
TAB_SELECTED,
|
||||
TAB_UNSELECTED,
|
||||
SURFACE
|
||||
TAB_UNSELECTED
|
||||
};
|
||||
|
||||
public static NinePatch get( Type type ) {
|
||||
|
@ -57,8 +56,6 @@ public class Chrome {
|
|||
return new NinePatch( Assets.CHROME, 64, 22, 10, 14, 4, 7, 4, 6 );
|
||||
case TAB_UNSELECTED:
|
||||
return new NinePatch( Assets.CHROME, 74, 22, 10, 14, 4, 7, 4, 6 );
|
||||
case SURFACE:
|
||||
return new NinePatch( Assets.CHROME, 86, 0, 22, 22, 5 );
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -125,11 +125,12 @@ public class Dungeon {
|
|||
public static boolean dewVial; // true if the dew vial can be spawned
|
||||
public static int transmutation; // depth number for a well of transmutation
|
||||
|
||||
public static int challenges;
|
||||
|
||||
public static Hero hero;
|
||||
public static Level level;
|
||||
|
||||
// Either<EFBFBD> Item or Class<? extends Item>
|
||||
// Either Item or Class<? extends Item>
|
||||
public static Object quickslot;
|
||||
|
||||
public static int depth;
|
||||
|
@ -148,6 +149,8 @@ public class Dungeon {
|
|||
|
||||
public static void init() {
|
||||
|
||||
challenges = ShatteredPixelDungeon.challenges();
|
||||
|
||||
Actor.clear();
|
||||
|
||||
PathFinder.setMapSize( Level.WIDTH, Level.HEIGHT );
|
||||
|
@ -186,6 +189,10 @@ public class Dungeon {
|
|||
StartScene.curClass.initHero( hero );
|
||||
}
|
||||
|
||||
public static boolean isChallenged( int mask ) {
|
||||
return (challenges & mask) != 0;
|
||||
}
|
||||
|
||||
public static Level newLevel() {
|
||||
|
||||
Dungeon.level = null;
|
||||
|
@ -375,6 +382,7 @@ public class Dungeon {
|
|||
private static final String RN_DEPTH_FILE = "ranger%d.dat";
|
||||
|
||||
private static final String VERSION = "version";
|
||||
private static final String CHALLENGES = "challenges";
|
||||
private static final String HERO = "hero";
|
||||
private static final String GOLD = "gold";
|
||||
private static final String DEPTH = "depth";
|
||||
|
@ -420,6 +428,7 @@ public class Dungeon {
|
|||
Bundle bundle = new Bundle();
|
||||
|
||||
bundle.put( VERSION, Game.versionCode );
|
||||
bundle.put( CHALLENGES, challenges );
|
||||
bundle.put( HERO, hero );
|
||||
bundle.put( GOLD, gold );
|
||||
bundle.put( DEPTH, depth );
|
||||
|
@ -489,11 +498,7 @@ public class Dungeon {
|
|||
saveGame( gameFile( hero.heroClass ) );
|
||||
saveLevel();
|
||||
|
||||
GamesInProgress.set(
|
||||
hero.heroClass,
|
||||
depth,
|
||||
hero.lvl,
|
||||
hero.belongings.armor != null ? hero.belongings.armor.tier : 0 );
|
||||
GamesInProgress.set( hero.heroClass, depth, hero.lvl );
|
||||
|
||||
} else if (WndResurrect.instance != null) {
|
||||
|
||||
|
@ -517,6 +522,8 @@ public class Dungeon {
|
|||
|
||||
version = bundle.getInt( VERSION );
|
||||
|
||||
Dungeon.challenges = bundle.getInt( CHALLENGES );
|
||||
|
||||
Dungeon.level = null;
|
||||
Dungeon.depth = -1;
|
||||
|
||||
|
@ -625,7 +632,7 @@ public class Dungeon {
|
|||
public static void preview( GamesInProgress.Info info, Bundle bundle ) {
|
||||
info.depth = bundle.getInt( DEPTH );
|
||||
if (info.depth == -1) {
|
||||
info.depth = bundle.getInt( "maxDepth" ); // <-- It has to be refactored!
|
||||
info.depth = bundle.getInt( "maxDepth" ); // FIXME
|
||||
}
|
||||
Hero.preview( info, bundle.getBundle( HERO ) );
|
||||
}
|
||||
|
@ -638,6 +645,11 @@ public class Dungeon {
|
|||
}
|
||||
|
||||
public static void win( String desc ) {
|
||||
|
||||
if (challenges != 0) {
|
||||
Badges.validateChampion();
|
||||
}
|
||||
|
||||
resultDescription = desc;
|
||||
Rankings.INSTANCE.submit( true );
|
||||
}
|
||||
|
|
|
@ -51,11 +51,10 @@ public class GamesInProgress {
|
|||
}
|
||||
}
|
||||
|
||||
public static void set( HeroClass cl, int depth, int level, int armor ) {
|
||||
public static void set( HeroClass cl, int depth, int level ) {
|
||||
Info info = new Info();
|
||||
info.depth = depth;
|
||||
info.level = level;
|
||||
info.armor = armor;
|
||||
state.put( cl, info );
|
||||
}
|
||||
|
||||
|
@ -70,6 +69,5 @@ public class GamesInProgress {
|
|||
public static class Info {
|
||||
public int depth;
|
||||
public int level;
|
||||
public int armor;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,11 +26,13 @@ enum Preferences {
|
|||
INSTANCE;
|
||||
|
||||
public static final String KEY_LANDSCAPE = "landscape";
|
||||
public static final String KEY_IMMERSIVE = "immersive";
|
||||
public static final String KEY_SCALE_UP = "scaleup";
|
||||
public static final String KEY_MUSIC = "music";
|
||||
public static final String KEY_SOUND_FX = "soundfx";
|
||||
public static final String KEY_ZOOM = "zoom";
|
||||
public static final String KEY_LAST_CLASS = "last_class";
|
||||
public static final String KEY_CHALLENGES = "challenges";
|
||||
public static final String KEY_DONATED = "donated";
|
||||
public static final String KEY_INTRO = "intro";
|
||||
public static final String KEY_BRIGHTNESS = "brightness";
|
||||
|
|
Loading…
Reference in New Issue
Block a user