This is called in GlobalNPC SetDefaults. Added a few comments explaining some stuff. Created a list for confusion weak enemies so they are also initialized in GlobalNPC SetDefaults.
134 lines
4.3 KiB
C#
134 lines
4.3 KiB
C#
using CalamityMod.Buffs.DamageOverTime;
|
|
using CalamityMod.Buffs.StatDebuffs;
|
|
using CalamityMod.Events;
|
|
using CalamityMod.World;
|
|
using Microsoft.Xna.Framework;
|
|
using Microsoft.Xna.Framework.Graphics;
|
|
using Terraria;
|
|
using Terraria.ID;
|
|
using Terraria.ModLoader;
|
|
namespace CalamityMod.NPCs.Perforator
|
|
{
|
|
public class PerforatorTailSmall : ModNPC
|
|
{
|
|
public override void SetStaticDefaults()
|
|
{
|
|
DisplayName.SetDefault("The Perforator");
|
|
}
|
|
|
|
public override void SetDefaults()
|
|
{
|
|
npc.GetNPCDamage();
|
|
npc.npcSlots = 5f;
|
|
npc.width = 40;
|
|
npc.height = 34;
|
|
npc.defense = 8;
|
|
npc.LifeMaxNERB(1250, 1500, 500000);
|
|
double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01;
|
|
npc.lifeMax += (int)(npc.lifeMax * HPBoost);
|
|
npc.aiStyle = 6;
|
|
aiType = -1;
|
|
npc.knockBackResist = 0f;
|
|
npc.scale = 0.9f;
|
|
npc.alpha = 255;
|
|
npc.behindTiles = true;
|
|
npc.noGravity = true;
|
|
npc.noTileCollide = true;
|
|
npc.canGhostHeal = false;
|
|
npc.HitSound = SoundID.NPCHit1;
|
|
npc.DeathSound = SoundID.NPCDeath1;
|
|
npc.netAlways = true;
|
|
npc.dontCountMe = true;
|
|
|
|
if (CalamityWorld.death || BossRushEvent.BossRushActive)
|
|
npc.scale = 1.25f;
|
|
else if (CalamityWorld.revenge)
|
|
npc.scale = 1.15f;
|
|
else if (Main.expertMode)
|
|
npc.scale = 1.1f;
|
|
}
|
|
|
|
public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
public override void AI()
|
|
{
|
|
if (!Main.npc[(int)npc.ai[1]].active)
|
|
{
|
|
npc.life = 0;
|
|
npc.HitEffect(0, 10.0);
|
|
npc.active = false;
|
|
}
|
|
if (Main.npc[(int)npc.ai[1]].alpha < 128)
|
|
{
|
|
npc.alpha -= 42;
|
|
if (npc.alpha < 0)
|
|
{
|
|
npc.alpha = 0;
|
|
}
|
|
}
|
|
}
|
|
|
|
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
|
|
{
|
|
SpriteEffects spriteEffects = SpriteEffects.None;
|
|
if (npc.spriteDirection == 1)
|
|
spriteEffects = SpriteEffects.FlipHorizontally;
|
|
|
|
Texture2D texture2D15 = Main.npcTexture[npc.type];
|
|
Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / 2));
|
|
|
|
Vector2 vector43 = npc.Center - Main.screenPosition;
|
|
vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * npc.scale / 2f;
|
|
vector43 += vector11 * npc.scale + new Vector2(0f, 4f + npc.gfxOffY);
|
|
spriteBatch.Draw(texture2D15, vector43, npc.frame, npc.GetAlpha(lightColor), npc.rotation, vector11, npc.scale, spriteEffects, 0f);
|
|
|
|
texture2D15 = ModContent.GetTexture("CalamityMod/NPCs/Perforator/PerforatorTailSmallGlow");
|
|
Color color37 = Color.Lerp(Color.White, Color.Yellow, 0.5f);
|
|
|
|
spriteBatch.Draw(texture2D15, vector43, npc.frame, color37, npc.rotation, vector11, npc.scale, spriteEffects, 0f);
|
|
|
|
return false;
|
|
}
|
|
|
|
public override void HitEffect(int hitDirection, double damage)
|
|
{
|
|
for (int k = 0; k < 5; k++)
|
|
{
|
|
Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f);
|
|
}
|
|
if (npc.life <= 0)
|
|
{
|
|
for (int k = 0; k < 5; k++)
|
|
{
|
|
Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f);
|
|
}
|
|
Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SmallPerf3"), 1f);
|
|
}
|
|
}
|
|
|
|
public override bool CheckActive()
|
|
{
|
|
return false;
|
|
}
|
|
|
|
public override bool PreNPCLoot()
|
|
{
|
|
return false;
|
|
}
|
|
|
|
public override void ScaleExpertStats(int numPlayers, float bossLifeScale)
|
|
{
|
|
npc.lifeMax = (int)(npc.lifeMax * 0.85f * bossLifeScale);
|
|
}
|
|
|
|
public override void OnHitPlayer(Player player, int damage, bool crit)
|
|
{
|
|
player.AddBuff(ModContent.BuffType<BurningBlood>(), 60, true);
|
|
player.AddBuff(BuffID.Bleeding, 60, true);
|
|
}
|
|
}
|
|
}
|