Files
CalamityModPublic/NPCs/NormalNPCs/CrimulanBlightSlime.cs
T
Mortis3 4a856851d1 Localization stuffs
localized (hopefully) every npc in calamity that needs it
2023-07-20 10:11:57 -04:00

87 lines
2.8 KiB
C#

using CalamityMod.Items.Materials;
using CalamityMod.Items.Placeables.Banners;
using Terraria;
using Terraria.GameContent.Bestiary;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.ModLoader.Utilities;
namespace CalamityMod.NPCs.NormalNPCs
{
public class CrimulanBlightSlime : ModNPC
{
public override void SetStaticDefaults()
{
Main.npcFrameCount[NPC.type] = 4;
}
public override void SetDefaults()
{
NPC.aiStyle = NPCAIStyleID.Slime;
AIType = NPCID.DungeonSlime;
NPC.damage = 30;
NPC.width = 60;
NPC.height = 42;
NPC.defense = 8;
NPC.lifeMax = 130;
NPC.knockBackResist = 0.3f;
AnimationType = NPCID.RainbowSlime;
NPC.value = Item.buyPrice(0, 0, 2, 0);
NPC.alpha = 105;
NPC.lavaImmune = false;
NPC.noGravity = false;
NPC.noTileCollide = false;
NPC.HitSound = SoundID.NPCHit1;
NPC.DeathSound = SoundID.NPCDeath1;
Banner = NPC.type;
BannerItem = ModContent.ItemType<CrimulanBlightSlimeBanner>();
NPC.Calamity().VulnerableToHeat = true;
NPC.Calamity().VulnerableToSickness = false;
}
public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry)
{
bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[]
{
BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.TheCrimson,
new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.BlightSlime")
});
}
public override float SpawnChance(NPCSpawnInfo spawnInfo)
{
if (spawnInfo.PlayerSafe || spawnInfo.Player.Calamity().ZoneAbyss)
{
return 0f;
}
return SpawnCondition.Crimson.Chance * 0.15f;
}
public override void HitEffect(NPC.HitInfo hit)
{
for (int k = 0; k < 5; k++)
{
Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f);
}
if (NPC.life <= 0)
{
for (int k = 0; k < 40; k++)
{
Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f);
}
}
}
public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo)
{
if (hurtInfo.Damage > 0)
target.AddBuff(BuffID.Darkness, 240, true);
}
public override void ModifyNPCLoot(NPCLoot npcLoot)
{
npcLoot.Add(ItemID.Gel, 1, 10, 14);
npcLoot.Add(ModContent.ItemType<BlightedGel>(), 1, 15, 21);
}
}
}