Files
CalamityModPublic/NPCs/NormalNPCs/PerennialSlime.cs
T
Andrew Marheine ba22da6cda 1 - Some 'minor' debuff changes.
2 - Added weakness and resistance system for debuffs. I'll explain it all later.
2021-12-13 15:06:59 -06:00

73 lines
2.3 KiB
C#

using CalamityMod.Items.Placeables.Banners;
using CalamityMod.Items.Placeables.Ores;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.NPCs.NormalNPCs
{
public class PerennialSlime : ModNPC
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Perennial Slime");
Main.npcFrameCount[npc.type] = 2;
}
public override void SetDefaults()
{
npc.aiStyle = 1;
aiType = NPCID.ToxicSludge;
npc.damage = 35;
npc.width = 40;
npc.height = 30;
npc.defense = 12;
npc.lifeMax = 150;
npc.knockBackResist = 0f;
animationType = NPCID.CorruptSlime;
npc.value = Item.buyPrice(0, 0, 10, 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<PerennialSlimeBanner>();
npc.Calamity().VulnerableToHeat = true;
npc.Calamity().VulnerableToSickness = false;
}
public override float SpawnChance(NPCSpawnInfo spawnInfo)
{
if (spawnInfo.playerSafe || !NPC.downedPlantBoss || spawnInfo.player.Calamity().ZoneAbyss ||
spawnInfo.player.Calamity().ZoneSunkenSea)
{
return 0f;
}
return SpawnCondition.Cavern.Chance * 0.08f;
}
public override void HitEffect(int hitDirection, double damage)
{
// TODO -- This dust was an invalid dust. Replaced with a random dust.
int dustType = 115;
for (int k = 0; k < 5; k++)
{
Dust.NewDust(npc.position, npc.width, npc.height, dustType, hitDirection, -1f, 0, default, 1f);
}
if (npc.life <= 0)
{
for (int k = 0; k < 20; k++)
{
Dust.NewDust(npc.position, npc.width, npc.height, dustType, hitDirection, -1f, 0, default, 1f);
}
}
}
public override void NPCLoot()
{
DropHelper.DropItem(npc, ModContent.ItemType<PerennialOre>(), 10, 26);
}
}
}