Files
CalamityModPublic/NPCs/NormalNPCs/AeroSlime.cs
T
ben-tk b745894036 Almost all debuff immunities/vulnerabilities are now centralized in NPCStats.cs
This is called in GlobalNPC SetDefaults.
Added a few comments explaining some stuff.
Created a list for confusion weak enemies so they are also initialized in GlobalNPC SetDefaults.
2020-12-14 22:44:26 -05:00

69 lines
2.1 KiB
C#

using CalamityMod.Items.Placeables.Banners;
using CalamityMod.Items.Placeables.Ores;
using CalamityMod.World;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.NPCs.NormalNPCs
{
public class AeroSlime : ModNPC
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Aero Slime");
Main.npcFrameCount[npc.type] = 4;
}
public override void SetDefaults()
{
npc.aiStyle = 14;
npc.damage = 18;
npc.width = 40;
npc.height = 30;
npc.defense = 6;
npc.lifeMax = 50;
npc.knockBackResist = 0f;
animationType = NPCID.Slimer;
npc.value = Item.buyPrice(0, 0, 1, 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<AeroSlimeBanner>();
}
public override float SpawnChance(NPCSpawnInfo spawnInfo)
{
if (spawnInfo.playerSafe || (!CalamityWorld.downedHiveMind && !CalamityWorld.downedPerforator) || spawnInfo.player.Calamity().ZoneAbyss ||
spawnInfo.player.Calamity().ZoneSunkenSea)
{
return 0f;
}
return SpawnCondition.Cavern.Chance * 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, 59, hitDirection, -1f, 0, default, 1f);
}
if (npc.life <= 0)
{
for (int k = 0; k < 20; k++)
{
Dust.NewDust(npc.position, npc.width, npc.height, 59, hitDirection, -1f, 0, default, 1f);
}
}
}
public override void NPCLoot()
{
DropHelper.DropItem(npc, ModContent.ItemType<AerialiteOre>(), 10, 26);
}
}
}