170 lines
6.2 KiB
C#
170 lines
6.2 KiB
C#
using CalamityMod.Buffs.StatDebuffs;
|
|
using CalamityMod.Events;
|
|
using CalamityMod.World;
|
|
using Microsoft.Xna.Framework;
|
|
using Microsoft.Xna.Framework.Graphics;
|
|
using System.IO;
|
|
using Terraria;
|
|
using Terraria.GameContent;
|
|
using Terraria.ID;
|
|
using Terraria.Localization;
|
|
using Terraria.ModLoader;
|
|
|
|
namespace CalamityMod.NPCs.AquaticScourge
|
|
{
|
|
public class AquaticScourgeBodyAlt : ModNPC
|
|
{
|
|
public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.AquaticScourgeHead.DisplayName");
|
|
public override void SetStaticDefaults()
|
|
{
|
|
this.HideFromBestiary();
|
|
}
|
|
|
|
public override void SetDefaults()
|
|
{
|
|
NPC.GetNPCDamage();
|
|
NPC.width = 32;
|
|
NPC.height = 32;
|
|
NPC.defense = 15;
|
|
NPC.DR_NERD(0.1f);
|
|
NPC.aiStyle = -1;
|
|
AIType = -1;
|
|
NPC.knockBackResist = 0f;
|
|
NPC.alpha = 255;
|
|
NPC.LifeMaxNERB(80000, 96000, 1000000);
|
|
if (CalamityWorld.LegendaryMode && CalamityWorld.revenge)
|
|
NPC.lifeMax *= 2;
|
|
|
|
double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01;
|
|
NPC.lifeMax += (int)(NPC.lifeMax * HPBoost);
|
|
NPC.behindTiles = true;
|
|
NPC.noGravity = true;
|
|
NPC.noTileCollide = true;
|
|
NPC.HitSound = SoundID.NPCHit1;
|
|
NPC.DeathSound = SoundID.NPCDeath1;
|
|
NPC.netAlways = true;
|
|
NPC.dontCountMe = true;
|
|
NPC.chaseable = false;
|
|
NPC.canGhostHeal = false;
|
|
|
|
if (BossRushEvent.BossRushActive)
|
|
NPC.scale *= 1.25f;
|
|
else if (CalamityWorld.death)
|
|
NPC.scale *= 1.2f;
|
|
else if (CalamityWorld.revenge)
|
|
NPC.scale *= 1.15f;
|
|
else if (Main.expertMode)
|
|
NPC.scale *= 1.1f;
|
|
|
|
if (Main.getGoodWorld)
|
|
NPC.scale *= 1.25f;
|
|
|
|
NPC.Calamity().VulnerableToHeat = false;
|
|
NPC.Calamity().VulnerableToSickness = false;
|
|
NPC.Calamity().VulnerableToElectricity = true;
|
|
NPC.Calamity().VulnerableToWater = false;
|
|
}
|
|
|
|
public override void SendExtraAI(BinaryWriter writer)
|
|
{
|
|
writer.Write(NPC.chaseable);
|
|
for (int i = 0; i < 4; i++)
|
|
writer.Write(NPC.Calamity().newAI[i]);
|
|
}
|
|
|
|
public override void ReceiveExtraAI(BinaryReader reader)
|
|
{
|
|
NPC.chaseable = reader.ReadBoolean();
|
|
for (int i = 0; i < 4; i++)
|
|
NPC.Calamity().newAI[i] = reader.ReadSingle();
|
|
}
|
|
|
|
public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
public override void AI()
|
|
{
|
|
CalamityAI.AquaticScourgeAI(NPC, Mod, false);
|
|
}
|
|
|
|
public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor)
|
|
{
|
|
if (NPC.IsABestiaryIconDummy)
|
|
return true;
|
|
|
|
SpriteEffects spriteEffects = SpriteEffects.None;
|
|
if (NPC.spriteDirection == 1)
|
|
spriteEffects = SpriteEffects.FlipHorizontally;
|
|
|
|
Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value;
|
|
Vector2 vector11 = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / 2);
|
|
|
|
Vector2 vector43 = NPC.Center - screenPos;
|
|
vector43 -= new Vector2(texture2D15.Width, texture2D15.Height) * NPC.scale / 2f;
|
|
vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY);
|
|
Color color = NPC.GetAlpha(drawColor);
|
|
|
|
if (CalamityWorld.revenge || BossRushEvent.BossRushActive || Main.zenithWorld)
|
|
{
|
|
if (Main.npc[(int)NPC.ai[2]].Calamity().newAI[3] > 300f)
|
|
color = Color.Lerp(color, Color.SandyBrown, MathHelper.Clamp((Main.npc[(int)NPC.ai[2]].Calamity().newAI[3] - 300f) / 180f, 0f, 1f));
|
|
else if (Main.npc[(int)NPC.ai[2]].localAI[3] > 0f)
|
|
color = Color.Lerp(color, Color.SandyBrown, MathHelper.Clamp(Main.npc[(int)NPC.ai[2]].localAI[3] / 90f, 0f, 1f));
|
|
}
|
|
|
|
spriteBatch.Draw(texture2D15, vector43, NPC.frame, color, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f);
|
|
|
|
return false;
|
|
}
|
|
|
|
public override bool? CanBeHitByProjectile(Projectile projectile)
|
|
{
|
|
if (projectile.minion)
|
|
{
|
|
return NPC.Calamity().newAI[0] == 1f;
|
|
}
|
|
return null;
|
|
}
|
|
|
|
public override bool CheckActive()
|
|
{
|
|
return false;
|
|
}
|
|
|
|
public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment)
|
|
{
|
|
NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance);
|
|
NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier());
|
|
}
|
|
|
|
public override void HitEffect(NPC.HitInfo hit)
|
|
{
|
|
for (int k = 0; k < 3; 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 < 10; 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>("ASBodyAlt").Type, NPC.scale);
|
|
Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find<ModGore>("ASBodyAlt2").Type, NPC.scale);
|
|
Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find<ModGore>("ASBodyAlt3").Type, NPC.scale);
|
|
}
|
|
}
|
|
}
|
|
|
|
public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo)
|
|
{
|
|
if (hurtInfo.Damage > 0)
|
|
target.AddBuff(ModContent.BuffType<Irradiated>(), 300, true);
|
|
}
|
|
}
|
|
}
|