Files
CalamityModPublic/Projectiles/Ranged/OpalChargedStrike.cs
T
Xyk 14e219a689 Early HM Ranged weapon adjustments
P90: Fixed tile collision issues, gave 30 armor pen so you can use it on early HM enemies more easily

Meowthrower: Reduced knockback to make it worse on some types of enemies so other weapons can shine more (It was a little too good in every scenario against regular enemies)

Opal Striker: Fixed tile collision issues

Needler: Adjusted the dust visuals and reduced how long it inflicts acid venom since its a very potent debuff in early HM on many enemies
2023-12-21 12:26:52 -08:00

83 lines
3.3 KiB
C#

using CalamityMod.Particles;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.Audio;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Ranged
{
public class OpalChargedStrike : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Ranged";
public override void SetStaticDefaults()
{
ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8;
ProjectileID.Sets.TrailingMode[Projectile.type] = 0;
}
public override void SetDefaults()
{
Projectile.width = Projectile.height = 30;
Projectile.friendly = true;
Projectile.alpha = 55;
Projectile.penetrate = 3;
Projectile.timeLeft = 300;
Projectile.DamageType = DamageClass.Ranged;
Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration;
Projectile.extraUpdates = 3;
Projectile.usesLocalNPCImmunity = true;
Projectile.localNPCHitCooldown = 50;
Projectile.tileCollide = false; // Custom tile collision since the hitbox is large
}
public override void AI()
{
if (Collision.SolidCollision(Projectile.Center, 5, 5))
Projectile.Kill();
if (Main.rand.NextBool(3))
{
Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(7, 7), 162);
dust.scale = 1.3f;
dust.velocity = -Projectile.velocity * 0.4f;
}
Player Owner = Main.player[Projectile.owner];
float playerDist = Vector2.Distance(Owner.Center, Projectile.Center);
if (Projectile.timeLeft % 2 == 0 && playerDist < 1400f && Projectile.timeLeft < 290)
{
SparkParticle spark = new SparkParticle(Projectile.Center - Projectile.velocity * 3f, -Projectile.velocity * 0.05f, false, 9, 2f, Color.OrangeRed * 0.25f);
GeneralParticleHandler.SpawnParticle(spark);
}
Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2;
}
public override bool PreDraw(ref Color lightColor)
{
CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1);
return false;
}
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
{
target.AddBuff(BuffID.OnFire, 300);
}
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
{
if (Projectile.numHits > 0)
Projectile.damage = (int)(Projectile.damage * 0.80f);
if (Projectile.damage < 1)
Projectile.damage = 1;
}
public override void OnKill(int timeLeft)
{
for (int i = 0; i <= 8; i++)
{
Dust dust = Dust.NewDustPerfect(Projectile.position, 162, Projectile.velocity.RotatedByRandom(MathHelper.ToRadians(30f)) / 2, 0, default, Main.rand.NextFloat(1.6f, 2.3f));
dust.noGravity = false;
}
}
public override bool? CanDamage() => base.CanDamage();
}
}