88 lines
3.3 KiB
C#
88 lines
3.3 KiB
C#
using CalamityMod.Events;
|
|
using CalamityMod.Projectiles.Boss;
|
|
using Microsoft.Xna.Framework;
|
|
using Terraria;
|
|
using Terraria.GameContent.Bestiary;
|
|
using Terraria.ID;
|
|
using Terraria.ModLoader;
|
|
|
|
namespace CalamityMod.NPCs.SlimeGod
|
|
{
|
|
public class CorruptSlimeSpawn : ModNPC
|
|
{
|
|
public override void SetStaticDefaults()
|
|
{
|
|
Main.npcFrameCount[Type] = 4;
|
|
NPCID.Sets.BossBestiaryPriority.Add(Type);
|
|
NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers();
|
|
value.PortraitPositionYOverride = -32f;
|
|
NPCID.Sets.NPCBestiaryDrawOffset[Type] = value;
|
|
}
|
|
|
|
// GFB exclusive
|
|
public static int ShaderainDamage = 12; // 48
|
|
|
|
public override void SetDefaults()
|
|
{
|
|
NPC.aiStyle = NPCAIStyleID.Bat;
|
|
NPC.damage = 28; // 56
|
|
NPC.width = 40;
|
|
NPC.height = 30;
|
|
|
|
NPC.defense = 6;
|
|
NPC.lifeMax = BossRushEvent.BossRushActive ? 10000 : 180;
|
|
NPC.knockBackResist = 0.7f;
|
|
AnimationType = NPCID.Slimer;
|
|
NPC.lavaImmune = false;
|
|
NPC.noGravity = false;
|
|
NPC.noTileCollide = false;
|
|
NPC.HitSound = SoundID.NPCHit1;
|
|
NPC.DeathSound = SoundID.NPCDeath1;
|
|
NPC.Calamity().VulnerableToHeat = true;
|
|
NPC.Calamity().VulnerableToSickness = false;
|
|
}
|
|
|
|
public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry)
|
|
{
|
|
int associatedNPCType = ModContent.NPCType<SplitEbonianPaladin>();
|
|
bestiaryEntry.UIInfoProvider = new CommonEnemyUICollectionInfoProvider(ContentSamples.NpcBestiaryCreditIdsByNpcNetIds[associatedNPCType], quickUnlock: true);
|
|
|
|
bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[]
|
|
{
|
|
BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.TheCorruption,
|
|
BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.TheCrimson,
|
|
new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.CorruptSlimeSpawn")
|
|
});
|
|
}
|
|
|
|
public override void AI()
|
|
{
|
|
Vector3 light = new Vector3(0.5f, 0.1f, 0.5f);
|
|
Lighting.AddLight(NPC.Center, light.X, light.Y, light.Z);
|
|
}
|
|
|
|
public override void HitEffect(NPC.HitInfo hit)
|
|
{
|
|
if (Main.netMode != NetmodeID.MultiplayerClient && NPC.life <= 0)
|
|
{
|
|
Vector2 spawnAt = NPC.Center + new Vector2(0f, (float)NPC.height / 2f);
|
|
NPC.NewNPC(NPC.GetSource_Loot(), (int)spawnAt.X, (int)spawnAt.Y, ModContent.NPCType<CorruptSlimeSpawn2>());
|
|
}
|
|
|
|
Color dustColor = Color.Lavender;
|
|
dustColor.A = 150;
|
|
|
|
for (int k = 0; k < 5; k++)
|
|
Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, hit.HitDirection, -1f, 0, dustColor, 1f);
|
|
}
|
|
public override void OnKill()
|
|
{
|
|
if (Main.zenithWorld && Main.netMode != NetmodeID.MultiplayerClient)
|
|
{
|
|
int type = ModContent.ProjectileType<ShadeNimbusHostile>();
|
|
Projectile.NewProjectile(NPC.GetSource_Death(), NPC.Center, Vector2.Zero, type, ShaderainDamage, 0f, Main.myPlayer);
|
|
}
|
|
}
|
|
}
|
|
}
|