diff --git a/CalPlayer/CalamityPlayerLifeRegen.cs b/CalPlayer/CalamityPlayerLifeRegen.cs index 6b992befcc..1fe99f6614 100644 --- a/CalPlayer/CalamityPlayerLifeRegen.cs +++ b/CalPlayer/CalamityPlayerLifeRegen.cs @@ -920,13 +920,16 @@ namespace CalamityMod.CalPlayer } } - // The Camper regen boost activates while moving so it can stack with Shiny Stone like effects - if (camper && Player.statLife < actualMaxLife && !Player.StandingStill()) + // The Camper counteracts the regen loss while moving horizontally + if (camper && (Player.velocity.X != 0 && Player.grappling[0] <= 0)) { - float camperRegenMult = areThereAnyDamnBosses ? 1.25f : 2f; - int camperRegenCount = areThereAnyDamnBosses ? 1 : 4; - Player.lifeRegen = (int)(Player.lifeRegen * camperRegenMult); - Player.lifeRegenCount += camperRegenCount; + // Vanilla base regen rate which gets boosted when resting + // The first 6 boosts increment every 300 frames, up to 6 at 1800 + // Then, the last 3 boosts increment every 600 frames, up to 9 at 3600 which is the cap + int baseRegenRate = Math.Clamp(Player.lifeRegenTime / 300, 0, 6) + Math.Clamp((Player.lifeRegenTime - 1800) / 600, 0, 3); + // Normally 1.25 while resting and 0.5 while not + Player.lifeRegen += (int)(baseRegenRate * 0.75f); + if (Main.rand.Next(30000) < Player.lifeRegenTime || Main.rand.NextBool(2)) { int regen = Dust.NewDust(Player.position, Player.width, Player.height, 12, 0f, 0f, 200, Color.OrangeRed, 1f); diff --git a/Items/Accessories/ShieldoftheOcean.cs b/Items/Accessories/ShieldoftheOcean.cs index 1af18c95e8..bc165b6e3f 100644 --- a/Items/Accessories/ShieldoftheOcean.cs +++ b/Items/Accessories/ShieldoftheOcean.cs @@ -1,5 +1,5 @@ using CalamityMod.Items.Materials; -using CalamityMod.Items.Armor; +using CalamityMod.Items.Armor.Victide; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -32,7 +32,11 @@ namespace CalamityMod.Items.Accessories { player.statDefense += 5; } - if (player.Calamity().victideSet) + // Accessory update comes before set bonus for some reason, so this has to be done + if ((player.armor[0].type == ModContent.ItemType() || player.armor[0].type == ModContent.ItemType() || + player.armor[0].type == ModContent.ItemType() || player.armor[0].type == ModContent.ItemType() || + player.armor[0].type == ModContent.ItemType()) && + player.armor[1].type == ModContent.ItemType() && player.armor[2].type == ModContent.ItemType()) { player.moveSpeed += 0.1f; player.lifeRegen += 2; diff --git a/Items/Accessories/TheCamper.cs b/Items/Accessories/TheCamper.cs index 46f9158970..d3b5319773 100644 --- a/Items/Accessories/TheCamper.cs +++ b/Items/Accessories/TheCamper.cs @@ -40,9 +40,24 @@ namespace CalamityMod.Items.Accessories var source = player.GetSource_Accessory(Item); CalamityPlayer modPlayer = player.Calamity(); modPlayer.camper = true; - player.AddBuff(BuffID.HeartLamp, 60, true); - player.AddBuff(BuffID.Campfire, 60, true); - player.AddBuff(BuffID.WellFed3, 60, true); + player.AddBuff(BuffID.HeartLamp, 60); + Main.SceneMetrics.HasHeartLantern = true; + player.AddBuff(BuffID.Campfire, 60); + Main.SceneMetrics.HasCampfire = true; + + // Only hand out the buff if the player is not already fully fed. This prevents the player from being robbed of food. + if (!player.HasBuff(BuffID.WellFed3)) + player.AddBuff(BuffID.WellFed3, 80); + else + { + // Prevent it from flickering + for (int l = 0; l < Player.MaxBuffs; l++) + { + if (player.buffType[l] == BuffID.WellFed3 && player.buffTime[l] < 80) + player.buffTime[l] = 80; + } + } + Lighting.AddLight(player.Center, 0.825f, 0.66f, 0f); if (Main.myPlayer == player.whoAmI) { diff --git a/Items/Placeables/Furniture/GloomTorch.cs b/Items/Placeables/Furniture/GloomTorch.cs new file mode 100644 index 0000000000..1f833a29b3 --- /dev/null +++ b/Items/Placeables/Furniture/GloomTorch.cs @@ -0,0 +1,69 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Furniture +{ + public class GloomTorch : ModItem + { + public override void SetStaticDefaults() + { + SacrificeTotal = 100; + ItemID.Sets.Torches[Item.type] = true; + } + + public override void SetDefaults() + { + Item.width = 14; + Item.height = 18; + Item.maxStack = 99; + Item.holdStyle = 1; + Item.noWet = true; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + Item.flame = true; + Item.value = 500; + } + + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + // Vanilla usually matches sorting methods with the right type of item, but sometimes, like with torches, it doesn't. Make sure to set whichever items manually if need be. + itemGroup = ContentSamples.CreativeHelper.ItemGroup.Torches; + } + + public override void HoldItem(Player player) + { + Vector2 position = player.RotatedRelativePoint(new Vector2(player.itemLocation.X + 12f * player.direction + player.velocity.X, player.itemLocation.Y - 14f + player.velocity.Y), true); + + if (!Item.wet) + Lighting.AddLight(position, 0.9f, 1.2f, 0.3f); + } + + public override void PostUpdate() + { + Lighting.AddLight((int)((Item.position.X + Item.width / 2) / 16f), (int)((Item.position.Y + Item.height / 2) / 16f), 0.5f, 0.75f, 1.2f); + } + + // This function doesn't even work.... + public override void AutoLightSelect(ref bool dryTorch, ref bool wetTorch, ref bool glowstick) + { + dryTorch = true; + wetTorch = false; + glowstick = false; + } + + public override void AddRecipes() + { + CreateRecipe(3). + AddIngredient(ItemID.Torch, 3). + AddIngredient(ModContent.ItemType()). + Register(); + } + } +} diff --git a/Items/Placeables/GloomTorch.png b/Items/Placeables/Furniture/GloomTorch.png similarity index 100% rename from Items/Placeables/GloomTorch.png rename to Items/Placeables/Furniture/GloomTorch.png diff --git a/Items/Placeables/Furniture/GloomTorch_Flame.png b/Items/Placeables/Furniture/GloomTorch_Flame.png new file mode 100644 index 0000000000..c1ae41f4c9 Binary files /dev/null and b/Items/Placeables/Furniture/GloomTorch_Flame.png differ diff --git a/Items/Placeables/Pylons/SunkenPylon.png b/Items/Placeables/Pylons/SunkenPylon.png index 240a444d52..71f2154735 100644 Binary files a/Items/Placeables/Pylons/SunkenPylon.png and b/Items/Placeables/Pylons/SunkenPylon.png differ diff --git a/NPCs/Abyss/Cuttlefish.cs b/NPCs/Abyss/Cuttlefish.cs index b02c4fd856..3165b2a89b 100644 --- a/NPCs/Abyss/Cuttlefish.cs +++ b/NPCs/Abyss/Cuttlefish.cs @@ -45,7 +45,7 @@ namespace CalamityMod.NPCs.Abyss NPC.Calamity().VulnerableToSickness = true; NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; - SpawnModBiomes = new int[3] { ModContent.GetInstance().Type, ModContent.GetInstance().Type, ModContent.GetInstance().Type }; + SpawnModBiomes = new int[2] { ModContent.GetInstance().Type, ModContent.GetInstance().Type }; } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -363,10 +363,6 @@ namespace CalamityMod.NPCs.Abyss public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.Player.Calamity().ZoneAbyssLayer1 && spawnInfo.Water) - { - return SpawnCondition.CaveJellyfish.Chance * 0.3f; - } if (spawnInfo.Player.Calamity().ZoneAbyssLayer2 && spawnInfo.Water) { return SpawnCondition.CaveJellyfish.Chance * 0.6f; diff --git a/NPCs/Abyss/DevilFish.cs b/NPCs/Abyss/DevilFish.cs index 915fd2ae4b..b3ad2b873d 100644 --- a/NPCs/Abyss/DevilFish.cs +++ b/NPCs/Abyss/DevilFish.cs @@ -58,7 +58,7 @@ namespace CalamityMod.NPCs.Abyss NPC.Calamity().VulnerableToSickness = true; NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; - SpawnModBiomes = new int[2] { ModContent.GetInstance().Type, ModContent.GetInstance().Type }; + SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -300,10 +300,6 @@ namespace CalamityMod.NPCs.Abyss public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.Player.Calamity().ZoneAbyssLayer1 && spawnInfo.Water) - { - return SpawnCondition.CaveJellyfish.Chance * 0.225f; - } if (spawnInfo.Player.Calamity().ZoneAbyssLayer2 && spawnInfo.Water) { return SpawnCondition.CaveJellyfish.Chance * 0.3f; diff --git a/NPCs/Abyss/DevilFishAlt.cs b/NPCs/Abyss/DevilFishAlt.cs index 58beec7df5..d1afae2ced 100644 --- a/NPCs/Abyss/DevilFishAlt.cs +++ b/NPCs/Abyss/DevilFishAlt.cs @@ -54,7 +54,7 @@ namespace CalamityMod.NPCs.Abyss NPC.Calamity().VulnerableToSickness = true; NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; - SpawnModBiomes = new int[2] { ModContent.GetInstance().Type, ModContent.GetInstance().Type }; + SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -296,10 +296,6 @@ namespace CalamityMod.NPCs.Abyss public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.Player.Calamity().ZoneAbyssLayer1 && spawnInfo.Water) - { - return SpawnCondition.CaveJellyfish.Chance * 0.225f; - } if (spawnInfo.Player.Calamity().ZoneAbyssLayer2 && spawnInfo.Water) { return SpawnCondition.CaveJellyfish.Chance * 0.3f; diff --git a/NPCs/Abyss/Viperfish.cs b/NPCs/Abyss/Viperfish.cs index a2fcae1577..9c594d829f 100644 --- a/NPCs/Abyss/Viperfish.cs +++ b/NPCs/Abyss/Viperfish.cs @@ -49,7 +49,7 @@ namespace CalamityMod.NPCs.Abyss NPC.Calamity().VulnerableToSickness = true; NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; - SpawnModBiomes = new int[3] { ModContent.GetInstance().Type, ModContent.GetInstance().Type, ModContent.GetInstance().Type }; + SpawnModBiomes = new int[2] { ModContent.GetInstance().Type, ModContent.GetInstance().Type }; } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -135,10 +135,6 @@ namespace CalamityMod.NPCs.Abyss public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.Player.Calamity().ZoneAbyssLayer1 && spawnInfo.Water) - { - return SpawnCondition.CaveJellyfish.Chance * 0.6f; - } if (spawnInfo.Player.Calamity().ZoneAbyssLayer2 && spawnInfo.Water) { return SpawnCondition.CaveJellyfish.Chance * 1.2f; diff --git a/NPCs/NormalNPCs/Eidolist.cs b/NPCs/NormalNPCs/Eidolist.cs index d77fdd7199..fd6bb5701e 100644 --- a/NPCs/NormalNPCs/Eidolist.cs +++ b/NPCs/NormalNPCs/Eidolist.cs @@ -319,7 +319,7 @@ namespace CalamityMod.NPCs.NormalNPCs } if (spawnInfo.Player.Calamity().ZoneAbyssLayer3 && spawnInfo.Water) { - return 0.05f; + return 0.1f; } return 0f; } diff --git a/NPCs/SulphurousSea/AquaticUrchin.cs b/NPCs/SulphurousSea/AquaticUrchin.cs index e2c7c1874d..2cc1d1ff1e 100644 --- a/NPCs/SulphurousSea/AquaticUrchin.cs +++ b/NPCs/SulphurousSea/AquaticUrchin.cs @@ -42,7 +42,7 @@ namespace CalamityMod.NPCs.SulphurousSea NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; - SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + SpawnModBiomes = new int[2] { ModContent.GetInstance().Type, ModContent.GetInstance().Type }; } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -137,7 +137,8 @@ namespace CalamityMod.NPCs.SulphurousSea { return 0f; } - if (spawnInfo.Player.Calamity().ZoneSulphur && spawnInfo.Water && NPC.CountNPCS(ModContent.NPCType()) < 12) + if ((spawnInfo.Player.Calamity().ZoneSulphur || spawnInfo.Player.Calamity().ZoneAbyssLayer1) && + spawnInfo.Water && NPC.CountNPCS(ModContent.NPCType()) < 12) { return 1.1f; } diff --git a/NPCs/SulphurousSea/Sulflounder.cs b/NPCs/SulphurousSea/Sulflounder.cs index d7140d463e..93e1ba87dc 100644 --- a/NPCs/SulphurousSea/Sulflounder.cs +++ b/NPCs/SulphurousSea/Sulflounder.cs @@ -38,7 +38,7 @@ namespace CalamityMod.NPCs.SulphurousSea NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; - SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + SpawnModBiomes = new int[2] { ModContent.GetInstance().Type, ModContent.GetInstance().Type }; } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -140,6 +140,10 @@ namespace CalamityMod.NPCs.SulphurousSea { return 0.2f; } + if (spawnInfo.Player.Calamity().ZoneAbyssLayer1 && spawnInfo.Water) + { + return 0.35f; + } return 0f; } diff --git a/Tiles/Abyss/AbyssAmbient/ShalePile.cs b/Tiles/Abyss/AbyssAmbient/ShalePile.cs new file mode 100644 index 0000000000..4e1292cdfa --- /dev/null +++ b/Tiles/Abyss/AbyssAmbient/ShalePile.cs @@ -0,0 +1,49 @@ +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Abyss.AbyssAmbient +{ + public class ShalePile1 : ModTile + { + public override void SetStaticDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + TileObjectData.newTile.Width = 3; + TileObjectData.newTile.Height = 2; + TileObjectData.newTile.Origin = new Point16(1, 1); + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.Table | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.WaterDeath = false; + TileObjectData.newTile.LavaDeath = true; + TileObjectData.newTile.DrawYOffset = 2; + TileObjectData.addTile(Type); + AddMapEntry(new Color(47, 30, 63)); + DustType = 33; + + base.SetStaticDefaults(); + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 2; + } + } + + public class ShalePile2 : ShalePile1 + { + } + + public class ShalePile3 : ShalePile1 + { + } +} diff --git a/Tiles/Abyss/AbyssAmbient/SulphurPireCoral.cs b/Tiles/Abyss/AbyssAmbient/SulphurPireCoral.cs new file mode 100644 index 0000000000..57b5b1e83e --- /dev/null +++ b/Tiles/Abyss/AbyssAmbient/SulphurPireCoral.cs @@ -0,0 +1,81 @@ +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Abyss.AbyssAmbient +{ + public class SulphurPireCoral1 : ModTile + { + public override void SetStaticDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + TileObjectData.newTile.Width = 3; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(1, 2); + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.Table | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.WaterDeath = false; + TileObjectData.newTile.LavaDeath = true; + TileObjectData.newTile.DrawYOffset = 2; + TileObjectData.addTile(Type); + AddMapEntry(new Color(64, 36, 39)); + DustType = 32; + + base.SetStaticDefaults(); + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + r = 230f / 500f; + g = 255f / 500f; + b = 0f; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 2; + } + + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + Tile tile = Framing.GetTileSafely(i, j); + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/SulphurPireCoral1Glow").Value; + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); + + spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); + } + } + + public class SulphurPireCoral2 : SulphurPireCoral1 + { + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + Tile tile = Framing.GetTileSafely(i, j); + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/SulphurPireCoral2Glow").Value; + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); + + spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); + } + } + + public class SulphurPireCoral3 : SulphurPireCoral1 + { + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + Tile tile = Framing.GetTileSafely(i, j); + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/SulphurPireCoral3Glow").Value; + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); + + spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); + } + } +} diff --git a/Tiles/Abyss/AbyssAmbient/SulphurTubeCoral.cs b/Tiles/Abyss/AbyssAmbient/SulphurTubeCoral.cs new file mode 100644 index 0000000000..5d7111671a --- /dev/null +++ b/Tiles/Abyss/AbyssAmbient/SulphurTubeCoral.cs @@ -0,0 +1,41 @@ +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Abyss.AbyssAmbient +{ + public class SulphurTubeCoral : ModTile + { + public override void SetStaticDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + TileObjectData.newTile.Width = 3; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(1, 2); + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.Table | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.WaterDeath = false; + TileObjectData.newTile.LavaDeath = true; + TileObjectData.newTile.DrawYOffset = 2; + TileObjectData.addTile(Type); + AddMapEntry(new Color(64, 36, 39)); + DustType = 32; + + base.SetStaticDefaults(); + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 2; + } + } +} diff --git a/Tiles/Abyss/PlantyMush.cs b/Tiles/Abyss/PlantyMush.cs index d55f5dac5b..13175685ae 100644 --- a/Tiles/Abyss/PlantyMush.cs +++ b/Tiles/Abyss/PlantyMush.cs @@ -30,6 +30,7 @@ namespace CalamityMod.Tiles.Abyss MineResist = 1f; HitSound = MineSound; } + int animationFrameWidth = 288; public override void NumDust(int i, int j, bool fail, ref int num) { @@ -47,6 +48,96 @@ namespace CalamityMod.Tiles.Abyss } } } + public override void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset) + { + int uniqueAnimationFrameX = 0; + int xPos = i % 4; + int yPos = j % 4; + switch (xPos) + { + case 0: + switch (yPos) + { + case 0: + uniqueAnimationFrameX = 0; + break; + case 1: + uniqueAnimationFrameX = 0; + break; + case 2: + uniqueAnimationFrameX = 1; + break; + case 3: + uniqueAnimationFrameX = 1; + break; + default: + uniqueAnimationFrameX = 0; + break; + } + break; + case 1: + switch (yPos) + { + case 0: + uniqueAnimationFrameX = 1; + break; + case 1: + uniqueAnimationFrameX = 0; + break; + case 2: + uniqueAnimationFrameX = 1; + break; + case 3: + uniqueAnimationFrameX = 1; + break; + default: + uniqueAnimationFrameX = 0; + break; + } + break; + case 2: + switch (yPos) + { + case 0: + uniqueAnimationFrameX = 1; + break; + case 1: + uniqueAnimationFrameX = 0; + break; + case 2: + uniqueAnimationFrameX = 0; + break; + case 3: + uniqueAnimationFrameX = 1; + break; + default: + uniqueAnimationFrameX = 0; + break; + } + break; + case 3: + switch (yPos) + { + case 0: + uniqueAnimationFrameX = 0; + break; + case 1: + uniqueAnimationFrameX = 1; + break; + case 2: + uniqueAnimationFrameX = 0; + break; + case 3: + uniqueAnimationFrameX = 1; + break; + default: + uniqueAnimationFrameX = 0; + break; + } + break; + } + frameXOffset = uniqueAnimationFrameX * animationFrameWidth; + } public override void RandomUpdate(int i, int j) { diff --git a/Tiles/Abyss/PlantyMush.png b/Tiles/Abyss/PlantyMush.png index 4342ec2884..6cf0f42678 100644 Binary files a/Tiles/Abyss/PlantyMush.png and b/Tiles/Abyss/PlantyMush.png differ diff --git a/Tiles/Abyss/ViperVines.png b/Tiles/Abyss/ViperVines.png index 2fe199034b..10969a4380 100644 Binary files a/Tiles/Abyss/ViperVines.png and b/Tiles/Abyss/ViperVines.png differ diff --git a/Tiles/Abyss/Voidstone.cs b/Tiles/Abyss/Voidstone.cs index 6640ef6b14..3936080b2c 100644 --- a/Tiles/Abyss/Voidstone.cs +++ b/Tiles/Abyss/Voidstone.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Tiles.Abyss { public class Voidstone : ModTile { - public static readonly SoundStyle MineSound = new("CalamityMod/Sounds/Custom/VoidstoneMine", 3); + public static readonly SoundStyle MineSound = new("CalamityMod/Sounds/Custom/VoidstoneMine", 3) { Volume = 0.4f }; internal static Texture2D GlowTexture; public override void SetStaticDefaults() { diff --git a/Tiles/Crags/GloomTorch.cs b/Tiles/Crags/GloomTorch.cs new file mode 100644 index 0000000000..c43cda1087 --- /dev/null +++ b/Tiles/Crags/GloomTorch.cs @@ -0,0 +1,92 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.Crags +{ + public class GloomTorch : ModTile + { + public override void SetStaticDefaults() + { + this.SetUpTorch(false, false); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Torch"); + AddMapEntry(new Color(253, 221, 3), name); + TileID.Sets.DisableSmartCursor[Type] = true; + ItemDrop = ModContent.ItemType(); + AdjTiles = new int[] { TileID.Torches }; + TileID.Sets.Torch[Type] = true; + Main.tileWaterDeath[Type] = true; + TileID.Sets.FramesOnKillWall[Type] = true; + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(190, 255, 60), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.cursorItemIconEnabled = true; + player.cursorItemIconID = ModContent.ItemType(); + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + Tile tile = Main.tile[i, j]; + if (tile.TileFrameX < 66) + { + r = 0.5f; + g = 0.75f; + b = 1.2f; + } + } + + public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) + { + offsetY = 0; + if (WorldGen.SolidTile(i, j - 1)) + { + offsetY = 2; + if (WorldGen.SolidTile(i - 1, j + 1) || WorldGen.SolidTile(i + 1, j + 1)) + { + offsetY = 4; + } + } + } + + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + CalamityUtils.DrawFlameEffect(ModContent.Request("CalamityMod/Tiles/Crags/GloomTorchFlame").Value, i, j, 2); + } + + public override void DrawEffects(int i, int j, SpriteBatch spriteBatch, ref TileDrawInfo drawData) + { + if (Main.tile[i, j].TileFrameX < 66) + CalamityUtils.DrawFlameSparks(Main.rand.NextBool() ? 61 : 64, 5, i, j); + } + + public override bool RightClick(int i, int j) + { + CalamityUtils.RightClickBreak(i, j); + return true; + } + + public override float GetTorchLuck(Player player) + { + // Note: Total Torch luck never goes below zero + return player.Calamity().ZoneCalamity ? 1f : -1f; + } + } +} diff --git a/Tiles/Crags/GloomTorchGlowmask.png b/Tiles/Crags/GloomTorchFlame.png similarity index 100% rename from Tiles/Crags/GloomTorchGlowmask.png rename to Tiles/Crags/GloomTorchFlame.png diff --git a/Tiles/Pylons/SunkenPylonTile.png b/Tiles/Pylons/SunkenPylonTile.png index c655af00f3..bbdcf59df6 100644 Binary files a/Tiles/Pylons/SunkenPylonTile.png and b/Tiles/Pylons/SunkenPylonTile.png differ diff --git a/World/Abyss.cs b/World/Abyss.cs index 12b0fded40..dc55340877 100644 --- a/World/Abyss.cs +++ b/World/Abyss.cs @@ -301,27 +301,24 @@ namespace CalamityMod.World { if (WorldGen.genRand.NextBool(2)) { - int randomIsland = WorldGen.genRand.Next(4); + int randomIsland = WorldGen.genRand.Next(3); switch (randomIsland) { case 0: - AbyssIsland(abyssChasmX - WorldGen.genRand.Next(55, 78), sulphurIslandY, 55, 75, 35, 45, false, false, false, true); + AbyssIsland(abyssChasmX - WorldGen.genRand.Next(-40, 40), sulphurIslandY, 55, 75, 35, 45, false, false, false, true); break; case 1: - AbyssIsland(abyssChasmX + WorldGen.genRand.Next(55, 78), sulphurIslandY, 55, 75, 35, 45, false, false, false, true); - break; - case 2: AbyssIsland(abyssChasmX + WorldGen.genRand.Next(55, 78), sulphurIslandY, 55, 75, 35, 45, false, false, false, true); AbyssIsland(abyssChasmX - WorldGen.genRand.Next(10, 20), sulphurIslandY, 55, 75, 35, 45, false, false, false, true); break; - case 3: + case 2: AbyssIsland(abyssChasmX - WorldGen.genRand.Next(55, 78), sulphurIslandY, 55, 75, 35, 45, false, false, false, true); AbyssIsland(abyssChasmX + WorldGen.genRand.Next(10, 20), sulphurIslandY, 55, 75, 35, 45, false, false, false, true); break; } //increase y value so islands cant be spammed on top of each other - sulphurIslandY += 12; + sulphurIslandY += 15; } } @@ -495,7 +492,28 @@ namespace CalamityMod.World //sulphur shale stuff if (tile.TileType == ModContent.TileType()) { - if (WorldGen.genRand.NextBool(8)) + if (WorldGen.genRand.NextBool(25)) + { + WorldGen.PlaceObject(abyssIndex, abyssIndex2, (ushort)ModContent.TileType()); + } + + if (WorldGen.genRand.NextBool(18)) + { + ushort[] ShalePiles = new ushort[] { (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; + + WorldGen.PlaceObject(abyssIndex, abyssIndex2, WorldGen.genRand.Next(ShalePiles)); + } + + if (WorldGen.genRand.NextBool(15)) + { + ushort[] PireCorals = new ushort[] { (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; + + WorldGen.PlaceObject(abyssIndex, abyssIndex2, WorldGen.genRand.Next(PireCorals)); + } + + if (WorldGen.genRand.NextBool(10)) { ushort[] SulphuricFossils = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; @@ -503,7 +521,7 @@ namespace CalamityMod.World WorldGen.PlaceObject(abyssIndex, abyssIndex2, WorldGen.genRand.Next(SulphuricFossils)); } - if (WorldGen.genRand.NextBool(6)) + if (WorldGen.genRand.NextBool(10)) { ushort[] Ribs = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), diff --git a/World/AerialiteOreGen.cs b/World/AerialiteOreGen.cs index 59957cf1ad..8d5b5ce2bc 100644 --- a/World/AerialiteOreGen.cs +++ b/World/AerialiteOreGen.cs @@ -30,10 +30,24 @@ namespace CalamityMod.World if (WorldGen.genRand.Next(365) == 0 && tile.TileType == TileID.Cloud && tile.HasTile) { ShapeData circle = new ShapeData(); + ShapeData biggerCircle = new ShapeData(); GenAction blotchMod = new Modifiers.Blotches(2, 0.4); int outerRadius = (int)(WorldGen.genRand.Next(3, 5) * WorldGen.genRand.NextFloat(0.74f, 0.82f)); + //big cloud circle + WorldUtils.Gen(new Point(x, y), new Shapes.Circle(outerRadius + 3), Actions.Chain(new GenAction[] + { + blotchMod.Output(biggerCircle) + })); + + WorldUtils.Gen(new Point(x, y), new ModShapes.All(biggerCircle), Actions.Chain(new GenAction[] + { + new Actions.ClearTile(), + new Actions.PlaceTile((ushort)TileID.Cloud) + })); + + //circle of ore WorldUtils.Gen(new Point(x, y), new Shapes.Circle(outerRadius), Actions.Chain(new GenAction[] { blotchMod.Output(circle) diff --git a/World/SulphurousSea.cs b/World/SulphurousSea.cs index 75cf866050..2c613cce75 100644 --- a/World/SulphurousSea.cs +++ b/World/SulphurousSea.cs @@ -1031,13 +1031,10 @@ namespace CalamityMod.World int type = WorldGen.genRand.Next(6); type++; int height = heightFromType(type); - - if ((Main.tile[x, y + dy + 1].TileType == ModContent.TileType() || - Main.tile[x, y + dy + 1].TileType == ModContent.TileType()) && - !Main.tile[x, y + dy + 1].LeftSlope && !Main.tile[x, y + dy + 1].RightSlope && !Main.tile[x, y + dy + 1].IsHalfBlock) - { + + PlaceStalactite(x, y, height, CalamityMod.Instance.Find($"SulphurousStalactite{type}").Type); + if (WorldGen.SolidTile(x, y + dy + 1)) PlaceStalacmite(x, y + dy, height, CalamityMod.Instance.Find($"SulphurousStalacmite{type}").Type); - } } } }