Megalodon rocket delay

This commit is contained in:
Xyk committed 2024-11-09 12:23:15 -08:00
1 parent 3e01f030e5
commit 8a7bddda07
1 file changed
+49 -39
+49 -39
View File
@@ -90,55 +90,65 @@ namespace CalamityMod.Projectiles.Ranged
}
swapType = !swapType;
shotCounter++;
if (shotCounter == 30)
framesBetweenShots = 15;
}
if (framesBetweenShots > 0)
framesBetweenShots--;
}
if (shotCounter == 31)
if (shotCounter == 30 && framesBetweenShots == 0)
{
Vector2 shootVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * 30;
//If the player hasn't hit any shots, increase the multiplier from 0 to 1 to avoid the rocket doing 0 damage
#region Visuals and Sounds
SoundStyle fire = new("CalamityMod/Sounds/Item/GunShotHeavy");
SoundEngine.PlaySound(fire with { Volume = 0.6f, Pitch = 0.2f }, Projectile.Center);
for (int i = 0; i <= 13; i++)
if (framesBetweenShots == 0)
{
Dust dust = Dust.NewDustPerfect(GunTipPosition, 303, shootVelocity.RotatedByRandom(0.5f) * Main.rand.NextFloat(0.2f, 1.1f), 80, default, Main.rand.NextFloat(0.4f, 1.3f));
dust.noGravity = false;
dust.color = Color.White;
Vector2 shootVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * 30;
//If the player hasn't hit any shots, increase the multiplier from 0 to 1 to avoid the rocket doing 0 damage
#region Visuals and Sounds
SoundStyle fire = new("CalamityMod/Sounds/Item/GunShotHeavy");
SoundEngine.PlaySound(fire with { Volume = 0.6f, Pitch = 0.2f }, Projectile.Center);
for (int i = 0; i <= 13; i++)
{
Dust dust = Dust.NewDustPerfect(GunTipPosition, 303, shootVelocity.RotatedByRandom(0.5f) * Main.rand.NextFloat(0.2f, 1.1f), 80, default, Main.rand.NextFloat(0.4f, 1.3f));
dust.noGravity = false;
dust.color = Color.White;
Dust dust2 = Dust.NewDustPerfect(GunTipPosition, 278, shootVelocity.RotatedByRandom(0.5f) * Main.rand.NextFloat(0.1f, 0.8f));
dust2.noGravity = true;
dust2.scale = Main.rand.NextFloat(0.52f, 0.72f);
dust2.color = Color.Lerp(Color.Orange, Color.Gold, Main.rand.NextFloat(0f, 1f));
}
for (int i = 0; i < 14; i++)
{
Particle smoke = new HeavySmokeParticle(GunTipPosition, shootVelocity.RotatedByRandom(0.6f) * Main.rand.NextFloat(0.2f, 1.5f), Color.RoyalBlue, Main.rand.Next(40, 60 + 1), Main.rand.NextFloat(0.3f, 0.6f), 0.5f, Main.rand.NextFloat(-0.2f, 0.2f), Main.rand.NextBool(), required: true);
GeneralParticleHandler.SpawnParticle(smoke);
}
float rotation = Projectile.velocity.ToRotation();
Particle pulse = new DirectionalPulseRing(GunTipPosition, shootVelocity / 4, Color.Gray, new Vector2(1f, 2.5f), rotation, 0.03f, 0.3f, 20);
GeneralParticleHandler.SpawnParticle(pulse);
//Extra sound and muzzle flash if the scaling is at max
if (Owner.Calamity().sharkGunDamageScaling == 30)
{
SoundStyle fireperfect = new("CalamityMod/Sounds/Item/ShadowboltReflect");
SoundEngine.PlaySound(fireperfect with { Volume = 0.6f, Pitch = 0f }, GunTipPosition);
GenericSparkle sparker = new GenericSparkle(GunTipPosition, Vector2.Zero, Color.DarkGoldenrod, Color.Gold, Main.rand.NextFloat(1.1f, 1.8f), 10, 2f, 2.68f);
GeneralParticleHandler.SpawnParticle(sparker);
}
#endregion
Dust dust2 = Dust.NewDustPerfect(GunTipPosition, 278, shootVelocity.RotatedByRandom(0.5f) * Main.rand.NextFloat(0.1f, 0.8f));
dust2.noGravity = true;
dust2.scale = Main.rand.NextFloat(0.52f, 0.72f);
dust2.color = Color.Lerp(Color.Orange, Color.Gold, Main.rand.NextFloat(0f, 1f));
}
for (int i = 0; i < 14; i++)
{
Particle smoke = new HeavySmokeParticle(GunTipPosition, shootVelocity.RotatedByRandom(0.6f) * Main.rand.NextFloat(0.2f, 1.5f), Color.RoyalBlue, Main.rand.Next(40, 60 + 1), Main.rand.NextFloat(0.3f, 0.6f), 0.5f, Main.rand.NextFloat(-0.2f, 0.2f), Main.rand.NextBool(), required: true);
GeneralParticleHandler.SpawnParticle(smoke);
}
float rotation = Projectile.velocity.ToRotation();
Particle pulse = new DirectionalPulseRing(GunTipPosition, shootVelocity / 4, Color.Gray, new Vector2(1f, 2.5f), rotation, 0.03f, 0.3f, 20);
GeneralParticleHandler.SpawnParticle(pulse);
//Extra sound and muzzle flash if the scaling is at max
if (Owner.Calamity().sharkGunDamageScaling == 30)
{
SoundStyle fireperfect = new("CalamityMod/Sounds/Item/ShadowboltReflect");
SoundEngine.PlaySound(fireperfect with { Volume = 0.6f, Pitch = 0f }, GunTipPosition);
GenericSparkle sparker = new GenericSparkle(GunTipPosition, Vector2.Zero, Color.DarkGoldenrod, Color.Gold, Main.rand.NextFloat(1.1f, 1.8f), 10, 2f, 2.68f);
GeneralParticleHandler.SpawnParticle(sparker);
}
#endregion
if(Owner.Calamity().sharkGunDamageScaling == 0)
if (Owner.Calamity().sharkGunDamageScaling == 0)
{
Owner.Calamity().sharkGunDamageScaling++;
}
//Fire the rocket. Damage is 50% of base, multiplied by how many shots the player hits
Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, shootVelocity, ModContent.ProjectileType<MegalodonRocket>(), (int)(Projectile.damage * 0.5f) * Owner.Calamity().sharkGunDamageScaling, Projectile.knockBack, Projectile.owner);
Main.NewText(Owner.Calamity().sharkGunDamageScaling);
//After firing the rocket, kill the projectile to allow left click to be held down
Projectile.Kill();
}
else
{
Owner.Calamity().sharkGunDamageScaling++;
framesBetweenShots--;
}
//Fire the rocket. Damage is 50% of base, multiplied by how many shots the player hits
Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, shootVelocity, ModContent.ProjectileType<MegalodonRocket>(), (int)(Projectile.damage * 0.5f) * Owner.Calamity().sharkGunDamageScaling, Projectile.knockBack, Projectile.owner);
Main.NewText(Owner.Calamity().sharkGunDamageScaling);
//After firing the rocket, kill the projectile to allow left click to be held down
Projectile.Kill();
}
Time++;
}