111 lines
4.2 KiB
C#
111 lines
4.2 KiB
C#
using CalamityMod.BiomeManagers;
|
|
using CalamityMod.Buffs.DamageOverTime;
|
|
using CalamityMod.Items.Materials;
|
|
using CalamityMod.Items.Placeables.Banners;
|
|
using Microsoft.Xna.Framework;
|
|
using Terraria;
|
|
using Terraria.GameContent.Bestiary;
|
|
using Terraria.GameContent.ItemDropRules;
|
|
using Terraria.ID;
|
|
using Terraria.ModLoader;
|
|
namespace CalamityMod.NPCs.Crags
|
|
{
|
|
public class CalamityEye : ModNPC
|
|
{
|
|
public override void SetStaticDefaults()
|
|
{
|
|
Main.npcFrameCount[NPC.type] = 4;
|
|
NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0);
|
|
value.Position.Y -= 10f;
|
|
value.PortraitPositionYOverride = -36f;
|
|
NPCID.Sets.NPCBestiaryDrawOffset[Type] = value;
|
|
}
|
|
|
|
public override void SetDefaults()
|
|
{
|
|
NPC.lavaImmune = true;
|
|
NPC.aiStyle = NPCAIStyleID.DemonEye;
|
|
NPC.damage = 40;
|
|
NPC.width = 30;
|
|
NPC.height = 30;
|
|
NPC.defense = 12;
|
|
NPC.lifeMax = 140;
|
|
NPC.knockBackResist = 0f;
|
|
AnimationType = NPCID.DemonEye;
|
|
NPC.value = Item.buyPrice(0, 0, 5, 0);
|
|
NPC.HitSound = SoundID.NPCHit1;
|
|
NPC.DeathSound = SoundID.NPCDeath1;
|
|
if (DownedBossSystem.downedProvidence)
|
|
{
|
|
NPC.damage = 80;
|
|
NPC.defense = 20;
|
|
NPC.lifeMax = 3000;
|
|
}
|
|
Banner = NPC.type;
|
|
BannerItem = ModContent.ItemType<CalamityEyeBanner>();
|
|
NPC.Calamity().VulnerableToHeat = false;
|
|
NPC.Calamity().VulnerableToCold = true;
|
|
NPC.Calamity().VulnerableToWater = true;
|
|
SpawnModBiomes = new int[1] { ModContent.GetInstance<BrimstoneCragsBiome>().Type };
|
|
}
|
|
|
|
public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry)
|
|
{
|
|
bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[]
|
|
{
|
|
new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.CalamityEye")
|
|
});
|
|
}
|
|
|
|
public override void AI()
|
|
{
|
|
if (Main.rand.NextBool(40))
|
|
{
|
|
int index = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y + NPC.height * 0.25f), NPC.width, (int)(NPC.height * 0.5), DustID.Blood, NPC.velocity.X, 2f, 0, new Color(), 1f);
|
|
Main.dust[index].velocity.X *= 0.5f;
|
|
Main.dust[index].velocity.Y *= 0.1f;
|
|
}
|
|
}
|
|
|
|
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 < 20; k++)
|
|
{
|
|
Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f);
|
|
}
|
|
if (Main.netMode != NetmodeID.Server)
|
|
{
|
|
Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find<ModGore>("CalamityEye").Type, 1f);
|
|
Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find<ModGore>("CalamityEye2").Type, 1f);
|
|
}
|
|
}
|
|
}
|
|
|
|
public override float SpawnChance(NPCSpawnInfo spawnInfo)
|
|
{
|
|
return spawnInfo.Player.Calamity().ZoneCalamity ? 0.25f : 0f;
|
|
}
|
|
|
|
public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo)
|
|
{
|
|
if (hurtInfo.Damage > 0)
|
|
target.AddBuff(ModContent.BuffType<BrimstoneFlames>(), 120, true);
|
|
}
|
|
|
|
public override void ModifyNPCLoot(NPCLoot npcLoot)
|
|
{
|
|
npcLoot.Add(ItemID.Lens, 2);
|
|
LeadingConditionRule hardmode = npcLoot.DefineConditionalDropSet(DropHelper.Hardmode());
|
|
LeadingConditionRule postProv = npcLoot.DefineConditionalDropSet(DropHelper.PostProv());
|
|
hardmode.Add(ModContent.ItemType<EssenceofHavoc>(), 2);
|
|
postProv.Add(ModContent.ItemType<Bloodstone>(), 4);
|
|
}
|
|
}
|
|
}
|