diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/armor/Armor.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/armor/Armor.java index d19067c14..c9a68bbaf 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/armor/Armor.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/armor/Armor.java @@ -568,16 +568,22 @@ public class Armor extends EquipableItem { } } level(n); - - //30% chance to be cursed - //15% chance to be inscribed - float effectRoll = Random.Float(); - if (effectRoll < 0.3f * ParchmentScrap.curseChanceMultiplier()) { - inscribe(Glyph.randomCurse()); - cursed = true; - } else if (effectRoll >= 1f - (0.15f * ParchmentScrap.enchantChanceMultiplier())){ - inscribe(); - } + + //we use a separate RNG here so that variance due to things like parchment scrap + //does not affect levelgen + Random.pushGenerator(Random.Long()); + + //30% chance to be cursed + //15% chance to be inscribed + float effectRoll = Random.Float(); + if (effectRoll < 0.3f * ParchmentScrap.curseChanceMultiplier()) { + inscribe(Glyph.randomCurse()); + cursed = true; + } else if (effectRoll >= 1f - (0.15f * ParchmentScrap.enchantChanceMultiplier())){ + inscribe(); + } + + Random.popGenerator(); return this; } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/Weapon.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/Weapon.java index efa609a93..d73e1e0f9 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/Weapon.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/Weapon.java @@ -331,16 +331,22 @@ abstract public class Weapon extends KindOfWeapon { } } level(n); - - //30% chance to be cursed - //10% chance to be enchanted - float effectRoll = Random.Float(); - if (effectRoll < 0.3f * ParchmentScrap.curseChanceMultiplier()) { - enchant(Enchantment.randomCurse()); - cursed = true; - } else if (effectRoll >= 1f - (0.1f * ParchmentScrap.enchantChanceMultiplier())){ - enchant(); - } + + //we use a separate RNG here so that variance due to things like parchment scrap + //does not affect levelgen + Random.pushGenerator(Random.Long()); + + //30% chance to be cursed + //10% chance to be enchanted + float effectRoll = Random.Float(); + if (effectRoll < 0.3f * ParchmentScrap.curseChanceMultiplier()) { + enchant(Enchantment.randomCurse()); + cursed = true; + } else if (effectRoll >= 1f - (0.1f * ParchmentScrap.enchantChanceMultiplier())){ + enchant(); + } + + Random.popGenerator(); return this; }