Files
CalamityModPublic/Projectiles/Melee/RainBolt.cs
T
mountaindrew10 daa48fe357 1 - Spectre Hood set bonus no longer nerfs magic damage.
2 - Destroyer resists Aftershock and Avalanche projectiles by 50%.
3 - PBG hovers 10 tiles closer to the player on the Y axis.
4 - Adjusted Grand Guardian a bit and made the healing orbs home in on their user after a delay.
5 - Removed Chlorophyte Bullet IL edit and overrode the AI instead to make the dust look better and produce less.
6 - Reduced Boss Rush EoW DR.
2024-03-22 17:51:39 -05:00

60 lines
2.2 KiB
C#

using Microsoft.Xna.Framework;
using Terraria;
using Terraria.Audio;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Melee
{
public class RainBolt : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Melee";
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
private const int TimeLeft = 180;
private const int HomingTime = TimeLeft - 30;
public override void SetDefaults()
{
Projectile.width = 10;
Projectile.height = 10;
Projectile.friendly = true;
Projectile.DamageType = DamageClass.Melee;
Projectile.penetrate = 1;
Projectile.timeLeft = TimeLeft;
}
public override bool? CanHitNPC(NPC target) => Projectile.timeLeft < HomingTime && target.CanBeChasedBy(Projectile);
public override void AI()
{
if (Projectile.localAI[0] == 0f)
{
SoundEngine.PlaySound(SoundID.Item9, Projectile.Center);
Projectile.localAI[0] += 1f;
}
int rainbow = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, DustID.RainbowTorch, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 2f);
Main.dust[rainbow].noGravity = true;
Main.dust[rainbow].velocity *= 0f;
if (Projectile.timeLeft < HomingTime)
CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 600f, 12f, 20f);
else
Projectile.velocity *= 0.95f;
}
public override void OnKill(int timeLeft)
{
SoundEngine.PlaySound(SoundID.Item60, Projectile.Center);
for (int k = 0; k < 5; k++)
{
int rain = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.RainbowTorch, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB));
Main.dust[rain].noGravity = true;
}
}
}
}