Ontological Despoiler P2

Still needs sounds and localization stuff
This commit is contained in:
Xyk committed 2024-08-27 23:18:53 -07:00
1 parent c30fc6406b
commit 20346d0067
12 files changed
+325 -418

No files matched your search

+11 -8
View File
@@ -1,5 +1,4 @@
using System.Linq;
using CalamityMod.Dusts;
using CalamityMod.Items.Materials;
using CalamityMod.Projectiles.Ranged;
using CalamityMod.Rarities;
@@ -15,13 +14,17 @@ namespace CalamityMod.Items.Weapons.Ranged
[LegacyName("MolecularManipulator")]
public class OntologicalDespoiler : ModItem, ILocalizedModType
{
public static readonly SoundStyle ChargeLV1 = new("CalamityMod/Sounds/Item/ArcNovaDiffuserChargeLV1") { Volume = 0.6f };
public static readonly SoundStyle ChargeLV2 = new("CalamityMod/Sounds/Item/ArcNovaDiffuserChargeLV2") { Volume = 0.6f };
public static readonly SoundStyle ChargeStart = new("CalamityMod/Sounds/Item/ArcNovaDiffuserChargeStart") { Volume = 0.6f };
public static readonly SoundStyle ChargeLoop = new("CalamityMod/Sounds/Item/ArcNovaDiffuserChargeLoop") { Volume = 0.6f };
public static readonly SoundStyle ChargeLV1 = new("CalamityMod/Sounds/Item/ArcNovaDiffuserChargeLV1");
public static readonly SoundStyle ChargeLV2 = new("CalamityMod/Sounds/Item/ArcNovaDiffuserChargeLV2");
public static readonly SoundStyle ChargeStart = new("CalamityMod/Sounds/Item/ArcNovaDiffuserChargeStart");
public static readonly SoundStyle ChargeLoop = new("CalamityMod/Sounds/Item/ArcNovaDiffuserChargeLoop");
internal static readonly int ChargeLoopSoundFrames = 151;
public static readonly SoundStyle SmallShot = new("CalamityMod/Sounds/Item/ArcNovaDiffuserSmallShot") { PitchVariance = 0.3f };
public static readonly SoundStyle BigShot = new("CalamityMod/Sounds/Item/ArcNovaDiffuserBigShot") { PitchVariance = 0.3f };
public static readonly SoundStyle SmallShot = new("CalamityMod/Sounds/Item/ArcNovaDiffuserSmallShot");
public static readonly SoundStyle BigShot = new("CalamityMod/Sounds/Item/ArcNovaDiffuserBigShot");
public static readonly SoundStyle SmallImpact = new("CalamityMod/Sounds/Item/ArcNovaDiffuserChargeLV1");
public static readonly SoundStyle LargeImpact = new("CalamityMod/Sounds/Item/ArcNovaDiffuserChargeLV2");
public bool shotType = true; // true = positive shot, false = negative shot
public new string LocalizationCategory => "Items.Weapons.Ranged";
@@ -35,7 +38,7 @@ namespace CalamityMod.Items.Weapons.Ranged
{
Item.width = 88;
Item.height = 34;
Item.damage = 772;
Item.damage = 426;
Item.DamageType = DamageClass.Ranged;
Item.useAnimation = Item.useTime = 8;
Item.noMelee = true;
@@ -245,8 +245,8 @@ WildfireBloomFlare.DisplayName: Wildfire Flare
WulfrumScrapBullet.DisplayName: High Speed Scrap
HellbornProj.DisplayName: Hell-born Gunblast
HellbornShell.DisplayName: Hell's Shell
NullBurst.DisplayName: Null Burst
NullFlash.DisplayName: Null Flash
OntologicalDespoilerBeam.DisplayName: Ontological Despoiler Beam
OntologicalDespoilerGrenade.DisplayName: Ontological Despoiler Grenade
OntologicalDespoilerShot.DisplayName: Ontological Despoiler Shot
OntoligicalDespoilerBurst.DisplayName: Ontoligical Despoiler Burst
+6 -1
View File
@@ -16,13 +16,14 @@ namespace CalamityMod.Particles
public string NewTexture;
public float ExtraRotation;
public Vector2 Stretch = new Vector2(0.5f, 1.6f);
public float ShrinkSpeed = 0;
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
public bool AltVisual = true;
public override bool UseAdditiveBlend => AltVisual;
public override bool SetLifetime => true;
public override bool UseCustomDraw => true;
public CustomSpark(Vector2 relativePosition, Vector2 velocity, string texture, bool affectedByGravity, int lifetime, float scale, Color color, Vector2 stretch, bool useAddativeBlend = true, bool glowCenter = false, float extraRotation = 0, bool fadeIn = false, bool affectedByLight = false)
public CustomSpark(Vector2 relativePosition, Vector2 velocity, string texture, bool affectedByGravity, int lifetime, float scale, Color color, Vector2 stretch, bool useAddativeBlend = true, bool glowCenter = false, float extraRotation = 0, bool fadeIn = false, bool affectedByLight = false, float shrinkSpeed = 0)
{
Position = relativePosition;
Velocity = velocity;
@@ -35,6 +36,7 @@ namespace CalamityMod.Particles
FadeInScale = scale;
Lifetime = lifetime;
Color = InitialColor = color;
ShrinkSpeed = shrinkSpeed;
AltVisual = useAddativeBlend;
GlowCenter = glowCenter;
@@ -70,6 +72,9 @@ namespace CalamityMod.Particles
Velocity.Y += 0.25f;
}
Rotation = Velocity.ToRotation() + MathHelper.PiOver2 + ExtraRotation;
Stretch.X *= (1 - 0.2f * ShrinkSpeed);
Stretch.Y *= (1 + 0.2f * ShrinkSpeed);
}
public override void CustomDraw(SpriteBatch spriteBatch)
Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

+5 -3
View File
@@ -12,13 +12,14 @@ namespace CalamityMod.Particles
public bool AffectedByGravity;
public float Ylength = 1f;
public float Xlength = 0.6f;
public float ShrinkSpeed = 1;
public override bool SetLifetime => true;
public override bool UseCustomDraw => true;
public override bool UseAdditiveBlend => false;
public override string Texture => "CalamityMod/Particles/LargeSpark";
public VoidSparkParticle(Vector2 relativePosition, Vector2 velocity, bool affectedByGravity, int lifetime, float scale, Color color)
public VoidSparkParticle(Vector2 relativePosition, Vector2 velocity, bool affectedByGravity, int lifetime, float scale, Color color, float shrinkSpeed = 1)
{
Position = relativePosition;
Velocity = velocity;
@@ -26,6 +27,7 @@ namespace CalamityMod.Particles
Scale = scale;
Lifetime = lifetime;
Color = InitialColor = color;
ShrinkSpeed = shrinkSpeed;
}
public override void Update()
@@ -33,8 +35,8 @@ namespace CalamityMod.Particles
Scale *= 0.9f;
Color = Color.Lerp(InitialColor, Color.Transparent, (float)Math.Pow(LifetimeCompletion, 3D));
Velocity *= 0.95f;
Ylength *= 1.25f;
Xlength *= 0.7f;
Ylength *= (1 + (0.25f * ShrinkSpeed));
Xlength *= (1 - (0.3f * ShrinkSpeed));
if (Velocity.Length() < 12f && AffectedByGravity)
{
@@ -1,16 +1,10 @@
using CalamityMod.CalPlayer;
using CalamityMod.NPCs;
using CalamityMod.NPCs.NormalNPCs;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using ReLogic.Content;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Ranged
{
public class NullBurst : ModProjectile, ILocalizedModType
public class OntoligicalDespoilerBurst : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Ranged";
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
@@ -35,10 +29,10 @@ namespace CalamityMod.Projectiles.Ranged
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
{
if (Projectile.numHits > 0)
Projectile.damage = (int)(Projectile.damage * 0.9f);
Projectile.damage = (int)(Projectile.damage * 0.8f);
if (Projectile.damage < 1)
Projectile.damage = 1;
}
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.ai[2] == 0 ? 150 : 300, targetHitbox);
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 300, targetHitbox);
}
}
+60 -172
View File
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using CalamityMod.CalPlayer;
using CalamityMod.Dusts;
using CalamityMod.Items.Weapons.Ranged;
using CalamityMod.NPCs;
using CalamityMod.NPCs.NormalNPCs;
using CalamityMod.Particles;
@@ -20,212 +21,99 @@ namespace CalamityMod.Projectiles.Ranged
public new string LocalizationCategory => "Projectiles.Ranged";
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
public ref float time => ref Projectile.ai[0];
public Color baseColor = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, Main.DiscoR);
public int sineDir = 1;
public override void SetStaticDefaults()
{
ProjectileID.Sets.TrailCacheLength[Projectile.type] = 25;
ProjectileID.Sets.TrailingMode[Projectile.type] = 2;
}
public Color baseColor = Color.White;
public bool fading = false;
public override void SetDefaults()
{
Projectile.width = 28;
Projectile.height = 28;
Projectile.width = 45;
Projectile.height = 45;
Projectile.friendly = true;
Projectile.penetrate = -1;
Projectile.timeLeft = 400;
Projectile.timeLeft = 1200;
Projectile.DamageType = DamageClass.Ranged;
Projectile.extraUpdates = 4;
Projectile.extraUpdates = 80;
Projectile.tileCollide = false;
Projectile.usesLocalNPCImmunity = true;
Projectile.localNPCHitCooldown = -1;
}
public override void AI()
{
Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2;
if (time == 0)
Player Owner = Main.player[Projectile.owner];
float targetDist = Vector2.Distance(Owner.Center, Projectile.Center);
bool inRange = targetDist < 1400;
Projectile.rotation = Projectile.velocity.ToRotation();
if (time <= 5)
Projectile.scale = 0.1f;
else if (Projectile.scale < 1 && !fading)
Projectile.scale += 0.07f;
else if (fading)
{
Projectile.scale = Projectile.ai[1] == 5 ? 2.2f : 1.5f;
sineDir = Main.rand.NextBool() ? 1 : -1;
Projectile.velocity *= 0.992f;
Projectile.scale *= 0.992f;
}
float rate = (Main.GlobalTimeWrappedHourly * 5);
List<Color> eColors = new List<Color>()
{
Color.Turquoise,
Color.Orchid
};
int colorIndex = (int)(rate / 2 % eColors.Count);
Color currentColor = eColors[colorIndex];
Color nextColor = eColors[(colorIndex + 1) % eColors.Count];
if (!Main.zenithWorld)
baseColor = Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f);
if (Projectile.ai[1] == 5 && !Main.zenithWorld)
baseColor = Color.White;
if (time == 5)
if (time > 11)
{
for (int i = 0; i < 4; i++)
if (Main.rand.NextBool(4) && !fading)
{
Dust dust = Dust.NewDustPerfect(Projectile.Center, Projectile.ai[1] == 5 ? ModContent.DustType<VoidDust>() : ModContent.DustType<LightDust>(), (Projectile.velocity * 4).RotatedByRandom(0.6f) * Main.rand.NextFloat(0.2f, 1f));
Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(20, 20), ModContent.DustType<VoidDust>(), Projectile.velocity.RotatedByRandom(0.1f) * Main.rand.NextFloat(2.3f, 5.8f));
dust.noGravity = true;
dust.scale = Main.rand.NextFloat(1.15f, 1.35f);
dust.scale = Main.rand.NextFloat(1.3f, 2.15f);
dust.color = baseColor;
}
}
if (time > 20)
{
if (Projectile.ai[1] == 5)
if (Main.rand.NextBool(12) && !fading)
{
// Spawn in a helix-style pattern
float sine = (float)Math.Sin(Projectile.timeLeft * 0.575f / MathHelper.Pi);
Vector2 offset = Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedBy(MathHelper.PiOver2) * sine * 16f;
float scale = Main.rand.NextFloat(0.8f, 1.1f);
if (Main.rand.NextBool(2))
Particle beam = new CustomSpark(Projectile.Center - Projectile.velocity * 8, Projectile.velocity * Main.rand.NextFloat(0.5f, 4f), "CalamityMod/Particles/DrainLine", false, 80, 4.5f * Projectile.scale, Color.Black, new Vector2(0.4f, 3f), false, false, 0, false, false, 0);
GeneralParticleHandler.SpawnParticle(beam);
}
if (time % (fading ? 2 : 1) == 0)
{
for (int i = 0; i < 2; i++)
{
Dust dust2 = Dust.NewDustPerfect(Projectile.Center + offset * sineDir, Projectile.ai[1] == 5 ? ModContent.DustType<VoidDust>() : ModContent.DustType<LightDust>(), -Projectile.velocity * Main.rand.NextFloat(0.3f, 0.8f));
dust2.noGravity = true;
dust2.scale = scale;
dust2.color = baseColor;
}
if (Main.rand.NextBool(2))
{
Dust dust3 = Dust.NewDustPerfect(Projectile.Center - offset * sineDir, /*Projectile.ai[1] == 5 ? ModContent.DustType<VoidDust>() : */ModContent.DustType<LightDust>(), -Projectile.velocity * Main.rand.NextFloat(0.3f, 0.8f));
dust3.noGravity = true;
dust3.scale = scale;
dust3.color = baseColor;
}
}
else if (Main.rand.NextBool(13))
{
Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(10, 10), Projectile.ai[1] == 5 ? ModContent.DustType<VoidDust>() : ModContent.DustType<LightDust>(), -Projectile.velocity * Main.rand.NextFloat(0.3f, 0.8f));
dust.noGravity = true;
dust.scale = Main.rand.NextFloat(1.05f, 1.65f);
dust.color = baseColor;
}
}
if (time > 13 && time < 34 && Projectile.ai[2] > 0)
{
Projectile.Center += Projectile.velocity.RotatedBy((Projectile.ai[2] == 1 ? MathHelper.PiOver2 : -MathHelper.PiOver2)) * 0.2f;
}
if (Projectile.ai[1] == 5)
{
NPC targetedNPC = Projectile.Center.ClosestNPCAt(700);
if (targetedNPC != null && time > 30 && Projectile.numHits < 1 && Vector2.Distance(targetedNPC.Center, Projectile.Center) < 700)
{
Vector2 position = targetedNPC.Center;
Vector2 moveToMouse = (position - Projectile.Center).SafeNormalize(Vector2.UnitX);
if (Projectile.velocity.Length() < 8 - (Utils.GetLerpValue(150, 0, Projectile.timeLeft, true) * 2))
Projectile.velocity += moveToMouse * (0.42f + Utils.GetLerpValue(300, 150, Projectile.timeLeft, true));
else
Projectile.velocity *= 0.9f;
}
}
else
{
if (Projectile.timeLeft < 100)
{
Projectile.velocity *= 0.96f;
Projectile.scale *= 0.98f;
}
Projectile.timeLeft--;
if (Projectile.timeLeft <= 1)
{
for (int i = 0; i < 4; i++)
{
Particle orb2 = new LineParticle(Projectile.Center, (Projectile.velocity * 5).RotatedByRandom(0.05f) * Main.rand.NextFloat(0.1f, 1f), false, Main.rand.Next(20, 28 + 1), Main.rand.NextFloat(0.6f, 1.3f), baseColor);
GeneralParticleHandler.SpawnParticle(orb2);
bool glow = i == 0;
Particle beam = new CustomSpark(Projectile.Center - Projectile.velocity * 8, -Projectile.velocity * 0.1f, glow ? "CalamityMod/Particles/VoidBeamGlow" : "CalamityMod/Particles/VoidBeam", false, 23, 2.3f * Projectile.scale, glow ? baseColor : Color.Black, Vector2.One, glow ? true : false, false, 0, false, false, 0.5f);
GeneralParticleHandler.SpawnParticle(beam);
}
}
}
time++;
}
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
{
if (Projectile.ai[1] == 5)
for (int i = 0; i < 30; i++)
{
for (int i = 0; i < 8; i++)
{
Dust dust = Dust.NewDustPerfect(Projectile.Center, Projectile.ai[1] == 5 ? ModContent.DustType<VoidDust>() : ModContent.DustType<LightDust>(), (Projectile.velocity * 3).RotatedByRandom(0.7f) * Main.rand.NextFloat(0.2f, 1f));
dust.noGravity = true;
dust.scale = Main.rand.NextFloat(1.15f, 1.45f);
dust.color = baseColor;
}
Particle orb = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/BloomRing", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0.3f, 0.65f, 13);
GeneralParticleHandler.SpawnParticle(orb);
Particle orb2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Black, "CalamityMod/Particles/SmallBloomRingLayered", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0.4f, 0.75f, 13, false);
float dustPower = Main.rand.NextFloat(0.2f, 1f);
Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType<VoidDust>(), (Projectile.velocity * 15 * (dustPower * dustPower)).RotatedByRandom(1f - dustPower * dustPower) * Main.rand.NextFloat(0.9f, 1f));
dust.noGravity = true;
dust.scale = Main.rand.NextFloat(2.15f, 3.45f) * dustPower;
dust.color = baseColor;
Dust dust3 = Dust.NewDustPerfect(Projectile.Center, 278, (Projectile.velocity * 25 * (dustPower * dustPower)).RotatedByRandom(1f - dustPower * dustPower) * Main.rand.NextFloat(0.9f, 1f));
dust3.noGravity = true;
dust3.scale = Main.rand.NextFloat(1.35f, 1.75f) * dustPower;
dust3.color = baseColor;
Particle orb2 = new AltLineParticle(Projectile.Center, (Projectile.velocity * 15 * (dustPower * dustPower)).RotatedByRandom(1f - dustPower * dustPower) * Main.rand.NextFloat(0.9f, 1f), false, Main.rand.Next(30, 38 + 1), Main.rand.NextFloat(2.6f, 3.3f) * dustPower, Color.Black);
GeneralParticleHandler.SpawnParticle(orb2);
Particle orb3 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Black, "CalamityMod/Particles/SmallBloom", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0.4f, 0.25f, 16, false);
}
Particle orb = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/BloomRing", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0.5f, 1.35f, 18);
GeneralParticleHandler.SpawnParticle(orb);
for (int i = 0; i < 6; i++)
{
Particle orb3 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Black, "CalamityMod/Particles/SmallBloom", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 1.05f - i * 0.1f, 0.4f, 25 - i * 2, false);
GeneralParticleHandler.SpawnParticle(orb3);
}
else
{
for (int i = 0; i < 3; i++)
{
Particle orb2 = new LineParticle(Projectile.Center, (Projectile.velocity * 2).RotatedByRandom(0.1f) * Main.rand.NextFloat(0.1f, 1f), false, Main.rand.Next(20, 28 + 1), Main.rand.NextFloat(0.6f, 1.3f), baseColor);
GeneralParticleHandler.SpawnParticle(orb2);
}
}
SoundStyle fire = new("CalamityMod/Sounds/Item/NullHit");
SoundEngine.PlaySound(fire with { Volume = (Projectile.ai[1] == 5 ? 1 : 0.7f), Pitch = Main.rand.NextFloat(0, 0.1f) * (Projectile.ai[1] == 5 ? 3 : 1) }, Projectile.Center);
if (Main.zenithWorld)
{
#region NPC Nullification
int nullBuff = Main.rand.Next(8);
switch (nullBuff)
{
case 0:
if (target.type != ModContent.NPCType<SuperDummyNPC>())
target.damage += 10;
break;
case 1:
target.damage -= 10;
break;
case 2:
target.knockBackResist = 0f;
break;
case 3:
target.knockBackResist = 1f;
break;
case 4:
target.defense += 5;
break;
case 5:
target.defense -= 5;
break;
case 6:
target.scale *= 2f;
break;
case 7:
target.scale *= 0.5f;
break;
default:
break;
}
#endregion
}
}
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
{
if (Projectile.numHits > 0)
Projectile.damage = (int)(Projectile.damage * 0.97f);
if (Projectile.damage < 1)
Projectile.damage = 1;
fading = true;
Projectile.velocity *= 0.5f;
Projectile.scale = 1.3f;
SoundStyle fire = new("CalamityMod/Sounds/Item/TheHiveNuke");
SoundEngine.PlaySound(fire with { Volume = 1, Pitch = Main.rand.NextFloat(0, 0.1f) }, Projectile.Center);
SoundStyle fire2 = new("CalamityMod/Sounds/Item/MeldExplosion");
SoundEngine.PlaySound(fire2 with { Volume = 1, Pitch = Main.rand.NextFloat(-0.5f, -0.6f) }, Projectile.Center);
}
public override bool? CanDamage() => Projectile.numHits < 1 ? null : false;
public override bool PreDraw(ref Color lightColor)
{
if (time < 18)
return false;
Asset<Texture2D> tex = ModContent.Request<Texture2D>("CalamityMod/Particles/DrainLineBloom");
Asset<Texture2D> tex2 = ModContent.Request<Texture2D>("CalamityMod/Particles/DrainLine");
CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], baseColor with { A = 0 } * 0.35f, 1, tex.Value);
CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], Projectile.ai[1] == 5 ? Color.Black : Color.Lerp(baseColor, Color.White, 0.5f), 1, tex2.Value, true, true);
return false;
}
}
+150 -160
View File
@@ -1,10 +1,8 @@
using System;
using System.Collections.Generic;
using CalamityMod.CalPlayer;
using CalamityMod.Dusts;
using CalamityMod.NPCs;
using CalamityMod.NPCs.NormalNPCs;
using CalamityMod.Particles;
using CalamityMod.Items.Weapons.Ranged;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using ReLogic.Content;
@@ -21,7 +19,12 @@ namespace CalamityMod.Projectiles.Ranged
public override string Texture => "CalamityMod/Projectiles/Ranged/OntologicalDespoilerGrenade";
public ref float time => ref Projectile.ai[0];
public Color baseColor = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, Main.DiscoR);
public int sineDir = 1;
public bool explode = true;
public Color color1 = Color.DarkMagenta;
public Color color2 = Color.DarkOrchid;
public Color color3 = Color.Purple;
public Color color4 = Color.BlueViolet;
public override void SetStaticDefaults()
{
ProjectileID.Sets.TrailCacheLength[Projectile.type] = 25;
@@ -29,203 +32,190 @@ namespace CalamityMod.Projectiles.Ranged
}
public override void SetDefaults()
{
Projectile.width = 28;
Projectile.height = 28;
Projectile.width = 40;
Projectile.height = 40;
Projectile.friendly = true;
Projectile.penetrate = -1;
Projectile.timeLeft = 400;
Projectile.penetrate = 1;
Projectile.timeLeft = 600;
Projectile.DamageType = DamageClass.Ranged;
Projectile.extraUpdates = 4;
Projectile.extraUpdates = 2;
Projectile.tileCollide = false;
Projectile.usesLocalNPCImmunity = true;
Projectile.localNPCHitCooldown = -1;
}
public override void AI()
{
Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2;
if (time == 0)
Projectile.rotation = Projectile.velocity.ToRotation();
Projectile.frameCounter++;
if (Projectile.frameCounter > 12)
{
Projectile.scale = Projectile.ai[1] == 5 ? 2.2f : 1.5f;
sineDir = Main.rand.NextBool() ? 1 : -1;
Projectile.frame++;
Projectile.frameCounter = 0;
}
float rate = (Main.GlobalTimeWrappedHourly * 5);
if (Projectile.frame > 5)
{
Projectile.frame = 0;
}
if (time < 60)
Projectile.velocity *= 0.979f;
float rate = (Main.GlobalTimeWrappedHourly * 15);
List<Color> eColors = new List<Color>()
{
Color.Turquoise,
Color.Orchid
color1,
color2,
color3,
color4
};
int colorIndex = (int)(rate / 2 % eColors.Count);
Color currentColor = eColors[colorIndex];
Color nextColor = eColors[(colorIndex + 1) % eColors.Count];
if (!Main.zenithWorld)
baseColor = Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f);
baseColor = Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f);
if (Projectile.ai[1] == 5 && !Main.zenithWorld)
baseColor = Color.White;
if (time == 5)
{
for (int i = 0; i < 4; i++)
{
Dust dust = Dust.NewDustPerfect(Projectile.Center, Projectile.ai[1] == 5 ? ModContent.DustType<VoidDust>() : ModContent.DustType<LightDust>(), (Projectile.velocity * 4).RotatedByRandom(0.6f) * Main.rand.NextFloat(0.2f, 1f));
dust.noGravity = true;
dust.scale = Main.rand.NextFloat(1.15f, 1.35f);
dust.color = baseColor;
}
}
if (time > 20)
{
if (Projectile.ai[1] == 5)
{
// Spawn in a helix-style pattern
float sine = (float)Math.Sin(Projectile.timeLeft * 0.575f / MathHelper.Pi);
// Spawn in a helix-style pattern
float sine = (float)Math.Sin(Projectile.timeLeft * 0.575f / MathHelper.Pi);
Vector2 offset = Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedBy(MathHelper.PiOver2) * sine * 16f;
float scale = Main.rand.NextFloat(0.8f, 1.1f);
if (Main.rand.NextBool(2))
{
Dust dust2 = Dust.NewDustPerfect(Projectile.Center + offset * sineDir, Projectile.ai[1] == 5 ? ModContent.DustType<VoidDust>() : ModContent.DustType<LightDust>(), -Projectile.velocity * Main.rand.NextFloat(0.3f, 0.8f));
dust2.noGravity = true;
dust2.scale = scale;
dust2.color = baseColor;
}
if (Main.rand.NextBool(2))
{
Dust dust3 = Dust.NewDustPerfect(Projectile.Center - offset * sineDir, /*Projectile.ai[1] == 5 ? ModContent.DustType<VoidDust>() : */ModContent.DustType<LightDust>(), -Projectile.velocity * Main.rand.NextFloat(0.3f, 0.8f));
dust3.noGravity = true;
dust3.scale = scale;
dust3.color = baseColor;
}
}
else if (Main.rand.NextBool(13))
Projectile.scale = MathHelper.Clamp(1 + sine, 0.7f, 1.3f);
Vector2 offset = Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedBy(MathHelper.PiOver2) * sine * 12f;
float scale = Main.rand.NextFloat(1.3f, 1.4f);
if (Main.rand.NextBool(3))
{
Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(10, 10), Projectile.ai[1] == 5 ? ModContent.DustType<VoidDust>() : ModContent.DustType<LightDust>(), -Projectile.velocity * Main.rand.NextFloat(0.3f, 0.8f));
Dust dust2 = Dust.NewDustPerfect(Projectile.Center + offset, ModContent.DustType<VoidDust>(), -Projectile.velocity * Main.rand.NextFloat(0.3f, 0.8f));
dust2.noGravity = true;
dust2.scale = scale;
dust2.color = baseColor;
}
if (Main.rand.NextBool(3))
{
Dust dust3 = Dust.NewDustPerfect(Projectile.Center - offset, ModContent.DustType<VoidDust>(), -Projectile.velocity * Main.rand.NextFloat(0.3f, 0.8f));
dust3.noGravity = true;
dust3.scale = scale;
dust3.color = baseColor;
}
}
if (Projectile.timeLeft == 1)
explode = false;
NPC targetedNPC = Projectile.Center.ClosestNPCAt(1200);
if (targetedNPC != null && time > 60 && Projectile.numHits < 1 && Vector2.Distance(targetedNPC.Center, Projectile.Center) < 1200)
{
Vector2 position = targetedNPC.Center;
Vector2 moveToMouse = (position - Projectile.Center).SafeNormalize(Vector2.UnitX);
if (Projectile.velocity.Length() < 6 - (Utils.GetLerpValue(350, 0, Projectile.timeLeft, true)))
Projectile.velocity += moveToMouse * (0.02f + Utils.GetLerpValue(550, 250, Projectile.timeLeft, true));
else
Projectile.velocity *= 0.9f;
explode = true;
}
time++;
}
public override void OnKill(int timeLeft)
{
Player Owner = Main.player[Projectile.owner];
if (explode)
{
Owner.Calamity().GeneralScreenShakePower = 8.5f;
for (int i = 0; i < 40; i++)
{
Color useColor = Main.rand.Next(4) switch
{
0 => color1,
1 => color2,
2 => color3,
_ => color4,
};
Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType<VoidDust>(), (Projectile.velocity * 6).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 1f));
dust.noGravity = true;
dust.scale = Main.rand.NextFloat(1.05f, 1.65f);
dust.color = baseColor;
}
}
if (time > 13 && time < 34 && Projectile.ai[2] > 0)
{
Projectile.Center += Projectile.velocity.RotatedBy((Projectile.ai[2] == 1 ? MathHelper.PiOver2 : -MathHelper.PiOver2)) * 0.2f;
}
dust.scale = Main.rand.NextFloat(1.85f, 2.45f);
dust.color = useColor;
if (Projectile.ai[1] == 5)
{
NPC targetedNPC = Projectile.Center.ClosestNPCAt(700);
if (targetedNPC != null && time > 30 && Projectile.numHits < 1 && Vector2.Distance(targetedNPC.Center, Projectile.Center) < 700)
{
Vector2 position = targetedNPC.Center;
Vector2 moveToMouse = (position - Projectile.Center).SafeNormalize(Vector2.UnitX);
if (Projectile.velocity.Length() < 8 - (Utils.GetLerpValue(150, 0, Projectile.timeLeft, true) * 2))
Projectile.velocity += moveToMouse * (0.42f + Utils.GetLerpValue(300, 150, Projectile.timeLeft, true));
else
Projectile.velocity *= 0.9f;
}
}
else
{
if (Projectile.timeLeft < 100)
{
Projectile.velocity *= 0.96f;
Projectile.scale *= 0.98f;
}
Projectile.timeLeft--;
if (Projectile.timeLeft <= 1)
{
for (int i = 0; i < 4; i++)
if (i % 2 == 0)
{
Particle orb2 = new LineParticle(Projectile.Center, (Projectile.velocity * 5).RotatedByRandom(0.05f) * Main.rand.NextFloat(0.1f, 1f), false, Main.rand.Next(20, 28 + 1), Main.rand.NextFloat(0.6f, 1.3f), baseColor);
Particle orb2 = new CustomSpark(Projectile.Center, new Vector2(0, -40).RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 1f), "CalamityMod/Particles/Sparkle", false, 40, Main.rand.NextFloat(1.4f, 2.4f), useColor, new Vector2(0.4f, 1.1f));
GeneralParticleHandler.SpawnParticle(orb2);
}
}
}
time++;
}
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
{
if (Projectile.ai[1] == 5)
{
for (int i = 0; i < 8; i++)
for (int i = 0; i < 3; i++)
{
Dust dust = Dust.NewDustPerfect(Projectile.Center, Projectile.ai[1] == 5 ? ModContent.DustType<VoidDust>() : ModContent.DustType<LightDust>(), (Projectile.velocity * 3).RotatedByRandom(0.7f) * Main.rand.NextFloat(0.2f, 1f));
dust.noGravity = true;
dust.scale = Main.rand.NextFloat(1.15f, 1.45f);
dust.color = baseColor;
Color useColor = Main.rand.Next(4) switch
{
0 => color1,
1 => color2,
2 => color3,
_ => color4,
};
Particle orb4 = new CustomPulse(Projectile.Center, Vector2.Zero, useColor, "CalamityMod/Particles/SoftRoundExplosion", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0, 0.4f - i * 0.03f, 13);
GeneralParticleHandler.SpawnParticle(orb4);
}
Particle orb = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/BloomRing", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0.3f, 0.65f, 13);
Particle orb = new CustomPulse(Projectile.Center, Vector2.Zero, baseColor, "CalamityMod/Particles/BloomRing", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0.15f, 2.5f, 38);
GeneralParticleHandler.SpawnParticle(orb);
Particle orb2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Black, "CalamityMod/Particles/SmallBloomRingLayered", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0.4f, 0.75f, 13, false);
GeneralParticleHandler.SpawnParticle(orb2);
Particle orb3 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Black, "CalamityMod/Particles/SmallBloom", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0.4f, 0.25f, 16, false);
int parts = 8;
float rot = Main.rand.NextFloat(-9, 9);
for (int i = 0; i < parts; i++)
{
Color useColor = Main.rand.Next(4) switch
{
0 => color1,
1 => color2,
2 => color3,
_ => color4,
};
Particle orb2 = new CustomSpark(Projectile.Center, new Vector2(0, -15 * (i % 2 == 0 ? 1.8f : 1f)).RotatedBy(i * (MathHelper.ToRadians(360f) / parts)).RotatedBy(rot), "CalamityMod/Particles/VerticalSmear", false, 19, 3, useColor, new Vector2(0.2f, 1));
GeneralParticleHandler.SpawnParticle(orb2);
}
Particle orb3 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Black, "CalamityMod/Particles/SmallBloom", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0, 1.2f, 39, false);
GeneralParticleHandler.SpawnParticle(orb3);
SoundStyle fire = new("CalamityMod/Sounds/Item/EarthMeteor");
SoundEngine.PlaySound(fire with { Volume = 1f, Pitch = Main.rand.NextFloat(0, 0.1f) * -3 }, Projectile.Center);
Projectile proj = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType<OntoligicalDespoilerBurst>(), (int)(Projectile.damage * 2f), Projectile.knockBack * 3, Projectile.owner, 0, 0, 0);
}
else
{
for (int i = 0; i < 3; i++)
for (int i = 0; i < 20; i++)
{
Particle orb2 = new LineParticle(Projectile.Center, (Projectile.velocity * 2).RotatedByRandom(0.1f) * Main.rand.NextFloat(0.1f, 1f), false, Main.rand.Next(20, 28 + 1), Main.rand.NextFloat(0.6f, 1.3f), baseColor);
GeneralParticleHandler.SpawnParticle(orb2);
Color useColor = Main.rand.Next(4) switch
{
0 => color1,
1 => color2,
2 => color3,
_ => color4,
};
Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType<VoidDust>(), (Projectile.velocity * 3).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 1f));
dust.noGravity = true;
dust.scale = Main.rand.NextFloat(1.85f, 2.45f);
dust.color = useColor;
}
}
SoundStyle fire = new("CalamityMod/Sounds/Item/NullHit");
SoundEngine.PlaySound(fire with { Volume = (Projectile.ai[1] == 5 ? 1 : 0.7f), Pitch = Main.rand.NextFloat(0, 0.1f) * (Projectile.ai[1] == 5 ? 3 : 1) }, Projectile.Center);
if (Main.zenithWorld)
{
#region NPC Nullification
int nullBuff = Main.rand.Next(8);
switch (nullBuff)
{
case 0:
if (target.type != ModContent.NPCType<SuperDummyNPC>())
target.damage += 10;
break;
case 1:
target.damage -= 10;
break;
case 2:
target.knockBackResist = 0f;
break;
case 3:
target.knockBackResist = 1f;
break;
case 4:
target.defense += 5;
break;
case 5:
target.defense -= 5;
break;
case 6:
target.scale *= 2f;
break;
case 7:
target.scale *= 0.5f;
break;
default:
break;
}
#endregion
}
}
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
{
if (Projectile.numHits > 0)
Projectile.damage = (int)(Projectile.damage * 0.97f);
if (Projectile.damage < 1)
Projectile.damage = 1;
}
public override bool PreDraw(ref Color lightColor)
{
if (time < 18)
if (time < 2)
return false;
Asset<Texture2D> tex = ModContent.Request<Texture2D>("CalamityMod/Particles/DrainLineBloom");
Asset<Texture2D> tex2 = ModContent.Request<Texture2D>("CalamityMod/Particles/DrainLine");
CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], baseColor with { A = 0 } * 0.35f, 1, tex.Value);
CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], Projectile.ai[1] == 5 ? Color.Black : Color.Lerp(baseColor, Color.White, 0.5f), 1, tex2.Value, true, true);
Vector2 drawPosition = Projectile.Center - Main.screenPosition;
float drawRotation = Projectile.rotation;
Asset<Texture2D> tex = ModContent.Request<Texture2D>("CalamityMod/Particles/DrainLineBloom2");
Asset<Texture2D> tex2 = ModContent.Request<Texture2D>("CalamityMod/Particles/DrainLine2");
CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], baseColor with { A = 0 } * 0.8f, 1, tex.Value);
CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], Color.Black, 1, tex2.Value, true, true);
Asset<Texture2D> tex3 = ModContent.Request<Texture2D>("CalamityMod/Projectiles/Ranged/OntologicalDespoilerGrenade");
Rectangle frame = tex3.Frame(1, 6, 0, Projectile.frame);
Vector2 rotationPoint = frame.Size() * 0.5f;
for (int i = 0; i < 4; i++)
Main.EntitySpriteDraw(tex3.Value, drawPosition + Main.rand.NextVector2Circular(7, 7), frame, baseColor with { A = 0 }, drawRotation, rotationPoint, 1, SpriteEffects.None);
Main.EntitySpriteDraw(tex3.Value, drawPosition, frame, baseColor, drawRotation, rotationPoint, 1, SpriteEffects.None);
return false;
}
}
@@ -1,8 +1,6 @@
using System;
using System.Collections.Generic;
using System.Reflection.Metadata;
using CalamityMod.Dusts;
using CalamityMod.Items.Weapons.Magic;
using CalamityMod.Items.Weapons.Ranged;
using CalamityMod.Particles;
using CalamityMod.Projectiles.BaseProjectiles;
@@ -11,8 +9,6 @@ using Microsoft.Xna.Framework.Graphics;
using ReLogic.Utilities;
using Terraria;
using Terraria.Audio;
using Terraria.GameContent;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Ranged
@@ -43,12 +39,14 @@ namespace CalamityMod.Projectiles.Ranged
public Color color4 = Color.BlueViolet;
public bool hasBegunFiring = false;
public bool Positive => Projectile.ai[2] == 0;
public bool Positive => (Projectile.ai[2] == 0 || Projectile.ai[2] == 10);
public ref float ShootRecoilTimer => ref Projectile.ai[1]; // Dual functions for rapid fire shooting cooldown and recoil
public int AftershotCooldownFrames = 8;
public int Charge1Frames = 156;
public int Charge2Frames = 308;
public int Charge2Frames = 312;
public bool hasReachedLV1 = false;
public bool hasReachedLV2 = false;
public int fireFrameCounter = 0;
public int fireFrame = 0;
@@ -57,7 +55,11 @@ namespace CalamityMod.Projectiles.Ranged
public bool showFlash = false;
public Vector2 flashPos;
public float flashRot;
// Distortion effect visuals
public Vector2 voidPlacement;
public int inverseTimer = 14;
public bool drawInverse = false;
public bool ChargeLV1 => CurrentChargingFrames >= Charge1Frames;
public bool ChargeLV2 => CurrentChargingFrames >= Charge2Frames;
public override void SetStaticDefaults()
@@ -88,11 +90,12 @@ namespace CalamityMod.Projectiles.Ranged
Color nextColor = eColors[(colorIndex + 1) % eColors.Count];
baseColor = Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f);
if (!Positive)
if ((!Positive && Projectile.ai[2] < 10) || Projectile.ai[2] == 15) // Color is white when Negative
baseColor = Color.White;
#region Frame control
Projectile.frameCounter++;
if (Projectile.frameCounter > 1)
if (Projectile.frameCounter > (Projectile.ai[2] >= 10 ? 2 : 1))
{
Projectile.frame++;
Projectile.frameCounter = 0;
@@ -103,7 +106,7 @@ namespace CalamityMod.Projectiles.Ranged
}
fireFrameCounter++;
if (fireFrameCounter > 1)
if (fireFrameCounter > (Projectile.ai[2] >= 10 ? 2 : 1))
{
fireFrame++;
fireFrameCounter = 0;
@@ -122,13 +125,27 @@ namespace CalamityMod.Projectiles.Ranged
if (flashFrame > 6)
showFlash = false;
}
#endregion
if (Time % 2 == 0)
voidPlacement = Main.rand.NextVector2Circular(10.5f, 10.5f);
if (Projectile.ai[2] >= 10) // Changing Mode
if (inverseTimer <= 9)
{
Owner.Calamity().despoilerNerf = false;
Projectile.frame = 6;
fireFrame = 6;
drawInverse = true;
if (inverseTimer == 0)
{
drawInverse = false;
inverseTimer = Main.rand.Next(20, 40 + 1);
}
}
if (ChargeLV2)
inverseTimer--;
// Changing Mode
if (Projectile.ai[2] >= 10)
{
Owner.Calamity().despoilerNerf = false; // Remove charge speed penalty if you swap
ShotsLoaded = 0;
if (Time == 0)
{
@@ -141,20 +158,27 @@ namespace CalamityMod.Projectiles.Ranged
2 => color3,
_ => color4,
};
Dust dust = Dust.NewDustPerfect(Owner.Center, Main.rand.NextBool() ? ModContent.DustType<VoidDust>() : ModContent.DustType<LightDust>(), new Vector2(12, 12).RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 1f));
Dust dust = Dust.NewDustPerfect(Owner.Center, !Positive ? ModContent.DustType<VoidDust>() : ModContent.DustType<LightDust>(), new Vector2(12, 12).RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 1f));
dust.noGravity = true;
dust.scale = Main.rand.NextFloat(0.9f, 1.25f);
dust.color = Projectile.ai[2] == 15 ? Color.White : useColor;
dust.color = Projectile.ai[2] == 15 ? baseColor : useColor;
}
Projectile.timeLeft = AftershotCooldownFrames * 2;
OffsetLengthFromArm = 25f;
Projectile.timeLeft = (int)(AftershotCooldownFrames * 3.5f);
OffsetLengthFromArm = 45f;
}
if (Main.rand.NextBool() && Time > 1)
{
Dust dust = Dust.NewDustPerfect(GunTipPosition - (Projectile.velocity * 60).RotatedBy(0.15f * Projectile.direction), Projectile.ai[2] == 15 ? ModContent.DustType<VoidDust>() : ModContent.DustType<LightDust>(), (Projectile.velocity * 14).RotatedBy(MathHelper.ToRadians(-135f) * Projectile.direction).RotatedByRandom(0.3f) * Main.rand.NextFloat(0.6f, 1f));
dust.noGravity = true;
dust.scale = Main.rand.NextFloat(0.8f, 0.9f) * Utils.GetLerpValue(-10, 20, Projectile.timeLeft);
dust.color = baseColor;
}
}
// Fire if the owner stops channeling or otherwise cannot use the weapon.
if (Owner.CantUseHoldout() || Projectile.ai[2] >= 10)
{
if (Projectile.ai[2] < 10)
if (Projectile.ai[2] < 10 && ChargeLV1) // Give charge speed nerf if you use any form of charge
Owner.Calamity().despoilerNerf = true;
hasBegunFiring = true;
KeepRefreshingLifetime = false;
@@ -169,24 +193,26 @@ namespace CalamityMod.Projectiles.Ranged
ChargeSound?.Stop();
Vector2 shootVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * BulletSpeed;
int charge2DamagePos = Projectile.damage * 3; // Most of the damage comes from the explosion
int charge2DamageNeg = Projectile.damage * 30;
if (Positive)
{
Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, shootVelocity * 2.5f, ModContent.ProjectileType<OntologicalDespoilerGrenade>(), charge2DamagePos, Projectile.knockBack, Projectile.owner);
}
else
{
Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, shootVelocity * 0.6f, ModContent.ProjectileType<OntologicalDespoilerBeam>(), charge2DamageNeg, Projectile.knockBack * 3, Projectile.owner);
Owner.Calamity().GeneralScreenShakePower = 10.5f;
}
SoundEngine.PlaySound(OntologicalDespoiler.BigShot, Projectile.position);
Vector2 shootVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * BulletSpeed;
int charge2Damage = Projectile.damage * 20;
float charge2KB = Projectile.knockBack * 3f;
//Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, shootVelocity, ModContent.ProjectileType<NovaChargedShot>(), charge2Damage, charge2KB, Projectile.owner);
Owner.Calamity().GeneralScreenShakePower = 9.5f;
// Setting stats for the flash visual effect so it doesn't stick to the gun
flashPos = GunTipPosition + Projectile.velocity * 90;
flashRot = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f);
showFlash = true;
for (int i = 0; i < 20; i++)
{
Color useColor = Main.rand.Next(4) switch
@@ -215,10 +241,10 @@ namespace CalamityMod.Projectiles.Ranged
else if (ShotsLoaded > 0)
{
// While bullets are remaining, refresh the lifespan; it will not refresh again after bullets run out
Projectile.timeLeft = AftershotCooldownFrames;
Projectile.timeLeft = (ChargeLV1 ? AftershotCooldownFrames : (int)(AftershotCooldownFrames * 1.5f));
// Retract recoil & shoot faster if charged
ShootRecoilTimer -= ChargeLV1 ? 2.5f : 2f;
ShootRecoilTimer -= ChargeLV1 ? 3f : 2f;
if (ShootRecoilTimer <= 0f)
{
@@ -238,7 +264,7 @@ namespace CalamityMod.Projectiles.Ranged
{
for (int i = 0; i < 2; i++)
{
Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, fireVec.RotatedByRandom(0.3f) * Main.rand.NextFloat(0.8f, 1f), ModContent.ProjectileType<OntologicalDespoilerShot>(), Projectile.damage / 3, Projectile.knockBack, Projectile.owner, 0, 0, 5);
Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, fireVec.RotatedByRandom(0.45f) * Main.rand.NextFloat(0.8f, 1f), ModContent.ProjectileType<OntologicalDespoilerShot>(), Projectile.damage / 3, Projectile.knockBack, Projectile.owner, 0, 0, 5);
}
}
@@ -266,7 +292,7 @@ namespace CalamityMod.Projectiles.Ranged
if (ShotsLoaded < MaxLoadableShots && CurrentChargingFrames % FramesPerLoad == 0)
ShotsLoaded++;
CurrentChargingFrames += 2 * (Owner.Calamity().despoilerNerf ? 0.5f : 1);
CurrentChargingFrames += ((ChargeLV1 && !Positive) ? 1 : 2) * (Owner.Calamity().despoilerNerf ? 0.5f : 1); // Charges slower if nerfed, charge LV2 for Negative is slower
// Sounds
if (ChargeLV1)
@@ -292,17 +318,16 @@ namespace CalamityMod.Projectiles.Ranged
float particleScale = MathHelper.Clamp(CurrentChargingFrames, 0f, Charge2Frames);
for (int i = 0; i < (ChargeLV2 ? 3 : ChargeLV1 ? 2 : 1); i++)
{
//SparkParticle spark2 = new SparkParticle((GunTipPosition - Projectile.velocity * 4) + Main.rand.NextVector2Circular(12, 12), -Projectile.velocity * Main.rand.NextFloat(16.1f, 30.8f), false, Main.rand.Next(2, 7), Main.rand.NextFloat(particleScale / 350f, particleScale / 270f), baseColor);
//GeneralParticleHandler.SpawnParticle(spark2);
Vector2 dustVel = -Projectile.velocity.RotatedByRandom(100) * Main.rand.NextFloat(1.1f, 15.8f);
Vector2 addedPlace = Positive ? Vector2.Zero : dustVel * 3;
Dust dust = Dust.NewDustPerfect(GunTipPosition + (Positive ? Vector2.Zero : (dustVel * 15 * Utils.GetLerpValue(Charge1Frames, Charge2Frames, CurrentChargingFrames, true))), !Positive ? ModContent.DustType<VoidDust>() : ChargeLV1 ? Main.rand.NextBool((int)(50 * Utils.GetLerpValue(Charge1Frames, Charge2Frames, CurrentChargingFrames, true) + 1)) ? ModContent.DustType<LightDust>() : ModContent.DustType<VoidDust>() : ModContent.DustType<LightDust>(), dustVel - addedPlace * Utils.GetLerpValue(Charge1Frames, Charge2Frames, CurrentChargingFrames, true));
bool dustChance = Main.rand.NextBool((int)(30 * Utils.GetLerpValue(Charge2Frames, Charge1Frames, CurrentChargingFrames, true) + 1));
int dustType = !Positive ? ModContent.DustType<VoidDust>() : ChargeLV1 ? (dustChance ? ModContent.DustType<VoidDust>() : ModContent.DustType<LightDust>()) : ModContent.DustType<LightDust>();
Dust dust = Dust.NewDustPerfect(GunTipPosition + (Positive ? Vector2.Zero : (dustVel * 15 * Utils.GetLerpValue(Charge1Frames, Charge2Frames, CurrentChargingFrames, true))), dustType, dustVel - addedPlace * Utils.GetLerpValue(Charge1Frames, Charge2Frames, CurrentChargingFrames, true));
dust.noGravity = true;
dust.scale = Main.rand.NextFloat(0.5f, 1.25f) * Utils.GetLerpValue(0, Charge1Frames, CurrentChargingFrames, true);
dust.color = baseColor;
}
//Particle orb2 = new GenericBloom(GunTipPosition, Projectile.velocity, Color.Black * 0.5f, (particleScale / 350f) * Main.rand.NextFloat(0.9f, 1.1f), 2, false, false);
//GeneralParticleHandler.SpawnParticle(orb2);
Particle orb = new GenericBloom(GunTipPosition, Projectile.velocity, Positive ? Color.Lerp(Color.White, Color.Black, Utils.GetLerpValue(Charge1Frames, Charge2Frames, CurrentChargingFrames, true)) : Color.Black * Utils.GetLerpValue(0, Charge1Frames, CurrentChargingFrames, true), (particleScale / 400f) * Main.rand.NextFloat(0.9f, 1.1f), 2, false, false);
GeneralParticleHandler.SpawnParticle(orb);
@@ -314,18 +339,19 @@ namespace CalamityMod.Projectiles.Ranged
{
for (int i = 0; i < 3; i++)
{
Particle orb = new CustomSpark(GunTipPosition, Projectile.velocity.RotatedByRandom(100) * Main.rand.NextFloat(1.1f, 15.8f), "CalamityMod/Particles/PearlParticleGlow", false, 3, Main.rand.NextFloat(1.8f, 1.9f), Color.Black, new Vector2(0.3f, 1.3f), false, false);
Particle orb = new CustomSpark(GunTipPosition, Projectile.velocity.RotatedByRandom(100) * Main.rand.NextFloat(1.1f, 15.8f), "CalamityMod/Particles/PearlParticleGlow", false, 3, Main.rand.NextFloat(2.3f, 2.6f), Color.Black, new Vector2(0.3f, 1.35f), false, false);
GeneralParticleHandler.SpawnParticle(orb);
bool color = Main.rand.NextBool(4);
Vector2 dustVel = -Projectile.velocity.RotatedByRandom(100) * Main.rand.NextFloat(1.1f, 15.8f);
Dust dust = Dust.NewDustPerfect(GunTipPosition, ModContent.DustType<VoidDust>(), dustVel);
dust.noGravity = true;
dust.scale = Main.rand.NextFloat(0.5f, 1.25f) * Utils.GetLerpValue(0, Charge1Frames, CurrentChargingFrames, true);
dust.color = baseColor;
dust.scale = Main.rand.NextFloat(0.5f, 1.25f) * (color ? 1.8f : 1);
dust.color = color ? Color.Black : baseColor;
}
}
// Full charge dusts
if (CurrentChargingFrames == Charge1Frames)
if (ChargeLV1 && !hasReachedLV1)
{
for (int i = 0; i < 16; i++)
{
@@ -342,8 +368,11 @@ namespace CalamityMod.Projectiles.Ranged
chargefull.noGravity = true;
chargefull.color = Positive ? useColor : baseColor;
}
Particle orb2 = new CustomPulse(GunTipPosition, Vector2.Zero, Positive ? baseColor : Color.Black, "CalamityMod/Particles/SmallBloomRingLayered", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0.65f, 0.85f, 11, Positive);
GeneralParticleHandler.SpawnParticle(orb2);
hasReachedLV1 = true;
}
if (CurrentChargingFrames == Charge2Frames)
if (ChargeLV2 && !hasReachedLV2)
{
for (int i = 0; i < 25; i++)
{
@@ -360,9 +389,12 @@ namespace CalamityMod.Projectiles.Ranged
chargefull.noGravity = true;
chargefull.color = Positive ? useColor : baseColor;
}
Particle orb2 = new CustomPulse(GunTipPosition, Vector2.Zero, Positive ? baseColor : Color.Black, "CalamityMod/Particles/SmallBloomRingLayered", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0.85f, 1.05f, 11, Positive);
GeneralParticleHandler.SpawnParticle(orb2);
hasReachedLV2 = true;
}
}
if (!hasBegunFiring)
if (!hasBegunFiring && Projectile.ai[2] < 10) // Prevents firing animation from playing when not firing or swapping types
{
Projectile.frame = 6;
fireFrame = 6;
@@ -386,11 +418,17 @@ namespace CalamityMod.Projectiles.Ranged
return false;
Texture2D texture = ModContent.Request<Texture2D>("CalamityMod/Projectiles/Ranged/OntologicalDespoilerHoldout").Value;
Texture2D textureAlt = ModContent.Request<Texture2D>("CalamityMod/Projectiles/Ranged/OntologicalDespoilerHoldout2").Value;
Vector2 drawPosition = Projectile.Center - Main.screenPosition;
float drawRotation = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f);
Rectangle frame = texture.Frame(1, Main.projFrames[Type], 0, Projectile.frame);
Vector2 rotationPoint = frame.Size() * 0.5f;
SpriteEffects flipSprite = (Projectile.spriteDirection * Owner.gravDir == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None;
if (!Owner.CantUseHoldout())
{
float rumble = MathHelper.Clamp(CurrentChargingFrames, 0f, Charge2Frames);
drawPosition += Main.rand.NextVector2Circular(rumble / 120f, rumble / 120f);
}
Texture2D fireTexture = ModContent.Request<Texture2D>("CalamityMod/Projectiles/Ranged/OntologicalDespoilerFlame").Value;
Texture2D fireTexture2 = ModContent.Request<Texture2D>("CalamityMod/Projectiles/Ranged/OntologicalDespoilerFlame2").Value;
@@ -401,9 +439,9 @@ namespace CalamityMod.Projectiles.Ranged
Rectangle frame3 = fireTexture.Frame(1, 6, 0, flashFrame);
Vector2 rotationPoint3 = frame3.Size() * 0.5f;
// Glow Orb
Texture2D rechargeTexture = ModContent.Request<Texture2D>("CalamityMod/Particles/FlameExplosion").Value;
Texture2D rechargeTexture2 = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/BasicCircle").Value;
// Glow Orb
float randSize = Main.rand.NextFloat(0.9f, 1.1f);
if (!hasBegunFiring)
{
@@ -411,11 +449,6 @@ namespace CalamityMod.Projectiles.Ranged
Main.EntitySpriteDraw(rechargeTexture, GunTipPosition - Main.screenPosition, null, baseColor with { A = 0 }, Projectile.rotation + Main.rand.NextFloat(-30, 30), rechargeTexture.Size() * 0.5f, 0.028f * Utils.GetLerpValue(0, Charge2Frames, CurrentChargingFrames, true) * randSize, SpriteEffects.None, 0);
Main.EntitySpriteDraw(rechargeTexture2, GunTipPosition - Main.screenPosition, null, Positive ? Color.Lerp(Color.White, Color.Black, Utils.GetLerpValue(Charge1Frames, Charge2Frames, CurrentChargingFrames, true)) : Color.Black, Projectile.rotation + Main.rand.NextFloat(-30, 30), rechargeTexture2.Size() * 0.5f, 0.58f * Utils.GetLerpValue(0, Charge2Frames, CurrentChargingFrames, true) * randSize, SpriteEffects.None, 0);
}
if (!Owner.CantUseHoldout())
{
float rumble = MathHelper.Clamp(CurrentChargingFrames, 0f, Charge2Frames);
drawPosition += Main.rand.NextVector2Circular(rumble / 120f, rumble / 120f);
}
if (ChargeLV1 && !Positive && !hasBegunFiring)
{
@@ -427,16 +460,13 @@ namespace CalamityMod.Projectiles.Ranged
}
}
Main.EntitySpriteDraw(texture, drawPosition, frame, Projectile.GetAlpha(lightColor), drawRotation, rotationPoint, Projectile.scale * Owner.gravDir, flipSprite);
if (drawInverse && !Positive)
Main.EntitySpriteDraw(textureAlt, drawPosition, frame, Color.White * Utils.GetLerpValue(0, 5, inverseTimer, true), drawRotation, rotationPoint, Projectile.scale * Owner.gravDir, flipSprite);
if (Projectile.frame < 6)
{
if (Positive && false)
Main.EntitySpriteDraw(fireTexture, drawPosition, frame2, baseColor with { A = 0 }, drawRotation, rotationPoint2, Projectile.scale * Owner.gravDir, flipSprite);
else
{
for (int i = 0; i< 4; i++)
Main.EntitySpriteDraw(fireTexture, drawPosition + Main.rand.NextVector2Circular(4.5f, 4.5f), frame2, baseColor with { A = 0 } * 0.3f, drawRotation, rotationPoint2, Projectile.scale * Owner.gravDir, flipSprite);
Main.EntitySpriteDraw(Positive ? fireTexture : fireTexture2, drawPosition, frame2, Positive ? baseColor with { A = 0 } : baseColor, drawRotation, rotationPoint2, Projectile.scale * Owner.gravDir, flipSprite);
}
for (int i = 0; i< 4; i++)
Main.EntitySpriteDraw(fireTexture, drawPosition + Main.rand.NextVector2Circular(4.5f, 4.5f), frame2, baseColor with { A = 0 } * 0.3f, drawRotation, rotationPoint2, Projectile.scale * Owner.gravDir, flipSprite);
Main.EntitySpriteDraw(Positive ? fireTexture : fireTexture2, drawPosition, frame2, Positive ? baseColor with { A = 0 } : baseColor, drawRotation, rotationPoint2, Projectile.scale * Owner.gravDir, flipSprite);
}
if (showFlash)
{
Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

@@ -1,9 +1,7 @@
using System;
using System.Collections.Generic;
using CalamityMod.CalPlayer;
using CalamityMod.Dusts;
using CalamityMod.NPCs;
using CalamityMod.NPCs.NormalNPCs;
using CalamityMod.Items.Weapons.Ranged;
using CalamityMod.Particles;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
@@ -12,7 +10,6 @@ using Terraria;
using Terraria.Audio;
using Terraria.ID;
using Terraria.ModLoader;
using static CalamityMod.Projectiles.Rogue.FinalDawnFlame;
namespace CalamityMod.Projectiles.Ranged
{
@@ -23,7 +20,6 @@ namespace CalamityMod.Projectiles.Ranged
public ref float time => ref Projectile.ai[0];
public Color baseColor = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, Main.DiscoR);
public int sineDir = 1;
public int zagRate = 55;
public Color color1 = Color.DarkMagenta;
public Color color2 = Color.DarkOrchid;
@@ -69,7 +65,6 @@ namespace CalamityMod.Projectiles.Ranged
Projectile.scale = 1f;
sineDir = Main.rand.NextBool() ? 1 : -1;
Projectile.frame = Main.rand.Next(0, 6 + 1);
zagRate = Main.rand.Next(55, 70 + 1);
if (!Positive)
Projectile.penetrate = 1;
}
@@ -182,19 +177,19 @@ namespace CalamityMod.Projectiles.Ranged
}
else
{
for (int i = 0; i < 3; i++)
for (int i = 0; i < MathHelper.Clamp((int)(3 - Projectile.numHits * 0.3f), 1, 3); i++)
{
Particle orb2 = new LineParticle(Projectile.Center, (Projectile.velocity * 4).RotatedByRandom(0.15f) * Main.rand.NextFloat(0.1f, 1f), false, Main.rand.Next(20, 28 + 1), Main.rand.NextFloat(0.6f, 1.3f), baseColor);
GeneralParticleHandler.SpawnParticle(orb2);
}
}
SoundStyle fire = new("CalamityMod/Sounds/Item/NullHit");
SoundStyle fire = OntologicalDespoiler.SmallImpact;
SoundEngine.PlaySound(fire with { Volume = (!Positive ? 1 : 0.7f), Pitch = Main.rand.NextFloat(0, 0.1f) * (!Positive ? 3 : 1) }, Projectile.Center);
}
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
{
if (Projectile.numHits > 0)
Projectile.damage = (int)(Projectile.damage * 0.9f);
Projectile.damage = (int)(Projectile.damage * 0.92f);
if (Projectile.damage < 1)
Projectile.damage = 1;
}