v2.5.0: fixed parchment scrap still affecting RNG in some cases

This commit is contained in:
Evan Debenham
2024-08-08 13:15:29 -04:00
parent 543bc3f587
commit 1ac5ac4fae
2 changed files with 32 additions and 20 deletions

View File

@@ -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;
}

View File

@@ -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;
}