Wulfrum battery toggle with visibility and dust change Sahara Slicers mixel removal Opal striker tip position to fit new sprite and charge visual improvement Reality rupture visual bugfix and touch ups Spear of Destiny visual bugfix and touch ups
79 lines
3.1 KiB
C#
79 lines
3.1 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;
|
|
}
|
|
|
|
public override void AI()
|
|
{
|
|
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();
|
|
}
|
|
}
|