Visuals start + Migrated Voidragon to holdout

This commit is contained in:
mochi-angel committed 2024-11-21 13:45:25 -08:00
1 parent 83be2a7a3f
commit 2bf4c65eeb
9 files changed
+225 -82

No files matched your search

+1 -1
View File
@@ -24,7 +24,7 @@ namespace CalamityMod.Items.Weapons.Ranged
{
Item.width = 90;
Item.height = 38;
Item.damage = 155;
Item.damage = 375;
Item.DamageType = DamageClass.Ranged;
Item.useTime = 3;
Item.useAnimation = 3;
+10 -29
View File
@@ -14,7 +14,7 @@ namespace CalamityMod.Items.Weapons.Ranged
public class Voidragon : ModItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Weapons.Ranged";
private int shotType = 1;
public int sharkGunDamageScaling = 0;
public override void SetStaticDefaults()
{
@@ -32,11 +32,14 @@ namespace CalamityMod.Items.Weapons.Ranged
Item.useStyle = ItemUseStyleID.Shoot;
Item.noMelee = true;
Item.knockBack = 5f;
Item.UseSound = SoundID.Item11;
Item.UseSound = null;
Item.autoReuse = true;
Item.noUseGraphic = true;
Item.channel = true;
Item.shoot = ProjectileID.PurificationPowder;
Item.shootSpeed = 18f;
Item.useAmmo = AmmoID.Bullet;
Item.shoot = ModContent.ProjectileType<VoidragonHoldout>();
Item.value = CalamityGlobalItem.RarityHotPinkBuyPrice;
Item.rare = ModContent.RarityType<HotPink>();
@@ -44,42 +47,20 @@ namespace CalamityMod.Items.Weapons.Ranged
Item.Calamity().canFirePointBlankShots = true;
}
public override Vector2? HoldoutOffset()
{
return new Vector2(-10, 0);
}
public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0;
public override bool CanConsumeAmmo(Item ammo, Player player) => Main.rand.NextFloat() > 0.95f && player.ownedProjectileCounts[Item.shoot] > 0;
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
{
float SpeedX = velocity.X + (float)Main.rand.Next(-5, 6) * 0.05f;
float SpeedY = velocity.Y + (float)Main.rand.Next(-5, 6) * 0.05f;
if (shotType > 2)
shotType = 1;
if (shotType == 1)
Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI);
else
Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType<Projectiles.Ranged.Voidragon>(), damage, knockback, player.whoAmI);
shotType++;
Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType<VoidragonTentacle>(), damage, knockback, player.whoAmI, (Main.rand.Next(-160, 160) * 0.001f), (Main.rand.Next(-160, 160) * 0.001f));
Projectile holdout = Projectile.NewProjectileDirect(source, position, velocity, Item.shoot, damage, knockback, player.whoAmI);
holdout.velocity = (player.Calamity().mouseWorld - player.MountedCenter).SafeNormalize(Vector2.Zero);
return false;
}
public override bool CanConsumeAmmo(Item ammo, Player player)
{
if (Main.rand.Next(0, 100) < 50 || shotType % 2 == 0)
return false;
return true;
}
public override void AddRecipes()
{
CreateRecipe().
AddIngredient<Seadragon>().
AddIngredient<CleansingBlaze>().
AddIngredient<ShadowspecBar>(5).
AddTile<DraedonsForge>().
Register();
@@ -245,7 +245,7 @@ VanquisherArrowMain.DisplayName: Vanquisher Arrow
VanquisherArrowProj.DisplayName: Vanquisher Arrow Proj
VeriumBoltProj.DisplayName: Verium Bolt
VernalBolt.DisplayName: Vernal Bolt
Voidragon.DisplayName: Voidragon Blast
VoidBlast.DisplayName: Void Blast
VoidragonTentacle.DisplayName: Voidragon Tentacle
WaterSpout.DisplayName: Spout
WildfireBloomFire.DisplayName: Wildfire Fire
+7 -35
View File
@@ -29,6 +29,7 @@ namespace CalamityMod.Projectiles.Ranged
Projectile.timeLeft = Lifetime;
Projectile.MaxUpdates = 3;
Projectile.usesLocalNPCImmunity = true;
Projectile.tileCollide = false;
Projectile.localNPCHitCooldown = -1;
Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration;
}
@@ -44,7 +45,7 @@ namespace CalamityMod.Projectiles.Ranged
}
if (Projectile.timeLeft <= Lifetime - 4)
{
Particle spark = new SparkParticle(Projectile.Center - Projectile.velocity * 2, -Projectile.velocity * 0.05f, false, 10, 1f, Color.Aquamarine);
Particle spark = new SparkParticle(Projectile.Center - Projectile.velocity * 2, -Projectile.velocity * 0.05f, false, 10, 1.1f, Color.Aquamarine);
GeneralParticleHandler.SpawnParticle(spark);
if (Main.rand.NextBool(8))
{
@@ -66,35 +67,6 @@ namespace CalamityMod.Projectiles.Ranged
}
}
}
//We use TileCollide and Onhit instead of OnKill due to it having pierce
public override bool OnTileCollide(Vector2 oldVelocity)
{
Collision.HitTiles(Projectile.Center, Projectile.velocity, Projectile.width, Projectile.height);
for (int i = 0; i < 4; ++i)
{
int bloodLifetime = Main.rand.Next(22, 25);
float bloodScale = Main.rand.NextFloat(0.6f, 0.8f);
Color bloodColor = Color.Lerp(Color.RoyalBlue * 0.7f, Color.DarkBlue, Main.rand.NextFloat());
bloodColor = Color.Lerp(bloodColor, new Color(51, 22, 94), Main.rand.NextFloat(0.65f));
if (Main.rand.NextBool(20))
bloodScale *= 2f;
float randomSpeedMultiplier = Main.rand.NextFloat(1.25f, 2.25f);
Vector2 bloodVelocity = Main.rand.NextVector2Unit() * 2 * randomSpeedMultiplier;
bloodVelocity.Y -= 5f;
BloodParticle blood = new BloodParticle(Projectile.Center, bloodVelocity, bloodLifetime, bloodScale, bloodColor);
GeneralParticleHandler.SpawnParticle(blood);
}
for (int i = 0; i <= 2; i++)
{
LineParticle spark = new LineParticle(Projectile.Center, -Projectile.velocity.RotatedBy(Main.rand.NextFloat(0.18f, 0.44f)) * Main.rand.NextFloat(0.4f, 2.5f), false, 8, 0.9f, Main.rand.NextBool() ? Color.CornflowerBlue : Color.RoyalBlue);
GeneralParticleHandler.SpawnParticle(spark);
LineParticle spark2 = new LineParticle(Projectile.Center, -Projectile.velocity.RotatedBy(Main.rand.NextFloat(-0.18f, -0.44f)) * Main.rand.NextFloat(0.4f, 2.5f), false, 8, 0.9f, Main.rand.NextBool() ? Color.CornflowerBlue : Color.RoyalBlue);
GeneralParticleHandler.SpawnParticle(spark2);
}
return true;
}
public override void OnKill(int timeLeft)
{
@@ -114,7 +86,7 @@ namespace CalamityMod.Projectiles.Ranged
if (Projectile.numHits == 0)
{
Player Owner = Main.player[Projectile.owner];
Projectile fishy = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Owner.Center + Main.rand.NextVector2Circular(150, 150), Vector2.Zero, ModContent.ProjectileType<SeaDragonRocket>(), Projectile.damage, Projectile.knockBack, Projectile.owner);
Projectile fishy = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Owner.Center + Main.rand.NextVector2Circular(150, 150), Vector2.Zero, ModContent.ProjectileType<SeaDragonRocket>(), (int)(Projectile.damage * 1.5f), Projectile.knockBack, Projectile.owner);
fishy.ai[2] = ((Owner.Calamity().sharkGunDamageScaling + 1) * 0.02f) + 0.1f;
}
for (int i = 0; i < 4; ++i)
@@ -135,9 +107,9 @@ namespace CalamityMod.Projectiles.Ranged
}
for (int i = 0; i <= 2; i++)
{
LineParticle spark = new LineParticle(Projectile.Center, -Projectile.velocity.RotatedBy(Main.rand.NextFloat(0.18f, 0.44f)) * Main.rand.NextFloat(0.4f, 1.5f), false, 8, 0.9f, Main.rand.NextBool() ? Color.CornflowerBlue * 0.6f : Color.MediumBlue);
LineParticle spark = new LineParticle(Projectile.Center, -Projectile.velocity.RotatedBy(Main.rand.NextFloat(0.18f, 0.44f)) * Main.rand.NextFloat(0.4f, 1.5f), false, 8, 0.9f, Main.rand.NextBool() ? Color.CornflowerBlue : Color.RoyalBlue);
GeneralParticleHandler.SpawnParticle(spark);
LineParticle spark2 = new LineParticle(Projectile.Center, -Projectile.velocity.RotatedBy(Main.rand.NextFloat(-0.18f, -0.44f)) * Main.rand.NextFloat(0.4f, 1.5f), false, 8, 0.9f, Main.rand.NextBool() ? Color.CornflowerBlue * 0.6f : Color.MediumBlue);
LineParticle spark2 = new LineParticle(Projectile.Center, -Projectile.velocity.RotatedBy(Main.rand.NextFloat(-0.18f, -0.44f)) * Main.rand.NextFloat(0.4f, 1.5f), false, 8, 0.9f, Main.rand.NextBool() ? Color.CornflowerBlue : Color.RoyalBlue);
GeneralParticleHandler.SpawnParticle(spark2);
}
}
@@ -168,9 +140,9 @@ namespace CalamityMod.Projectiles.Ranged
}
for (int i = 0; i <= 2; i++)
{
LineParticle spark = new LineParticle(Projectile.Center, -Projectile.velocity.RotatedBy(Main.rand.NextFloat(0.18f, 0.44f)) * Main.rand.NextFloat(0.4f, 1.5f), false, 8, 0.9f, Main.rand.NextBool() ? Color.RoyalBlue * 0.7f : Color.MediumBlue);
LineParticle spark = new LineParticle(Projectile.Center, -Projectile.velocity.RotatedBy(Main.rand.NextFloat(0.18f, 0.44f)) * Main.rand.NextFloat(0.4f, 1.5f), false, 8, 0.9f, Main.rand.NextBool() ? Color.CornflowerBlue : Color.RoyalBlue);
GeneralParticleHandler.SpawnParticle(spark);
LineParticle spark2 = new LineParticle(Projectile.Center, -Projectile.velocity.RotatedBy(Main.rand.NextFloat(-0.18f, -0.44f)) * Main.rand.NextFloat(0.4f, 1.5f), false, 8, 0.9f, Main.rand.NextBool() ? Color.RoyalBlue * 0.7f : Color.MediumBlue);
LineParticle spark2 = new LineParticle(Projectile.Center, -Projectile.velocity.RotatedBy(Main.rand.NextFloat(-0.18f, -0.44f)) * Main.rand.NextFloat(0.4f, 1.5f), false, 8, 0.9f, Main.rand.NextBool() ? Color.CornflowerBlue : Color.RoyalBlue);
GeneralParticleHandler.SpawnParticle(spark2);
}
}
+21 -9
View File
@@ -1,6 +1,7 @@
using System;
using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Dusts;
using CalamityMod.Particles;
using CalamityMod.Projectiles.Typeless;
using Microsoft.Xna.Framework;
using Terraria;
@@ -52,13 +53,23 @@ namespace CalamityMod.Projectiles.Ranged
else
Projectile.velocity *= 0.9f;
}
if (Main.rand.NextBool(3))
if (Main.rand.NextBool(10))
{
Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType<LightDust>(), -Projectile.velocity.RotatedByRandom(0.2f) * Main.rand.NextFloat(0.1f, 0.5f));
dust.noGravity = false;
dust.scale = 0.9f;
dust.color = Color.DodgerBlue;
dust.noLightEmittence = true;
Dust trailDust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(5, 5) - Projectile.velocity, 66);
trailDust.scale = Main.rand.NextFloat(0.7f, 0.85f);
trailDust.velocity = -Projectile.velocity * Main.rand.NextFloat(0.3f, 0.5f);
trailDust.color = Main.rand.NextBool() ? Color.AliceBlue : Color.SkyBlue;
trailDust.noGravity = true;
if (attacking)
{
Particle trail = new SparkParticle(Projectile.Center + Main.rand.NextVector2Circular(10, 10), -Projectile.velocity * Main.rand.NextFloat(0.2f, 0.8f), false, 15, Main.rand.NextFloat(0.6f, 0.8f), Color.RoyalBlue);
GeneralParticleHandler.SpawnParticle(trail);
}
}
if (Main.rand.NextBool(8) && !attacking)
{
Particle Star = new CritSpark(Projectile.Center, -Projectile.velocity * Main.rand.NextFloat(0.3f, 0.5f), Color.SkyBlue, Color.DeepSkyBlue, Main.rand.NextFloat(0.4f, 0.7f), 30, 0.1f, 3f);
GeneralParticleHandler.SpawnParticle(Star);
}
time++;
}
@@ -68,7 +79,8 @@ namespace CalamityMod.Projectiles.Ranged
// Explode on kill if attacking, else just poof out
if (attacking)
{
SoundEngine.PlaySound(SoundID.Item110, Projectile.Center);
SoundStyle hitSound = new("CalamityMod/Sounds/NPCHit/AnahitaHit", 3);
SoundEngine.PlaySound(hitSound with { Volume = 2f }, Projectile.Center);
// Create Blast (If you want to know how to use this blast, check the projectile, it tells you exactly how to use it!)
float blastSize = 80;
@@ -83,7 +95,7 @@ namespace CalamityMod.Projectiles.Ranged
blast.DamageType = Projectile.DamageType;
// Add visuals here
for (int i = 0; i < 20; i++)
for (int i = 0; i < 1; i++)
{
Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType<LightDust>(), Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(9, 12));
dust.noGravity = true;
@@ -94,7 +106,7 @@ namespace CalamityMod.Projectiles.Ranged
}
else
{
for (int i = 0; i < 10; i++)
for (int i = 0; i < 7; i++)
{
Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType<LightDust>(), Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(4, 6));
dust.noGravity = false;
+5 -1
View File
@@ -55,7 +55,7 @@ namespace CalamityMod.Projectiles.Ranged
{
if (framesBetweenShots == 0 && shotCounter <= 51)
{
Vector2 shootVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * 19;
Vector2 shootVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * 30;
#region Debug Text Display
//Main.NewText(shotCounter);
//Main.NewText(Owner.Calamity().sharkGunDamageScaling);
@@ -103,6 +103,10 @@ namespace CalamityMod.Projectiles.Ranged
{
if (framesBetweenShots == 0)
{
SoundStyle hitSound = new("CalamityMod/Sounds/Custom/AuricMine", 3);
SoundEngine.PlaySound(hitSound with { Pitch = 1.1f , Volume = 2f }, Projectile.Center);
Particle Star = new CritSpark(GunTipPosition + (-Projectile.velocity.RotatedBy(0.1 * Projectile.direction) * 28), Vector2.Zero, Color.Goldenrod, Color.OrangeRed, 2f, 20, 0.2f, 3f);
GeneralParticleHandler.SpawnParticle(Star);
Projectile.Kill();
for (int x = 0; x < Main.maxProjectiles; x++)
{
@@ -7,7 +7,7 @@ using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Ranged
{
public class Voidragon : ModProjectile, ILocalizedModType
public class VoidBlast : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Ranged";
public override void SetStaticDefaults()
@@ -31,11 +31,6 @@ namespace CalamityMod.Projectiles.Ranged
public override void AI()
{
if (Projectile.soundDelay == 0)
{
Projectile.soundDelay = 150 + Main.rand.Next(40);
SoundEngine.PlaySound(SoundID.Item92, Projectile.position);
}
Projectile.localAI[0] += 1f;
if (Projectile.localAI[0] == 12f)
{
File renamed without changes.

Before

Width:  |  Height:  |  Size: 364 B

After

Width:  |  Height:  |  Size: 364 B

+179
View File
@@ -0,0 +1,179 @@
using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Items.Weapons.Ranged;
using CalamityMod.Particles;
using CalamityMod.Projectiles.BaseProjectiles;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using ReLogic.Utilities;
using Terraria;
using Terraria.Audio;
using Terraria.GameContent;
using Terraria.ModLoader;
using Terraria.ID;
using Steamworks;
using CalamityMod.Projectiles.Turret;
using Mono.Cecil;
namespace CalamityMod.Projectiles.Ranged
{
public class VoidragonHoldout : BaseGunHoldoutProjectile
{
public override int AssociatedItemID => ModContent.ItemType<Voidragon>();
public override float MaxOffsetLengthFromArm => 24f;
public override float OffsetXUpwards => -5f;
public override float BaseOffsetY => -1f;
public override float OffsetYDownwards => 5f;
public override Vector2 GunTipPosition => Projectile.Center + (Projectile.velocity * 50).RotatedBy(0.13f * Projectile.direction);
public int Time = 0;
public int shotCounter = 0;
public int framesBetweenShots = 0;
public bool swapType = false;
public override void KillHoldoutLogic()
{
//If the player is dead, kill the holdout.
if (Owner.CantUseHoldout() || HeldItem.type != Owner.ActiveItem().type)
Projectile.Kill();
}
public override void HoldoutAI()
{
//Pause to give the effect of reloading
if (Time == 30)
{
Player Owner = Main.player[Projectile.owner];
SoundEngine.PlaySound(SoundID.Item149, Projectile.Center);
if (Main.netMode != NetmodeID.Server)
{
string goreType = "MegalodonMag";
Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.Center + (-Projectile.velocity * 18), Projectile.velocity.RotatedBy(2f * -Owner.direction) * Main.rand.NextFloat(0.6f, 0.7f), Mod.Find<ModGore>(goreType).Type);
}
//Set the scaling to 0 whenever it reloads
Owner.Calamity().sharkGunDamageScaling = 0;
}
if (Time >= 90)
{
if (framesBetweenShots == 0 && shotCounter <= 51)
{
Vector2 shootVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * 19;
#region Debug Text Display
//Main.NewText(shotCounter);
//Main.NewText(Owner.Calamity().sharkGunDamageScaling);
#endregion
#region Visuals and Sounds
SoundStyle fire = new("CalamityMod/Sounds/Item/GunShotTiny");
SoundEngine.PlaySound(fire with { Volume = 0.4f, PitchVariance = 0.2f }, Projectile.Center);
Particle sparker = new CritSpark(GunTipPosition, Vector2.Zero, Color.Gold, Color.LightGoldenrodYellow, 1.7f, 3, 0.5f, 3f);
GeneralParticleHandler.SpawnParticle(sparker);
for (int i = 0; i <= 4; i++)
{
Dust dust = Dust.NewDustPerfect(GunTipPosition, Main.rand.NextBool(3) ? 303 : 244, (shootVelocity * Main.rand.NextFloat(0.2f, 1.1f)).RotatedByRandom(0.4f));
dust.noGravity = true;
dust.scale = Main.rand.NextFloat(0.8f, 1.4f);
}
#endregion
//How many frames between firing projectiles, and how far the gun moves backward to give the effect of recoil. Change this number to edit fire rate
framesBetweenShots = 3;
OffsetLengthFromArm -= 3f;
//Here we detect which ammo the bullets will use
Owner.PickAmmo(Owner.ActiveItem(), out int bulletAMMO, out float SpeedNoUse, out int bulletDamage, out float kBackNoUse, out _, !Main.rand.NextBool(4));
//Alternate between shooting bullets and water streams. We seperate it into two different projectiles due to the bullets needing to use a Global Projectile to track the damage multiplier
if (!swapType)
{
Projectile scalingShot = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), GunTipPosition, shootVelocity.RotatedByRandom(MathHelper.ToRadians(1.5f)), bulletAMMO, Projectile.damage, Projectile.knockBack, Projectile.owner);
CalamityGlobalProjectile cgp = scalingShot.Calamity();
cgp.sharkBullets = true;
//Only eject casings from the gun if bullets are fired, preventing too many at once
if (Main.netMode != NetmodeID.Server)
{
string goreType = "MegalodonCasing";
Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.Center + (-Projectile.velocity * 18), -Projectile.velocity * 4f, Mod.Find<ModGore>(goreType).Type);
}
}
if (swapType)
{
Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, shootVelocity.RotatedByRandom(MathHelper.ToRadians(1.5f)), ModContent.ProjectileType<VoidBlast>(), Projectile.damage, Projectile.knockBack, Projectile.owner);
}
swapType = !swapType;
shotCounter++;
//Allow a pause before firing the rocket. This allows the final bullet a chance to hit before the rocket is fired. Lowering this number reduces the delay, but may also cause the gun to become inconsistent
if (shotCounter == 50)
framesBetweenShots = 18;
}
if (framesBetweenShots > 0)
framesBetweenShots--;
}
if (shotCounter == 50 && framesBetweenShots == 0)
{
if (framesBetweenShots == 0)
{
Vector2 shootVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * 30;
//Debug Text
//Main.NewText(Owner.Calamity().sharkGunDamageScaling);
#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
//If the player hasn't hit any shots, increase the multiplier from 0 to 1 to avoid the rocket doing 0 damage
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);
//After firing the rocket, kill the projectile to allow left click to be held down
Projectile.Kill();
}
else
{
framesBetweenShots--;
}
}
Time++;
}
public override bool PreDraw(ref Color lightColor)
{
if (Time < 2)
return false;
Texture2D texture = TextureAssets.Projectile[Type].Value;
Vector2 drawPosition = Projectile.Center - Main.screenPosition;
float drawRotation = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f);
Vector2 rotationPoint = texture.Size() * 0.5f;
SpriteEffects flipSprite = (Projectile.spriteDirection * Owner.gravDir == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None;
Main.EntitySpriteDraw(texture, drawPosition, null, Projectile.GetAlpha(lightColor), drawRotation, rotationPoint, Projectile.scale * Owner.gravDir, flipSprite);
return false;
}
}
}