Files
CalamityModPublic/NPCs/NormalNPCs/PhantomSpirit.cs
T
2020-03-26 18:55:31 -04:00

89 lines
2.8 KiB
C#

using CalamityMod.Buffs.StatDebuffs;
using CalamityMod.Items.Materials;
using CalamityMod.Items.Placeables.Banners;
using CalamityMod.World;
using Microsoft.Xna.Framework;
using System;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.NPCs.NormalNPCs
{
public class PhantomSpirit : ModNPC
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Phantom Spirit");
Main.npcFrameCount[npc.type] = 3;
}
public override void SetDefaults()
{
npc.aiStyle = -1;
npc.damage = 70;
npc.width = 16;
npc.height = 16;
npc.defense = 10;
npc.lifeMax = 1000;
npc.knockBackResist = 0.1f;
animationType = 288;
aiType = -1;
npc.value = Item.buyPrice(0, 0, 20, 0);
npc.HitSound = SoundID.NPCHit36;
npc.DeathSound = SoundID.NPCDeath39;
npc.noGravity = true;
npc.noTileCollide = true;
banner = npc.type;
bannerItem = ModContent.ItemType<PhantomSpiritBanner>();
}
public override void AI()
{
float speed = CalamityWorld.death ? 22f : 17f;
CalamityAI.DungeonSpiritAI(npc, mod, speed, -MathHelper.PiOver2);
int num822 = Dust.NewDust(npc.position, npc.width, npc.height, 60, 0f, 0f, 0, default, 1f);
Dust dust = Main.dust[num822];
dust.velocity *= 0.1f;
dust.scale = 1.3f;
dust.noGravity = true;
}
public override void OnHitPlayer(Player player, int damage, bool crit)
{
if (CalamityWorld.revenge)
{
player.AddBuff(ModContent.BuffType<MarkedforDeath>(), 120);
}
}
public override void HitEffect(int hitDirection, double damage)
{
for (int k = 0; k < 5; k++)
{
Dust.NewDust(npc.position, npc.width, npc.height, 60, hitDirection, -1f, 0, default, 1f);
}
if (npc.life <= 0)
{
for (int num288 = 0; num288 < 50; num288++)
{
int num289 = Dust.NewDust(npc.position, npc.width, npc.height, 60, npc.velocity.X, npc.velocity.Y, 0, default, 1f);
Dust dust = Main.dust[num289];
dust.velocity *= 2f;
dust.noGravity = true;
dust.scale = 1.4f;
}
}
}
public override Color? GetAlpha(Color drawColor)
{
return new Color(200, 200, 200, 0);
}
public override void NPCLoot()
{
DropHelper.DropItem(npc, ModContent.ItemType<Phantoplasm>());
}
}
}