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

View File

@@ -54,15 +54,18 @@ public class Statue extends Mob {
public Statue() {
super();
do {
weapon = (MeleeWeapon) Generator.random(Generator.Category.WEAPON);
} while (weapon.cursed);
weapon.enchant( Enchantment.random() );
weapon = createWeapon();
HP = HT = 15 + Dungeon.depth * 5;
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";

View File

@@ -147,22 +147,10 @@ public class Warlock extends Mob implements Callback {
Dungeon.LimitedDrops.WARLOCK_HP.count++;
return new PotionOfHealing();
} else {
Item i = Generator.randomUsingDefaults(Generator.Category.POTION);
int healingTried = 0;
while (i instanceof PotionOfHealing){
healingTried++;
Item i;
do {
i = Generator.randomUsingDefaults(Generator.Category.POTION);
}
//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;
}
}
}
} while (i instanceof PotionOfHealing);
return i;
}

View File

@@ -280,7 +280,7 @@ public class ScrollOfTransmutation extends InventoryScroll {
private static Wand changeWand( Wand w ) {
Wand n;
do {
n = (Wand)Generator.random( Generator.Category.WAND );
n = (Wand)Generator.randomUsingDefaults( Generator.Category.WAND );
} while ( Challenges.isItemBlocked(n) || n.getClass() == w.getClass());
n.level( 0 );

View File

@@ -425,7 +425,7 @@ public class CursedWand {
origin.detach(Dungeon.hero.belongings.backpack);
Item result;
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));
} while (result.cursed);
if (result.isUpgradable()) result.upgrade();

View File

@@ -27,6 +27,9 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Statue;
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
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.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.StatueSprite;
@@ -77,11 +80,13 @@ public class GuardianTrap extends Trap {
levelGenStatue = false;
}
public Guardian(){
super();
weapon.enchant(null);
weapon.degrade(weapon.level());
@Override
public Weapon createWeapon() {
Weapon w = (MeleeWeapon) Generator.randomUsingDefaults(Generator.Category.WEAPON);
w.cursed = false;
w.enchant(null);
w.level(0);
return w;
}
@Override