diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 4d9aeaa1d2..2abf4401af 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -840,6 +840,10 @@ namespace CalamityMod.CalPlayer public bool tundraFlameBlossom = false; #endregion + #region Fountains + public int fountain = 0; + #endregion + #region Biome public bool ZoneCalamity = false; public bool ZoneAstral = false; @@ -1251,6 +1255,8 @@ namespace CalamityMod.CalPlayer externalColdImmunity = externalHeatImmunity = false; alcoholPoisonLevel = 0; + fountain = 0; + thirdSage = false; if (player.immuneTime <= 0) thirdSageH = false; diff --git a/Items/Placeables/Furniture/Fountains/SunkenSeaFountain.cs b/Items/Placeables/Furniture/Fountains/SunkenSeaFountain.cs new file mode 100644 index 0000000000..82099e5799 --- /dev/null +++ b/Items/Placeables/Furniture/Fountains/SunkenSeaFountain.cs @@ -0,0 +1,30 @@ +using Terraria; +using Terraria.ModLoader; +using CalamityMod.Tiles.Furniture.Fountains; + +namespace CalamityMod.Items.Placeables.Furniture.Fountains +{ + public class SunkenSeaFountain : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sunken Water Fountain"); + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 32; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.value = Item.buyPrice(0, 4, 0, 0); + item.rare = 0; + item.createTile = ModContent.TileType(); + } + } +} diff --git a/Items/Placeables/Furniture/Fountains/SunkenSeaFountain.png b/Items/Placeables/Furniture/Fountains/SunkenSeaFountain.png new file mode 100644 index 0000000000..a4dbce972b Binary files /dev/null and b/Items/Placeables/Furniture/Fountains/SunkenSeaFountain.png differ diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 12dd74c0b4..6f7de6cd9b 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -13,6 +13,7 @@ using CalamityMod.Items.Ammo; using CalamityMod.Items.Dyes; using CalamityMod.Items.Materials; using CalamityMod.Items.Pets; +using CalamityMod.Items.Placeables.Furniture.Fountains; using CalamityMod.Items.Placeables.Walls; using CalamityMod.Items.SummonItems; using CalamityMod.Items.Weapons.Ranged; @@ -5603,6 +5604,7 @@ namespace CalamityMod.NPCs if (type == NPCID.WitchDoctor) { + SetShopItem(ref shop, ref nextSlot, ModContent.ItemType()); SetShopItem(ref shop, ref nextSlot, ItemID.Abeemination, CalamityMod.CalamityConfig.SellBossSummons, price: Item.buyPrice(0, 8)); SetShopItem(ref shop, ref nextSlot, ModContent.ItemType(), NPC.downedPlantBoss && CalamityMod.CalamityConfig.SellBossSummons, Item.buyPrice(0, 20)); SetShopItem(ref shop, ref nextSlot, ItemID.SolarTablet, NPC.downedGolemBoss, Item.buyPrice(0, 25)); diff --git a/Tiles/Furniture/Fountains/SunkenSeaFountainTile.cs b/Tiles/Furniture/Fountains/SunkenSeaFountainTile.cs new file mode 100644 index 0000000000..0db5f61fd3 --- /dev/null +++ b/Tiles/Furniture/Fountains/SunkenSeaFountainTile.cs @@ -0,0 +1,87 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items.Placeables.Furniture.Fountains; + +namespace CalamityMod.Tiles.Furniture.Fountains +{ + public class SunkenSeaFountainTile : ModTile + { + public override void SetDefaults() + { + this.SetUpFountain(); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Sunken Sea Fountain"); + AddMapEntry(new Color(104, 195, 255), name); + animationFrameHeight = 72; + } + + public override void NearbyEffects(int i, int j, bool closer) + { + Tile tile = Main.tile[i, j]; + Player player = Main.LocalPlayer; + if (player is null) + return; + if (player.active) + { + if (tile.frameX < 54) + { + player.Calamity().fountain = 1; + } + } + } + + public override bool HasSmartInteract() + { + return 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(119, 102, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 33, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void AnimateTile(ref int frame, ref int frameCounter) + { + frameCounter++; + if (frameCounter >= 6) + { + frame = (frame + 1) % 4; + frameCounter = 0; + } + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 32, ModContent.ItemType()); + } + + public override void HitWire(int i, int j) + { + CalamityUtils.LightHitWire(Type, i, j, 2, 4); + } + + public override bool NewRightClick(int i, int j) + { + CalamityUtils.LightHitWire(Type, i, j, 2, 4); + return true; + } + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.showItemIcon = true; + player.showItemIcon2 = ModContent.ItemType(); + } + } +} \ No newline at end of file diff --git a/Tiles/Furniture/Fountains/SunkenSeaFountainTile.png b/Tiles/Furniture/Fountains/SunkenSeaFountainTile.png new file mode 100644 index 0000000000..e8ceb8d0a1 Binary files /dev/null and b/Tiles/Furniture/Fountains/SunkenSeaFountainTile.png differ diff --git a/Tiles/Furniture/Fountains/SunkenSeaFountainTile_Highlight.png b/Tiles/Furniture/Fountains/SunkenSeaFountainTile_Highlight.png new file mode 100644 index 0000000000..5866fcb8b8 Binary files /dev/null and b/Tiles/Furniture/Fountains/SunkenSeaFountainTile_Highlight.png differ diff --git a/Utilities/CalamityUtils.cs b/Utilities/CalamityUtils.cs index 70f7fe3459..7ec060b2b4 100644 --- a/Utilities/CalamityUtils.cs +++ b/Utilities/CalamityUtils.cs @@ -2138,6 +2138,33 @@ namespace CalamityMod // All work benches count as tables. mt.AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); } + + /// + /// Extension which initializes a ModTile to be a fountain. + /// + /// The ModTile which is being initialized. + internal static void SetUpFountain(this ModTile mt) + { + //All fountains are immune to lava + Main.tileLighted[mt.Type] = true; + Main.tileFrameImportant[mt.Type] = true; + Main.tileLavaDeath[mt.Type] = false; + Main.tileWaterDeath[mt.Type] = false; + //TileObjectData.newTile.CopyFrom(TileObjectData.Style3x4); + //TileObjectData.newTile.Width = 2; + TileObjectData.newTile.LavaDeath = false; + TileObjectData.addTile(mt.Type); + TileID.Sets.HasOutlines[mt.Type] = true; + + TileObjectData.newTile.Width = 2; + TileObjectData.newTile.Height = 4; + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16, 16 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.Origin = new Point16(0, 3); + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, 2, 0); + TileObjectData.addTile(mt.Type); + } #endregion #endregion diff --git a/Waters/AbyssWater.cs b/Waters/AbyssWater.cs index acf70e4ef8..d20ca43865 100644 --- a/Waters/AbyssWater.cs +++ b/Waters/AbyssWater.cs @@ -1,3 +1,4 @@ +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; @@ -8,7 +9,8 @@ namespace CalamityMod.Waters { public override bool ChooseWaterStyle() { - return Main.LocalPlayer.Calamity().ZoneAbyss; + CalamityPlayer modPlayer = Main.LocalPlayer.Calamity(); + return (modPlayer.ZoneAbyss && modPlayer.fountain == 0) || modPlayer.fountain == 2; } public override int ChooseWaterfallStyle() diff --git a/Waters/AstralWater.cs b/Waters/AstralWater.cs index 61c8de3d82..ab7c1b88bc 100644 --- a/Waters/AstralWater.cs +++ b/Waters/AstralWater.cs @@ -1,3 +1,4 @@ +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; @@ -8,7 +9,8 @@ namespace CalamityMod.Waters { public override bool ChooseWaterStyle() { - return Main.LocalPlayer.Calamity().ZoneAstral; + CalamityPlayer modPlayer = Main.LocalPlayer.Calamity(); + return (modPlayer.ZoneAstral && modPlayer.fountain == 0) || modPlayer.fountain == 4; } public override int ChooseWaterfallStyle() diff --git a/Waters/SulphuricWater.cs b/Waters/SulphuricWater.cs index 1c0a59d613..144eebd262 100644 --- a/Waters/SulphuricWater.cs +++ b/Waters/SulphuricWater.cs @@ -1,3 +1,4 @@ +using CalamityMod.CalPlayer; using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; @@ -32,7 +33,9 @@ namespace CalamityMod.Waters bool inYZone = Main.LocalPlayer.Center.Y < Main.rockLayer * 16f - 320 && Main.LocalPlayer.Center.Y >= 5800f; - return (inXZone && inYZone) || Main.LocalPlayer.Calamity().ZoneSulphur; + CalamityPlayer modPlayer = Main.LocalPlayer.Calamity(); + bool greenWater = (inXZone && inYZone) || modPlayer.ZoneSulphur; + return (greenWater && modPlayer.fountain == 0) || modPlayer.fountain == 3; } public override int ChooseWaterfallStyle() diff --git a/Waters/SunkenSeaWater.cs b/Waters/SunkenSeaWater.cs index 16f9e35348..4bb6903bf0 100644 --- a/Waters/SunkenSeaWater.cs +++ b/Waters/SunkenSeaWater.cs @@ -1,3 +1,4 @@ +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; @@ -8,7 +9,8 @@ namespace CalamityMod.Waters { public override bool ChooseWaterStyle() { - return Main.LocalPlayer.Calamity().ZoneSunkenSea; + CalamityPlayer modPlayer = Main.LocalPlayer.Calamity(); + return (modPlayer.ZoneSunkenSea && modPlayer.fountain == 0) || modPlayer.fountain == 1; } public override int ChooseWaterfallStyle()