added Shroomble 🍄

This commit is contained in:
GinYuH authored and Cameron Ewell committed 2024-09-18 15:37:53 -04:00
1 parent 027b49d25c
commit 655e73c8ab
14 files changed
+256 -17

No files matched your search

Binary file not shown.

After

Width:  |  Height:  |  Size: 450 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 235 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 279 B

+34
View File
@@ -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<Shroomble>();
Item.value = Item.sellPrice(silver: 1);
Item.rare = ItemRarityID.White;
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 301 B

@@ -0,0 +1,7 @@
namespace CalamityMod.Items.Placeables.Banners
{
public class ShroombleBanner : BaseBanner
{
public override int BannerTileStyle => 51;
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 359 B

@@ -143,6 +143,11 @@ SeaMinnowGoldItem: {
Tooltip: ""
}
ShroombleItem: {
DisplayName: "{$Mods.CalamityMod.NPCs.Shroomble.DisplayName}"
Tooltip: ""
}
TwinklerItem: {
DisplayName: "{$Mods.CalamityMod.NPCs.Twinkler.DisplayName}"
Tooltip: ""
@@ -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
+192
View File
@@ -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<ShroombleBanner>();
NPC.catchItem = (short)ModContent.ItemType<ShroombleItem>();
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<ModGore>("Shroomble").Type);
Gore.NewGore(NPC.GetSource_Death(), NPC.Center, NPC.velocity, Mod.Find<ModGore>("Shroomble2").Type);
Gore.NewGore(NPC.GetSource_Death(), NPC.Center, NPC.velocity, Mod.Find<ModGore>("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;
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 798 B

+14 -14
View File
@@ -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);
/// <summary>
/// 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);
}
/// <summary>
@@ -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);
}
/// <summary>
@@ -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);
}
/// <summary>
@@ -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);
}
/// <summary>
+3 -3
View File
@@ -222,9 +222,9 @@ namespace CalamityMod.Tiles
case 50:
npc = NPCType<ProfanedEnergyBody>();
break;
/*case 51:
npc = NPCType<Unused>(); - Formerly Wulfrum Slime
break*/
case 51:
npc = NPCType<Shroomble>();
break;
case 52:
npc = NPCType<WulfrumDrone>();
break;
Binary file not shown.

Before

Width:  |  Height:  |  Size: 76 KiB

After

Width:  |  Height:  |  Size: 81 KiB