using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.NPCs.NormalNPCs { public class BlightedEye : ModNPC { public override void SetStaticDefaults() { DisplayName.SetDefault("Blighted Eye"); Main.npcFrameCount[npc.type] = 2; } public override void SetDefaults() { npc.aiStyle = 2; aiType = NPCID.TheHungryII; npc.damage = 32; npc.width = 30; npc.height = 32; npc.defense = 8; npc.lifeMax = 120; npc.knockBackResist = 0.6f; animationType = NPCID.DemonEye; npc.value = Item.buyPrice(0, 0, 2, 0); npc.HitSound = SoundID.NPCHit1; npc.DeathSound = SoundID.NPCDeath1; banner = npc.type; bannerItem = ModContent.ItemType(); npc.Calamity().VulnerableToHeat = true; npc.Calamity().VulnerableToCold = true; npc.Calamity().VulnerableToSickness = true; } public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) { Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { for (int k = 0; k < 20; k++) { Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } } } public override float SpawnChance(NPCSpawnInfo spawnInfo) { if (spawnInfo.playerSafe || !Main.hardMode || spawnInfo.player.Calamity().ZoneSulphur) { return 0f; } return SpawnCondition.OverworldNightMonster.Chance * 0.075f; } public override void OnHitPlayer(Player player, int damage, bool crit) { player.AddBuff(BuffID.Weak, 180, true); } public override void NPCLoot() { DropHelper.DropItemChance(npc, ModContent.ItemType(), 0.5f); } } }