Megalodon Resprite + Seadragon Start

This commit is contained in:
mochi-angel committed 2024-11-09 21:03:15 -08:00
1 parent 2aa0e87f7f
commit 64b97affeb
11 files changed
+331 -139

No files matched your search

Binary file not shown.

After

Width:  |  Height:  |  Size: 226 B

+2 -2
View File
@@ -18,8 +18,8 @@ namespace CalamityMod.Items.Weapons.Ranged
public override void SetDefaults()
{
Item.width = 72;
Item.height = 32;
Item.width = 92;
Item.height = 42;
Item.damage = 58;
Item.DamageType = DamageClass.Ranged;
Item.useTime = 3;
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

+12 -52
View File
@@ -24,75 +24,35 @@ namespace CalamityMod.Items.Weapons.Ranged
{
Item.width = 90;
Item.height = 38;
Item.damage = 60;
Item.damage = 155;
Item.DamageType = DamageClass.Ranged;
Item.useTime = 5;
Item.useAnimation = 5;
Item.useTime = 3;
Item.useAnimation = 3;
Item.channel = true;
Item.useStyle = ItemUseStyleID.Shoot;
Item.noMelee = true;
Item.knockBack = 2.5f;
Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice;
Item.rare = ModContent.RarityType<Turquoise>();
Item.UseSound = SoundID.Item11;
Item.UseSound = null;
Item.autoReuse = true;
Item.shoot = ModContent.ProjectileType<MegalodonShot>();
Item.shootSpeed = 16f;
Item.noUseGraphic = true;
Item.shoot = ModContent.ProjectileType<SeadragonHoldout>();
Item.shootSpeed = 2f;
Item.useAmmo = AmmoID.Bullet;
Item.Calamity().canFirePointBlankShots = true;
}
public override Vector2? HoldoutOffset() => 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)
{
// Reposition to the gun's tip + add some inaccuracy
Vector2 newPos = position + new Vector2(74f, player.direction * (Math.Abs(velocity.SafeNormalize(Vector2.Zero).X) < 0.02f ? -2f : -8f)).RotatedBy(velocity.ToRotation());
Vector2 newVel = velocity.RotatedByRandom(MathHelper.ToRadians(5f));
// Fire either the bullet or the water jet, depending on cadence.
bool fireWater = shotCounter % 2 == 0;
int projectileToFire = fireWater ? Item.shoot : type;
Projectile.NewProjectile(source, newPos, newVel, projectileToFire, damage, knockback, player.whoAmI);
// Always fires a close range water blast.
// It goes in the same direction as the main shot but has a minor velocity variation to be less monotonous.
int waterRingDamage = (int)(damage * 0.5f);
float boostedKB = knockback + 7f; // Same KB bonus as Megalodon. The muzzle blast will annihilate nearby enemies and send their gibs flying.
Projectile.NewProjectile(source, newPos, newVel * Main.rand.NextFloat(0.45f, 0.65f), ModContent.ProjectileType<ArcherfishRing>(), waterRingDamage, boostedKB, player.whoAmI);
// Check cadence position to determine which bonus projectile to add, if any.
bool fireRocket = shotCounter == 9;
bool muzzleBlast = shotCounter == 17;
// Rockets have their own more chaotic spread than bullets.
if (fireRocket)
{
int rocketDamage = damage * 3;
Projectile.NewProjectile(source, newPos, newVel * 1.2f, ModContent.ProjectileType<SeaDragonRocket>(), rocketDamage, knockback, player.whoAmI);
SoundEngine.PlaySound(SoundID.Item109, player.Center);
}
// Muzzle blasts are always directly in line with the gun's muzzle.
if (muzzleBlast)
{
int muzzleBlastDamage = damage * 12; // "This might be too much but it's every 18th shot..." Narrator: 25x was in fact too much.
float muzzleBlastKB = knockback + 12f;
Projectile.NewProjectile(source, newPos, velocity, ModContent.ProjectileType<SeaDragonMuzzleBlast>(), muzzleBlastDamage, muzzleBlastKB, player.whoAmI);
// Play additional sound for muzzle blasts
SoundEngine.PlaySound(SoundID.DD2_ExplosiveTrapExplode, position);
}
// Increment and then reset the shot counter so the pattern loops indefinitely. The muzzle blast replaces the first bullet in the repeating pattern.
++shotCounter;
if (shotCounter > 17)
shotCounter = 2;
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;
}
// Does not consume ammo when firing water jets.
public override bool CanConsumeAmmo(Item ammo, Player player) => shotCounter % 2 == 1;
public override void AddRecipes()
{
CreateRecipe().
@@ -743,7 +743,7 @@ Megalodon: {
Tooltip:
'''
Loads a 30 round magazine of bullets and pressurized water streams that are rapidly unleashed
After firing, the gun unleashes a massive homing rocket before reloading
After firing, the gun unleashes a powerful homing rocket before reloading
Rocket damage is based on how many shots hit
'''
}
@@ -19,6 +19,7 @@ AuricBullet.DisplayName: Auric Bullet
AuroraFire.DisplayName: Aurora Blaze
BallistaGreatArrow.DisplayName: Ballista Great Arrow
BarinadeArrow.DisplayName: Fin Arrow
BlahajBlast.DisplayName: Blahaj Blast
BlightFlames.DisplayName: Blight Flames
BlissfulBombardierDustProjectile.DisplayName: Holy Flare Dust
BloodBoilerFire.DisplayName: Blood Fire
@@ -182,7 +183,6 @@ ScorchedEarthClusterBomb.DisplayName: Cluster Bomb
ScorchedEarthRocket.DisplayName: Rocket
ScorpioRocket.DisplayName: Nano Missile
ScorpioLargeRocket.DisplayName: Nano Nuke
SeaDragonMuzzleBlast.DisplayName: Seadragon Muzzle Blast
SeaDragonRocket.DisplayName: Seadragon RPG
SeasSearingBubble.DisplayName: Searing Bubble
SeasSearingSecondary.DisplayName: Hydroshower
+178
View File
@@ -0,0 +1,178 @@
using System.Composition.Hosting.Core;
using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Dusts;
using CalamityMod.Particles;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.Audio;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Ranged
{
public class BlahajBlast : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Ranged";
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
public static int Lifetime = 600;
public override void SetDefaults()
{
Projectile.width = 8;
Projectile.height = 8;
Projectile.friendly = true;
Projectile.DamageType = DamageClass.Ranged;
Projectile.ignoreWater = true;
Projectile.penetrate = 4;
Projectile.alpha = 255;
Projectile.timeLeft = Lifetime;
Projectile.MaxUpdates = 3;
Projectile.usesLocalNPCImmunity = true;
Projectile.localNPCHitCooldown = -1;
Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration;
}
public override void AI()
{
if (Main.rand.NextBool(3))
{
Gore bubble = Gore.NewGorePerfect(Projectile.GetSource_FromAI(), Projectile.position, Projectile.velocity * 0.2f + Main.rand.NextVector2Circular(1f, 1f), 411);
bubble.timeLeft = 9 + Main.rand.Next(7);
bubble.scale = Main.rand.NextFloat(0.6f, 1f);
bubble.type = Main.rand.NextBool(3) ? 412 : 411;
}
if (Projectile.timeLeft <= Lifetime - 4)
{
Particle spark = new SparkParticle(Projectile.Center - Projectile.velocity * 2, -Projectile.velocity * 0.05f, false, 10, 1f, Color.Aquamarine);
GeneralParticleHandler.SpawnParticle(spark);
if (Main.rand.NextBool(8))
{
MediumMistParticle smoke = new MediumMistParticle(Projectile.Center + Main.rand.NextVector2Circular(25, 25), -Projectile.velocity * 0.05f, Main.rand.NextBool(3) ? Color.SeaGreen : Color.SkyBlue, Color.DarkBlue, 0.5f, 180, 3f);
GeneralParticleHandler.SpawnParticle(smoke);
}
}
if (Projectile.timeLeft <= Lifetime - 8)
{
if (Main.rand.NextBool(2))
{
Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(15, 15), ModContent.DustType<LightDust>(), -Projectile.velocity);
dust.noGravity = true;
dust.scale = Main.rand.NextFloat(0.9f, 1.1f);
dust.color = Main.rand.NextBool() ? Color.DarkBlue : Color.DarkBlue * 0.5f;
Particle trail = new SparkParticle(Projectile.Center + Main.rand.NextVector2Circular(10, 10), -Projectile.velocity * Main.rand.NextFloat(0.2f, 0.8f), false, 30, Main.rand.NextFloat(0.4f, 0.6f), Color.RoyalBlue);
GeneralParticleHandler.SpawnParticle(trail);
}
}
}
//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)
{
// Bubbles
for (int i = 0; i < 10; i++)
{
Gore bubble = Gore.NewGorePerfect(Projectile.GetSource_FromAI(), Projectile.position, Projectile.velocity.RotatedByRandom(MathHelper.ToRadians(60f)) * 0.3f, 411);
bubble.timeLeft = 9 + Main.rand.Next(7);
bubble.scale = Main.rand.NextFloat(0.6f, 1f);
bubble.type = Main.rand.NextBool(3) ? 412 : 411;
}
}
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
{
target.AddBuff(ModContent.BuffType<RiptideDebuff>(), 60);
//Only increase damage of the rocket on the first hit
if (Projectile.numHits == 0)
{
Player Owner = Main.player[Projectile.owner];
Owner.Calamity().sharkGunDamageScaling++;
}
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, 1.5f), false, 8, 0.9f, Main.rand.NextBool() ? Color.CornflowerBlue * 0.6f : Color.MediumBlue);
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);
GeneralParticleHandler.SpawnParticle(spark2);
}
}
public override void OnHitPlayer(Player target, Player.HurtInfo info)
{
{
if (Projectile.numHits == 0)
{
Player Owner = Main.player[Projectile.owner];
Owner.Calamity().sharkGunDamageScaling++;
}
target.AddBuff(ModContent.BuffType<RiptideDebuff>(), 60);
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, 1.5f), false, 8, 0.9f, Main.rand.NextBool() ? Color.RoyalBlue * 0.7f : Color.MediumBlue);
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);
GeneralParticleHandler.SpawnParticle(spark2);
}
}
}
}
}
+8 -5
View File
@@ -23,6 +23,7 @@ namespace CalamityMod.Projectiles.Ranged
public override float OffsetXUpwards => -5f;
public override float BaseOffsetY => -1f;
public override float OffsetYDownwards => 5f;
public override Vector2 GunTipPosition => Projectile.Center + (Projectile.velocity * 45).RotatedBy(0.18f * Projectile.direction);
public int Time = 0;
public int shotCounter = 0;
@@ -43,11 +44,6 @@ namespace CalamityMod.Projectiles.Ranged
{
Player Owner = Main.player[Projectile.owner];
SoundEngine.PlaySound(SoundID.Item149, Projectile.Center);
if (Main.netMode != NetmodeID.Server)
{
string goreType = Main.rand.NextBool() ? "EmptyAnimosityShell" : "EmptyAnimosityShell2";
Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.Center, Projectile.velocity.RotatedBy(2f * -Owner.direction) * Main.rand.NextFloat(0.6f, 0.7f), Mod.Find<ModGore>(goreType).Type);
}
Owner.Calamity().sharkGunDamageScaling = 0;
}
if (Time >= 90)
@@ -83,6 +79,12 @@ namespace CalamityMod.Projectiles.Ranged
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)
{
@@ -90,6 +92,7 @@ namespace CalamityMod.Projectiles.Ranged
}
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 == 30)
framesBetweenShots = 18;
}
+1 -1
View File
@@ -40,7 +40,7 @@ namespace CalamityMod.Projectiles.Ranged
public override void AI()
{
Lighting.AddLight(Projectile.Center, 0.3f, 0.5f, 0.1f);
if (Projectile.timeLeft <= Lifetime - 3)
if (Projectile.timeLeft <= Lifetime - 6)
{
AltSparkParticle spark = new AltSparkParticle(Projectile.Center, -Projectile.velocity * 0.05f, false, 15, 1f, Color.Gold * 0.1f);
GeneralParticleHandler.SpawnParticle(spark);
@@ -1,77 +0,0 @@
using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.Audio;
using Terraria.DataStructures;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Ranged
{
public class SeaDragonMuzzleBlast : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Ranged";
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
public override void SetDefaults()
{
Projectile.width = 80;
Projectile.height = 80;
Projectile.friendly = true;
Projectile.DamageType = DamageClass.Ranged;
Projectile.ignoreWater = true;
Projectile.penetrate = -1;
Projectile.tileCollide = false;
Projectile.timeLeft = 8;
Projectile.MaxUpdates = 4;
Projectile.usesLocalNPCImmunity = true;
Projectile.localNPCHitCooldown = -1;
// This projectile is already point blank. It cannot be boosted by point blank.
}
public override void AI()
{
// Belching smoke and flames copied from Handheld Tank with a few edits (lasts 8 frames, but all happens at once due to extra updates)
for (int i = 0; i < 30; ++i)
{
// Pick a random type of fire (there's a little water mixed in)
int dustID;
switch (Main.rand.Next(6))
{
case 0:
dustID = 170;
break;
case 1:
case 2:
dustID = 174;
break;
default:
dustID = 33;
break;
}
// Choose a random speed and angle to belch out the fire
float dustSpeed = Main.rand.NextFloat(3.0f, 13.0f);
float angleRandom = 0.07f;
Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(Projectile.velocity.ToRotation());
dustVel = dustVel.RotatedBy(-angleRandom);
dustVel = dustVel.RotatedByRandom(2.0f * angleRandom);
// Pick a size for the fire particle
float scale = Main.rand.NextFloat(0.7f, 1.8f);
// Actually spawn the fire
int idx = Dust.NewDust(Projectile.Center, 1, 1, dustID, dustVel.X, dustVel.Y, 0, default, scale);
Main.dust[idx].noGravity = true;
Main.dust[idx].position = Projectile.Center;
}
}
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
{
target.AddBuff(BuffID.OnFire3, 240);
}
}
}
+128
View File
@@ -0,0 +1,128 @@
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 SeadragonHoldout : BaseGunHoldoutProjectile
{
public override int AssociatedItemID => ModContent.ItemType<Seadragon>();
public override float MaxOffsetLengthFromArm => 24f;
public override float OffsetXUpwards => -5f;
public override float BaseOffsetY => -1f;
public override float OffsetYDownwards => 5f;
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 = Main.rand.NextBool() ? "EmptyAnimosityShell" : "EmptyAnimosityShell2";
Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.Center, Projectile.velocity.RotatedBy(2f * -Owner.direction) * Main.rand.NextFloat(0.6f, 0.7f), Mod.Find<ModGore>(goreType).Type);
}
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.5f, Pitch = 0.3f , PitchVariance = 0.1f, MaxInstances = -1 }, Projectile.Center);
Particle sparker = new CustomPulse(GunTipPosition, Vector2.Zero, Color.HotPink, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 0.02f, 0.5f, 10, true, 0.8f);
GeneralParticleHandler.SpawnParticle(sparker);
GenericSparkle sparker2 = new GenericSparkle(GunTipPosition, Vector2.Zero, Main.rand.NextBool() ? Color.SeaShell : Color.Silver * 0.9f, Color.HotPink, Main.rand.NextFloat(0.8f, 1.2f), 2, 0, 2.68f);
GeneralParticleHandler.SpawnParticle(sparker2);
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 = 4;
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;
}
if (swapType)
{
Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, shootVelocity.RotatedByRandom(MathHelper.ToRadians(1.5f)), ModContent.ProjectileType<BlahajBlast>(), Projectile.damage, Projectile.knockBack, Projectile.owner);
}
swapType = !swapType;
shotCounter++;
if (shotCounter == 50)
framesBetweenShots = 18;
}
if (framesBetweenShots > 0)
framesBetweenShots--;
}
if (shotCounter == 50 && framesBetweenShots == 0)
{
if (framesBetweenShots == 0)
{
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;
}
}
}