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); level(n);
//30% chance to be cursed //we use a separate RNG here so that variance due to things like parchment scrap
//15% chance to be inscribed //does not affect levelgen
float effectRoll = Random.Float(); Random.pushGenerator(Random.Long());
if (effectRoll < 0.3f * ParchmentScrap.curseChanceMultiplier()) {
inscribe(Glyph.randomCurse()); //30% chance to be cursed
cursed = true; //15% chance to be inscribed
} else if (effectRoll >= 1f - (0.15f * ParchmentScrap.enchantChanceMultiplier())){ float effectRoll = Random.Float();
inscribe(); if (effectRoll < 0.3f * ParchmentScrap.curseChanceMultiplier()) {
} inscribe(Glyph.randomCurse());
cursed = true;
} else if (effectRoll >= 1f - (0.15f * ParchmentScrap.enchantChanceMultiplier())){
inscribe();
}
Random.popGenerator();
return this; return this;
} }

View File

@@ -331,16 +331,22 @@ abstract public class Weapon extends KindOfWeapon {
} }
} }
level(n); level(n);
//30% chance to be cursed //we use a separate RNG here so that variance due to things like parchment scrap
//10% chance to be enchanted //does not affect levelgen
float effectRoll = Random.Float(); Random.pushGenerator(Random.Long());
if (effectRoll < 0.3f * ParchmentScrap.curseChanceMultiplier()) {
enchant(Enchantment.randomCurse()); //30% chance to be cursed
cursed = true; //10% chance to be enchanted
} else if (effectRoll >= 1f - (0.1f * ParchmentScrap.enchantChanceMultiplier())){ float effectRoll = Random.Float();
enchant(); if (effectRoll < 0.3f * ParchmentScrap.curseChanceMultiplier()) {
} enchant(Enchantment.randomCurse());
cursed = true;
} else if (effectRoll >= 1f - (0.1f * ParchmentScrap.enchantChanceMultiplier())){
enchant();
}
Random.popGenerator();
return this; return this;
} }