Files
CalamityModPublic/NPCs/NormalNPCs/Stormlion.cs
T
mountaindrew10 cb001b2fd9 1 - DoG enters his phase 2 portal twice as fast.
2 - Stormlions have a 4% chance to drop Storm Spear and Thunder Zapper.
3 - Added recipes for Bast Statue, Encumbering Stone and Desert Minecart.
2022-11-29 15:23:40 -06:00

111 lines
4.4 KiB
C#

using CalamityMod.Items.Materials;
using CalamityMod.Items.Placeables.Banners;
using CalamityMod.Items.Weapons.Summon;
using Terraria;
using Terraria.GameContent.Bestiary;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.ModLoader.Utilities;
namespace CalamityMod.NPCs.NormalNPCs
{
public class Stormlion : ModNPC
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Stormlion");
Main.npcFrameCount[NPC.type] = 6;
NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0);
}
public override void SetDefaults()
{
NPC.damage = 20;
NPC.aiStyle = NPCAIStyleID.Fighter;
NPC.width = 33;
NPC.height = 31;
NPC.defense = 8;
NPC.lifeMax = 80;
NPC.knockBackResist = 0.2f;
AnimationType = NPCID.WalkingAntlion;
NPC.value = Item.buyPrice(0, 0, 2, 0);
NPC.HitSound = SoundID.NPCHit31;
NPC.DeathSound = SoundID.NPCDeath34;
Banner = NPC.type;
BannerItem = ModContent.ItemType<StormlionBanner>();
NPC.Calamity().VulnerableToCold = true;
NPC.Calamity().VulnerableToSickness = true;
NPC.Calamity().VulnerableToElectricity = false;
NPC.Calamity().VulnerableToWater = true;
}
public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry)
{
bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] {
BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.UndergroundDesert,
// Will move to localization whenever that is cleaned up.
new FlavorTextBestiaryInfoElement("What these appear to feed on are the electric storms that brew over deserts. When the skies darken, they reach upwards with their mandibles that act as lightning rods.")
});
}
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 < 20; k++)
{
Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f);
}
if (Main.netMode != NetmodeID.Server)
{
Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find<ModGore>("Stormlion").Type, NPC.scale);
Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find<ModGore>("Stormlion2").Type, NPC.scale);
Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find<ModGore>("Stormlion3").Type, NPC.scale);
Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find<ModGore>("Stormlion4").Type, NPC.scale);
}
}
}
public override float SpawnChance(NPCSpawnInfo spawnInfo)
{
if (spawnInfo.PlayerSafe ||
spawnInfo.Player.Calamity().ZoneSunkenSea ||
spawnInfo.Player.PillarZone() ||
spawnInfo.Player.InAstral() ||
spawnInfo.Player.ZoneCorrupt ||
spawnInfo.Player.ZoneCrimson ||
spawnInfo.Player.ZoneOldOneArmy ||
Main.eclipse ||
Main.snowMoon ||
Main.pumpkinMoon ||
Main.invasionType != InvasionID.None)
{
return 0f;
}
if (Main.IsItStorming && spawnInfo.Player.ZoneDesert)
{
return SpawnCondition.OverworldDayDesert.Chance;
}
return SpawnCondition.DesertCave.Chance * 0.3f;
}
public override void OnHitPlayer(Player player, int damage, bool crit)
{
if (damage > 0)
player.AddBuff(BuffID.Electrified, 120, true);
}
public override void ModifyNPCLoot(NPCLoot npcLoot)
{
npcLoot.Add(ModContent.ItemType<StormlionMandible>());
npcLoot.Add(ModContent.ItemType<StormjawStaff>(), 5);
npcLoot.Add(ItemID.ThunderSpear, 25);
npcLoot.Add(ItemID.ThunderStaff, 25);
}
}
}