Files
CalamityModPublic/NPCs/Ravager/RavagerLegLeft.cs
T

97 lines
3.1 KiB
C#

using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Buffs.StatDebuffs;
using CalamityMod.Events;
using CalamityMod.World;
using Microsoft.Xna.Framework;
using System;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.NPCs.Ravager
{
public class RavagerLegLeft : ModNPC
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Ravager");
}
public override void SetDefaults()
{
npc.aiStyle = -1;
npc.damage = 0;
npc.width = 60;
npc.height = 60;
npc.defense = 40;
npc.DR_NERD(0.15f);
npc.lifeMax = 22010;
npc.knockBackResist = 0f;
aiType = -1;
npc.noGravity = true;
npc.canGhostHeal = false;
npc.noTileCollide = true;
npc.alpha = 255;
npc.HitSound = SoundID.NPCHit41;
npc.DeathSound = SoundID.NPCDeath14;
if (CalamityWorld.downedProvidence && !BossRushEvent.BossRushActive)
{
npc.defense *= 2;
npc.lifeMax *= 4;
}
if (BossRushEvent.BossRushActive)
{
npc.lifeMax = 40000;
}
double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01;
npc.lifeMax += (int)(npc.lifeMax * HPBoost);
npc.Calamity().VulnerableToSickness = false;
npc.Calamity().VulnerableToWater = true;
}
public override void AI()
{
if (CalamityGlobalNPC.scavenger < 0 || !Main.npc[CalamityGlobalNPC.scavenger].active)
{
npc.active = false;
npc.netUpdate = true;
return;
}
if (npc.timeLeft < 1800)
npc.timeLeft = 1800;
if (npc.alpha > 0)
{
npc.alpha -= 10;
if (npc.alpha < 0)
npc.alpha = 0;
npc.ai[1] = 0f;
}
npc.Center = Main.npc[CalamityGlobalNPC.scavenger].Center + new Vector2(-70f, 88f);
}
public override bool CheckActive() => false;
public override void HitEffect(int hitDirection, double damage)
{
for (int k = 0; k < 3; k++)
{
Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f);
Dust.NewDust(npc.position, npc.width, npc.height, DustID.Fire, hitDirection, -1f, 0, default, 1f);
}
if (npc.life <= 0)
{
Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScavengerGores/ScavengerLegLeft"), 1f);
Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScavengerGores/ScavengerLegLeft2"), 1f);
for (int k = 0; k < 20; k++)
{
Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f);
Dust.NewDust(npc.position, npc.width, npc.height, DustID.Fire, hitDirection, -1f, 0, default, 1f);
}
}
}
}
}