Files
CalamityModPublic/Projectiles/DraedonsArsenal/TrackingDiskLaser.cs
T
Xyk 86025c0712 Arsenal Improvements Part 1
Part of my attempt to create a visual identity for each arsenal energy type that can be consistently applied across all items once they are reworked

This commit changes:
Taser - New left click and previous function is on right click with arsenal cooldown, vfx overhaul
Scattershot Skewer - Completely re-coded the entire thing, now has right and left click separation and can perform a skewer dash, vfx overhaul
Pulse Pistol - Completely re-coded how the orb tracking and movement works, hits twice before splitting instead of once, vfx overhaul
Pulse Rifle - Same as Pulse Pistol, vfx overhaul

Added 4 more dust types

Changed the dusts and colors used by Effects.ArsenalEffects

Fixed Plama typo
2025-03-26 20:21:27 -07:00

99 lines
3.7 KiB
C#

using CalamityMod.NPCs;
using CalamityMod.Particles;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.DraedonsArsenal
{
public class TrackingDiskLaser : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Misc";
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
public float Time
{
get => Projectile.localAI[0];
set => Projectile.localAI[0] = value;
}
public override void SetDefaults()
{
Projectile.width = 2;
Projectile.height = 2;
Projectile.friendly = true;
Projectile.DamageType = RogueDamageClass.Instance;
Projectile.tileCollide = false;
Projectile.penetrate = 1;
Projectile.extraUpdates = 100;
Projectile.timeLeft = 600;
Projectile.ArmorPenetration = 10;
}
public override void AI()
{
Player Owner = Main.player[Projectile.owner];
float targetDist = Vector2.Distance(Owner.Center, Projectile.Center);
Time++;
if (Time == 1)
{
for (int i = 0; i < 7; i++)
{
Dust dust = Dust.NewDustPerfect(Projectile.Center, 267);
dust.velocity = (Projectile.velocity * 3).RotatedByRandom(0.4f) * Main.rand.NextFloat(0.3f, 1f);
dust.scale = Main.rand.NextFloat(0.6f, 0.8f);
dust.noGravity = true;
dust.color = Color.Red;
}
}
if (Time >= 15f)
{
if (Projectile.timeLeft % 11 == 0 && targetDist < 1400)
{
Particle spark = new LineParticle(Projectile.Center - Projectile.velocity * 10, -Projectile.velocity * 0.01f, false, 4, 1.5f * Projectile.scale, Color.Red);
GeneralParticleHandler.SpawnParticle(spark);
}
if (Projectile.timeLeft % 2 == 0 && targetDist < 1400)
{
Particle spark2 = new LineParticle(Projectile.Center - Projectile.velocity * 10, -Projectile.velocity * 0.01f, false, 4, 0.35f * Projectile.scale, Color.White);
GeneralParticleHandler.SpawnParticle(spark2);
}
}
}
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
{
// Handles giving the NPC the laser burn effect
CalamityGlobalNPC modNPC = target.Calamity();
if (!modNPC.laserBurnMarked)
{
modNPC.laserBurnMarked = true;
modNPC.laserBurnType = 1;
modNPC.laserBurnTimer = CalamityGlobalNPC.laserBurnTime;
}
modNPC.laserBurnTimer -= modNPC.laserBurnStacks * 2;
modNPC.laserBurnDamage += (int)(Projectile.damage * 0.2f);
modNPC.laserBurnStacks++;
if (Projectile.scale == 1)
{
Projectile.damage = 1;
modifiers.HideCombatText();
}
else
modifiers.SourceDamage *= 0.15f;
}
public override void OnKill(int timeLeft)
{
for (int i = 0; i < 7; i++)
{
Dust dust = Dust.NewDustPerfect(Projectile.Center, 267);
dust.velocity = (Projectile.velocity * 3 * Projectile.scale).RotatedByRandom(0.3f) * Main.rand.NextFloat(0.3f, 1f);
dust.scale = Main.rand.NextFloat(0.4f, 0.7f) * Projectile.scale;
dust.noGravity = true;
dust.color = Color.Red;
}
}
}
}