From cb819daab8cc1c0103cd2d1a5cc0de37273fedae Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Fri, 24 Apr 2020 21:50:38 -0400 Subject: [PATCH] attempted (and failed) at sunken sea fountain --- CalPlayer/CalamityPlayer.cs | 6 ++ .../Furniture/Fountains/SunkenSeaFountain.cs | 30 ++++++ .../Furniture/Fountains/SunkenSeaFountain.png | Bin 0 -> 499 bytes NPCs/CalamityGlobalNPC.cs | 2 + .../Fountains/SunkenSeaFountainTile.cs | 87 ++++++++++++++++++ .../Fountains/SunkenSeaFountainTile.png | Bin 0 -> 3566 bytes .../SunkenSeaFountainTile_Highlight.png | Bin 0 -> 2256 bytes Utilities/CalamityUtils.cs | 27 ++++++ Waters/AbyssWater.cs | 4 +- Waters/AstralWater.cs | 4 +- Waters/SulphuricWater.cs | 5 +- Waters/SunkenSeaWater.cs | 4 +- 12 files changed, 165 insertions(+), 4 deletions(-) create mode 100644 Items/Placeables/Furniture/Fountains/SunkenSeaFountain.cs create mode 100644 Items/Placeables/Furniture/Fountains/SunkenSeaFountain.png create mode 100644 Tiles/Furniture/Fountains/SunkenSeaFountainTile.cs create mode 100644 Tiles/Furniture/Fountains/SunkenSeaFountainTile.png create mode 100644 Tiles/Furniture/Fountains/SunkenSeaFountainTile_Highlight.png 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 0000000000000000000000000000000000000000..a4dbce972b480c984785a2992ebfef1bc03dfbc0 GIT binary patch literal 499 zcmVPx$tw}^dR7i=vmc35GP!z|1CD4$fVAQIKCdME!ad&dy4IEsZd<1vj!P&`Y;T0HI zkhp04K#gE%NNHM!avDydxN!Sl+WT>Ce?9r1d#}Y*uH9f(>pN8dem{m03skO^Er9W0 ztor+Y7l6W|pjF5c(u!LFVALNe!n3P$06w4JRNzyqr`mS4WC8fY36KXd5CI%D>uSRG z!JcXh`Jn%$`oB9r$(mr0xR~x3oL90My(q6_DiyyWX&-@rH@zB_Xet0Pu$sRe{dFqXNAb4}hXm zv;YDx0CLzX5?9EV++k9QaRu20A&g+2JPg8x3!BezmL&H@C;qv>3lzEJTGq-h$7#Z3 zLI&x7GEbc4WAUd{qDU&PU>7Wa(AVxTM=Ye`S0POk%AS$lD@dK;$$BeCoyv0U#?n2Z zT(ebsJn&U}#>YzLT_LA)`c%$Ra?d!{{c_(hpX02Gk{qXVn5697U#Tzb}t p-XC9qdAFo1F~7UpD%J#p#DB!)mu^9W{AvII002ovPDHLkV1jIm=aT>c literal 0 HcmV?d00001 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 0000000000000000000000000000000000000000..e8ceb8d0a192244ef3735d0d93ce65e916306ad7 GIT binary patch literal 3566 zcmcJSXHZk?*2g!XiOLaFniL5jVCWVEK?p@i5ETI_M^H*Y0*JK8fzU+-i9ik_AV|-- z)I&n=Ay^_+5h>D9dJB_OlJ1pnf0u_*8lfk&oevL+zfT}h}aPT z0FGWYF|q`&CIG-CbqE69iRfN@4_>&imMBAj^hsg?3@W^8WMCDPLC>`JlCTwRjhNb4 z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yXGSuy19YGW9t*LBS#K}DWMhp_zmGd2oq4OI1pg1-VOjP#CJ+WmJ3)O zoDVT@V}Wari)~t{6Av|CAC6PxJQ{ApM(r|IQ#QcaGWxP*Vj3#vIMdD^-hl1pg(vr2kcXEU%jsBQpxhIBrQg)2^l*_La^7Kj46?#%4w&L#L?!1C7q>W&i*H literal 0 HcmV?d00001 diff --git a/Tiles/Furniture/Fountains/SunkenSeaFountainTile_Highlight.png b/Tiles/Furniture/Fountains/SunkenSeaFountainTile_Highlight.png new file mode 100644 index 0000000000000000000000000000000000000000..5866fcb8b8fa8491955c08b71ae70007ef9463ae GIT binary patch literal 2256 zcmeH}ZB)`%9LF&Uf|Ns=^P!kjXwIB-O)Et}noiU*C`&6z%~Q^_OiW27G)+TIG}E*) zq||9Kq0KUbj82*V=`z&vAq(+|DXHL7Dl1`s_i*-d@Aj&D?m73qx#xa=_xJsN&ds9w zdmAIIkPryO*oWe|8(b+6hyiv54BVL$TpA&e6~#WDcc^%3YTYs1bM@$`wMA8G)-=$jileeTY z>hPv02fQ5f9UGE}7P-k=`{?@M zn5{g#-6g;9MA&lG}zj*d2fSMhNZ0TNJTpBScAqL`qFz| zCr{c-tlTKYuQ17Q<}WjP34>;BuTwljrnq8~=~l;`EouM^?z55UmEVNv&ztoh7yqp3 z-K&!)PKSncX3#4Ek{^?5ThKIZl;+MZ-;}D@!(f6EUl-*RWk+>cOE)|RnquKU6P6nQb#VG zx(CnD-@VF8RIcFgrjGeM3eLk*^0#6QO`zg;J;|~06PjL(s)gm7vNdH+G@Y1pWOrn= z2ZHjs)sm=@IO^4u==z!9vDJhF;6W-KWyhlq-QYCJm+I%)R%>TfwMI@<0Nj`QEHI+e{~(nw|-;V)v__f&O+iz@IGwD=Tyct2u* z^dm1f&l(XiwkCH7m3Devamq&e@bO)>gSD7Trpj&hkMMS;vpvu*G^fF$`|4!2N@rWA(kSVLr_!2nL7;!CvF3nSHTvMUGiF} z)jdG8$$KcTchC8yUKd87+2h)vtdj5x?E5(VyQH^dNnn?DNB{n1wamPBdvT&TVR+sW zG=mk@AT!c1tx=#H?UNo9wN%XxGvVZ$`LKZ0u-;TG?Uy-8(7;z!;Ud5CTv+-0`t-)Z zV0M`8_#!DA*>+#0v@D!=P&|Eze5Foe!CHlWmxA?&rv{tk<$4tj?n-e?te($stJBJra z^P^At^ySr%GuICB$ceIP!gGPggb;{m8}|i#pSg_XDOUX!K2)C`NFK literal 0 HcmV?d00001 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()