diff --git a/Items/Critters/PolypPanaseaDeluxeItem.cs b/Items/Critters/PolypPanaseaDeluxeItem.cs new file mode 100644 index 0000000000..804bb98290 --- /dev/null +++ b/Items/Critters/PolypPanaseaDeluxeItem.cs @@ -0,0 +1,33 @@ +using CalamityMod.NPCs.SunkenSea; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Critters +{ + public class PolypPanaseaDeluxeItem : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Misc"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 5; + } + + public override void SetDefaults() + { + Item.width = 26; + Item.height = 24; + Item.useStyle = ItemUseStyleID.Swing; + Item.autoReuse = true; + Item.useTurn = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.maxStack = 9999; + Item.consumable = true; + Item.noUseGraphic = true; + Item.value = Item.buyPrice(0, 0, 30, 0); + Item.makeNPC = (short)ModContent.NPCType(); + Item.rare = ItemRarityID.Green; + } + } +} diff --git a/Items/Critters/PolypPanaseaDeluxeItem.png b/Items/Critters/PolypPanaseaDeluxeItem.png new file mode 100644 index 0000000000..112eed64a6 Binary files /dev/null and b/Items/Critters/PolypPanaseaDeluxeItem.png differ diff --git a/Items/Critters/PolypPanaseaGreenItem.cs b/Items/Critters/PolypPanaseaGreenItem.cs new file mode 100644 index 0000000000..8b9305af4d --- /dev/null +++ b/Items/Critters/PolypPanaseaGreenItem.cs @@ -0,0 +1,33 @@ +using CalamityMod.NPCs.SunkenSea; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Critters +{ + public class PolypPanaseaGreenItem : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Misc"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 5; + } + + public override void SetDefaults() + { + Item.width = 26; + Item.height = 24; + Item.useStyle = ItemUseStyleID.Swing; + Item.autoReuse = true; + Item.useTurn = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.maxStack = 9999; + Item.consumable = true; + Item.noUseGraphic = true; + Item.value = Item.buyPrice(0, 0, 30, 0); + Item.makeNPC = (short)ModContent.NPCType(); + Item.rare = ItemRarityID.Green; + } + } +} diff --git a/Items/Critters/PolypPanaseaGreenItem.png b/Items/Critters/PolypPanaseaGreenItem.png new file mode 100644 index 0000000000..5348095c25 Binary files /dev/null and b/Items/Critters/PolypPanaseaGreenItem.png differ diff --git a/Items/Critters/PolypPanaseaItem.cs b/Items/Critters/PolypPanaseaItem.cs new file mode 100644 index 0000000000..28c5c878b5 --- /dev/null +++ b/Items/Critters/PolypPanaseaItem.cs @@ -0,0 +1,79 @@ +using CalamityMod.NPCs.SunkenSea; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Critters +{ + public class PolypPanaseaItem : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Misc"; + public override void SetStaticDefaults() + { + On_Player.ItemCheck_ReleaseCritter += ReleaseColoredPanasea; + Item.ResearchUnlockCount = 5; + } + + public override void SetDefaults() + { + Item.width = 26; + Item.height = 24; + Item.useStyle = ItemUseStyleID.Swing; + Item.autoReuse = true; + Item.useTurn = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.maxStack = 9999; + Item.consumable = true; + Item.noUseGraphic = true; + Item.value = Item.buyPrice(0, 0, 30, 0); + Item.makeNPC = (short)ModContent.NPCType(); + Item.rare = ItemRarityID.Green; + } + + // Since all Polyp Panasea variants are a single NPC type, this needs to be done in order for each item to spawn the correct color + public static void ReleaseColoredPanasea(On_Player.orig_ItemCheck_ReleaseCritter orig, Player player, Item item) + { + if (item.makeNPC == ModContent.NPCType()) + { + int mouseX = Main.mouseX + (int)Main.screenPosition.X; + int mouseY = Main.mouseY + (int)Main.screenPosition.Y; + int tileX = mouseX / 16; + int tileY = mouseY / 16; + if (!WorldGen.SolidTile(tileX, tileY)) + { + int colorType = (int)PolypPanasea.FishColor.Red; + if (item.type == ModContent.ItemType()) + { + colorType = (int)PolypPanasea.FishColor.Green; + } + if (item.type == ModContent.ItemType()) + { + colorType = (int)PolypPanasea.FishColor.Turquoise; + } + if (item.type == ModContent.ItemType()) + { + colorType = (int)PolypPanasea.FishColor.Purple; + } + if (item.type == ModContent.ItemType()) + { + colorType = (int)PolypPanasea.FishColor.Deluxe; + } + if (item.type == ModContent.ItemType()) + { + colorType = (int)PolypPanasea.FishColor.Radiant; + } + player.ApplyItemTime(item); + int n = NPC.ReleaseNPC(mouseX, mouseY, item.makeNPC, item.placeStyle, player.whoAmI); + Main.npc[n].ai[1] = colorType; + Main.npc[n].ai[2] = 0; + Main.npc[n].ai[3] = 1; + } + } + else + { + orig(player, item); + } + } + } +} diff --git a/Items/Critters/PolypPanaseaItem.png b/Items/Critters/PolypPanaseaItem.png new file mode 100644 index 0000000000..4b961ac2e2 Binary files /dev/null and b/Items/Critters/PolypPanaseaItem.png differ diff --git a/Items/Critters/PolypPanaseaPurpleItem.cs b/Items/Critters/PolypPanaseaPurpleItem.cs new file mode 100644 index 0000000000..33233155cb --- /dev/null +++ b/Items/Critters/PolypPanaseaPurpleItem.cs @@ -0,0 +1,33 @@ +using CalamityMod.NPCs.SunkenSea; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Critters +{ + public class PolypPanaseaPurpleItem : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Misc"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 5; + } + + public override void SetDefaults() + { + Item.width = 26; + Item.height = 24; + Item.useStyle = ItemUseStyleID.Swing; + Item.autoReuse = true; + Item.useTurn = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.maxStack = 9999; + Item.consumable = true; + Item.noUseGraphic = true; + Item.value = Item.buyPrice(0, 0, 30, 0); + Item.makeNPC = (short)ModContent.NPCType(); + Item.rare = ItemRarityID.Green; + } + } +} diff --git a/Items/Critters/PolypPanaseaPurpleItem.png b/Items/Critters/PolypPanaseaPurpleItem.png new file mode 100644 index 0000000000..9125ccacd5 Binary files /dev/null and b/Items/Critters/PolypPanaseaPurpleItem.png differ diff --git a/Items/Critters/PolypPanaseaRadiantItem.cs b/Items/Critters/PolypPanaseaRadiantItem.cs new file mode 100644 index 0000000000..8ac583b80f --- /dev/null +++ b/Items/Critters/PolypPanaseaRadiantItem.cs @@ -0,0 +1,33 @@ +using CalamityMod.NPCs.SunkenSea; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Critters +{ + public class PolypPanaseaRadiantItem : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Misc"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 5; + } + + public override void SetDefaults() + { + Item.width = 26; + Item.height = 24; + Item.useStyle = ItemUseStyleID.Swing; + Item.autoReuse = true; + Item.useTurn = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.maxStack = 9999; + Item.consumable = true; + Item.noUseGraphic = true; + Item.value = Item.buyPrice(0, 0, 30, 0); + Item.makeNPC = (short)ModContent.NPCType(); + Item.rare = ItemRarityID.Green; + } + } +} diff --git a/Items/Critters/PolypPanaseaRadiantItem.png b/Items/Critters/PolypPanaseaRadiantItem.png new file mode 100644 index 0000000000..b419186c46 Binary files /dev/null and b/Items/Critters/PolypPanaseaRadiantItem.png differ diff --git a/Items/Critters/PolypPanaseaTurquoiseItem.cs b/Items/Critters/PolypPanaseaTurquoiseItem.cs new file mode 100644 index 0000000000..cbcad52d70 --- /dev/null +++ b/Items/Critters/PolypPanaseaTurquoiseItem.cs @@ -0,0 +1,33 @@ +using CalamityMod.NPCs.SunkenSea; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Critters +{ + public class PolypPanaseaTurquoiseItem : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Misc"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 5; + } + + public override void SetDefaults() + { + Item.width = 26; + Item.height = 24; + Item.useStyle = ItemUseStyleID.Swing; + Item.autoReuse = true; + Item.useTurn = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.maxStack = 9999; + Item.consumable = true; + Item.noUseGraphic = true; + Item.value = Item.buyPrice(0, 0, 30, 0); + Item.makeNPC = (short)ModContent.NPCType(); + Item.rare = ItemRarityID.Green; + } + } +} diff --git a/Items/Critters/PolypPanaseaTurquoiseItem.png b/Items/Critters/PolypPanaseaTurquoiseItem.png new file mode 100644 index 0000000000..7aba44f54a Binary files /dev/null and b/Items/Critters/PolypPanaseaTurquoiseItem.png differ diff --git a/Localization/en-US/Mods.CalamityMod.Items.Misc.hjson b/Localization/en-US/Mods.CalamityMod.Items.Misc.hjson index 0c302fbb07..b1c71c8a94 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Misc.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Misc.hjson @@ -333,3 +333,33 @@ NimbleBounder: { [c/842593:'Might be useful for speedrunning'] ''' } + +PolypPanaseaDeluxeItem: { + DisplayName: Polyp Panasea Deluxe Item + Tooltip: "" +} + +PolypPanaseaGreenItem: { + DisplayName: Polyp Panasea Green Item + Tooltip: "" +} + +PolypPanaseaItem: { + DisplayName: Polyp Panasea Item + Tooltip: "" +} + +PolypPanaseaPurpleItem: { + DisplayName: Polyp Panasea Purple Item + Tooltip: "" +} + +PolypPanaseaRadiantItem: { + DisplayName: Polyp Panasea Radiant Item + Tooltip: "" +} + +PolypPanaseaTurquoiseItem: { + DisplayName: Polyp Panasea Turquoise Item + Tooltip: "" +} diff --git a/NPCs/SunkenSea/PolypPanasea.cs b/NPCs/SunkenSea/PolypPanasea.cs index ead0a0741b..de17c1d6d7 100644 --- a/NPCs/SunkenSea/PolypPanasea.cs +++ b/NPCs/SunkenSea/PolypPanasea.cs @@ -1,17 +1,16 @@ using CalamityMod.BiomeManagers; using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Critters; -using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; +using Terraria.DataStructures; +using Terraria.GameContent; using Terraria.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; using Terraria.ModLoader.Utilities; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using ReLogic.Content; -using Terraria.DataStructures; -using Terraria.GameContent; namespace CalamityMod.NPCs.SunkenSea { @@ -19,13 +18,13 @@ namespace CalamityMod.NPCs.SunkenSea { #region Textures // Welcome to the fish texture wall, have a nice stay, or just collapse this region, either works - public static Texture2D DeluxTexture; + public static Texture2D DeluxeTexture; public static Texture2D GreenTexture; public static Texture2D PurpleTexture; public static Texture2D TurquoiseTexture; public static Texture2D RadiantTexture; public static Texture2D TextureCoated; - public static Texture2D DeluxTextureCoated; + public static Texture2D DeluxeTextureCoated; public static Texture2D GreenTextureCoated; public static Texture2D PurpleTextureCoated; public static Texture2D TurquoiseTextureCoated; @@ -39,20 +38,20 @@ namespace CalamityMod.NPCs.SunkenSea Green = 2, Purple = 3, Radiant = 4, - Blue = 5 + Deluxe = 5 } public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 6; if (!Main.dedServ) { - DeluxTexture = ModContent.Request("CalamityMod/NPCs/SunkenSea/PolypPanaseaDelux", AssetRequestMode.ImmediateLoad).Value; + DeluxeTexture = ModContent.Request("CalamityMod/NPCs/SunkenSea/PolypPanaseaDeluxe", AssetRequestMode.ImmediateLoad).Value; RadiantTexture = ModContent.Request("CalamityMod/NPCs/SunkenSea/PolypPanaseaRadiant", AssetRequestMode.ImmediateLoad).Value; GreenTexture = ModContent.Request("CalamityMod/NPCs/SunkenSea/PolypPanaseaGreen", AssetRequestMode.ImmediateLoad).Value; PurpleTexture = ModContent.Request("CalamityMod/NPCs/SunkenSea/PolypPanaseaPurple", AssetRequestMode.ImmediateLoad).Value; TurquoiseTexture = ModContent.Request("CalamityMod/NPCs/SunkenSea/PolypPanaseaTurquoise", AssetRequestMode.ImmediateLoad).Value; - TextureCoated = ModContent.Request("CalamityMod/NPCs/SunkenSea/PolypPanaseaCoated", AssetRequestMode.ImmediateLoad).Value; - DeluxTextureCoated = ModContent.Request("CalamityMod/NPCs/SunkenSea/PolypPanaseaDeluxCoated", AssetRequestMode.ImmediateLoad).Value; + TextureCoated = ModContent.Request("CalamityMod/NPCs/SunkenSea/PolypPanaseaRedCoated", AssetRequestMode.ImmediateLoad).Value; + DeluxeTextureCoated = ModContent.Request("CalamityMod/NPCs/SunkenSea/PolypPanaseaDeluxeCoated", AssetRequestMode.ImmediateLoad).Value; RadiantTextureCoated = ModContent.Request("CalamityMod/NPCs/SunkenSea/PolypPanaseaRadiantCoated", AssetRequestMode.ImmediateLoad).Value; GreenTextureCoated = ModContent.Request("CalamityMod/NPCs/SunkenSea/PolypPanaseaGreenCoated", AssetRequestMode.ImmediateLoad).Value; PurpleTextureCoated = ModContent.Request("CalamityMod/NPCs/SunkenSea/PolypPanaseaPurpleCoated", AssetRequestMode.ImmediateLoad).Value; @@ -78,7 +77,7 @@ namespace CalamityMod.NPCs.SunkenSea //Banner = NPC.type; //BannerItem = ModContent.ItemType(); NPC.chaseable = false; - //NPC.catchItem = (short)ModContent.ItemType(); + NPC.catchItem = (short)ModContent.ItemType(); NPC.Calamity().VulnerableToHeat = false; NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToElectricity = true; @@ -88,6 +87,9 @@ namespace CalamityMod.NPCs.SunkenSea public override void OnSpawn(IEntitySource source) { + // If the player places one, dont deal with this + if (NPC.ai[3] == 1) + return; // Randomize the color of the fish NPC.ai[1] = Main.rand.Next(0, 4); // 1 in 30 chance for a rare fish variant (rfv) @@ -98,7 +100,25 @@ namespace CalamityMod.NPCs.SunkenSea // 1 in 5 chance for a Panasea to be coated if (Main.rand.NextBool(5)) { - NPC.ai[2] = 121; + NPC.ai[2] = 61; + } + switch (NPC.ai[1]) + { + case (int)FishColor.Purple: + NPC.catchItem = ModContent.ItemType(); + break; + case (int)FishColor.Green: + NPC.catchItem = ModContent.ItemType(); + break; + case (int)FishColor.Turquoise: + NPC.catchItem = ModContent.ItemType(); + break; + case (int)FishColor.Radiant: + NPC.catchItem = ModContent.ItemType(); + break; + case (int)FishColor.Deluxe: + NPC.catchItem = ModContent.ItemType(); + break; } } @@ -112,12 +132,12 @@ namespace CalamityMod.NPCs.SunkenSea public override void AI() { - NPC.catchItem = NPC.ai[2] > 120 ? ItemID.FlaskofPoison : ModContent.ItemType(); CalamityAI.PassiveSwimmingAI(NPC, Mod, 3, 60f, 0.2f, 0.1f, 4f, 4f, 0.05f); NPC.direction = NPC.velocity.X > 0 ? 1 : -1; NPC.spriteDirection = (NPC.direction > 0) ? 1 : -1; NPC.noGravity = true; - if (NPC.ai[2] <= 120 && NPC.ai[2] > 0) + // Assure it cant be caught hen collecting panacea + if (NPC.ai[2] <= 60 && NPC.ai[2] > 0) { NPC.ai[2]--; } @@ -162,23 +182,23 @@ namespace CalamityMod.NPCs.SunkenSea Texture2D texture = TextureAssets.Npc[NPC.type].Value; switch (Variant) { - case (int)FishColor.Blue: - texture = NPC.ai[2] >= 121 ? DeluxTextureCoated : DeluxTexture; + case (int)FishColor.Deluxe: + texture = NPC.ai[2] >= 61 ? DeluxeTextureCoated : DeluxeTexture; break; case (int)FishColor.Radiant: - texture = NPC.ai[2] >= 121 ? RadiantTextureCoated : RadiantTexture; + texture = NPC.ai[2] >= 61 ? RadiantTextureCoated : RadiantTexture; break; case (int)FishColor.Purple: - texture = NPC.ai[2] >= 121 ? PurpleTextureCoated : PurpleTexture; + texture = NPC.ai[2] >= 61 ? PurpleTextureCoated : PurpleTexture; break; case (int)FishColor.Green: - texture = NPC.ai[2] >= 121 ? GreenTextureCoated : GreenTexture; + texture = NPC.ai[2] >= 61 ? GreenTextureCoated : GreenTexture; break; case (int)FishColor.Turquoise: - texture = NPC.ai[2] >= 121 ? TurquoiseTextureCoated : TurquoiseTexture; + texture = NPC.ai[2] >= 61 ? TurquoiseTextureCoated : TurquoiseTexture; break; case (int)FishColor.Red: - texture = NPC.ai[2] >= 121 ? TextureCoated : TextureAssets.Npc[NPC.type].Value; + texture = NPC.ai[2] >= 61 ? TextureCoated : TextureAssets.Npc[NPC.type].Value; break; } Vector2 origin = new Vector2((float)(texture.Width / 2), (float)(texture.Height / Main.npcFrameCount[NPC.type] / 2)); @@ -194,10 +214,10 @@ namespace CalamityMod.NPCs.SunkenSea { if (NPC.ai[2] > 0) { - if (NPC.ai[2] > 120) + if (NPC.ai[2] > 60) { - Item.NewItem(NPC.GetSource_CatchEntity(NPC), (int)NPC.Center.X, (int)NPC.Center.Y, 1, 1, NPC.catchItem); - NPC.ai[2] = 120; + Item.NewItem(NPC.GetSource_CatchEntity(NPC), (int)NPC.Center.X, (int)NPC.Center.Y, 1, 1, ItemID.FlaskofPoison); + NPC.ai[2] = 60; } return false; } diff --git a/NPCs/SunkenSea/PolypPanaseaCoated.png b/NPCs/SunkenSea/PolypPanaseaCoated.png deleted file mode 100644 index 3d4c9475f8..0000000000 Binary files a/NPCs/SunkenSea/PolypPanaseaCoated.png and /dev/null differ diff --git a/NPCs/SunkenSea/PolypPanaseaDelux.png b/NPCs/SunkenSea/PolypPanaseaDeluxe.png similarity index 100% rename from NPCs/SunkenSea/PolypPanaseaDelux.png rename to NPCs/SunkenSea/PolypPanaseaDeluxe.png diff --git a/NPCs/SunkenSea/PolypPanaseaDeluxCoated.png b/NPCs/SunkenSea/PolypPanaseaDeluxeCoated.png similarity index 100% rename from NPCs/SunkenSea/PolypPanaseaDeluxCoated.png rename to NPCs/SunkenSea/PolypPanaseaDeluxeCoated.png diff --git a/NPCs/SunkenSea/PolypPanaseaGreenCoated.png b/NPCs/SunkenSea/PolypPanaseaGreenCoated.png index 6d9f423150..1f46bf5148 100644 Binary files a/NPCs/SunkenSea/PolypPanaseaGreenCoated.png and b/NPCs/SunkenSea/PolypPanaseaGreenCoated.png differ diff --git a/NPCs/SunkenSea/PolypPanaseaPurpleCoated.png b/NPCs/SunkenSea/PolypPanaseaPurpleCoated.png index 1f46bf5148..6d9f423150 100644 Binary files a/NPCs/SunkenSea/PolypPanaseaPurpleCoated.png and b/NPCs/SunkenSea/PolypPanaseaPurpleCoated.png differ diff --git a/NPCs/SunkenSea/PolypPanaseaRedCoated.png b/NPCs/SunkenSea/PolypPanaseaRedCoated.png new file mode 100644 index 0000000000..bfbf7ba316 Binary files /dev/null and b/NPCs/SunkenSea/PolypPanaseaRedCoated.png differ diff --git a/NPCs/SunkenSea/PolypPanaseaTurquoiseCoated.png b/NPCs/SunkenSea/PolypPanaseaTurquoiseCoated.png index bfbf7ba316..3d4c9475f8 100644 Binary files a/NPCs/SunkenSea/PolypPanaseaTurquoiseCoated.png and b/NPCs/SunkenSea/PolypPanaseaTurquoiseCoated.png differ