using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.NPCs.NormalNPCs { public class CalamityEye : ModNPC { public override void SetStaticDefaults() { DisplayName.SetDefault("Calamity Eye"); Main.npcFrameCount[npc.type] = 2; } public override void SetDefaults() { npc.lavaImmune = true; npc.aiStyle = 2; npc.damage = 40; npc.width = 30; npc.height = 32; npc.defense = 12; npc.lifeMax = 140; npc.knockBackResist = 0f; animationType = 2; npc.value = Item.buyPrice(0, 0, 5, 0); npc.HitSound = SoundID.NPCHit1; npc.DeathSound = SoundID.NPCDeath1; banner = npc.type; bannerItem = ModContent.ItemType(); } public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) { Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { for (int k = 0; k < 20; k++) { Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); } } } public override float SpawnChance(NPCSpawnInfo spawnInfo) { if (spawnInfo.playerSafe || !NPC.downedPlantBoss || spawnInfo.player.Calamity().ZoneSulphur) { return 0f; } return SpawnCondition.OverworldNightMonster.Chance * 0.045f; } public override void OnHitPlayer(Player player, int damage, bool crit) { player.AddBuff(BuffID.Weak, 120, true); player.AddBuff(ModContent.BuffType(), 120, true); } public override void NPCLoot() { if (Main.rand.NextBool(2)) { Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType()); } if (Main.rand.NextBool(2)) { Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Lens); } } } }