Files
CalamityModPublic/NPCs/AcidRain/IrradiatedSlime.cs
T
2019-11-09 21:57:22 -05:00

81 lines
2.6 KiB
C#

using CalamityMod.Items.Accessories;
using CalamityMod.Items.Placeables.Banners;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.NPCs.AcidRain
{
public class IrradiatedSlime : ModNPC
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Irradiated Slime");
Main.npcFrameCount[npc.type] = 2;
}
public override void SetDefaults()
{
npc.aiStyle = 1;
npc.damage = 50;
npc.width = 40;
npc.height = 30;
npc.defense = 10;
npc.lifeMax = 300;
npc.knockBackResist = 0f;
animationType = 81;
for (int k = 0; k < npc.buffImmune.Length; k++)
{
npc.buffImmune[k] = true;
}
npc.value = Item.buyPrice(0, 0, 5, 0);
npc.alpha = 50;
npc.lavaImmune = false;
npc.noGravity = false;
npc.noTileCollide = false;
npc.HitSound = SoundID.NPCHit1;
npc.DeathSound = SoundID.NPCDeath1;
banner = npc.type;
bannerItem = ModContent.ItemType<IrradiatedSlimeBanner>();
}
public override void AI()
{
Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.6f, 0.8f, 0.6f);
}
public override float SpawnChance(NPCSpawnInfo spawnInfo)
{
if (spawnInfo.playerSafe || !spawnInfo.player.Calamity().ZoneSulphur || !Main.raining)
{
return 0f;
}
return 0.05f;
}
public override void HitEffect(int hitDirection, double damage)
{
for (int k = 0; k < 5; k++)
{
Dust.NewDust(npc.position, npc.width, npc.height, 75, hitDirection, -1f, 0, default, 1f);
}
if (npc.life <= 0)
{
for (int k = 0; k < 20; k++)
{
Dust.NewDust(npc.position, npc.width, npc.height, 75, hitDirection, -1f, 0, default, 1f);
}
Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/IrradiatedSlime"), 1f);
Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/IrradiatedSlime2"), 1f);
}
}
public override void NPCLoot()
{
if (Main.rand.NextBool(10))
{
Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType<LeadCore>());
}
}
}
}