Files
CalamityModPublic/NPCs/SlimeGod/CorruptSlimeSpawn2.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

81 lines
2.6 KiB
C#

using CalamityMod.Events;
using CalamityMod.World;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.NPCs.SlimeGod
{
public class CorruptSlimeSpawn2 : ModNPC
{
public override void SetStaticDefaults()
{
this.HideFromBestiary();
DisplayName.SetDefault("Corrupt Slime Spawn");
Main.npcFrameCount[NPC.type] = 2;
}
public override void SetDefaults()
{
NPC.aiStyle = 1;
NPC.GetNPCDamage();
NPC.width = 40;
NPC.height = 30;
NPC.defense = 4;
NPC.lifeMax = 90;
if (BossRushEvent.BossRushActive)
{
NPC.lifeMax = 5000;
}
NPC.knockBackResist = 0f;
AnimationType = NPCID.CorruptSlime;
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 HitEffect(int hitDirection, double damage)
{
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);
}
if (NPC.life <= 0)
{
for (int k = 0; k < 20; k++)
{
Dust.NewDust(NPC.position, NPC.width, NPC.height, 4, hitDirection, -1f, NPC.alpha, dustColor, 1f);
}
}
}
public override void OnKill()
{
int closestPlayer = Player.FindClosest(NPC.Center, 1, 1);
if (Main.rand.NextBool(8) && Main.player[closestPlayer].statLife < Main.player[closestPlayer].statLifeMax2)
Item.NewItem(NPC.GetSource_Loot(), (int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart);
}
public override void ModifyNPCLoot(NPCLoot npcLoot) => npcLoot.Add(ItemID.Vitamins, 50);
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;
}
}
}