diff --git a/Items/CalamityGlobalItemLoot.cs b/Items/CalamityGlobalItemLoot.cs index d1878c2281..2bd464da9c 100644 --- a/Items/CalamityGlobalItemLoot.cs +++ b/Items/CalamityGlobalItemLoot.cs @@ -113,7 +113,6 @@ namespace CalamityMod.Items if ((!NPC.downedMechBoss1 || !NPC.downedMechBoss2 || !NPC.downedMechBoss3) && CalamityConfig.Instance.EarlyHardmodeProgressionRework) DropHelper.BlockDrops(ItemID.HallowedBar); - DropHelper.DropItemChance(player, ModContent.ItemType(), DropHelper.BagWeaponDropRateFloat); break; case ItemID.TwinsBossBag: diff --git a/Items/Materials/PlasmaDriveCore.cs b/Items/Materials/PlasmaDriveCore.cs new file mode 100644 index 0000000000..6cbcd756ef --- /dev/null +++ b/Items/Materials/PlasmaDriveCore.cs @@ -0,0 +1,57 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.World; +using Terraria.Graphics.Shaders; +using System; + +namespace CalamityMod.Items.Materials +{ + public class PlasmaDriveCore : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Prototype Plasma Drive Core"); + Tooltip.SetDefault("Despite all the time it spent in storage, its furnace still burns strong"); + } + + public override void SetDefaults() + { + item.width = 30; + item.height = 30; + item.maxStack = 999; + item.value = Item.buyPrice(0, 0, 0, 0); + item.rare = ItemRarityID.Red; + item.Calamity().customRarity = CalamityRarity.DraedonRust; + } + + public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + Texture2D tex = Main.itemTexture[item.type]; + + //Give it an outline. Make it look really important and shiny. The player must not confuse this for a random material + spriteBatch.End(); + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, null, null, null, null, Main.UIScaleMatrix); + Color outlineColor = Color.Lerp(Color.Cyan, Color.Orange, (float)Math.Sin(Main.GlobalTime * 2f) * 0.5f + 0.5f); + Vector3 outlineHSL = Main.rgbToHsl(outlineColor); //BasicTint uses the opposite hue i guess? or smth is fucked with the way shaders get their colors. anyways, we invert it + + GameShaders.Misc["CalamityMod:BasicTint"].UseOpacity(1f); + GameShaders.Misc["CalamityMod:BasicTint"].UseColor(Main.hslToRgb(1 - outlineHSL.X, outlineHSL.Y, outlineHSL.Z)); + GameShaders.Misc["CalamityMod:BasicTint"].Apply(); + + float outlineWidth = MathHelper.Lerp(2, 3, (float)Math.Sin(Main.GlobalTime * 2f) * 0.5f + 0.5f); + + for (float i = 0; i < 1; i += 0.25f) + { + spriteBatch.Draw(tex, position + (i * MathHelper.TwoPi).ToRotationVector2() * outlineWidth * scale, frame, outlineColor, 0f, origin, scale, 0f, 0f); + } + + spriteBatch.End(); + spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, null, null, Main.UIScaleMatrix); + + return true; + } + } +} diff --git a/Items/Materials/PlasmaDriveCore.png b/Items/Materials/PlasmaDriveCore.png new file mode 100644 index 0000000000..5e7622537d Binary files /dev/null and b/Items/Materials/PlasmaDriveCore.png differ diff --git a/Items/Materials/SuspiciousScrap.cs b/Items/Materials/SuspiciousScrap.cs new file mode 100644 index 0000000000..f19f33f508 --- /dev/null +++ b/Items/Materials/SuspiciousScrap.cs @@ -0,0 +1,46 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.World; + +namespace CalamityMod.Items.Materials +{ + public class SuspiciousScrap : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Suspicious Scrap"); + Tooltip.SetDefault("Looks like it may be part of a greater whole..."); + } + + public override void SetDefaults() + { + item.width = 30; + item.height = 30; + item.maxStack = 999; + item.value = Item.buyPrice(0, 0, 0, 20); + item.rare = ItemRarityID.Red; + item.Calamity().customRarity = CalamityRarity.DraedonRust; + } + + public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + Texture2D tex = Main.itemTexture[item.type]; + Rectangle variant = new Rectangle(CalamityWorld.OreTypes[0] == TileID.Tin ? 0 : 32, CalamityWorld.OreTypes[1] == TileID.Lead ? 0 : 32, 30, 30); + spriteBatch.Draw(tex, position, variant, drawColor, 0f, origin, scale * 2f, 0f, 0f); + return false; + } + + public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) + { + Texture2D tex = Main.itemTexture[item.type]; + Rectangle variant = new Rectangle(CalamityWorld.OreTypes[0] == TileID.Tin ? 0 : 32, CalamityWorld.OreTypes[1] == TileID.Lead ? 0 : 32, 30, 30); + Vector2 positionDisplace = new Vector2( 16 , 16 ) * scale; + + spriteBatch.Draw(tex, item.position + positionDisplace - Main.screenPosition, variant, lightColor, rotation, variant.Size() / 2f, scale, 0f, 0f); + return false; + } + } +} diff --git a/Items/Materials/SuspiciousScrap.png b/Items/Materials/SuspiciousScrap.png new file mode 100644 index 0000000000..630a5b88cb Binary files /dev/null and b/Items/Materials/SuspiciousScrap.png differ diff --git a/Items/Weapons/Magic/SHPC.cs b/Items/Weapons/Magic/SHPC.cs index 9e4ae6a5a5..8411e6da9a 100644 --- a/Items/Weapons/Magic/SHPC.cs +++ b/Items/Weapons/Magic/SHPC.cs @@ -1,3 +1,4 @@ +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; using Microsoft.Xna.Framework; using Terraria; @@ -94,5 +95,16 @@ namespace CalamityMod.Items.Weapons.Magic return false; } } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 1); + recipe.AddIngredient(ModContent.ItemType(), 4); + recipe.AddRecipeGroup("AnyMythrilBar", 10); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } } } diff --git a/Items/Weapons/Rogue/NanoblackReaperRogue.cs b/Items/Weapons/Rogue/NanoblackReaperRogue.cs index ba3f97d8b6..dc1a52045c 100644 --- a/Items/Weapons/Rogue/NanoblackReaperRogue.cs +++ b/Items/Weapons/Rogue/NanoblackReaperRogue.cs @@ -17,7 +17,10 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Nanoblack Reaper"); - Tooltip.SetDefault("Unleashes a storm of nanoblack energy blades\nBlades target bosses whenever possible\n'She smothered them in Her hatred'"); + Tooltip.SetDefault("Unleashes a storm of nanoblack energy blades\n" + + "Blades target bosses whenever possible\n" + + "Stealth strikes cause the scythe to create a large amount of homing afterimages instead of energy blades\n" + + "'She smothered them in Her hatred'"); } public override void SafeSetDefaults() @@ -46,10 +49,15 @@ namespace CalamityMod.Items.Weapons.Rogue public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); - if (proj.WithinBounds(Main.maxProjectiles)) - Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); - return false; + if (player.Calamity().StealthStrikeAvailable()) + { + damage = (int)(damage * 1.5); + int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + if (stealth.WithinBounds(Main.maxProjectiles)) + Main.projectile[stealth].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); + return false; + } + return true; } public override void AddRecipes() diff --git a/Items/Weapons/Rogue/TheAtomSplitter.cs b/Items/Weapons/Rogue/TheAtomSplitter.cs index ce31d0b5ba..a363db0941 100644 --- a/Items/Weapons/Rogue/TheAtomSplitter.cs +++ b/Items/Weapons/Rogue/TheAtomSplitter.cs @@ -38,8 +38,10 @@ namespace CalamityMod.Items.Weapons.Rogue public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { int javelin = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, -1f); - if (player.Calamity().StealthStrikeAvailable() && Main.projectile.IndexInRange(javelin)) + if (player.Calamity().StealthStrikeAvailable() && Main.projectile.IndexInRange(javelin)) { Main.projectile[javelin].Calamity().stealthStrike = true; + Main.projectile[javelin].damage = (int)(1.15 * Main.projectile[javelin].damage); + } return false; } } diff --git a/ModSupport/WeakReferenceSupport.cs b/ModSupport/WeakReferenceSupport.cs index 7f62027d76..47d5c7a73f 100644 --- a/ModSupport/WeakReferenceSupport.cs +++ b/ModSupport/WeakReferenceSupport.cs @@ -721,7 +721,6 @@ namespace CalamityMod // The Destroyer AddLoot(bossChecklist, "TheDestroyer", - new List() { ItemType() }, new List() { ItemType(), ItemType() } ); diff --git a/NPCs/CalamityGlobalNPCLoot.cs b/NPCs/CalamityGlobalNPCLoot.cs index ef1ea5ee6c..26f8c06d4d 100644 --- a/NPCs/CalamityGlobalNPCLoot.cs +++ b/NPCs/CalamityGlobalNPCLoot.cs @@ -248,8 +248,6 @@ namespace CalamityMod.NPCs DropHelper.DropItemCondition(npc, ModContent.ItemType(), Main.expertMode, DraedonMayhem, 8, 16); DropHelper.DropItemCondition(npc, ModContent.ItemType(), Main.expertMode, DraedonMayhem, 8, 16); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), !Main.expertMode, DropHelper.NormalWeaponDropRateFloat); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !NPC.downedMechBoss1); SetNewShopVariable(new int[] { NPCID.DD2Bartender, NPCID.Stylist, NPCID.Truffle, ModContent.NPCType() }, NPC.downedMechBossAny); SetNewShopVariable(new int[] { NPCID.Stylist, ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType() }, NPC.downedMechBoss1 || !NPC.downedMechBoss2 || !NPC.downedMechBoss3); diff --git a/Projectiles/Rogue/NanoblackMain.cs b/Projectiles/Rogue/NanoblackMain.cs index 633aa0f140..108fd345f9 100644 --- a/Projectiles/Rogue/NanoblackMain.cs +++ b/Projectiles/Rogue/NanoblackMain.cs @@ -16,7 +16,8 @@ namespace CalamityMod.Projectiles.Rogue private const int Lifetime = 240; private const float ReboundTime = 50f; private const int MinBladeTimer = 13; - private const int MaxBladeTimer = 18; + private const int MaxBladeTimer = 18; + public override void SetStaticDefaults() { @@ -48,7 +49,7 @@ namespace CalamityMod.Projectiles.Rogue // Initialize the frame counter and random blade delay on the very first frame. if (projectile.timeLeft == Lifetime) - projectile.ai[1] = GetBladeDelay(); + projectile.ai[1] = projectile.Calamity().stealthStrike ? 4f : GetBladeDelay(); // Produces electricity and green firework sparks constantly while in flight. if (Main.rand.NextBool(3)) @@ -121,11 +122,19 @@ namespace CalamityMod.Projectiles.Rogue projectile.Kill(); } - // Create nanoblack energy blades at a somewhat-random rate while in flight. + // Create nanoblack energy blades at a somewhat-random rate while in flight. (or full-sized scythes afterimages if stealth strike) if (projectile.ai[1] <= 0f) { - SpawnEnergyBlade(); - projectile.ai[1] = GetBladeDelay(); + if (projectile.Calamity().stealthStrike) + { + SpawnScytheAfterimage(); + projectile.ai[1] = 4f; + } + else + { + SpawnEnergyBlade(); + projectile.ai[1] = GetBladeDelay(); + } } // Rotate the scythe as it flies. @@ -158,5 +167,17 @@ namespace CalamityMod.Projectiles.Rogue if (projectile.owner == Main.myPlayer) Projectile.NewProjectile(pos, Vector2.Zero, bladeID, bladeDamage, bladeKB, projectile.owner, 0f, spin); } + + private void SpawnScytheAfterimage() + { + int bladeID = ModContent.ProjectileType(); + int bladeDamage = projectile.damage / 2; + float bladeKB = 4f; + float spin = projectile.direction <= 0 ? -1f : 1f; + float d = 16f; + float velocityMult = 0.9f; + if (projectile.owner == Main.myPlayer) + Projectile.NewProjectile(projectile.Center, Vector2.Zero, bladeID, bladeDamage, bladeKB, projectile.owner, 0f, spin); + } } } diff --git a/Projectiles/Rogue/NanoblackStealthSplit.cs b/Projectiles/Rogue/NanoblackStealthSplit.cs new file mode 100644 index 0000000000..829bb5bc61 --- /dev/null +++ b/Projectiles/Rogue/NanoblackStealthSplit.cs @@ -0,0 +1,208 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class NanoblackStealthSplit : ModProjectile + { + + public override string Texture => "CalamityMod/Items/Weapons/Rogue/NanoblackReaperRogue"; + + private static int Lifetime = 300; + private static float MaxSpeed = 40f; + private static float MaxRotationSpeed = 0.25f; + + private static float HomingStartRange = 4000f; + private static float HomingBreakRange = 6000f; + private static float HomingBonusRangeCap = 2000f; + private static float BaseHomingFactor = 2.6f; + private static float MaxHomingFactor = 8.6f; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Nanoblack Afterimage"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 7; + ProjectileID.Sets.TrailingMode[projectile.type] = 2; + } + + public override void SetDefaults() + { + projectile.width = 56; + projectile.height = 56; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.penetrate = 12; + projectile.extraUpdates = 1; + projectile.timeLeft = Lifetime; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 8; + projectile.Calamity().rogue = true; + } + + // ai[0] = Index of current NPC target. If 0 or negative, the projectile has no target + // ai[1] = Current spin speed. When it reaches 0, starts homing into enemies. Negative speeds are also allowed. + public override void AI() + { + + // Produces electricity and green firework sparks constantly while in flight. (Like the main projectile) + if (Main.rand.NextBool(3)) + { + int dustType = Main.rand.NextBool(5) ? 226 : 220; + float scale = 0.8f + Main.rand.NextFloat(0.3f); + float velocityMult = Main.rand.NextFloat(0.3f, 0.6f); + int idx = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType); + Main.dust[idx].noGravity = true; + Main.dust[idx].velocity = velocityMult * projectile.velocity; + Main.dust[idx].scale = scale; + } + + // Spin in the specified starting direction and slow down spin over time + // Loses 1.66% of current speed every frame + // Also update current orientation to reflect current spin direction + if (projectile.timeLeft > 200) + { + float currentSpin = projectile.ai[1]; + projectile.direction = currentSpin <= 0f ? -1 : 1; + projectile.spriteDirection = projectile.direction; + projectile.rotation += currentSpin * MaxRotationSpeed; + float spinReduction = 0.0166f * currentSpin; + projectile.ai[1] -= spinReduction; + } + // Search for and home in on nearby targets after the given time, and stops spinning + else + { + projectile.rotation = 0f; + HomingAI(); + } + } + + private void HomingAI() + { + // If we don't currently have a target, go try and get one! + int targetID = (int)projectile.ai[0] - 1; + if (targetID < 0) + targetID = AcquireTarget(); + + // Save the target, whether we have one or not. + projectile.ai[0] = targetID + 1f; + + // If we don't have a target, then just slow down a bit. + if (targetID < 0) + { + projectile.velocity *= 0.94f; + return; + } + + // Homing behavior depends on how far the blade is from its target. + NPC target = Main.npc[targetID]; + float xDist = projectile.Center.X - target.Center.X; + float yDist = projectile.Center.Y - target.Center.Y; + float dist = (float)Math.Sqrt(xDist * xDist + yDist * yDist); + + // If the target is too far away, stop homing in on it. + if (dist > HomingBreakRange) + { + projectile.ai[0] = 0f; + return; + } + + // Adds a multiple of the towards-target vector to its velocity every frame. + float homingFactor = CalcHomingFactor(dist); + Vector2 posDiff = target.Center - projectile.Center; + posDiff = posDiff.SafeNormalize(Vector2.Zero); + posDiff *= homingFactor; + Vector2 newVelocity = projectile.velocity += posDiff; + + // Caps speed to make sure it doesn't go too fast. + if (newVelocity.Length() >= MaxSpeed) + { + newVelocity = newVelocity.SafeNormalize(Vector2.Zero); + newVelocity *= MaxSpeed; + } + + projectile.velocity = newVelocity; + + //The afterimage's blade always tries to face its target + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.ToRadians(45f); + } + + // Returns the ID of the NPC to be targeted by this energy blade. + // It chooses the closest target which can be chased, ignoring invulnerable NPCs. + // Nanoblack Afterimages prefer to target bosses whenever possible. + private int AcquireTarget() + { + bool bossFound = false; + int target = -1; + float minDist = HomingStartRange; + for (int i = 0; i < 200; ++i) + { + NPC npc = Main.npc[i]; + if (!npc.active || npc.type == NPCID.TargetDummy) + continue; + + // If we've found a valid boss target, ignore ALL targets which aren't bosses. + if (bossFound && !npc.boss) + continue; + + if (npc.CanBeChasedBy(projectile, false)) + { + float xDist = projectile.Center.X - npc.Center.X; + float yDist = projectile.Center.Y - npc.Center.Y; + float distToNPC = (float)Math.Sqrt(xDist * xDist + yDist * yDist); + if (distToNPC < minDist) + { + // If this target within range is a boss, set the boss found flag. + if (npc.boss) + bossFound = true; + minDist = distToNPC; + target = i; + } + } + } + return target; + } + + // Afterimages home even more aggressively if they are very close to their target. + private float CalcHomingFactor(float dist) + { + float baseFactor = BaseHomingFactor; + float bonus = (MaxHomingFactor - BaseHomingFactor) * (1f - dist / HomingBonusRangeCap); + if (bonus < 0f) + bonus = 0f; + return baseFactor + bonus; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + return false; + } + + // Spawns a tiny bit of dust when the afterimage vanishes. + public override void Kill(int timeLeft) + { + SpawnDust(); + } + + // Spawns a small bit of Luminite themed dust. + private void SpawnDust() + { + int dustCount = Main.rand.Next(3, 6); + Vector2 corner = projectile.position; + for (int i = 0; i < dustCount; ++i) + { + int dustType = 229; + float scale = 0.6f + Main.rand.NextFloat(0.4f); + int idx = Dust.NewDust(corner, projectile.width, projectile.height, dustType); + Main.dust[idx].noGravity = true; + Main.dust[idx].velocity *= 3f; + Main.dust[idx].scale = scale; + } + } + } +} \ No newline at end of file diff --git a/World/CalamityWorld.cs b/World/CalamityWorld.cs index d1a5525e93..dee651e997 100644 --- a/World/CalamityWorld.cs +++ b/World/CalamityWorld.cs @@ -36,6 +36,7 @@ namespace CalamityMod.World public static int MoneyStolenByBandit = 0; public static int Reforges; public static bool IsWorldAfterDraedonUpdate = false; + public static ushort[] OreTypes = new ushort[4]; // Boss Rush public static int bossRushHostileProjKillCounter = 0; @@ -506,6 +507,11 @@ namespace CalamityMod.World downed.Add("HasGeneratedLuminitePlanetoids"); downed.AddWithCondition("IsWorldAfterDraedonUpdate", IsWorldAfterDraedonUpdate); + downed.AddWithCondition("TinOreWorld", OreTypes[0] == TileID.Tin); + downed.AddWithCondition("LeadOreWorld", OreTypes[1] == TileID.Lead); + downed.AddWithCondition("TungstenOreWorld", OreTypes[2] == TileID.Tungsten); + downed.AddWithCondition("PlatinumOreWorld", OreTypes[3] == TileID.Platinum); + RecipeUnlockHandler.Save(downed); return new TagCompound @@ -615,6 +621,11 @@ namespace CalamityMod.World HasGeneratedLuminitePlanetoids = downed.Contains("HasGeneratedLuminitePlanetoids"); IsWorldAfterDraedonUpdate = downed.Contains("IsWorldAfterDraedonUpdate"); + OreTypes[0] = downed.Contains("TinOreWorld") ? TileID.Tin : TileID.Copper; + OreTypes[1] = downed.Contains("LeadOreWorld") ? TileID.Lead : TileID.Iron; + OreTypes[2] = downed.Contains("TungstenOreWorld") ? TileID.Tungsten : TileID.Silver; + OreTypes[3] = downed.Contains("PlatinumOreWorld") ? TileID.Platinum : TileID.Gold; + RecipeUnlockHandler.Load(downed); abyssChasmBottom = tag.GetInt("abyssChasmBottom"); @@ -1295,6 +1306,12 @@ namespace CalamityMod.World } } } + + // Save the set of ores that got generated + OreTypes[0] = WorldGen.CopperTierOre; + OreTypes[1] = WorldGen.IronTierOre; + OreTypes[2] = WorldGen.SilverTierOre; + OreTypes[3] = WorldGen.GoldTierOre; } #endregion } diff --git a/World/DraedonStructures.cs b/World/DraedonStructures.cs index 1f32544031..171fc4f468 100644 --- a/World/DraedonStructures.cs +++ b/World/DraedonStructures.cs @@ -94,6 +94,12 @@ namespace CalamityMod.World new ChestItem(ItemID.Bomb, WorldGen.genRand.Next(6, 7 + 1)), new ChestItem(potionType, WorldGen.genRand.Next(3, 5 + 1)), }; + + //Add suspicious scrap into the chest rarely. Chance depends on the world size + int probability = Main.maxTilesX <= 4200f ? 0 : Main.maxTilesX >= 8400f ? 2 : 1; + if (Main.rand.Next(probability) == 0f) + contents.Insert(2, new ChestItem(ModContent.ItemType(), 1)); + for (int i = 0; i < contents.Count; i++) { chest.item[i].SetDefaults(contents[i].Type); @@ -153,12 +159,14 @@ namespace CalamityMod.World { new ChestItem(ModContent.ItemType(), WorldGen.genRand.Next(10, 17 + 1)), new ChestItem(ModContent.ItemType(), WorldGen.genRand.Next(10, 15 + 1)), + new ChestItem(ModContent.ItemType(), 1), new ChestItem(ItemID.Torch, WorldGen.genRand.Next(20, 40 + 1)), new ChestItem(ItemID.GoldCoin, WorldGen.genRand.Next(8, 16 + 1)), new ChestItem(ItemID.HealingPotion, WorldGen.genRand.Next(7, 10 + 1)), new ChestItem(ItemID.Dynamite, WorldGen.genRand.Next(4, 6 + 1)), new ChestItem(potionType, WorldGen.genRand.Next(4, 7 + 1)), }; + for (int i = 0; i < contents.Count; i++) { chest.item[i].SetDefaults(contents[i].Type); @@ -551,7 +559,9 @@ namespace CalamityMod.World { contents.Insert(0, new ChestItem(ModContent.ItemType(), 1)); contents.Insert(1, new ChestItem(ModContent.ItemType(), 1)); + contents.Insert(2, new ChestItem(ModContent.ItemType(), 1)); } + for (int i = 0; i < contents.Count; i++) { chest.item[i].SetDefaults(contents[i].Type);