v2.2.0: fixed a few cases of non-levelgen drops interacting with decks

This commit is contained in:
Evan Debenham
2023-10-11 12:58:43 -04:00
parent 52e76fe0f9
commit cf7ddd4dbd
5 changed files with 23 additions and 27 deletions
@@ -54,15 +54,18 @@ public class Statue extends Mob {
public Statue() { public Statue() {
super(); super();
do { weapon = createWeapon();
weapon = (MeleeWeapon) Generator.random(Generator.Category.WEAPON);
} while (weapon.cursed);
weapon.enchant( Enchantment.random() );
HP = HT = 15 + Dungeon.depth * 5; HP = HT = 15 + Dungeon.depth * 5;
defenseSkill = 4 + Dungeon.depth; defenseSkill = 4 + Dungeon.depth;
} }
public Weapon createWeapon(){
Weapon weapon = (MeleeWeapon) Generator.random(Generator.Category.WEAPON);
weapon.cursed = false;
weapon.enchant( Enchantment.random() );
return weapon;
}
private static final String WEAPON = "weapon"; private static final String WEAPON = "weapon";
@@ -147,22 +147,10 @@ public class Warlock extends Mob implements Callback {
Dungeon.LimitedDrops.WARLOCK_HP.count++; Dungeon.LimitedDrops.WARLOCK_HP.count++;
return new PotionOfHealing(); return new PotionOfHealing();
} else { } else {
Item i = Generator.randomUsingDefaults(Generator.Category.POTION); Item i;
int healingTried = 0; do {
while (i instanceof PotionOfHealing){
healingTried++;
i = Generator.randomUsingDefaults(Generator.Category.POTION); i = Generator.randomUsingDefaults(Generator.Category.POTION);
} } while (i instanceof PotionOfHealing);
//return the attempted healing potion drops to the pool
if (healingTried > 0){
for (int j = 0; j < Generator.Category.POTION.classes.length; j++){
if (Generator.Category.POTION.classes[j] == PotionOfHealing.class){
Generator.Category.POTION.probs[j] += healingTried;
}
}
}
return i; return i;
} }
@@ -280,7 +280,7 @@ public class ScrollOfTransmutation extends InventoryScroll {
private static Wand changeWand( Wand w ) { private static Wand changeWand( Wand w ) {
Wand n; Wand n;
do { do {
n = (Wand)Generator.random( Generator.Category.WAND ); n = (Wand)Generator.randomUsingDefaults( Generator.Category.WAND );
} while ( Challenges.isItemBlocked(n) || n.getClass() == w.getClass()); } while ( Challenges.isItemBlocked(n) || n.getClass() == w.getClass());
n.level( 0 ); n.level( 0 );
@@ -425,7 +425,7 @@ public class CursedWand {
origin.detach(Dungeon.hero.belongings.backpack); origin.detach(Dungeon.hero.belongings.backpack);
Item result; Item result;
do { do {
result = Generator.random(Random.oneOf(Generator.Category.WEAPON, Generator.Category.ARMOR, result = Generator.randomUsingDefaults(Random.oneOf(Generator.Category.WEAPON, Generator.Category.ARMOR,
Generator.Category.RING, Generator.Category.ARTIFACT)); Generator.Category.RING, Generator.Category.ARTIFACT));
} while (result.cursed); } while (result.cursed);
if (result.isUpgradable()) result.upgrade(); if (result.isUpgradable()) result.upgrade();
@@ -27,6 +27,9 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Statue; import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Statue;
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter; import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck; import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
import com.shatteredpixel.shatteredpixeldungeon.items.Generator;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MeleeWeapon;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.StatueSprite; import com.shatteredpixel.shatteredpixeldungeon.sprites.StatueSprite;
@@ -77,11 +80,13 @@ public class GuardianTrap extends Trap {
levelGenStatue = false; levelGenStatue = false;
} }
public Guardian(){ @Override
super(); public Weapon createWeapon() {
Weapon w = (MeleeWeapon) Generator.randomUsingDefaults(Generator.Category.WEAPON);
weapon.enchant(null); w.cursed = false;
weapon.degrade(weapon.level()); w.enchant(null);
w.level(0);
return w;
} }
@Override @Override