Files
CalamityModPublic/NPCs/SlimeGod/CorruptSlimeSpawn.cs
T
mountaindrew10 f113254d00 1 - Slime God dust color adjustments.
2 - Slime Gods reduce their X velocity dramatically upon teleporting to avoid cheap hits.
2022-07-24 03:33:48 -05:00

85 lines
3.1 KiB
C#

using CalamityMod.Events;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.GameContent.Bestiary;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.NPCs.SlimeGod
{
public class CorruptSlimeSpawn : ModNPC
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Corrupt Slime Spawn");
Main.npcFrameCount[NPC.type] = 4;
NPCID.Sets.BossBestiaryPriority.Add(Type);
}
public override void SetDefaults()
{
NPC.aiStyle = 14;
NPC.GetNPCDamage();
NPC.width = 40;
NPC.height = 30;
NPC.defense = 6;
NPC.lifeMax = 180;
if (BossRushEvent.BossRushActive)
{
NPC.lifeMax = 10000;
}
NPC.knockBackResist = 0f;
AnimationType = 121;
NPC.Opacity = 0.8f;
NPC.lavaImmune = false;
NPC.noGravity = false;
NPC.noTileCollide = false;
NPC.canGhostHeal = false;
NPC.HitSound = SoundID.NPCHit1;
NPC.DeathSound = SoundID.NPCDeath1;
NPC.Calamity().VulnerableToHeat = true;
NPC.Calamity().VulnerableToSickness = false;
}
public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry)
{
int associatedNPCType = ModContent.NPCType<SplitEbonianSlimeGod>();
bestiaryEntry.UIInfoProvider = new CommonEnemyUICollectionInfoProvider(ContentSamples.NpcBestiaryCreditIdsByNpcNetIds[associatedNPCType], quickUnlock: true);
bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] {
BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.TheCorruption,
BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.TheCrimson,
// Will move to localization whenever that is cleaned up.
new FlavorTextBestiaryInfoElement("They rapidly flap their wings, created from membranes of gel and spines of hardened slime. They will incessantly hunt you down.")
});
}
public override void HitEffect(int hitDirection, double damage)
{
if (Main.netMode != NetmodeID.MultiplayerClient && NPC.life <= 0)
{
Vector2 spawnAt = NPC.Center + new Vector2(0f, (float)NPC.height / 2f);
NPC.NewNPC(NPC.GetSource_Loot(), (int)spawnAt.X, (int)spawnAt.Y, ModContent.NPCType<CorruptSlimeSpawn2>());
}
Color dustColor = Color.Lavender;
dustColor.A = 150;
for (int k = 0; k < 5; k++)
{
Dust.NewDust(NPC.position, NPC.width, NPC.height, 4, hitDirection, -1f, NPC.alpha, dustColor, 1f);
}
}
public override void OnHitPlayer(Player player, int damage, bool crit)
{
player.AddBuff(BuffID.Weak, 90, true);
}
public override Color? GetAlpha(Color drawColor)
{
return new Color(255, 255, 255, drawColor.A) * NPC.Opacity;
}
}
}