2 - New DoG, Slime God and Brimstone Monster sounds. 3 - Fixed Aquatic Scourge toxic cloud issues. 4 - Green Jellyfish can now spawn in prehm. 5 - Blue Jellyfish can now spawn in hardmode.
172 lines
6.3 KiB
C#
172 lines
6.3 KiB
C#
using CalamityMod.Buffs.DamageOverTime;
|
|
using CalamityMod.Buffs.StatDebuffs;
|
|
using CalamityMod.Projectiles.Boss;
|
|
using CalamityMod.World;
|
|
using Microsoft.Xna.Framework;
|
|
using Microsoft.Xna.Framework.Graphics;
|
|
using System;
|
|
using Terraria;
|
|
using Terraria.ID;
|
|
using Terraria.ModLoader;
|
|
namespace CalamityMod.NPCs.Perforator
|
|
{
|
|
public class PerforatorBodySmall : ModNPC
|
|
{
|
|
public override void SetStaticDefaults()
|
|
{
|
|
DisplayName.SetDefault("The Perforator");
|
|
}
|
|
|
|
public override void SetDefaults()
|
|
{
|
|
npc.damage = 18;
|
|
npc.npcSlots = 5f;
|
|
npc.width = 42;
|
|
npc.height = 42;
|
|
npc.defense = 4;
|
|
npc.LifeMaxNERB(1250, 1500, 500000);
|
|
double HPBoost = (double)CalamityConfig.Instance.BossHealthBoost * 0.01;
|
|
npc.lifeMax += (int)((double)npc.lifeMax * HPBoost);
|
|
npc.aiStyle = 6;
|
|
aiType = -1;
|
|
npc.knockBackResist = 0f;
|
|
npc.alpha = 255;
|
|
npc.buffImmune[ModContent.BuffType<TimeSlow>()] = false;
|
|
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;
|
|
}
|
|
|
|
public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
public override void AI()
|
|
{
|
|
// Target
|
|
if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active)
|
|
npc.TargetClosest(true);
|
|
|
|
Player player = Main.player[npc.target];
|
|
|
|
bool expertMode = Main.expertMode || CalamityWorld.bossRushActive;
|
|
bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive;
|
|
if (Main.netMode != NetmodeID.MultiplayerClient)
|
|
{
|
|
int shoot = revenge ? 5 : 4;
|
|
npc.localAI[0] += Main.rand.Next(shoot);
|
|
if (npc.localAI[0] >= Main.rand.Next(1200, 6000))
|
|
{
|
|
npc.localAI[0] = 0f;
|
|
npc.TargetClosest(true);
|
|
if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height))
|
|
{
|
|
float num941 = revenge ? 9f : 8f;
|
|
Vector2 vector104 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + (npc.height / 2));
|
|
float num942 = player.position.X + player.width * 0.5f - vector104.X;
|
|
float num943 = player.position.Y + player.height * 0.5f - vector104.Y;
|
|
float num944 = (float)Math.Sqrt(num942 * num942 + num943 * num943);
|
|
num944 = num941 / num944;
|
|
num942 *= num944;
|
|
num943 *= num944;
|
|
int num945 = expertMode ? 12 : 15;
|
|
int num946 = ModContent.ProjectileType<BloodClot>();
|
|
vector104.X += num942 * 5f;
|
|
vector104.Y += num943 * 5f;
|
|
if (Main.rand.NextBool(2))
|
|
{
|
|
int num947 = Projectile.NewProjectile(vector104.X, vector104.Y, num942, num943, num946, num945, 0f, Main.myPlayer, 0f, 0f);
|
|
Main.projectile[num947].timeLeft = 160;
|
|
}
|
|
npc.netUpdate = true;
|
|
}
|
|
}
|
|
}
|
|
if (player.dead)
|
|
{
|
|
npc.TargetClosest(false);
|
|
}
|
|
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/PerforatorBodySmallGlow");
|
|
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 bool CheckActive()
|
|
{
|
|
return false;
|
|
}
|
|
|
|
public override bool PreNPCLoot()
|
|
{
|
|
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/SmallPerf2"), 1f);
|
|
}
|
|
}
|
|
|
|
public override void ScaleExpertStats(int numPlayers, float bossLifeScale)
|
|
{
|
|
npc.lifeMax = (int)(npc.lifeMax * 0.7f * bossLifeScale);
|
|
npc.damage = (int)(npc.damage * 0.8f);
|
|
}
|
|
|
|
public override void OnHitPlayer(Player player, int damage, bool crit)
|
|
{
|
|
player.AddBuff(ModContent.BuffType<BurningBlood>(), 90, true);
|
|
player.AddBuff(BuffID.Bleeding, 90, true);
|
|
}
|
|
}
|
|
}
|