v3.1.0: added unlock logic for 3 of the new badges (debug only atm)
This commit is contained in:
@@ -21,6 +21,7 @@
|
||||
|
||||
package com.shatteredpixel.shatteredpixeldungeon;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.AscensionChallenge;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroClass;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroSubClass;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
||||
@@ -30,6 +31,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.bags.PotionBandolier;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.bags.ScrollHolder;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.bags.VelvetPouch;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.potions.Potion;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.quest.Pickaxe;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.remains.RemainsItem;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.Scroll;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MeleeWeapon;
|
||||
@@ -1027,6 +1029,16 @@ public class Badges {
|
||||
}
|
||||
}
|
||||
|
||||
public static void validateTakingTheMick(Object cause){
|
||||
if (!DeviceCompat.isDebug()) return;
|
||||
if (cause == Dungeon.hero &&
|
||||
Dungeon.hero.belongings.attackingWeapon() instanceof Pickaxe
|
||||
&& Dungeon.hero.belongings.attackingWeapon().buffedLvl() >= 20){
|
||||
local.add( Badge.TAKING_THE_MICK );
|
||||
displayBadge(Badge.TAKING_THE_MICK);
|
||||
}
|
||||
}
|
||||
|
||||
public static void validateNoKilling() {
|
||||
if (!local.contains( Badge.NO_MONSTERS_SLAIN ) && Statistics.completedWithNoKilling) {
|
||||
Badge badge = Badge.NO_MONSTERS_SLAIN;
|
||||
@@ -1043,6 +1055,15 @@ public class Badges {
|
||||
displayBadge( badge );
|
||||
}
|
||||
}
|
||||
|
||||
public static void validateManyBuffs(){
|
||||
if (!DeviceCompat.isDebug()) return;
|
||||
if (!local.contains( Badge.MANY_BUFFS )) {
|
||||
Badge badge = Badge.MANY_BUFFS;
|
||||
local.add( badge );
|
||||
displayBadge( badge );
|
||||
}
|
||||
}
|
||||
|
||||
public static void validateGamesPlayed() {
|
||||
Badge badge = null;
|
||||
@@ -1107,6 +1128,12 @@ public class Badges {
|
||||
local.add( Badge.HAPPY_END_REMAINS );
|
||||
displayBadge( Badge.HAPPY_END_REMAINS );
|
||||
}
|
||||
|
||||
if (!DeviceCompat.isDebug()) return;
|
||||
if (AscensionChallenge.qualifiedForPacifist()) {
|
||||
local.add( Badge.PACIFIST_ASCENT );
|
||||
displayBadge( Badge.PACIFIST_ASCENT );
|
||||
}
|
||||
}
|
||||
|
||||
public static void validateChampion( int challenges ) {
|
||||
|
||||
@@ -156,6 +156,13 @@ public class AscensionChallenge extends Buff {
|
||||
return speed;
|
||||
}
|
||||
|
||||
public static boolean qualifiedForPacifist(){
|
||||
if (Dungeon.hero.buff(AscensionChallenge.class) != null){
|
||||
return !Dungeon.hero.buff(AscensionChallenge.class).stacksLowered;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void processEnemyKill(Char enemy){
|
||||
AscensionChallenge chal = Dungeon.hero.buff(AscensionChallenge.class);
|
||||
if (chal == null) return;
|
||||
@@ -185,6 +192,7 @@ public class AscensionChallenge extends Buff {
|
||||
} else {
|
||||
chal.stacks -= 1;
|
||||
}
|
||||
chal.stacksLowered = true;
|
||||
chal.stacks = Math.max(0, chal.stacks);
|
||||
if (chal.stacks < 8f && (int)(chal.stacks/2) != (int)(oldStacks/2f)){
|
||||
GLog.p(Messages.get(AscensionChallenge.class, "weaken"));
|
||||
@@ -234,6 +242,8 @@ public class AscensionChallenge extends Buff {
|
||||
private float stacks = 0;
|
||||
private float damageInc = 0;
|
||||
|
||||
private boolean stacksLowered = false;
|
||||
|
||||
public void onLevelSwitch(){
|
||||
if (Dungeon.depth < Statistics.highestAscent){
|
||||
Statistics.highestAscent = Dungeon.depth;
|
||||
@@ -366,11 +376,14 @@ public class AscensionChallenge extends Buff {
|
||||
public static final String STACKS = "enemy_stacks";
|
||||
public static final String DAMAGE = "damage_inc";
|
||||
|
||||
public static final String STACKS_LOWERED = "stacks_lowered";
|
||||
|
||||
@Override
|
||||
public void storeInBundle(Bundle bundle) {
|
||||
super.storeInBundle(bundle);
|
||||
bundle.put(STACKS, stacks);
|
||||
bundle.put(DAMAGE, damageInc);
|
||||
bundle.put(STACKS_LOWERED, stacksLowered);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -378,6 +391,12 @@ public class AscensionChallenge extends Buff {
|
||||
super.restoreFromBundle(bundle);
|
||||
stacks = bundle.getFloat(STACKS);
|
||||
damageInc = bundle.getFloat(DAMAGE);
|
||||
if (bundle.contains(STACKS_LOWERED)){
|
||||
stacksLowered = bundle.getBoolean(STACKS_LOWERED);
|
||||
//pre-v3.1 saves
|
||||
} else {
|
||||
stacksLowered = true;
|
||||
}
|
||||
}
|
||||
|
||||
//chars with this buff are not boosted by the ascension challenge
|
||||
|
||||
@@ -48,7 +48,6 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.hero.abilities.warrior.He
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.abilities.warrior.Shockwave;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.BrokenSeal;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.TengusMask;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.Waterskin;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.armor.ClothArmor;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.CloakOfShadows;
|
||||
@@ -61,7 +60,6 @@ import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfLiquidFlam
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfMindVision;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfPurity;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfStrength;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.potions.exotic.PotionOfShielding;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfIdentify;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfLullaby;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfMagicMapping;
|
||||
@@ -69,8 +67,6 @@ import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfMirrorImag
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRage;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRemoveCurse;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfUpgrade;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.spells.CurseInfusion;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.stones.StoneOfEnchantment;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.wands.WandOfMagicMissile;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.SpiritBow;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.Cudgel;
|
||||
@@ -146,15 +142,6 @@ public enum HeroClass {
|
||||
break;
|
||||
}
|
||||
|
||||
new ClothArmor().collect();
|
||||
|
||||
new CurseInfusion().quantity(4).collect();
|
||||
new StoneOfEnchantment().quantity(3).collect();
|
||||
|
||||
new PotionOfShielding().quantity(5).collect();
|
||||
|
||||
new TengusMask().collect();
|
||||
|
||||
if (SPDSettings.quickslotWaterskin()) {
|
||||
for (int s = 0; s < QuickSlot.SIZE; s++) {
|
||||
if (Dungeon.quickslot.getItem(s) == null) {
|
||||
|
||||
@@ -536,6 +536,8 @@ public class YogDzewa extends Mob {
|
||||
}
|
||||
Statistics.bossScores[4] += 5000 + 1250*Statistics.spawnersAlive;
|
||||
|
||||
Badges.validateTakingTheMick(cause);
|
||||
|
||||
Dungeon.level.unseal();
|
||||
super.die( cause );
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
package com.shatteredpixel.shatteredpixeldungeon.ui;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Badges;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
||||
@@ -260,6 +261,10 @@ public class BuffIndicator extends Component {
|
||||
cumulativeAdjust -= leftAdjust;
|
||||
}
|
||||
}
|
||||
|
||||
if (this == heroInstance && buffButtons.size() >= 10){
|
||||
Badges.validateManyBuffs();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean allBuffsVisible(){
|
||||
|
||||
Reference in New Issue
Block a user