Merging 1.7.5 Source: core changes
This commit is contained in:
parent
12b647959c
commit
a2670f2a36
|
@ -33,6 +33,7 @@ public class Assets {
|
||||||
public static final String HP_BAR = "hp_bar.png";
|
public static final String HP_BAR = "hp_bar.png";
|
||||||
public static final String XP_BAR = "exp_bar.png";
|
public static final String XP_BAR = "exp_bar.png";
|
||||||
public static final String TOOLBAR = "toolbar.png";
|
public static final String TOOLBAR = "toolbar.png";
|
||||||
|
public static final String SHADOW = "shadow.png";
|
||||||
|
|
||||||
public static final String WARRIOR = "warrior.png";
|
public static final String WARRIOR = "warrior.png";
|
||||||
public static final String MAGE = "mage.png";
|
public static final String MAGE = "mage.png";
|
||||||
|
@ -83,7 +84,9 @@ public class Assets {
|
||||||
public static final String TROLL = "blacksmith.png";
|
public static final String TROLL = "blacksmith.png";
|
||||||
public static final String IMP = "demon.png";
|
public static final String IMP = "demon.png";
|
||||||
public static final String RATKING = "ratking.png";
|
public static final String RATKING = "ratking.png";
|
||||||
|
public static final String BEE = "bee.png";
|
||||||
|
public static final String MIMIC = "mimic.png";
|
||||||
|
|
||||||
public static final String ITEMS = "items.png";
|
public static final String ITEMS = "items.png";
|
||||||
public static final String PLANTS = "plants.png";
|
public static final String PLANTS = "plants.png";
|
||||||
|
|
||||||
|
@ -157,4 +160,7 @@ public class Assets {
|
||||||
public static final String SND_GHOST = "snd_ghost.mp3";
|
public static final String SND_GHOST = "snd_ghost.mp3";
|
||||||
public static final String SND_SECRET = "snd_secret.mp3";
|
public static final String SND_SECRET = "snd_secret.mp3";
|
||||||
public static final String SND_BONES = "snd_bones.mp3";
|
public static final String SND_BONES = "snd_bones.mp3";
|
||||||
|
public static final String SND_BEE = "snd_bee.mp3";
|
||||||
|
public static final String SND_DEGRADE = "snd_degrade.mp3";
|
||||||
|
public static final String SND_MIMIC = "snd_mimic.mp3";
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,6 +45,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.wands.Wand;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
|
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
|
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
|
||||||
import com.watabou.utils.Bundle;
|
import com.watabou.utils.Bundle;
|
||||||
|
import com.watabou.utils.Callback;
|
||||||
|
|
||||||
public class Badges {
|
public class Badges {
|
||||||
|
|
||||||
|
@ -168,7 +169,9 @@ public class Badges {
|
||||||
private static HashSet<Badge> local = new HashSet<Badges.Badge>();
|
private static HashSet<Badge> local = new HashSet<Badges.Badge>();
|
||||||
|
|
||||||
private static boolean saveNeeded = false;
|
private static boolean saveNeeded = false;
|
||||||
|
|
||||||
|
public static Callback loadingListener = null;
|
||||||
|
|
||||||
public static void reset() {
|
public static void reset() {
|
||||||
local.clear();
|
local.clear();
|
||||||
loadGlobal();
|
loadGlobal();
|
||||||
|
|
|
@ -25,18 +25,20 @@ public class Challenges {
|
||||||
public static final int NO_HERBALISM = 8;
|
public static final int NO_HERBALISM = 8;
|
||||||
public static final int SWARM_INTELLIGENCE = 16;
|
public static final int SWARM_INTELLIGENCE = 16;
|
||||||
public static final int DARKNESS = 32;
|
public static final int DARKNESS = 32;
|
||||||
|
public static final int NO_SCROLLS = 64;
|
||||||
|
|
||||||
public static final String[] NAMES = {
|
public static final String[] NAMES = {
|
||||||
"No food",
|
"On diet",
|
||||||
"No armors",
|
"Faith is my armor",
|
||||||
"No healing potions",
|
"Pharmacophobia",
|
||||||
"No dew, no seeds",
|
"Barren land",
|
||||||
"Swarm intelligence",
|
"Swarm intelligence",
|
||||||
"Darkness"
|
"Into darkness",
|
||||||
|
"Forbidden runes"
|
||||||
};
|
};
|
||||||
|
|
||||||
public static final int[] MASKS = {
|
public static final int[] MASKS = {
|
||||||
NO_FOOD, NO_ARMOR, NO_HEALING, NO_HERBALISM, SWARM_INTELLIGENCE, DARKNESS
|
NO_FOOD, NO_ARMOR, NO_HEALING, NO_HERBALISM, SWARM_INTELLIGENCE, DARKNESS, NO_SCROLLS
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
|
@ -75,59 +75,7 @@ import java.util.Date;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
|
||||||
public class Dungeon {
|
public class Dungeon {
|
||||||
|
|
||||||
private static final String NO_TIPS = "The text is indecipherable...";
|
|
||||||
private static final String[] TIPS = {
|
|
||||||
"Almost all equipment has a strength requirement. Don't overestimate your strength, using equipment you can't " +
|
|
||||||
"handle has big penalties!\n\nRaising your strength is not the only way to access better equipment, " +
|
|
||||||
"you can also lower equipment strength requirements with Scrolls of Upgrade.\n\n\n" +
|
|
||||||
"Items found in the dungeon will often be unidentified. Some items will have unknown effects, others " +
|
|
||||||
"may be upgraded, or degraded and cursed! Unidentified items are unpredictable, so be careful!",
|
|
||||||
"Charging forward recklessly is a great way to get killed.\n\n" +
|
|
||||||
"Slowing down a bit to examine enemies and use the environment and items to your advantage can make a" +
|
|
||||||
" big difference.\n\nThe dungeon is full of traps and hidden passageways as well, keep your eyes open!",
|
|
||||||
"Levelling up is important!\n\nBeing at least the same level as the floor you are on is a good idea. " +
|
|
||||||
"Don't be afraid to slow down a little and train yourself up.",
|
|
||||||
"The rogue isn't the only character that benefits from being sneaky. You can retreat to the other side of a " +
|
|
||||||
"door to ambush a chasing opponent for a guaranteed hit!" +
|
|
||||||
"\n\nAny attack on an unaware opponent is guaranteed to hit them.",
|
|
||||||
|
|
||||||
"Note to all sewer maintenance & cleaning crews: TURN BACK NOW. Some sort of sludge monster has made its home" +
|
|
||||||
" here and several crews have been lost trying to deal with it.\n\n" +
|
|
||||||
"Approval has been given to seal off the lower sewers, this area has been condemned, LEAVE NOW.",
|
|
||||||
|
|
||||||
"Pixel-Mart - all you need for successful adventure!",
|
|
||||||
"Identify your potions and scrolls as soon as possible. Don't put it off to the moment " +
|
|
||||||
"when you actually need them.",
|
|
||||||
"Being hungry doesn't hurt, but starving does hurt.",
|
|
||||||
"Surprise attack has a better chance to hit. For example, you can ambush your enemy behind " +
|
|
||||||
"a closed door when you know it is approaching.",
|
|
||||||
|
|
||||||
"Don't let The Tengu out!",
|
|
||||||
|
|
||||||
"Pixel-Mart. Spend money. Live longer.",
|
|
||||||
"When you're attacked by several monsters at the same time, try to retreat behind a door.",
|
|
||||||
"If you are burning, you can't put out the fire in the water while levitating.",
|
|
||||||
"There is no sense in possessing more than one unblessed Ankh at the same time, " +
|
|
||||||
"because you will lose them upon resurrecting.",
|
|
||||||
|
|
||||||
"DANGER! Heavy machinery can cause injury, loss of limbs or death!",
|
|
||||||
|
|
||||||
"Pixel-Mart. A safer life in dungeon.",
|
|
||||||
"When you upgrade an enchanted weapon, there is a chance to destroy that enchantment.",
|
|
||||||
"In a Well of Transmutation you can get an item, that cannot be obtained otherwise.",
|
|
||||||
"The only way to enchant a weapon is by upgrading it with a Scroll of Weapon Upgrade.",
|
|
||||||
|
|
||||||
"No weapons allowed in the presence of His Majesty!",
|
|
||||||
|
|
||||||
"Pixel-Mart. Special prices for demon hunters!",
|
|
||||||
"The text is written in demonic language.",
|
|
||||||
"The text is written in demonic language.",
|
|
||||||
"The text is written in demonic language."
|
|
||||||
};
|
|
||||||
|
|
||||||
private static final String TXT_DEAD_END =
|
|
||||||
"What are you doing here?!";
|
|
||||||
|
|
||||||
public static boolean dewVial; // true if the dew vial can be spawned
|
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 transmutation; // depth number for a well of transmutation
|
||||||
|
@ -314,24 +262,6 @@ public class Dungeon {
|
||||||
switchLevel( level, level.entrance );
|
switchLevel( level, level.entrance );
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String tip() {
|
|
||||||
|
|
||||||
if (level instanceof DeadEndLevel) {
|
|
||||||
|
|
||||||
return TXT_DEAD_END;
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
int index = depth - 1;
|
|
||||||
|
|
||||||
if (index < TIPS.length) {
|
|
||||||
return TIPS[index];
|
|
||||||
} else {
|
|
||||||
return NO_TIPS;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean shopOnLevel() {
|
public static boolean shopOnLevel() {
|
||||||
return depth == 6 || depth == 11 || depth == 16;
|
return depth == 6 || depth == 11 || depth == 16;
|
||||||
}
|
}
|
||||||
|
@ -392,7 +322,7 @@ public class Dungeon {
|
||||||
return chance( quota, limitedDrops.strengthPotions.count );
|
return chance( quota, limitedDrops.strengthPotions.count );
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean soeNeeded() {
|
public static boolean souNeeded() {
|
||||||
int[] quota = {5, 3, 10, 6, 15, 9, 20, 12, 25, 13};
|
int[] quota = {5, 3, 10, 6, 15, 9, 20, 12, 25, 13};
|
||||||
return chance( quota, limitedDrops.upgradeScrolls.count );
|
return chance( quota, limitedDrops.upgradeScrolls.count );
|
||||||
}
|
}
|
||||||
|
@ -547,8 +477,8 @@ public class Dungeon {
|
||||||
saveGame( gameFile( hero.heroClass ) );
|
saveGame( gameFile( hero.heroClass ) );
|
||||||
saveLevel();
|
saveLevel();
|
||||||
|
|
||||||
GamesInProgress.set( hero.heroClass, depth, hero.lvl );
|
GamesInProgress.set( hero.heroClass, depth, hero.lvl, challenges != 0 );
|
||||||
|
|
||||||
} else if (WndResurrect.instance != null) {
|
} else if (WndResurrect.instance != null) {
|
||||||
|
|
||||||
WndResurrect.instance.hide();
|
WndResurrect.instance.hide();
|
||||||
|
@ -688,6 +618,7 @@ public class Dungeon {
|
||||||
|
|
||||||
public static void preview( GamesInProgress.Info info, Bundle bundle ) {
|
public static void preview( GamesInProgress.Info info, Bundle bundle ) {
|
||||||
info.depth = bundle.getInt( DEPTH );
|
info.depth = bundle.getInt( DEPTH );
|
||||||
|
info.challenges = (bundle.getInt( CHALLENGES ) != 0);
|
||||||
if (info.depth == -1) {
|
if (info.depth == -1) {
|
||||||
info.depth = bundle.getInt( "maxDepth" ); // FIXME
|
info.depth = bundle.getInt( "maxDepth" ); // FIXME
|
||||||
}
|
}
|
||||||
|
@ -703,6 +634,8 @@ public class Dungeon {
|
||||||
|
|
||||||
public static void win( String desc ) {
|
public static void win( String desc ) {
|
||||||
|
|
||||||
|
hero.belongings.identify();
|
||||||
|
|
||||||
if (challenges != 0) {
|
if (challenges != 0) {
|
||||||
Badges.validateChampion();
|
Badges.validateChampion();
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,11 +51,12 @@ public class GamesInProgress {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void set( HeroClass cl, int depth, int level ) {
|
public static void set( HeroClass cl, int depth, int level, boolean challenges ) {
|
||||||
Info info = new Info();
|
Info info = new Info();
|
||||||
info.depth = depth;
|
info.depth = depth;
|
||||||
info.level = level;
|
info.level = level;
|
||||||
|
info.challenges = challenges;
|
||||||
state.put( cl, info );
|
state.put( cl, info );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,5 +71,6 @@ public class GamesInProgress {
|
||||||
public static class Info {
|
public static class Info {
|
||||||
public int depth;
|
public int depth;
|
||||||
public int level;
|
public int level;
|
||||||
|
public boolean challenges;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,8 @@ public enum Rankings {
|
||||||
public ArrayList<Record> records;
|
public ArrayList<Record> records;
|
||||||
public int lastRecord;
|
public int lastRecord;
|
||||||
public int totalNumber;
|
public int totalNumber;
|
||||||
|
public int wonNumber;
|
||||||
|
|
||||||
public void submit( boolean win ) {
|
public void submit( boolean win ) {
|
||||||
|
|
||||||
load();
|
load();
|
||||||
|
@ -91,7 +92,10 @@ public enum Rankings {
|
||||||
}
|
}
|
||||||
|
|
||||||
totalNumber++;
|
totalNumber++;
|
||||||
|
if (win) {
|
||||||
|
wonNumber++;
|
||||||
|
}
|
||||||
|
|
||||||
Badges.validateGamesPlayed();
|
Badges.validateGamesPlayed();
|
||||||
|
|
||||||
save();
|
save();
|
||||||
|
@ -104,13 +108,15 @@ public enum Rankings {
|
||||||
private static final String RECORDS = "records";
|
private static final String RECORDS = "records";
|
||||||
private static final String LATEST = "latest";
|
private static final String LATEST = "latest";
|
||||||
private static final String TOTAL = "total";
|
private static final String TOTAL = "total";
|
||||||
|
private static final String WON = "won";
|
||||||
|
|
||||||
public void save() {
|
public void save() {
|
||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
bundle.put( RECORDS, records );
|
bundle.put( RECORDS, records );
|
||||||
bundle.put( LATEST, lastRecord );
|
bundle.put( LATEST, lastRecord );
|
||||||
bundle.put( TOTAL, totalNumber );
|
bundle.put( TOTAL, totalNumber );
|
||||||
|
bundle.put( WON, wonNumber );
|
||||||
|
|
||||||
try {
|
try {
|
||||||
OutputStream output = Game.instance.openFileOutput( RANKINGS_FILE, Game.MODE_PRIVATE );
|
OutputStream output = Game.instance.openFileOutput( RANKINGS_FILE, Game.MODE_PRIVATE );
|
||||||
Bundle.write( bundle, output );
|
Bundle.write( bundle, output );
|
||||||
|
@ -142,7 +148,17 @@ public enum Rankings {
|
||||||
totalNumber = records.size();
|
totalNumber = records.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wonNumber = bundle.getInt( WON );
|
||||||
|
if (wonNumber == 0) {
|
||||||
|
for (Record rec : records) {
|
||||||
|
if (rec.win) {
|
||||||
|
wonNumber++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,15 +37,20 @@ public class ShatteredPixelDungeon extends Game {
|
||||||
|
|
||||||
public ShatteredPixelDungeon() {
|
public ShatteredPixelDungeon() {
|
||||||
super( TitleScene.class );
|
super( TitleScene.class );
|
||||||
/*
|
|
||||||
// 1.7.2
|
// 0.2.4
|
||||||
com.watabou.utils.Bundle.addAlias(
|
com.watabou.utils.Bundle.addAlias(
|
||||||
com.shatteredpixel.shatteredpixeldungeon.plants.Dreamweed.class,
|
com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Shock.class,
|
||||||
"com.shatteredpixel.shatteredpixeldungeon.plants.Blindweed" );
|
"com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Piercing" );
|
||||||
com.watabou.utils.Bundle.addAlias(
|
com.watabou.utils.Bundle.addAlias(
|
||||||
com.shatteredpixel.shatteredpixeldungeon.plants.Dreamweed.Seed.class,
|
com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Shock.class,
|
||||||
"com.shatteredpixel.shatteredpixeldungeon.plants.Blindweed$Seed" );
|
"com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Swing" );
|
||||||
*/
|
/* If I rename scroll of weapon upgrade, uncomment this and correct it.
|
||||||
|
com.watabou.utils.Bundle.addAlias(
|
||||||
|
com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfEnchantment.class,
|
||||||
|
"com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfWeaponUpgrade" );
|
||||||
|
*/
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
|
@ -75,6 +80,55 @@ public class ShatteredPixelDungeon extends Game {
|
||||||
|
|
||||||
Music.INSTANCE.enable( music() );
|
Music.INSTANCE.enable( music() );
|
||||||
Sample.INSTANCE.enable( soundFx() );
|
Sample.INSTANCE.enable( soundFx() );
|
||||||
|
|
||||||
|
Sample.INSTANCE.load(
|
||||||
|
Assets.SND_CLICK,
|
||||||
|
Assets.SND_BADGE,
|
||||||
|
Assets.SND_GOLD,
|
||||||
|
|
||||||
|
Assets.SND_DESCEND,
|
||||||
|
Assets.SND_STEP,
|
||||||
|
Assets.SND_WATER,
|
||||||
|
Assets.SND_OPEN,
|
||||||
|
Assets.SND_UNLOCK,
|
||||||
|
Assets.SND_ITEM,
|
||||||
|
Assets.SND_DEWDROP,
|
||||||
|
Assets.SND_HIT,
|
||||||
|
Assets.SND_MISS,
|
||||||
|
Assets.SND_EAT,
|
||||||
|
Assets.SND_READ,
|
||||||
|
Assets.SND_LULLABY,
|
||||||
|
Assets.SND_DRINK,
|
||||||
|
Assets.SND_SHATTER,
|
||||||
|
Assets.SND_ZAP,
|
||||||
|
Assets.SND_LIGHTNING,
|
||||||
|
Assets.SND_LEVELUP,
|
||||||
|
Assets.SND_DEATH,
|
||||||
|
Assets.SND_CHALLENGE,
|
||||||
|
Assets.SND_CURSED,
|
||||||
|
Assets.SND_EVOKE,
|
||||||
|
Assets.SND_TRAP,
|
||||||
|
Assets.SND_TOMB,
|
||||||
|
Assets.SND_ALERT,
|
||||||
|
Assets.SND_MELD,
|
||||||
|
Assets.SND_BOSS,
|
||||||
|
Assets.SND_BLAST,
|
||||||
|
Assets.SND_PLANT,
|
||||||
|
Assets.SND_RAY,
|
||||||
|
Assets.SND_BEACON,
|
||||||
|
Assets.SND_TELEPORT,
|
||||||
|
Assets.SND_CHARMS,
|
||||||
|
Assets.SND_MASTERY,
|
||||||
|
Assets.SND_PUFF,
|
||||||
|
Assets.SND_ROCKS,
|
||||||
|
Assets.SND_BURNING,
|
||||||
|
Assets.SND_FALLING,
|
||||||
|
Assets.SND_GHOST,
|
||||||
|
Assets.SND_SECRET,
|
||||||
|
Assets.SND_BONES,
|
||||||
|
Assets.SND_BEE,
|
||||||
|
Assets.SND_DEGRADE,
|
||||||
|
Assets.SND_MIMIC );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -142,16 +196,21 @@ public class ShatteredPixelDungeon extends Game {
|
||||||
@SuppressLint("NewApi")
|
@SuppressLint("NewApi")
|
||||||
public static void updateImmersiveMode() {
|
public static void updateImmersiveMode() {
|
||||||
if (android.os.Build.VERSION.SDK_INT >= 19) {
|
if (android.os.Build.VERSION.SDK_INT >= 19) {
|
||||||
instance.getWindow().getDecorView().setSystemUiVisibility(
|
try {
|
||||||
immersed() ?
|
// Sometime NullPointerException happens here
|
||||||
View.SYSTEM_UI_FLAG_LAYOUT_STABLE |
|
instance.getWindow().getDecorView().setSystemUiVisibility(
|
||||||
View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION |
|
immersed() ?
|
||||||
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN |
|
View.SYSTEM_UI_FLAG_LAYOUT_STABLE |
|
||||||
View.SYSTEM_UI_FLAG_HIDE_NAVIGATION |
|
View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION |
|
||||||
View.SYSTEM_UI_FLAG_FULLSCREEN |
|
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN |
|
||||||
View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
|
View.SYSTEM_UI_FLAG_HIDE_NAVIGATION |
|
||||||
:
|
View.SYSTEM_UI_FLAG_FULLSCREEN |
|
||||||
0 );
|
View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
|
||||||
|
:
|
||||||
|
0 );
|
||||||
|
} catch (Exception e) {
|
||||||
|
reportException( e );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -241,8 +300,8 @@ public class ShatteredPixelDungeon extends Game {
|
||||||
/*
|
/*
|
||||||
* <--- Preferences
|
* <--- Preferences
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public static void reportException( Exception e ) {
|
public static void reportException( Throwable tr ) {
|
||||||
Log.e( "PD", Log.getStackTraceString( e ) );
|
Log.e("PD", Log.getStackTraceString(tr));
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user