Files
CalamityModPublic/Projectiles/Summon/Hiveling.cs
T
Merkalto c28930bce4 Hive pod nerf, this was a long time coming.
Decreased base damage and removed astral infection debuff. You can still get the debuff from the star generator accessory. Decreased timeLeft for Hivelings.
2021-10-26 12:17:30 -05:00

76 lines
2.8 KiB
C#

using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Dusts;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Summon
{
public class Hiveling : ModProjectile
{
public override string Texture => "CalamityMod/NPCs/Astral/Hiveling";
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Hiveling");
Main.projFrames[projectile.type] = 4;
ProjectileID.Sets.TrailCacheLength[projectile.type] = 4;
ProjectileID.Sets.TrailingMode[projectile.type] = 0;
ProjectileID.Sets.SentryShot[projectile.type] = true;
}
public override void SetDefaults()
{
projectile.width = 24;
projectile.height = 24;
projectile.friendly = true;
projectile.minion = true;
projectile.tileCollide = false;
projectile.penetrate = 1;
projectile.timeLeft = 240;
}
public override void AI()
{
Player player = Main.player[projectile.owner];
projectile.frameCounter++;
if (projectile.frameCounter > 3)
{
projectile.frame++;
projectile.frameCounter = 0;
}
if (projectile.frame > 3)
{
projectile.frame = 0;
}
projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2 + MathHelper.PiOver4;
projectile.spriteDirection = -projectile.direction;
projectile.rotation = projectile.velocity.X * 0.05f;
NPC potentialTarget = projectile.Center.MinionHoming(1200f, Main.player[projectile.owner]);
if (potentialTarget != null)
projectile.velocity = (projectile.velocity * 30f + projectile.SafeDirectionTo(potentialTarget.Center) * 10f) / 31f;
}
public override void Kill(int timeLeft)
{
for (int k = 0; k < 3; k++)
{
Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, ModContent.DustType<AstralBlue>(), projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f);
}
for (int k = 0; k < 3; k++)
{
Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, ModContent.DustType<AstralOrange>(), projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f);
}
}
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
{
CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1);
return false;
}
}
}