Files
CalamityModPublic/Projectiles/Magic/HadopelagicEcho2.cs
T
termigator1359 1b22071cf4 squash merge: Removed all unused textures
Removed nearly all unused textures in the entire mod, especially focusing on projectiles.
Apotheosis & the Death Valley Duster weapon line were ignored to prevent merge conflicts.
2020-11-15 14:25:46 -05:00

77 lines
2.6 KiB
C#

using CalamityMod.Buffs.DamageOverTime;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Magic
{
public class HadopelagicEcho2 : ModProjectile
{
public override string Texture => "CalamityMod/Projectiles/Magic/EidolicWailSoundwave";
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Echo");
ProjectileID.Sets.TrailCacheLength[projectile.type] = 8;
ProjectileID.Sets.TrailingMode[projectile.type] = 0;
}
public override void SetDefaults()
{
projectile.width = 36;
projectile.height = 36;
projectile.scale = 0.85f;
projectile.alpha = 255;
projectile.friendly = true;
projectile.ignoreWater = true;
projectile.penetrate = -1;
projectile.magic = true;
projectile.usesLocalNPCImmunity = true;
projectile.localNPCHitCooldown = -1;
projectile.timeLeft = 30;
projectile.extraUpdates = 1;
projectile.tileCollide = false;
}
public override void AI()
{
projectile.width = (int)(36f * projectile.scale);
projectile.height = (int)(36f * projectile.scale);
if (projectile.alpha > 100)
{
projectile.alpha -= 25;
}
if (projectile.alpha < 100)
projectile.alpha = 100;
projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X);
if (projectile.ai[0] == 1f)
CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 500f, 8f, 20f);
}
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
{
target.AddBuff(ModContent.BuffType<CrushDepth>(), 600);
}
public override Color? GetAlpha(Color lightColor)
{
if (projectile.timeLeft < 85)
{
byte b2 = (byte)(projectile.timeLeft * 3);
byte a2 = (byte)(100f * ((float)b2 / 255f));
return new Color((int)b2, (int)b2, (int)b2, (int)a2);
}
return new Color(255, 255, 255, 100);
}
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
{
CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1);
return false;
}
}
}