diff --git a/Gores/Shroomble/Shroomble.png b/Gores/Shroomble/Shroomble.png new file mode 100644 index 0000000000..5f5d8912ae Binary files /dev/null and b/Gores/Shroomble/Shroomble.png differ diff --git a/Gores/Shroomble/Shroomble2.png b/Gores/Shroomble/Shroomble2.png new file mode 100644 index 0000000000..783adc9f75 Binary files /dev/null and b/Gores/Shroomble/Shroomble2.png differ diff --git a/Gores/Shroomble/Shroomble3.png b/Gores/Shroomble/Shroomble3.png new file mode 100644 index 0000000000..7a0cb88f26 Binary files /dev/null and b/Gores/Shroomble/Shroomble3.png differ diff --git a/Items/Critters/ShroombleItem.cs b/Items/Critters/ShroombleItem.cs new file mode 100644 index 0000000000..e318ef142c --- /dev/null +++ b/Items/Critters/ShroombleItem.cs @@ -0,0 +1,34 @@ +using CalamityMod.NPCs.NormalNPCs; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Critters +{ + public class ShroombleItem : 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.makeNPC = (short)ModContent.NPCType(); + + Item.value = Item.sellPrice(silver: 1); + Item.rare = ItemRarityID.White; + } + } +} diff --git a/Items/Critters/ShroombleItem.png b/Items/Critters/ShroombleItem.png new file mode 100644 index 0000000000..67a5e736dc Binary files /dev/null and b/Items/Critters/ShroombleItem.png differ diff --git a/Items/Placeables/Banners/ShroombleBanner.cs b/Items/Placeables/Banners/ShroombleBanner.cs new file mode 100644 index 0000000000..5cd84c158d --- /dev/null +++ b/Items/Placeables/Banners/ShroombleBanner.cs @@ -0,0 +1,7 @@ +namespace CalamityMod.Items.Placeables.Banners +{ + public class ShroombleBanner : BaseBanner + { + public override int BannerTileStyle => 51; + } +} diff --git a/Items/Placeables/Banners/ShroombleBanner.png b/Items/Placeables/Banners/ShroombleBanner.png new file mode 100644 index 0000000000..dff34d0223 Binary files /dev/null and b/Items/Placeables/Banners/ShroombleBanner.png differ diff --git a/Localization/en-US/Mods.CalamityMod.Items.Misc.hjson b/Localization/en-US/Mods.CalamityMod.Items.Misc.hjson index 4917867a0e..b5b842c7a5 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Misc.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Misc.hjson @@ -143,6 +143,11 @@ SeaMinnowGoldItem: { Tooltip: "" } +ShroombleItem: { + DisplayName: "{$Mods.CalamityMod.NPCs.Shroomble.DisplayName}" + Tooltip: "" +} + TwinklerItem: { DisplayName: "{$Mods.CalamityMod.NPCs.Twinkler.DisplayName}" Tooltip: "" diff --git a/Localization/en-US/Mods.CalamityMod.NPCs.hjson b/Localization/en-US/Mods.CalamityMod.NPCs.hjson index 412d33de51..baf6053ade 100644 --- a/Localization/en-US/Mods.CalamityMod.NPCs.hjson +++ b/Localization/en-US/Mods.CalamityMod.NPCs.hjson @@ -186,6 +186,7 @@ Rotdog.DisplayName: Rotdog ScornEater.DisplayName: Scorn Eater SeaUrchin.DisplayName: Sea Urchin ShockstormShuttle.DisplayName: Shockstorm Shuttle +Shroomble.DisplayName: Shroomble SkeletronPrime2.DisplayName: Skeletron Prime Stormlion.DisplayName: Stormlion Sunskater.DisplayName: Sunskater diff --git a/NPCs/NormalNPCs/Shroomble.cs b/NPCs/NormalNPCs/Shroomble.cs new file mode 100644 index 0000000000..5de897f1ab --- /dev/null +++ b/NPCs/NormalNPCs/Shroomble.cs @@ -0,0 +1,192 @@ +using System; +using System.Numerics; +using CalamityMod.Items.Critters; +using CalamityMod.Items.Placeables.Banners; +using CalamityMod.Projectiles.Summon; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.GameContent.Bestiary; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ModLoader.Utilities; +namespace CalamityMod.NPCs.NormalNPCs +{ + public class Shroomble : ModNPC + { + public override void SetStaticDefaults() + { + Main.npcFrameCount[NPC.type] = 7; + Main.npcCatchable[NPC.type] = true; + NPCID.Sets.CountsAsCritter[NPC.type] = true; + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() + { + SpriteDirection = 1 + }; + NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + NPCID.Sets.CantTakeLunchMoney[Type] = true; + NPCID.Sets.NormalGoldCritterBestiaryPriority.Add(Type); + } + + public override void SetDefaults() + { + NPC.chaseable = false; + NPC.damage = 0; + NPC.width = 28; + NPC.height = 24; + NPC.lifeMax = 25; // This is how much Mushrooms heal with Calamity + NPC.aiStyle = NPCAIStyleID.Passive; + AIType = NPCID.Squirrel; + NPC.knockBackResist = 0.5f; + NPC.value = Item.buyPrice(0, 0, 1, 0); + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + Banner = NPC.type; + BannerItem = ModContent.ItemType(); + NPC.catchItem = (short)ModContent.ItemType(); + NPC.Calamity().VulnerableToHeat = true; + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToSickness = true; + } + + public override void AI() + { + for (int i = 0; i < Main.maxPlayers; i++) + { + Player player = Main.player[i]; + if (player is null || !player.active) + continue; + + if (NPC.Hitbox.Intersects(player.HitboxForBestiaryNearbyCheck)) + { + Main.BestiaryTracker.Kills.RegisterKill(NPC); + break; + } + } + bool walking = NPC.ai[0] == 1; + // Do a cute lil' hop randomly + int jumpChance = walking ? 600 : 100; + if (NPC.velocity.Y == 0 && Main.rand.NextBool(jumpChance) && NPC.ai[2] <= 0) + { + SoundEngine.PlaySound(HarvestStaffMinion.JumpSound, NPC.Center); + NPC.velocity.Y = Main.rand.NextFloat(-6, -4); + // Cooldown + NPC.ai[2] = walking ? 180 : 90; + // Ai[1] is time left for a NPCAIStyleID.Passive critter to cycle between standing still and walking + // Increment it here so that it doesn't suddenly start walking when doing it's baby hop + NPC.ai[1] += 60; + } + + // Randomly look around while standing still + if (!walking && Main.rand.NextBool(200) && NPC.velocity.Y == 0) + { + NPC.direction *= -1; + } + + // Decrement cooldown + if (NPC.ai[2] > 0) + { + NPC.ai[2]--; + } + // Don't idle for too long + if (NPC.ai[1] > 300) + { + NPC.ai[1] = 300; + } + } + + public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) + { + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + { + BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Times.DayTime, + BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Surface, + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Shroomble") + }); + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.Player.Calamity().ZoneSulphur || spawnInfo.Player.Calamity().ZoneSunkenSea) + { + return 0f; + } + return (Main.remixWorld ? SpawnCondition.Cavern.Chance : SpawnCondition.TownCritter.Chance) * 0.05f; + } + + public override void FindFrame(int frameHeight) + { + if (NPC.velocity.Y == 0f) + { + if (!NPC.IsABestiaryIconDummy) + { + if (NPC.direction == 1) + { + NPC.spriteDirection = -1; + } + if (NPC.direction == -1) + { + NPC.spriteDirection = 1; + } + + if (NPC.velocity.X == 0f) + { + NPC.frame.Y = frameHeight * 1; + NPC.frameCounter = 0.0; + return; + } + } + NPC.frameCounter += NPC.IsABestiaryIconDummy ? 0.6f : Math.Abs(NPC.velocity.X) * 0.5f; + NPC.frameCounter += 1.0; + if (NPC.frameCounter > 12.0) + { + NPC.frame.Y = NPC.frame.Y + frameHeight; + NPC.frameCounter = 0.0; + } + if (NPC.frame.Y / frameHeight >= Main.npcFrameCount[NPC.type] - 1) + { + NPC.frame.Y = frameHeight; + } + } + else + { + NPC.frameCounter = 0.0; + NPC.frame.Y = frameHeight * (Main.npcFrameCount[NPC.type] - 1); + } + } + + public override void ModifyNPCLoot(NPCLoot npcLoot) => npcLoot.Add(ItemID.Mushroom, 1, 1, 4); + + public override void HitEffect(NPC.HitInfo hit) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Pixie, hit.HitDirection * 0.5f, -0.5f, 0, default, 0.5f); + } + if (NPC.life <= 0) + { + for (int k = 0; k < 15; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Pixie, hit.HitDirection * 0.5f, -0.5f, 0, default, 0.5f); + } + if (Main.netMode != NetmodeID.Server) + { + Gore.NewGore(NPC.GetSource_Death(), NPC.Center, NPC.velocity, Mod.Find("Shroomble").Type); + Gore.NewGore(NPC.GetSource_Death(), NPC.Center, NPC.velocity, Mod.Find("Shroomble2").Type); + Gore.NewGore(NPC.GetSource_Death(), NPC.Center, NPC.velocity, Mod.Find("Shroomble3").Type); + } + } + } + + public override Color? GetAlpha(Color drawColor) + { + // Psychedelic in gfb + if (Main.zenithWorld) + { + Color lightColor = new Color(Main.DiscoR, Main.DiscoB, Main.DiscoG, drawColor.A); + return lightColor * NPC.Opacity; + } + else return null; + } + } +} diff --git a/NPCs/NormalNPCs/Shroomble.png b/NPCs/NormalNPCs/Shroomble.png new file mode 100644 index 0000000000..5388a66e89 Binary files /dev/null and b/NPCs/NormalNPCs/Shroomble.png differ diff --git a/Projectiles/Summon/HarvestStaffMinion.cs b/Projectiles/Summon/HarvestStaffMinion.cs index 15842a6816..56e20a6b8e 100644 --- a/Projectiles/Summon/HarvestStaffMinion.cs +++ b/Projectiles/Summon/HarvestStaffMinion.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Projectiles.Summon if (value == AIState.Attack) { Animation = AnimationState.Run; - SoundEngine.PlaySound(_screamSound, Projectile.Center); + SoundEngine.PlaySound(ScreamSound, Projectile.Center); } else if (value == AIState.Idle) Animation = AnimationState.Idle; @@ -154,19 +154,19 @@ namespace CalamityMod.Projectiles.Summon set => Projectile.spriteDirection = Projectile.direction = value; } - private SoundStyle _growSound = new("CalamityMod/Sounds/Custom/PumpkinEmerge", 3); + public static SoundStyle GrowSound = new("CalamityMod/Sounds/Custom/PumpkinEmerge", 3); - private SoundStyle _idleSound = new("CalamityMod/Sounds/Custom/PumpkinIdle", 4); + public static SoundStyle IdleSound = new("CalamityMod/Sounds/Custom/PumpkinIdle", 4); - private SoundStyle _idleRareSound = new("CalamityMod/Sounds/Custom/PumpkinRareIdle") { Volume = 0.2f }; + public static SoundStyle IdleRareSound = new("CalamityMod/Sounds/Custom/PumpkinRareIdle") { Volume = 0.2f }; - private SoundStyle _screamSound = new("CalamityMod/Sounds/Custom/PumpkinScream", 2) { Volume = 0.5f }; + public static SoundStyle ScreamSound = new("CalamityMod/Sounds/Custom/PumpkinScream", 2) { Volume = 0.5f }; - private SoundStyle _jumpSound = new("CalamityMod/Sounds/Custom/PumpkinJump"); + public static SoundStyle JumpSound = new("CalamityMod/Sounds/Custom/PumpkinJump"); - private SoundStyle _boomSound = new("CalamityMod/Sounds/Custom/PumpkinExplode", 2) { Volume = 0.6f }; + public static SoundStyle BoomSound = new("CalamityMod/Sounds/Custom/PumpkinExplode", 2) { Volume = 0.6f }; - private SoundStyle _boomSoundGFB = new("CalamityMod/Sounds/Custom/PumpkinExplodeGFB", 2); + public static SoundStyle BoomSoundGFB = new("CalamityMod/Sounds/Custom/PumpkinExplodeGFB", 2); /// /// The owner of this minion. @@ -325,9 +325,9 @@ namespace CalamityMod.Projectiles.Summon } if (Main.zenithWorld) - SoundEngine.PlaySound(_boomSoundGFB, Projectile.Center); + SoundEngine.PlaySound(BoomSoundGFB, Projectile.Center); else - SoundEngine.PlaySound(_boomSound, Projectile.Center); + SoundEngine.PlaySound(BoomSound, Projectile.Center); } /// @@ -340,7 +340,7 @@ namespace CalamityMod.Projectiles.Summon if ((Target is not null || (AnyPlayer is not null && Projectile.getRect().Intersects(AnyPlayer.getRect()))) && Animation == AnimationState.Grow && CompletedAnimation) { Animation = AnimationState.Rise; - SoundEngine.PlaySound(_growSound, Projectile.Center); + SoundEngine.PlaySound(GrowSound, Projectile.Center); } // And when they have completed their jumping out animation, they idle until they find a target. @@ -386,7 +386,7 @@ namespace CalamityMod.Projectiles.Summon Collision.StepUp(ref Projectile.position, ref Projectile.velocity, Projectile.width, Projectile.height, ref Projectile.stepSpeed, ref Projectile.gfxOffY); if (Main.rand.NextBool(700)) - SoundEngine.PlaySound(Main.rand.NextBool(20) ? _idleRareSound : _idleSound, Projectile.Center); + SoundEngine.PlaySound(Main.rand.NextBool(20) ? IdleRareSound : IdleSound, Projectile.Center); } /// @@ -436,7 +436,7 @@ namespace CalamityMod.Projectiles.Summon Direction = MathF.Sign(AnyPlayer.Center.X - Projectile.Center.X); Animation = AnimationState.Jump; - SoundEngine.PlaySound(_jumpSound with { Pitch = Utils.Remap(Variant, 0f, 2f, -0.3f, 0.3f) }, Projectile.Center); + SoundEngine.PlaySound(JumpSound with { Pitch = Utils.Remap(Variant, 0f, 2f, -0.3f, 0.3f) }, Projectile.Center); } /// @@ -465,7 +465,7 @@ namespace CalamityMod.Projectiles.Summon // And now we need to negate the velocity to get it on Terraria's coordinate system: v = -sqrt(-2 * gravity * distance). Projectile.velocity.Y = -MathF.Sqrt(-2f * PumpkinGravityStrength * (destination.Y - Projectile.Bottom.Y)); Animation = AnimationState.Jump; - SoundEngine.PlaySound(_jumpSound with { Pitch = Utils.Remap(Variant, 0f, 2f, -0.3f, 0.3f) }, Projectile.Center); + SoundEngine.PlaySound(JumpSound with { Pitch = Utils.Remap(Variant, 0f, 2f, -0.3f, 0.3f) }, Projectile.Center); } /// diff --git a/Tiles/MonsterBanner.cs b/Tiles/MonsterBanner.cs index 5534030c02..134f81524f 100644 --- a/Tiles/MonsterBanner.cs +++ b/Tiles/MonsterBanner.cs @@ -222,9 +222,9 @@ namespace CalamityMod.Tiles case 50: npc = NPCType(); break; - /*case 51: - npc = NPCType(); - Formerly Wulfrum Slime - break*/ + case 51: + npc = NPCType(); + break; case 52: npc = NPCType(); break; diff --git a/Tiles/MonsterBanner.png b/Tiles/MonsterBanner.png index ceacf605f2..f833b58f79 100644 Binary files a/Tiles/MonsterBanner.png and b/Tiles/MonsterBanner.png differ