2 - Death changes some enemies to be harder than current Death. 3 - Added buff for Trinket of Chi team regen.
125 lines
4.4 KiB
C#
125 lines
4.4 KiB
C#
using CalamityMod.Items.Materials;
|
|
using CalamityMod.Items.Placeables.Banners;
|
|
using CalamityMod.World;
|
|
using Terraria;
|
|
using Terraria.GameContent.Bestiary;
|
|
using Terraria.ID;
|
|
using Terraria.ModLoader;
|
|
|
|
namespace CalamityMod.NPCs.NormalNPCs
|
|
{
|
|
public class Cryon : ModNPC
|
|
{
|
|
public override void SetStaticDefaults()
|
|
{
|
|
DisplayName.SetDefault("Cryon");
|
|
Main.npcFrameCount[NPC.type] = 6;
|
|
NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0);
|
|
}
|
|
|
|
public override void SetDefaults()
|
|
{
|
|
NPC.aiStyle = -1;
|
|
AIType = -1;
|
|
NPC.damage = 42;
|
|
NPC.width = 50;
|
|
NPC.height = 64;
|
|
NPC.defense = 10;
|
|
NPC.DR_NERD(0.1f);
|
|
NPC.lifeMax = 300;
|
|
NPC.knockBackResist = 0f;
|
|
NPC.value = Item.buyPrice(0, 0, 5, 0);
|
|
NPC.HitSound = SoundID.NPCHit5;
|
|
NPC.DeathSound = SoundID.NPCDeath7;
|
|
Banner = NPC.type;
|
|
BannerItem = ModContent.ItemType<CryonBanner>();
|
|
NPC.coldDamage = true;
|
|
NPC.Calamity().VulnerableToHeat = true;
|
|
NPC.Calamity().VulnerableToCold = false;
|
|
NPC.Calamity().VulnerableToSickness = false;
|
|
}
|
|
|
|
public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry)
|
|
{
|
|
bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] {
|
|
BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Snow,
|
|
BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.UndergroundSnow,
|
|
|
|
// Will move to localization whenever that is cleaned up.
|
|
new FlavorTextBestiaryInfoElement("Within the octahedron, one can find ancient runes engraved into ice that does not melt. Who could have created these?")
|
|
});
|
|
}
|
|
|
|
public override void AI()
|
|
{
|
|
CalamityAI.UnicornAI(NPC, Mod, false, CalamityWorld.death ? 8f : CalamityWorld.revenge ? 6f : 4f, 5f, CalamityWorld.death ? 0.2f : CalamityWorld.revenge ? 0.15f : 0.1f);
|
|
}
|
|
|
|
public override void FindFrame(int frameHeight)
|
|
{
|
|
if ((NPC.velocity.Y > 0f || NPC.velocity.Y < 0f) && !NPC.IsABestiaryIconDummy)
|
|
{
|
|
NPC.spriteDirection = NPC.direction;
|
|
NPC.frame.Y = frameHeight * 5;
|
|
NPC.frameCounter = 0.0;
|
|
}
|
|
else
|
|
{
|
|
if (NPC.IsABestiaryIconDummy)
|
|
{
|
|
NPC.frameCounter += 2;
|
|
}
|
|
else
|
|
{
|
|
NPC.frameCounter += (double)(NPC.velocity.Length() / 2f);
|
|
}
|
|
NPC.spriteDirection = NPC.direction;
|
|
if (NPC.frameCounter > 12.0)
|
|
{
|
|
NPC.frame.Y = NPC.frame.Y + frameHeight;
|
|
NPC.frameCounter = 0.0;
|
|
}
|
|
if (NPC.frame.Y >= frameHeight * 4)
|
|
{
|
|
NPC.frame.Y = 0;
|
|
}
|
|
}
|
|
}
|
|
|
|
public override float SpawnChance(NPCSpawnInfo spawnInfo)
|
|
{
|
|
return spawnInfo.Player.ZoneSnow &&
|
|
!spawnInfo.Player.PillarZone() &&
|
|
!spawnInfo.Player.ZoneDungeon &&
|
|
!spawnInfo.Player.InSunkenSea() &&
|
|
Main.hardMode && !spawnInfo.PlayerInTown && !spawnInfo.Player.ZoneOldOneArmy && !Main.snowMoon && !Main.pumpkinMoon ? 0.045f : 0f;
|
|
}
|
|
|
|
public override void OnHitPlayer(Player player, int damage, bool crit)
|
|
{
|
|
if (damage > 0)
|
|
{
|
|
player.AddBuff(BuffID.Frostburn, 120, true);
|
|
player.AddBuff(BuffID.Chilled, 90, true);
|
|
}
|
|
}
|
|
|
|
public override void HitEffect(int hitDirection, double damage)
|
|
{
|
|
for (int k = 0; k < 3; k++)
|
|
{
|
|
Dust.NewDust(NPC.position, NPC.width, NPC.height, 92, hitDirection, -1f, 0, default, 1f);
|
|
}
|
|
if (NPC.life <= 0)
|
|
{
|
|
for (int k = 0; k < 15; k++)
|
|
{
|
|
Dust.NewDust(NPC.position, NPC.width, NPC.height, 92, hitDirection, -1f, 0, default, 1f);
|
|
}
|
|
}
|
|
}
|
|
|
|
public override void ModifyNPCLoot(NPCLoot npcLoot) => npcLoot.Add(ModContent.ItemType<EssenceofEleum>(), 2);
|
|
}
|
|
}
|