Files
CalamityModPublic/Projectiles/Magic/Shadowbolt.cs
T
Xyk 6f761e6fd4 Cleansing blaze pierce changes and pierce reduction fix
Cleansing Blaze now pierces 7 times instead of infinite and has a 25% damage reduction per hit.

Fixed how damage reduction on consecutive hits was written so it now doesn't effect the initial hit.

Fixed shadowbolt staff increasing its damage on the first hit and buffed its damage to compensate
2023-11-16 14:08:20 -08:00

73 lines
2.4 KiB
C#

using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Magic
{
public class Shadowbolt : 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.ignoreWater = true;
Projectile.penetrate = 6;
Projectile.extraUpdates = 100;
Projectile.timeLeft = 300;
Projectile.usesLocalNPCImmunity = true;
Projectile.localNPCHitCooldown = 10;
}
public override bool OnTileCollide(Vector2 oldVelocity)
{
Projectile.damage = (int)(Projectile.damage * 1.15);
Projectile.penetrate--;
if (Projectile.penetrate <= 0)
{
Projectile.Kill();
}
else
{
if (Projectile.velocity.X != oldVelocity.X)
{
Projectile.velocity.X = -oldVelocity.X;
}
if (Projectile.velocity.Y != oldVelocity.Y)
{
Projectile.velocity.Y = -oldVelocity.Y;
}
}
return false;
}
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
{
if (Projectile.numHits > 0)
Projectile.damage = (int)(Projectile.damage * 1.15);
}
public override void AI()
{
Projectile.localAI[0] += 1f;
if (Projectile.localAI[0] > 9f)
{
for (int i = 0; i < 4; i++)
{
Vector2 projPos = Projectile.position;
projPos -= Projectile.velocity * ((float)i * 0.25f);
Projectile.alpha = 255;
int shadowDust = Dust.NewDust(projPos, 1, 1, 173, 0f, 0f, 0, default, 1f);
Main.dust[shadowDust].position = projPos;
Main.dust[shadowDust].scale = (float)Main.rand.Next(70, 110) * 0.013f;
Main.dust[shadowDust].velocity *= 0.2f;
}
}
}
}
}