Files
CalamityModPublic/Projectiles/Ranged/VanquisherArrowMain.cs
T

78 lines
2.8 KiB
C#

using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Projectiles.Typeless;
using Microsoft.Xna.Framework;
using System;
using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Ranged
{
public class VanquisherArrowMain : ModProjectile
{
private int projCount = 18;
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Arrow");
}
public override void SetDefaults()
{
projectile.width = 22;
projectile.height = 22;
projectile.friendly = true;
projectile.ranged = true;
projectile.tileCollide = false;
projectile.arrow = true;
projectile.penetrate = 1;
projectile.timeLeft = 90;
projectile.extraUpdates = 1;
}
public override void AI()
{
projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f;
projCount--;
if (projCount <= 0)
{
if (projectile.owner == Main.myPlayer)
{
Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.25f, projectile.velocity.Y * 0.25f, ModContent.ProjectileType<VanquisherArrowSplit>(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f);
}
projCount = 18;
}
}
// DEFECT -- Vanquisher Arrow projectile glowmask doesn't work.
/*
public override void PostDraw(SpriteBatch spriteBatch, Color lightColor)
{
Vector2 origin = new Vector2(0f, 0f);
Color color = Color.White;
if (projectile.timeLeft < 85)
{
byte b2 = (byte)(projectile.timeLeft * 3);
byte a2 = (byte)(100f * ((float)b2 / 255f));
color = new Color((int)b2, (int)b2, (int)b2, (int)a2);
}
spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Projectiles/Ranged/VanquisherArrowMainGlow"), projectile.Center - Main.screenPosition, null, color, projectile.rotation, origin, 1f, SpriteEffects.None, 0f);
}
*/
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 void OnHitNPC(NPC target, int damage, float knockback, bool crit)
{
target.AddBuff(ModContent.BuffType<GodSlayerInferno>(), 300);
}
}
}