Files
CalamityModPublic/Projectiles/Magic/PlasmaRay.cs
T
Xyk 6d45ebbcf0 Levi Amber nerf Plasma Rod prep
Nerfed Levi Amber knockback and damage slightly

Halved Plasma rod's shadowflame duration in prep for the incoming damage buff shadowflame will receive
2023-09-19 11:28:34 -07:00

93 lines
3.9 KiB
C#

using Microsoft.Xna.Framework;
using System;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Magic
{
public class PlasmaRay : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Magic";
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
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, NPC.HitInfo hit, int damageDone)
{
target.AddBuff(BuffID.ShadowFlame, 180);
}
}
}