132 lines
4.4 KiB
C#
132 lines
4.4 KiB
C#
using CalamityMod.BiomeManagers;
|
|
using CalamityMod.Buffs.DamageOverTime;
|
|
using CalamityMod.Dusts;
|
|
using CalamityMod.Items.Materials;
|
|
using CalamityMod.Items.Placeables.Banners;
|
|
using CalamityMod.Items.Weapons.Rogue;
|
|
using CalamityMod.Sounds;
|
|
using Microsoft.Xna.Framework;
|
|
using Microsoft.Xna.Framework.Graphics;
|
|
using ReLogic.Content;
|
|
using Terraria;
|
|
using Terraria.Audio;
|
|
using Terraria.GameContent.Bestiary;
|
|
using Terraria.ID;
|
|
using Terraria.ModLoader;
|
|
|
|
namespace CalamityMod.NPCs.Astral
|
|
{
|
|
public class Aries : ModNPC
|
|
{
|
|
private static Texture2D glowmask;
|
|
|
|
public override void SetStaticDefaults()
|
|
{
|
|
Main.npcFrameCount[NPC.type] = 8;
|
|
if (!Main.dedServ)
|
|
glowmask = ModContent.Request<Texture2D>("CalamityMod/NPCs/Astral/AriesGlow", AssetRequestMode.ImmediateLoad).Value;
|
|
}
|
|
|
|
public override void SetDefaults()
|
|
{
|
|
NPC.damage = 50;
|
|
NPC.width = 66;
|
|
NPC.height = 64;
|
|
NPC.aiStyle = NPCAIStyleID.Herpling;
|
|
NPC.defense = 14;
|
|
NPC.DR_NERD(0.15f);
|
|
NPC.lifeMax = 300;
|
|
NPC.knockBackResist = 0.6f;
|
|
NPC.value = Item.buyPrice(0, 0, 10, 0);
|
|
NPC.DeathSound = CommonCalamitySounds.AstralNPCDeathSound;
|
|
Banner = NPC.type;
|
|
BannerItem = ModContent.ItemType<AriesBanner>();
|
|
if (DownedBossSystem.downedAstrumAureus)
|
|
{
|
|
NPC.damage = 85;
|
|
NPC.defense = 24;
|
|
NPC.knockBackResist = 0.5f;
|
|
NPC.lifeMax = 450;
|
|
}
|
|
NPC.Calamity().VulnerableToHeat = true;
|
|
NPC.Calamity().VulnerableToSickness = false;
|
|
SpawnModBiomes = new int[1] { ModContent.GetInstance<AbovegroundAstralBiome>().Type };
|
|
}
|
|
|
|
public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry)
|
|
{
|
|
bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[]
|
|
{
|
|
new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Aries")
|
|
});
|
|
}
|
|
|
|
public override void FindFrame(int frameHeight)
|
|
{
|
|
CalamityGlobalNPC.SpawnDustOnNPC(NPC, 66, frameHeight, ModContent.DustType<AstralOrange>(), new Rectangle(44, 18, 12, 12));
|
|
if (NPC.velocity.Y == 0f)
|
|
{
|
|
NPC.frame.Y = 0;
|
|
}
|
|
else if ((double)NPC.velocity.Y < -1.5)
|
|
{
|
|
NPC.frame.Y = frameHeight * 7;
|
|
}
|
|
else if ((double)NPC.velocity.Y < 0)
|
|
{
|
|
NPC.frame.Y = frameHeight * 4;
|
|
}
|
|
else if ((double)NPC.velocity.Y > 1.5)
|
|
{
|
|
NPC.frame.Y = frameHeight * 6;
|
|
}
|
|
else
|
|
{
|
|
NPC.frame.Y = frameHeight * 5;
|
|
}
|
|
}
|
|
|
|
public override void HitEffect(NPC.HitInfo hit)
|
|
{
|
|
if (NPC.soundDelay == 0)
|
|
{
|
|
NPC.soundDelay = 15;
|
|
SoundEngine.PlaySound(CommonCalamitySounds.AstralNPCHitSound, NPC.Center);
|
|
}
|
|
|
|
CalamityGlobalNPC.DoHitDust(NPC, hit.HitDirection, ModContent.DustType<AstralOrange>(), 1f, 4, 24);
|
|
}
|
|
|
|
public override void PostDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor)
|
|
{
|
|
//draw glowmask
|
|
spriteBatch.Draw(glowmask, NPC.Center - screenPos, NPC.frame, Color.White * 0.6f, NPC.rotation, new Vector2(33, 31), 1f, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0);
|
|
}
|
|
|
|
public override float SpawnChance(NPCSpawnInfo spawnInfo)
|
|
{
|
|
if (CalamityGlobalNPC.AnyEvents(spawnInfo.Player))
|
|
{
|
|
return 0f;
|
|
}
|
|
else if (spawnInfo.Player.InAstral(1))
|
|
{
|
|
return 0.15f;
|
|
}
|
|
return 0f;
|
|
}
|
|
|
|
public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo)
|
|
{
|
|
if (hurtInfo.Damage > 0)
|
|
target.AddBuff(ModContent.BuffType<AstralInfectionDebuff>(), 120, true);
|
|
}
|
|
|
|
public override void ModifyNPCLoot(NPCLoot npcLoot)
|
|
{
|
|
npcLoot.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType<Stardust>(), 2, 1, 2, 1, 3));
|
|
npcLoot.AddIf(() => DownedBossSystem.downedAstrumAureus, ModContent.ItemType<StellarKnife>(), 7);
|
|
}
|
|
}
|
|
}
|