diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 2abf4401af..4d9aeaa1d2 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -840,10 +840,6 @@ 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; @@ -1255,8 +1251,6 @@ 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/AbyssFountainItem.cs b/Items/Placeables/Furniture/Fountains/AbyssFountainItem.cs new file mode 100644 index 0000000000..c20189457b --- /dev/null +++ b/Items/Placeables/Furniture/Fountains/AbyssFountainItem.cs @@ -0,0 +1,30 @@ +using Terraria; +using Terraria.ModLoader; +using CalamityMod.Tiles.Furniture.Fountains; + +namespace CalamityMod.Items.Placeables.Furniture.Fountains +{ + public class AbyssFountainItem : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Abyss Fountain"); + } + + public override void SetDefaults() + { + item.width = 22; + item.height = 42; + 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/AbyssFountainItem.png b/Items/Placeables/Furniture/Fountains/AbyssFountainItem.png new file mode 100644 index 0000000000..2b82813299 Binary files /dev/null and b/Items/Placeables/Furniture/Fountains/AbyssFountainItem.png differ diff --git a/Items/Placeables/Furniture/Fountains/AstralFountainItem.cs b/Items/Placeables/Furniture/Fountains/AstralFountainItem.cs new file mode 100644 index 0000000000..bad8e6b893 --- /dev/null +++ b/Items/Placeables/Furniture/Fountains/AstralFountainItem.cs @@ -0,0 +1,30 @@ +using Terraria; +using Terraria.ModLoader; +using CalamityMod.Tiles.Furniture.Fountains; + +namespace CalamityMod.Items.Placeables.Furniture.Fountains +{ + public class AstralFountainItem : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Astral Fountain"); + } + + public override void SetDefaults() + { + item.width = 22; + item.height = 42; + 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/AstralFountainItem.png b/Items/Placeables/Furniture/Fountains/AstralFountainItem.png new file mode 100644 index 0000000000..b206cf12fb Binary files /dev/null and b/Items/Placeables/Furniture/Fountains/AstralFountainItem.png differ diff --git a/Items/Placeables/Furniture/Fountains/SulphurousFountainItem.cs b/Items/Placeables/Furniture/Fountains/SulphurousFountainItem.cs new file mode 100644 index 0000000000..0e39da0063 --- /dev/null +++ b/Items/Placeables/Furniture/Fountains/SulphurousFountainItem.cs @@ -0,0 +1,30 @@ +using Terraria; +using Terraria.ModLoader; +using CalamityMod.Tiles.Furniture.Fountains; + +namespace CalamityMod.Items.Placeables.Furniture.Fountains +{ + public class SulphurousFountainItem : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sulphuric Fountain"); + } + + public override void SetDefaults() + { + item.width = 22; + item.height = 42; + 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/SulphurousFountainItem.png b/Items/Placeables/Furniture/Fountains/SulphurousFountainItem.png new file mode 100644 index 0000000000..138609c239 Binary files /dev/null and b/Items/Placeables/Furniture/Fountains/SulphurousFountainItem.png differ diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 6f7de6cd9b..49e257c2e8 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -5605,6 +5605,9 @@ namespace CalamityMod.NPCs if (type == NPCID.WitchDoctor) { SetShopItem(ref shop, ref nextSlot, ModContent.ItemType()); + SetShopItem(ref shop, ref nextSlot, ModContent.ItemType()); + SetShopItem(ref shop, ref nextSlot, ModContent.ItemType(), Main.hardMode); + SetShopItem(ref shop, ref nextSlot, ModContent.ItemType(), Main.hardMode); 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/CalamityGlobalTile.cs b/Tiles/CalamityGlobalTile.cs index 2e164cbcd1..b92fa96ba2 100644 --- a/Tiles/CalamityGlobalTile.cs +++ b/Tiles/CalamityGlobalTile.cs @@ -10,6 +10,8 @@ using CalamityMod.Tiles.SunkenSea; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System.Collections.Generic; +using System.Reflection; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -18,6 +20,7 @@ namespace CalamityMod.Tiles { public class CalamityGlobalTile : GlobalTile { + public static IList WaterStyles => (IList)typeof(WaterStyleLoader).GetField("waterStyles", BindingFlags.Static | BindingFlags.NonPublic).GetValue(null); public static ushort[] PlantTypes = new ushort[] { TileID.Plants, diff --git a/Tiles/Furniture/Fountains/AbyssFountainTile.cs b/Tiles/Furniture/Fountains/AbyssFountainTile.cs new file mode 100644 index 0000000000..7b9e479ea7 --- /dev/null +++ b/Tiles/Furniture/Fountains/AbyssFountainTile.cs @@ -0,0 +1,82 @@ +using Microsoft.Xna.Framework; +using System.Linq; +using Terraria; +using Terraria.ModLoader; +using CalamityMod.Items.Placeables.Furniture.Fountains; + +namespace CalamityMod.Tiles.Furniture.Fountains +{ + public class AbyssFountainTile : ModTile + { + public override void SetDefaults() + { + this.SetUpFountain(); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Abyss Fountain"); + AddMapEntry(new Color(71, 93, 107), name); + animationFrameHeight = 72; + } + + public override void NearbyEffects(int i, int j, bool closer) + { + if (Main.tile[i, j].frameX < 36) + { + if (CalamityGlobalTile.WaterStyles.Any((style) => style.Name == "AbyssWater")) + { + Main.fountainColor = CalamityGlobalTile.WaterStyles.FirstOrDefault((style) => style.Name == "AbyssWater").Type; + } + } + } + + 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/AbyssFountainTile.png b/Tiles/Furniture/Fountains/AbyssFountainTile.png new file mode 100644 index 0000000000..68927bab25 Binary files /dev/null and b/Tiles/Furniture/Fountains/AbyssFountainTile.png differ diff --git a/Tiles/Furniture/Fountains/AbyssFountainTile_Highlight.png b/Tiles/Furniture/Fountains/AbyssFountainTile_Highlight.png new file mode 100644 index 0000000000..1d1e01fe1a Binary files /dev/null and b/Tiles/Furniture/Fountains/AbyssFountainTile_Highlight.png differ diff --git a/Tiles/Furniture/Fountains/AstralFountainTile.cs b/Tiles/Furniture/Fountains/AstralFountainTile.cs new file mode 100644 index 0000000000..1b683385ca --- /dev/null +++ b/Tiles/Furniture/Fountains/AstralFountainTile.cs @@ -0,0 +1,83 @@ +using Microsoft.Xna.Framework; +using System.Linq; +using Terraria; +using Terraria.ModLoader; +using CalamityMod.Dusts; +using CalamityMod.Items.Placeables.Furniture.Fountains; + +namespace CalamityMod.Tiles.Furniture.Fountains +{ + public class AstralFountainTile : ModTile + { + public override void SetDefaults() + { + this.SetUpFountain(); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Astral Fountain"); + AddMapEntry(new Color(59, 50, 77), name); + animationFrameHeight = 72; + } + + public override void NearbyEffects(int i, int j, bool closer) + { + if (Main.tile[i, j].frameX < 36) + { + if (CalamityGlobalTile.WaterStyles.Any((style) => style.Name == "AstralWater")) + { + Main.fountainColor = CalamityGlobalTile.WaterStyles.FirstOrDefault((style) => style.Name == "AstralWater").Type; + } + } + } + + 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, ModContent.DustType()); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, ModContent.DustType()); + 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/AstralFountainTile.png b/Tiles/Furniture/Fountains/AstralFountainTile.png new file mode 100644 index 0000000000..126498ac4d Binary files /dev/null and b/Tiles/Furniture/Fountains/AstralFountainTile.png differ diff --git a/Tiles/Furniture/Fountains/AstralFountainTile_Highlight.png b/Tiles/Furniture/Fountains/AstralFountainTile_Highlight.png new file mode 100644 index 0000000000..169f6ac0a3 Binary files /dev/null and b/Tiles/Furniture/Fountains/AstralFountainTile_Highlight.png differ diff --git a/Tiles/Furniture/Fountains/SulphurousFountainTile.cs b/Tiles/Furniture/Fountains/SulphurousFountainTile.cs new file mode 100644 index 0000000000..c849322ad6 --- /dev/null +++ b/Tiles/Furniture/Fountains/SulphurousFountainTile.cs @@ -0,0 +1,82 @@ +using Microsoft.Xna.Framework; +using System.Linq; +using Terraria; +using Terraria.ModLoader; +using CalamityMod.Items.Placeables.Furniture.Fountains; + +namespace CalamityMod.Tiles.Furniture.Fountains +{ + public class SulphurousFountainTile : ModTile + { + public override void SetDefaults() + { + this.SetUpFountain(); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Sulphuric Fountain"); + AddMapEntry(new Color(104, 195, 255), name); + animationFrameHeight = 72; + } + + public override void NearbyEffects(int i, int j, bool closer) + { + if (Main.tile[i, j].frameX < 36) + { + if (CalamityGlobalTile.WaterStyles.Any((style) => style.Name == "SulphuricWater")) + { + Main.fountainColor = CalamityGlobalTile.WaterStyles.FirstOrDefault((style) => style.Name == "SulphuricWater").Type; + } + } + } + + 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/SulphurousFountainTile.png b/Tiles/Furniture/Fountains/SulphurousFountainTile.png new file mode 100644 index 0000000000..9dfcecd6e6 Binary files /dev/null and b/Tiles/Furniture/Fountains/SulphurousFountainTile.png differ diff --git a/Tiles/Furniture/Fountains/SulphurousFountainTile_Highlight.png b/Tiles/Furniture/Fountains/SulphurousFountainTile_Highlight.png new file mode 100644 index 0000000000..31243c312d Binary files /dev/null and b/Tiles/Furniture/Fountains/SulphurousFountainTile_Highlight.png differ diff --git a/Tiles/Furniture/Fountains/SunkenSeaFountainTile.cs b/Tiles/Furniture/Fountains/SunkenSeaFountainTile.cs index 0db5f61fd3..320c833be8 100644 --- a/Tiles/Furniture/Fountains/SunkenSeaFountainTile.cs +++ b/Tiles/Furniture/Fountains/SunkenSeaFountainTile.cs @@ -1,7 +1,6 @@ using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; +using System.Linq; using Terraria; -using Terraria.ID; using Terraria.ModLoader; using CalamityMod.Items.Placeables.Furniture.Fountains; @@ -20,17 +19,13 @@ namespace CalamityMod.Tiles.Furniture.Fountains 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; - } - } + if (Main.tile[i, j].frameX < 36) + { + if (CalamityGlobalTile.WaterStyles.Any((style) => style.Name == "SunkenSeaWater")) + { + Main.fountainColor = CalamityGlobalTile.WaterStyles.FirstOrDefault((style) => style.Name == "SunkenSeaWater").Type; + } + } } public override bool HasSmartInteract() diff --git a/Waters/AbyssWater.cs b/Waters/AbyssWater.cs index d20ca43865..76bc725e05 100644 --- a/Waters/AbyssWater.cs +++ b/Waters/AbyssWater.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Waters public override bool ChooseWaterStyle() { CalamityPlayer modPlayer = Main.LocalPlayer.Calamity(); - return (modPlayer.ZoneAbyss && modPlayer.fountain == 0) || modPlayer.fountain == 2; + return modPlayer.ZoneAbyss; } public override int ChooseWaterfallStyle() diff --git a/Waters/AstralWater.cs b/Waters/AstralWater.cs index ab7c1b88bc..82d110d09d 100644 --- a/Waters/AstralWater.cs +++ b/Waters/AstralWater.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Waters public override bool ChooseWaterStyle() { CalamityPlayer modPlayer = Main.LocalPlayer.Calamity(); - return (modPlayer.ZoneAstral && modPlayer.fountain == 0) || modPlayer.fountain == 4; + return modPlayer.ZoneAstral; } public override int ChooseWaterfallStyle() diff --git a/Waters/SulphuricWater.cs b/Waters/SulphuricWater.cs index 144eebd262..61d90d8335 100644 --- a/Waters/SulphuricWater.cs +++ b/Waters/SulphuricWater.cs @@ -35,7 +35,7 @@ namespace CalamityMod.Waters CalamityPlayer modPlayer = Main.LocalPlayer.Calamity(); bool greenWater = (inXZone && inYZone) || modPlayer.ZoneSulphur; - return (greenWater && modPlayer.fountain == 0) || modPlayer.fountain == 3; + return greenWater; } public override int ChooseWaterfallStyle() diff --git a/Waters/SunkenSeaWater.cs b/Waters/SunkenSeaWater.cs index 4bb6903bf0..e8cb9e7ff5 100644 --- a/Waters/SunkenSeaWater.cs +++ b/Waters/SunkenSeaWater.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Waters public override bool ChooseWaterStyle() { CalamityPlayer modPlayer = Main.LocalPlayer.Calamity(); - return (modPlayer.ZoneSunkenSea && modPlayer.fountain == 0) || modPlayer.fountain == 1; + return modPlayer.ZoneSunkenSea; } public override int ChooseWaterfallStyle()