Files
CalamityModPublic/NPCs/NormalNPCs/BlightedEye.cs
T
DominicKarma42 55e89c9b98 Replaced (hopefully) every magic number with a constant
Note: Does not include item rarities, and appears to shown nonexistant using directive movement in the commit. This does not really affect anything, however.
2020-05-30 17:56:36 -04:00

72 lines
2.2 KiB
C#

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 = 116;
npc.damage = 32;
npc.width = 30;
npc.height = 32;
npc.defense = 8;
npc.lifeMax = 120;
npc.knockBackResist = 0.6f;
animationType = 2;
npc.value = Item.buyPrice(0, 0, 2, 0);
npc.HitSound = SoundID.NPCHit1;
npc.DeathSound = SoundID.NPCDeath1;
banner = npc.type;
bannerItem = ModContent.ItemType<BlightedEyeBanner>();
}
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 || !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, 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<BlightedLens>());
}
}
}
}