Skip to content

Commit

Permalink
Version 0.3.0c
Browse files Browse the repository at this point in the history
- reworked the "Enchanted item with +X bonus acquired" badge into "X scrolls of Upgrade used" badge
- scrolls of Banishment and potions of Blessing now affect wands in the wand holder
- potions of Strength now give 2 bonus health points regardless of your class
- you can double tap the Search button to search now (with default behaviour set)
- decreased skeleton respawn rate in the fourth boss fight

- fixed scroll of Challenge freezing the game on floors with no mobs
- fixed Harpoons crashing the game when used on immovable target
- fixed the search button switch in the settings having incorrect text
- fixed "Nevermind" button when the game asks you which quickslot to replace
- fixed DM-300's boulders crashing the game in rare cases
- NPCs are immovable now
  • Loading branch information
ConsideredHamster committed Mar 25, 2017
1 parent 421b085 commit 14ff051
Show file tree
Hide file tree
Showing 31 changed files with 255 additions and 179 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ android {
applicationId "com.consideredhamster.yetanotherpixeldungeon"
minSdkVersion 9
targetSdkVersion 21
versionCode 302
versionName '0.3.0b'
versionCode 303
versionName '0.3.0c'
archivesBaseName = "yapd-$versionName"
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public static enum Badge {
"3rd boss slain by Gladiator, Berserker, Warlock, Battlemage, Freerunner, Assassin, Sniper & Warden", 33, true ),
RING_OF_HAGGLER( "Ring of Haggler obtained", 20 ),
RING_OF_THORNS( "Ring of Thorns obtained", 21 ),
STRENGTH_ATTAINED_1( "1 potions of Strength used", 40 ),
STRENGTH_ATTAINED_1( "1 potion of Strength used", 40 ),
STRENGTH_ATTAINED_2( "3 potions of Strength used", 41 ),
STRENGTH_ATTAINED_3( "6 potions of Strength used", 42 ),
STRENGTH_ATTAINED_4( "10 potions of Strength used", 43 ),
Expand All @@ -110,10 +110,10 @@ public static enum Badge {
MASTERY_SCHOLAR,
MASTERY_BRIGAND,
MASTERY_ACOLYTE,
ITEM_LEVEL_1( "Enchanted item with +0 bonus acquired", 48 ),
ITEM_LEVEL_2( "Enchanted item with +1 bonus acquired", 49 ),
ITEM_LEVEL_3( "Enchanted item with +2 bonus acquired", 50 ),
ITEM_LEVEL_4( "Enchanted item with +3 bonus acquired", 51 ),
ITEMS_UPGRADED_1( "1 scroll of Upgrade used", 48 ),
ITEMS_UPGRADED_2( "3 scrolls of Upgrade used", 49 ),
ITEMS_UPGRADED_3( "6 scrolls of Upgrade used", 50 ),
ITEMS_UPGRADED_4( "10 scrolls of Upgrade used", 51 ),
RARE_ALBINO,
RARE_BANDIT,
RARE_SHIELDED,
Expand Down Expand Up @@ -239,7 +239,7 @@ public static void saveGlobal() {
store(bundle, global);

try {
OutputStream output = Game.instance.openFileOutput( BADGES_FILE, Game.MODE_PRIVATE );
OutputStream output = Game.instance.openFileOutput(BADGES_FILE, Game.MODE_PRIVATE);
Bundle.write( bundle, output );
output.close();
saveNeeded = false;
Expand Down Expand Up @@ -330,8 +330,8 @@ public static void validateLevelReached() {
displayBadge(badge);
}
}
public static void validateStrengthAttained() {

public static void validateStrengthAttained() {

if ( Dungeon.difficulty > Difficulties.EASY ) {

Expand All @@ -356,7 +356,34 @@ public static void validateStrengthAttained() {

displayBadge(badge);
}
}
}

public static void validateItemsUpgraded() {

if ( Dungeon.difficulty > Difficulties.EASY ) {

Badge badge = null;

if (!local.contains(Badge.ITEMS_UPGRADED_1) && Statistics.itemsUpgraded >= 1) {
badge = Badge.ITEMS_UPGRADED_1;
local.add(badge);
}
if (!local.contains(Badge.ITEMS_UPGRADED_2) && Statistics.itemsUpgraded >= 3) {
badge = Badge.ITEMS_UPGRADED_2;
local.add(badge);
}
if (!local.contains(Badge.ITEMS_UPGRADED_3) && Statistics.itemsUpgraded >= 6) {
badge = Badge.ITEMS_UPGRADED_3;
local.add(badge);
}
if (!local.contains(Badge.ITEMS_UPGRADED_4) && Statistics.itemsUpgraded >= 10) {
badge = Badge.ITEMS_UPGRADED_4;
local.add(badge);
}

displayBadge(badge);
}
}

public static void validateFoodEaten() {

Expand Down Expand Up @@ -427,45 +454,45 @@ public static void validatePiranhasKilled() {
}
}

public static void validateItemLevelAcquired(Item item) {

if ( Dungeon.difficulty > Difficulties.EASY ) {


// This method should be called:
// 1) When an item gets obtained (Item.collect)
// 2) When an item gets upgraded (ScrollOfUpgrade, ScrollOfWeaponUpgrade, ShortSword, WandOfMagicMissile)
// 3) When an item gets identified
if (item.known < Item.UPGRADE_KNOWN) {
return;
}

Badge badge = null;

if (item instanceof Weapon && ((Weapon) item).isEnchanted() ||
item instanceof Armour && ((Armour) item).isInscribed()) {

if (!local.contains(Badge.ITEM_LEVEL_1) && item.bonus >= 0) {
badge = Badge.ITEM_LEVEL_1;
local.add(badge);
}
if (!local.contains(Badge.ITEM_LEVEL_2) && item.bonus >= 1) {
badge = Badge.ITEM_LEVEL_2;
local.add(badge);
}
if (!local.contains(Badge.ITEM_LEVEL_3) && item.bonus >= 2) {
badge = Badge.ITEM_LEVEL_3;
local.add(badge);
}
if (!local.contains(Badge.ITEM_LEVEL_4) && item.bonus >= 3) {
badge = Badge.ITEM_LEVEL_4;
local.add(badge);
}
}

displayBadge(badge);
}
}
// public static void validateItemLevelAcquired(Item item) {
//
// if ( Dungeon.difficulty > Difficulties.EASY ) {
//
//
// // This method should be called:
// // 1) When an item gets obtained (Item.collect)
// // 2) When an item gets upgraded (ScrollOfUpgrade, ScrollOfWeaponUpgrade, ShortSword, WandOfMagicMissile)
// // 3) When an item gets identified
// if (item.known < Item.UPGRADE_KNOWN) {
// return;
// }
//
// Badge badge = null;
//
// if (item instanceof Weapon && ((Weapon) item).isEnchanted() ||
// item instanceof Armour && ((Armour) item).isInscribed()) {
//
// if (!local.contains(Badge.ITEM_LEVEL_1) && item.bonus >= 0) {
// badge = Badge.ITEM_LEVEL_1;
// local.add(badge);
// }
// if (!local.contains(Badge.ITEM_LEVEL_2) && item.bonus >= 1) {
// badge = Badge.ITEM_LEVEL_2;
// local.add(badge);
// }
// if (!local.contains(Badge.ITEM_LEVEL_3) && item.bonus >= 2) {
// badge = Badge.ITEM_LEVEL_3;
// local.add(badge);
// }
// if (!local.contains(Badge.ITEM_LEVEL_4) && item.bonus >= 3) {
// badge = Badge.ITEM_LEVEL_4;
// local.add(badge);
// }
// }
//
// displayBadge(badge);
// }
// }

public static void validateAllPotionsIdentified() {

Expand Down Expand Up @@ -1027,7 +1054,7 @@ public static List<Badge> filtered( boolean global ) {
leaveBest( filtered, Badge.LEVEL_REACHED_1, Badge.LEVEL_REACHED_2, Badge.LEVEL_REACHED_3, Badge.LEVEL_REACHED_4 );
leaveBest( filtered, Badge.STRENGTH_ATTAINED_1, Badge.STRENGTH_ATTAINED_2, Badge.STRENGTH_ATTAINED_3, Badge.STRENGTH_ATTAINED_4 );
leaveBest( filtered, Badge.FOOD_EATEN_1, Badge.FOOD_EATEN_2, Badge.FOOD_EATEN_3, Badge.FOOD_EATEN_4 );
leaveBest( filtered, Badge.ITEM_LEVEL_1, Badge.ITEM_LEVEL_2, Badge.ITEM_LEVEL_3, Badge.ITEM_LEVEL_4 );
leaveBest( filtered, Badge.ITEMS_UPGRADED_1, Badge.ITEMS_UPGRADED_2, Badge.ITEMS_UPGRADED_3, Badge.ITEMS_UPGRADED_4 );
leaveBest( filtered, Badge.POTIONS_COOKED_1, Badge.POTIONS_COOKED_2, Badge.POTIONS_COOKED_3, Badge.POTIONS_COOKED_4 );
leaveBest( filtered, Badge.BOSS_SLAIN_1_ALL_CLASSES, Badge.BOSS_SLAIN_3_ALL_SUBCLASSES );
leaveBest( filtered, Badge.DEATH_FROM_FIRE, Badge.YASD );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,6 @@ public static Level newLevel() {
Actor.clear();

depth++;
// depth=30;

if (depth > Statistics.deepestFloor) {
Statistics.deepestFloor = depth;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
public class Statistics {

public static int goldCollected;
public static int itemsUpgraded;
public static int deepestFloor;
public static int enemiesSlain;
public static int foodEaten;
Expand All @@ -43,6 +44,7 @@ public class Statistics {
public static void reset() {

goldCollected = 0;
itemsUpgraded = 0;
deepestFloor = 0;
enemiesSlain = 0;
foodEaten = 0;
Expand All @@ -60,6 +62,7 @@ public static void reset() {
}

private static final String GOLD = "score";
private static final String UPGRADES = "itemsUpgraded";
private static final String DEEPEST = "maxDepth";
private static final String SLAIN = "enemiesSlain";
private static final String FOOD = "foodEaten";
Expand All @@ -72,6 +75,7 @@ public static void reset() {

public static void storeInBundle( Bundle bundle ) {
bundle.put( GOLD, goldCollected );
bundle.put( UPGRADES, itemsUpgraded );
bundle.put( DEEPEST, deepestFloor );
bundle.put( SLAIN, enemiesSlain );
bundle.put( FOOD, foodEaten );
Expand All @@ -85,6 +89,7 @@ public static void storeInBundle( Bundle bundle ) {

public static void restoreFromBundle( Bundle bundle ) {
goldCollected = bundle.getInt( GOLD );
itemsUpgraded = bundle.getInt( UPGRADES );
deepestFloor = bundle.getInt( DEEPEST );
enemiesSlain = bundle.getInt( SLAIN );
foodEaten = bundle.getInt( FOOD );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ protected Item affectItem( Item item ) {
return null;
} else {
item.identify();
Badges.validateItemLevelAcquired(item);
// Badges.validateItemLevelAcquired(item);

emitter.parent.add( new Identification( DungeonTilemap.tileCenterToWorld( pos ) ) );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,15 +148,15 @@ public void identify() {
public void observe() {
if (weap1 != null) {
weap1.identify();
Badges.validateItemLevelAcquired(weap1);
// Badges.validateItemLevelAcquired(weap1);
}
if (weap2 != null) {
weap2.identify();
Badges.validateItemLevelAcquired(weap2);
// Badges.validateItemLevelAcquired(weap2);
}
if (armor != null) {
armor.identify();
Badges.validateItemLevelAcquired(armor);
// Badges.validateItemLevelAcquired(armor);
}
// if (ring1 != null) {
// ring1.identify();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -830,7 +830,7 @@ private static DwarvenKing king() {
}

private static int spawnDelay( int breaks ) {
return Random.IntRange( 10, 15 ) - Random.IntRange( breaks * 2, breaks * 3 ); // 10-15 8-12 6-9 4-6
return Random.IntRange( 10, 15 ) - Random.IntRange( breaks * 1, breaks * 2 ); // 10-15 8-12 6-9 4-6
}

private static float armorDuration( int breaks ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,11 @@ public void damage( int dmg, Object src, DamageType type ) {
public boolean add( Buff buff ) {
return false;
}

@Override
public boolean immovable() {
return true;
}

@Override
public boolean reset() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ public class Blacksmith extends NPC {
name = "troll blacksmith";
spriteClass = BlacksmithSprite.class;
}

@Override
public boolean immovable() {
return true;
}

@Override
protected boolean act() {
Expand Down Expand Up @@ -216,7 +221,7 @@ public static void upgrade( Item item1, Item item2 ) {
GLog.p( TXT_LOOKS_BETTER, first.name() );

Dungeon.hero.spendAndNext( 2f );
Badges.validateItemLevelAcquired(first);
// Badges.validateItemLevelAcquired(first);

if (second.isEquipped( Dungeon.hero )) {
((EquipableItem)second).doUnequip( Dungeon.hero, false );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,11 @@ private void flee() {
public boolean isMagical() {
return true;
}

@Override
public boolean immovable() {
return true;
}

@Override
public float moveSpeed() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,11 @@ protected boolean act() {
// public int dexterity( Char enemy ) {
// return 1000;
// }

@Override
public boolean immovable() {
return true;
}

@Override
public String defenseVerb() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,9 +230,9 @@ public boolean collect( Bag container ) {
// if (items.size() < container.size) {
if ( container.countVisibleItems() < container.size || !visible ) {

if (Dungeon.hero != null && Dungeon.hero.isAlive()) {
Badges.validateItemLevelAcquired(this);
}
// if (Dungeon.hero != null && Dungeon.hero.isAlive()) {
// Badges.validateItemLevelAcquired(this);
// }

items.add( this );
QuickSlot.refresh();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ public int proc( Char attacker, Char defender, int damage ) {
if (hitsToKnow <= 0) {
identify();
GLog.w( TXT_IDENTIFY, name(), toString() );
Badges.validateItemLevelAcquired(this);
// Badges.validateItemLevelAcquired(this);
}
}

Expand Down
Loading

0 comments on commit 14ff051

Please sign in to comment.