Files
CalamityModPublic/NPCs/SulphurousSea/Catfish.cs
T
Andrew Marheine ba22da6cda 1 - Some 'minor' debuff changes.
2 - Added weakness and resistance system for debuffs. I'll explain it all later.
2021-12-13 15:06:59 -06:00

117 lines
3.4 KiB
C#

using CalamityMod.Buffs.StatDebuffs;
using CalamityMod.Items.Placeables.Banners;
using System.IO;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.NPCs.SulphurousSea
{
public class Catfish : ModNPC
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Catfish");
Main.npcFrameCount[npc.type] = 4;
}
public override void SetDefaults()
{
npc.noGravity = true;
npc.damage = 30;
npc.width = 98;
npc.height = 40;
npc.defense = 12;
npc.lifeMax = 120;
npc.aiStyle = -1;
aiType = -1;
npc.value = Item.buyPrice(0, 0, 1, 0);
npc.HitSound = SoundID.NPCHit1;
npc.DeathSound = SoundID.NPCDeath40;
npc.knockBackResist = 0.8f;
banner = npc.type;
bannerItem = ModContent.ItemType<CatfishBanner>();
npc.chaseable = false;
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);
}
public override void ReceiveExtraAI(BinaryReader reader)
{
npc.chaseable = reader.ReadBoolean();
}
public override void AI()
{
CalamityAI.PassiveSwimmingAI(npc, mod, 0, Main.player[npc.target].Calamity().GetAbyssAggro(200f, 150f), 0.25f, 0.15f, 8f, 8f, 0.1f);
}
public override bool? CanBeHitByProjectile(Projectile projectile)
{
if (projectile.minion && !projectile.Calamity().overridesMinionDamagePrevention)
{
return npc.chaseable;
}
return null;
}
public override void FindFrame(int frameHeight)
{
if (!npc.wet)
{
npc.frameCounter = 0.0;
return;
}
npc.frameCounter += npc.chaseable ? 0.15f : 0.075f;
npc.frameCounter %= Main.npcFrameCount[npc.type];
int frame = (int)npc.frameCounter;
npc.frame.Y = frame * frameHeight;
}
public override void OnHitPlayer(Player player, int damage, bool crit)
{
player.AddBuff(ModContent.BuffType<Irradiated>(), 180);
}
public override float SpawnChance(NPCSpawnInfo spawnInfo)
{
if (spawnInfo.playerSafe)
{
return 0f;
}
if (spawnInfo.player.Calamity().ZoneSulphur && spawnInfo.water)
{
return 0.2f;
}
return 0f;
}
public override void NPCLoot()
{
DropHelper.DropItemChance(npc, ItemID.DivingHelmet, 20);
}
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 < 25; k++)
{
Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f);
}
}
}
}
}