Files
CalamityModPublic/Projectiles/Rogue/CrystallineProj.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

67 lines
2.6 KiB
C#

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Rogue
{
public class CrystallineProj : ModProjectile
{
public override string Texture => "CalamityMod/Items/Weapons/Rogue/Crystalline";
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Crystalline");
}
public override void SetDefaults()
{
projectile.width = 10;
projectile.height = 10;
projectile.friendly = true;
projectile.penetrate = 1;
projectile.aiStyle = 113;
projectile.timeLeft = 120;
aiType = ProjectileID.BoneJavelin;
projectile.Calamity().rogue = true;
}
public override void AI()
{
projectile.rotation = projectile.velocity.ToRotation() + MathHelper.ToRadians(45f);
projectile.ai[1] += 1f;
if (projectile.ai[1] == 30f)
{
int numProj = 2;
float rotation = MathHelper.ToRadians(50);
if (projectile.owner == Main.myPlayer)
{
for (int i = 0; i < numProj + 1; i++)
{
float AI1 = projectile.Calamity().stealthStrike ? 1f : 0f;
Vector2 perturbedSpeed = projectile.velocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1)));
Projectile.NewProjectile(projectile.Center, perturbedSpeed, ModContent.ProjectileType<Crystalline2>(), (int)(projectile.damage * 0.5f), projectile.knockBack, projectile.owner, 0f, AI1);
}
}
}
}
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
{
Texture2D tex = Main.projectileTexture[projectile.type];
spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f);
return false;
}
public override void Kill(int timeLeft)
{
Main.PlaySound(SoundID.Item27, (int)projectile.position.X, (int)projectile.position.Y);
for (int k = 0; k < 5; k++)
{
Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 154, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f);
}
}
}
}