Files
CalamityModPublic/NPCs/Abyss/Laserfish.cs
T
Andrew Marheine 724bf08f4a 1 - Added boss contact damage scaling with boss velocity.
2 - Nightwither added to Calamity Dust enum.
3 - Providence night variant and spawn animation added.
4 - A lot of new grey textures for the Prov night variant.
5 - Removed some useless casts in various files.
6 - Profaned Cores can now be used during nighttime and changed the tooltips to be ambiguous.
7 - Bobbit Worm lunge speed buffed.
8 - Buffed several abyss enemy HP and damage.
9 - Fixed Cuttlefish and some other abyss enemies not properly utilizing abyss stealth mechanics.
10 - Fixed several flying worm enemies that were meant to be passive until attacked that weren't passive at all, most notably the Sea Serpent.
11 - Removed some unnecessary code in several worm NPC files.
12 - Mirage Jellies should teleport more sensibly now.
13 - Edited Providence's AI a lot to account for the new nighttime AI and spawn animation.
14 - Yharon AI completely reworked, mostly phase 1. HAS NOT BEEN TESTED BY ME YET.
15 - Brimstone Monsters spread out speed cut in half.
16 - Rev+ Plantera spawns an extra set of tentacles when below 10% HP, however, her defense only scales up to 99 in this phase, not 9999.
17 - Death Mode ocean sharknadoes and cthulhunadoes no longer spawn sharkrons.
18 - Added new method for Tenebris to spread and Lumenyl/Sea Prism Crystals to spawn, in CalamityWorld.
19 - Added GetLerpValue method from Terraria 1.4 to CalamityUtils, can be removed when necessary.
2020-05-29 08:08:38 -05:00

145 lines
5.4 KiB
C#

using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Items.Materials;
using CalamityMod.Items.Placeables.Banners;
using CalamityMod.Items.Weapons.Ranged;
using CalamityMod.World;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using System.IO;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.NPCs.Abyss
{
public class Laserfish : ModNPC
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Laserfish");
Main.npcFrameCount[npc.type] = 6;
}
public override void SetDefaults()
{
npc.noGravity = true;
npc.damage = 40;
npc.width = 60;
npc.height = 26;
npc.defense = 25;
npc.lifeMax = 480;
npc.aiStyle = -1;
aiType = -1;
npc.buffImmune[ModContent.BuffType<CrushDepth>()] = true;
npc.value = Item.buyPrice(0, 0, 10, 0);
npc.HitSound = SoundID.NPCHit51;
npc.DeathSound = SoundID.NPCDeath26;
npc.knockBackResist = 0.65f;
banner = npc.type;
bannerItem = ModContent.ItemType<LaserfishBanner>();
npc.chaseable = 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(400f, 200f), 0.15f, 0.15f, 4f, 4f, 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 PostDraw(SpriteBatch spriteBatch, Color drawColor)
{
SpriteEffects spriteEffects = SpriteEffects.None;
if (npc.spriteDirection == 1)
{
spriteEffects = SpriteEffects.FlipHorizontally;
}
Vector2 center = new Vector2(npc.Center.X, npc.Center.Y);
Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2));
Vector2 vector = center - Main.screenPosition;
vector -= new Vector2((float)ModContent.GetTexture("CalamityMod/NPCs/Abyss/LaserfishGlow").Width, (float)(ModContent.GetTexture("CalamityMod/NPCs/Abyss/LaserfishGlow").Height / Main.npcFrameCount[npc.type])) * 1f / 2f;
vector += vector11 * 1f + new Vector2(0f, 0f + 4f + npc.gfxOffY);
Color color = new Color(127 - npc.alpha, 127 - npc.alpha, 127 - npc.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.Yellow);
Main.spriteBatch.Draw(ModContent.GetTexture("CalamityMod/NPCs/Abyss/LaserfishGlow"), vector,
new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f);
}
public override float SpawnChance(NPCSpawnInfo spawnInfo)
{
if (spawnInfo.player.Calamity().ZoneAbyssLayer2 && spawnInfo.water)
{
return SpawnCondition.CaveJellyfish.Chance * 0.6f;
}
if (spawnInfo.player.Calamity().ZoneAbyssLayer3 && spawnInfo.water)
{
return SpawnCondition.CaveJellyfish.Chance * 1.2f;
}
return 0f;
}
public override void NPCLoot()
{
if (Main.rand.NextBool(1000000) && CalamityWorld.revenge)
{
Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType<HalibutCannon>());
}
if (CalamityWorld.downedCalamitas)
{
if (Main.rand.NextBool(2))
{
Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType<Lumenite>());
}
}
}
public override void HitEffect(int hitDirection, double damage)
{
for (int k = 0; k < 5; k++)
{
Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f);
}
if (npc.life <= 0)
{
for (int k = 0; k < 25; k++)
{
Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f);
}
Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Laserfish"), 1f);
Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Laserfish2"), 1f);
Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Laserfish3"), 1f);
}
}
}
}