Files
CalamityModPublic/Projectiles/Magic/PlasmaRay.cs
T
Altixal 2be6a40cd7 cleaning up the balancing backlog: part 1
non-balancing changes --
- did the thing with helium flash dust drawing
- fix nasty cholla stealth strike not scaling with stealth damage
- gave additional tooltip to some items
- fixed urchin mace getting pierce resisted
- fixed sludge splotch having flat damage stealth strikes
- also just cleaned up sludge splotch code in general lmao
- cleaned up hardened honeycomb code
- changed shinobi blade's stealth strike effect
2023-02-19 19:26:46 -05:00

97 lines
4.0 KiB
C#

using Microsoft.Xna.Framework;
using System;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Magic
{
public class PlasmaRay : ModProjectile
{
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Ray");
}
public override void SetDefaults()
{
Projectile.width = 4;
Projectile.height = 4;
Projectile.friendly = true;
Projectile.DamageType = DamageClass.Magic;
Projectile.penetrate = 1;
Projectile.extraUpdates = 100;
Projectile.timeLeft = 80;
}
public override void AI()
{
Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 65, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f);
if (Projectile.velocity.X != Projectile.velocity.X)
{
Projectile.position.X = Projectile.position.X + Projectile.velocity.X;
Projectile.velocity.X = -Projectile.velocity.X;
}
if (Projectile.velocity.Y != Projectile.velocity.Y)
{
Projectile.position.Y = Projectile.position.Y + Projectile.velocity.Y;
Projectile.velocity.Y = -Projectile.velocity.Y;
}
Projectile.localAI[0] += 1f;
if (Projectile.localAI[0] > 9f)
{
for (int num447 = 0; num447 < 4; num447++)
{
Vector2 vector33 = Projectile.position;
vector33 -= Projectile.velocity * ((float)num447 * 0.25f);
Projectile.alpha = 255;
int num448 = Dust.NewDust(vector33, 1, 1, 173, 0f, 0f, 0, default, 0.75f);
Main.dust[num448].position = vector33;
Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f;
Main.dust[num448].velocity *= 0.2f;
}
}
}
public override bool OnTileCollide(Vector2 oldVelocity)
{
float random = Main.rand.Next(30, 90);
float spread = random * 0.0174f;
double startAngle = Math.Atan2(Projectile.velocity.X, Projectile.velocity.Y) - spread / 2;
double deltaAngle = spread / 8f;
double offsetAngle;
int i;
if (Projectile.owner == Main.myPlayer)
{
for (i = 0; i < 4; i++)
{
offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i;
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType<PlasmaRay2>(), (int)(Projectile.damage * 1.75), Projectile.knockBack, Projectile.owner, 0f, 0f);
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType<PlasmaRay2>(), (int)(Projectile.damage * 1.75), Projectile.knockBack, Projectile.owner, 0f, 0f);
}
}
Projectile.penetrate--;
if (Projectile.penetrate <= 0)
{
Projectile.Kill();
}
return false;
}
public override void Kill(int timeLeft)
{
for (int k = 0; k < 5; k++)
{
Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 173, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f);
}
}
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
{
target.AddBuff(BuffID.ShadowFlame, 360);
}
}
}