cleaned up the on craft behavior

This commit is contained in:
ben-tk authored and Cameron Ewell committed 2022-09-06 13:06:55 -04:00
1 parent 2ce1e3b515
commit 2ecedde952
4 files changed
+44 -21

No files matched your search

+11 -17
View File
@@ -1737,23 +1737,8 @@ namespace CalamityMod.Items
#region On Create
public override void OnCreate(Item item, ItemCreationContext context)
{
// Crafting a rogue weapon has a 75% chance for a random modifier
// Negative modifiers have a 66.66% chance of being voided
// Note, the modifier doesn't show up in the craft text (the one that indicates you got a new item)
if (context is RecipeCreationContext)
{
if (item.CanGetRoguePrefix())
{
if (Main.rand.Next(4) < 3)
{
int prefix = CalamityUtils.RandomRoguePrefix();
if (!CalamityUtils.NegativeRoguePrefix(prefix) || Main.rand.NextBool(3))
{
item.Prefix(prefix);
}
}
}
}
// ChoosePrefix also happens on craft so go reset it here too
storedPrefix = -1;
}
#endregion
@@ -1772,6 +1757,15 @@ namespace CalamityMod.Items
// removed data saved on items; reforging is now a coalescing flowchart that has no RNG
public override int ChoosePrefix(Item item, UnifiedRandom rand)
{
if (storedPrefix == -1 && item.CanGetRoguePrefix())
{
// Crafting (or first reforge of) a rogue weapon has a 75% chance for a random modifier, this check is done by vanilla
// Negative modifiers have a 66.66% chance of being voided, Annoying modifier is intentionally ignored by vanilla
int prefix = CalamityUtils.RandomRoguePrefix();
bool keepPrefix = !CalamityUtils.NegativeRoguePrefix(prefix) || Main.rand.NextBool(3);
return keepPrefix ? prefix : 0;
}
if (!CalamityConfig.Instance.RemoveReforgeRNG || Main.gameMenu || storedPrefix == -1)
return -1;
+1 -1
View File
@@ -9,7 +9,7 @@ namespace CalamityMod.Projectiles.Rogue
{
public class GacruxianHome : ModProjectile
{
public override string Texture => "CalamityMod/Items/Fishing/AstralCatches/GacruxianMollusk";
public override string Texture => "CalamityMod/Items/Weapons/Rogue/GacruxianMollusk";
public override void SetStaticDefaults()
{
+1 -1
View File
@@ -9,7 +9,7 @@ namespace CalamityMod.Projectiles.Rogue
{
public class GacruxianProj : ModProjectile
{
public override string Texture => "CalamityMod/Items/Fishing/AstralCatches/GacruxianMollusk";
public override string Texture => "CalamityMod/Items/Weapons/Rogue/GacruxianMollusk";
public override void SetStaticDefaults()
{
+31 -2
View File
@@ -692,7 +692,30 @@ namespace CalamityMod
mod.Find<ModPrefix>("Blunt").Type,
mod.Find<ModPrefix>("Flimsy").Type,
mod.Find<ModPrefix>("Unbalanced").Type,
mod.Find<ModPrefix>("Atrocious").Type
mod.Find<ModPrefix>("Atrocious").Type,
PrefixID.Keen,
PrefixID.Superior,
PrefixID.Forceful,
PrefixID.Broken,
PrefixID.Damaged,
PrefixID.Hurtful,
PrefixID.Strong,
PrefixID.Unpleasant,
PrefixID.Weak,
PrefixID.Ruthless,
PrefixID.Godly,
PrefixID.Demonic,
PrefixID.Zealous,
PrefixID.Quick,
PrefixID.Deadly2,
PrefixID.Agile,
PrefixID.Nimble,
PrefixID.Murderous,
PrefixID.Slow,
PrefixID.Sluggish,
PrefixID.Lazy,
PrefixID.Annoying, // Vanilla does not include this in "bad" reforges so we won't either
PrefixID.Nasty
});
return roguePrefix;
}
@@ -705,7 +728,13 @@ namespace CalamityMod
mod.Find<ModPrefix>("Blunt").Type,
mod.Find<ModPrefix>("Flimsy").Type,
mod.Find<ModPrefix>("Unbalanced").Type,
mod.Find<ModPrefix>("Atrocious").Type
mod.Find<ModPrefix>("Atrocious").Type,
PrefixID.Broken,
PrefixID.Damaged,
PrefixID.Shoddy,
PrefixID.Slow,
PrefixID.Sluggish,
PrefixID.Lazy
};
return badPrefixes.Contains(prefix);
}