Start of Elemental Saw

This commit is contained in:
CongratsIsTrash committed 2024-04-24 15:05:03 -04:00
1 parent ad28225b73
commit 6855fd3ed8
22 files changed
+506 -128

No files matched your search

+1 -1
View File
@@ -3044,7 +3044,7 @@ namespace CalamityMod.CalPlayer
//Right click dash on Speed Blaster
if (sBlasterDashActivated == true)
{
if ((Player.controlUp || Player.controlDown || Player.controlLeft || Player.controlRight) && !Player.pulley && Player.grappling[0] == -1 && !Player.tongued && !Player.mount.Active && Player.HasCooldown(Cooldowns.SpeedBlasterBoost.ID) && Player.dashDelay == 0)
if ((Player.controlUp || Player.controlDown || Player.controlLeft || Player.controlRight) && !Player.pulley && Player.grappling[0] == -1 && !Player.tongued && !Player.mount.Active && (Player.HasCooldown(SpeedBlasterBoost.ID) || Player.HasCooldown(ElementalSawBoost.ID)) && Player.dashDelay == 0)
{
SpeedBlasterDashStarted = true;
}
+18
View File
@@ -0,0 +1,18 @@
using Microsoft.Xna.Framework;
using System;
using Terraria;
using Terraria.Localization;
namespace CalamityMod.Cooldowns
{
public class ElementalSawBoost : CooldownHandler
{
public static new string ID => "ElementalSawBoost";
public override bool ShouldDisplay => true;
public override LocalizedText DisplayName => CalamityUtils.GetText($"UI.Cooldowns.{ID}");
public override string Texture => "CalamityMod/Cooldowns/ElementalSawBoost";
public override Color OutlineColor => new Color(207, 207, 207);
public override Color CooldownStartColor => new Color(122, 240, 58);
public override Color CooldownEndColor => new Color(32, 186, 171);
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 443 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 213 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 175 B

+1 -2
View File
@@ -1,5 +1,4 @@
using CalamityMod.Items.Materials;
using CalamityMod.Projectiles.Ranged;
using CalamityMod.Projectiles.Ranged;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.DataStructures;
-53
View File
@@ -1,53 +0,0 @@
using CalamityMod.Items.Materials;
using CalamityMod.Projectiles.Ranged;
using CalamityMod.Sounds;
using Microsoft.Xna.Framework;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items.Weapons.Ranged
{
public class ElementalBlaster : ModItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Weapons.Ranged";
public override void SetStaticDefaults()
{
ItemID.Sets.IsRangedSpecialistWeapon[Item.type] = true;
}
public override void SetDefaults()
{
Item.width = 104;
Item.height = 42;
Item.damage = 67;
Item.DamageType = DamageClass.Ranged;
Item.useTime = 2;
Item.useAnimation = 6;
Item.useStyle = ItemUseStyleID.Shoot;
Item.noMelee = true;
Item.knockBack = 1.75f;
Item.value = CalamityGlobalItem.RarityPurpleBuyPrice;
Item.rare = ItemRarityID.Purple;
Item.UseSound = CommonCalamitySounds.PlasmaBoltSound;
Item.autoReuse = true;
Item.shoot = ModContent.ProjectileType<RainbowBlast>();
Item.shootSpeed = 18f;
}
public override Vector2? HoldoutOffset()
{
return new Vector2(-15, 0);
}
public override void AddRecipes()
{
CreateRecipe().
AddIngredient<SpeedBlaster>().
AddIngredient(ItemID.LunarBar, 5).
AddIngredient<LifeAlloy>(5).
AddIngredient<GalacticaSingularity>(5).
AddTile(TileID.LunarCraftingStation).
Register();
}
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

+114
View File
@@ -0,0 +1,114 @@
using CalamityMod.Cooldowns;
using CalamityMod.Items.Materials;
using CalamityMod.Particles;
using CalamityMod.Projectiles.Ranged;
using CalamityMod.Sounds;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.DataStructures;
using Terraria.ID;
using Terraria.Localization;
using Terraria.ModLoader;
namespace CalamityMod.Items.Weapons.Ranged
{
[LegacyName("ElementalBlaster")]
public class ElementalSaw : ModItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Weapons.Ranged";
public const float ShootSpeed = 18f;
public const int DashCooldown = 360;
public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(DashCooldown / 60);
public override void SetStaticDefaults()
{
ItemID.Sets.IsRangedSpecialistWeapon[Item.type] = true;
}
public override void SetDefaults()
{
Item.width = 104;
Item.height = 42;
Item.damage = 67;
Item.DamageType = DamageClass.Ranged;
Item.useTime = 30;
Item.useAnimation = 30;
Item.useStyle = ItemUseStyleID.Shoot;
Item.noMelee = true;
Item.noUseGraphic = true;
Item.channel = true;
Item.knockBack = 1.75f;
Item.value = CalamityGlobalItem.RarityPurpleBuyPrice;
Item.rare = ItemRarityID.Purple;
//Item.UseSound = CommonCalamitySounds.PlasmaBoltSound;
Item.autoReuse = true;
Item.shoot = ModContent.ProjectileType<ElementalSawHoldout>();
Item.shootSpeed = ShootSpeed;
Item.Calamity().canFirePointBlankShots = true;
}
// Terraria seems to really dislike high crit values in SetDefaults
public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 21;
public override bool AltFunctionUse(Player player) => true;
public override bool CanUseItem(Player player)
{
if (player.altFunctionUse == 2 && player.HasCooldown(Cooldowns.ElementalSawBoost.ID))
return false;
else
return 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)
{
// Right click dash
if (player.altFunctionUse == 2)
{
if (!player.HasCooldown(ElementalSawBoost.ID))
{
player.AddCooldown(ElementalSawBoost.ID, DashCooldown);
player.Calamity().sBlasterDashActivated = true;
// TODO - Lingering saw on right click, and empowering saws
// If moving, make particle effects when the dash activates
if (player.velocity != Vector2.Zero)
{
int particleAmt = 7;
for (int c = 0; c < particleAmt; c++)
{
Color sparkColor = Color.Lerp(new Color(122, 240, 58), new Color(32, 186, 171), c / (particleAmt - 1));
Particle spark = new CritSpark(player.Center, player.velocity.RotatedByRandom(MathHelper.ToRadians(13f)) * Main.rand.NextFloat(-2.1f, -4.5f), Color.White, sparkColor, 2f, 45, 2.25f, 2f);
GeneralParticleHandler.SpawnParticle(spark);
}
for (int e = 0; e < particleAmt; e++)
{
Color sparkColor2 = Color.Lerp(new Color(122, 240, 58), new Color(32, 186, 171), e / (particleAmt - 1));
Particle spark2 = new NanoParticle(player.Center, player.velocity.RotatedByRandom(MathHelper.ToRadians(-MathHelper.PiOver4)) * Main.rand.NextFloat(0.25f, 0.5f), sparkColor2, 1.5f, 45, Main.rand.NextBool(3));
GeneralParticleHandler.SpawnParticle(spark2);
}
}
}
}
else
{
// The holdout deals 2x base damage.
Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType<ElementalSawHoldout>(), (int)(damage * 2), knockback, player.whoAmI, 0f, 0f);
}
return false;
}
public override void AddRecipes()
{
CreateRecipe().
AddIngredient<Buzzkill>().
AddIngredient<SpeedBlaster>().
AddIngredient(ItemID.LunarBar, 5).
AddIngredient<LifeAlloy>(5).
AddIngredient<GalacticaSingularity>(5).
AddTile(TileID.LunarCraftingStation).
Register();
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

@@ -207,7 +207,7 @@ Buzzkill: {
Tooltip:
'''
Hold <left> to charge up a powerful buzzsaw that deals close-range damage
Fired buzzsaws slice through foes, making them bleed, and can bounce off tiles
Fired buzzsaws slice through foes, lacerating them, and can bounce off tiles
The longer it is charged, the more damage and pierce the buzzsaw has
Does not consume ammo
'Not to be confused with the Sawed-On Shotgun'
@@ -441,11 +441,17 @@ Drataliornus: {
'''
}
ElementalBlaster: {
DisplayName: Elemental Blaster
ElementalSaw: {
DisplayName: Elemental Saw
Tooltip:
'''
Fires a storm of rainbow blasts
Hold <left> to charge up a powerful elemental buzzsaw that deals close-range damage
Fired buzzsaws lacerate foes and inflict Elemental Mix, and can bounce off tiles
The longer it is charged, the more damage and pierce the buzzsaw has
Buzzsaws return to the player after exhausting their pierce, releasing homing bolts
Press <right> to propel a short distance and fire a lingering buzzsaw towards the cursor
This dash has a {0} second cooldown
While on cooldown, buzzsaws slightly home to the cursor and release homing bolts faster while returning
Does not consume ammo
'''
}
@@ -68,6 +68,7 @@ DrizzlefishFireSplit.DisplayName: Drizzlefish Flames
DWArrow.DisplayName: Death's Arrow
ElementalFire.DisplayName: Elemental Fire
ElementalFlare.DisplayName: Elemental Flare
ElementalSawProj.DisplayName: Elemental Buzzsaw
ElysianArrowProj.DisplayName: Elysian Arrow
ElysianArrowRain.DisplayName: Elysian Light
EmesisGore.DisplayName: Rotten Gore
@@ -165,7 +166,6 @@ PristineFire.DisplayName: Pristine Fire
PristineSecondary.DisplayName: Pristine Lingering Fire
PumplerGrenade.DisplayName: Squash Shell
P90Round.DisplayName: Armor-piercing Round
RainbowBlast.DisplayName: Blast
RainbowFront.DisplayName: Rainbow
RainbowTrail.DisplayName: Rainbow
RealmRavagerBullet.DisplayName: Explosive Bullet
@@ -88,6 +88,7 @@ Cooldowns: {
DivingPlatesBreaking: Abyssal Diving Suit Plates Durability
DivingPlatesBroken: Abyssal Diving Suit Broken Plates
ParryCooldown: Parry Ability Cooldown
ElementalSawBoost: Elemental Saw Boost
EvasionScarf: Scarf Cooldown
FleshTotem: Contact Damage Halving Cooldown
GaelsRage: Gael's Greatsword Rage Cooldown
+3 -3
View File
@@ -1,11 +1,11 @@
using System;
using CalamityMod.Buffs.DamageOverTime;
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 System;
using Terraria;
using Terraria.Audio;
using Terraria.DataStructures;
@@ -78,7 +78,7 @@ namespace CalamityMod.Projectiles.Ranged
Projectile.timeLeft = 30;
SoundEngine.PlaySound(SoundID.DD2_BallistaTowerShot, GunTipPosition);
float sawDamageMult = MathHelper.Clamp(MathHelper.Lerp(1f, 5f, Time / ChargeupTime), 1f, 4f) / 1.6f; // The damage must be divided by 1.6 to offset the holdout having 1.6x base damage.
float sawDamageMult = MathHelper.Clamp(MathHelper.Lerp(1f, 5f, Time / ChargeupTime), 1f, 5f) / 1.6f; // The damage must be divided by 1.6 to offset the holdout having 1.6x base damage.
int sawPierce = (int)MathHelper.Clamp(MathHelper.Lerp(2f, 6f, Time / ChargeupTime), 2f, 6f);
bool useSmallSlash = (Time / ChargeupTime) >= 0.25f;
+198
View File
@@ -0,0 +1,198 @@
using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Cooldowns;
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 System;
using Terraria;
using Terraria.Audio;
using Terraria.DataStructures;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Ranged
{
public class ElementalSawHoldout : BaseGunHoldoutProjectile
{
public override int AssociatedItemID => ModContent.ItemType<ElementalSaw>();
public override float RecoilResolveSpeed => 0.05f;
public override float MaxOffsetLengthFromArm => 36f;
public override float BaseOffsetY => -5f;
public override float OffsetYUpwards => -5f;
public override float OffsetYDownwards => 5f;
public override Vector2 GunTipPosition => Projectile.Center + Vector2.UnitX.RotatedBy(Projectile.rotation) * Projectile.width * 0.25f;
public ref float Time => ref Projectile.ai[0];
public const float ChargeupTime = 120f;
public SlotId ChargeIdle;
// Controls the saw visually disappearing from the holdout when it fires.
public bool NoSawOnHoldout = false;
public override void SetStaticDefaults()
{
Main.projFrames[Projectile.type] = 5;
}
public override void SetDefaults()
{
base.SetDefaults();
Projectile.friendly = true;
Projectile.DamageType = DamageClass.Ranged;
Projectile.penetrate = -1;
Projectile.ignoreWater = true;
Projectile.usesLocalNPCImmunity = true;
Projectile.localNPCHitCooldown = 10;
}
public override void KillHoldoutLogic()
{
if (HeldItem.type != Owner.ActiveItem().type)
{
Projectile.Kill();
Projectile.netUpdate = true;
}
}
public override void HoldoutAI()
{
Time++;
if (Main.myPlayer == Projectile.owner)
Owner.Calamity().rightClickListener = true;
if (Owner.CantUseHoldout())
{
if (Projectile.ai[1] < 1f)
{
Projectile.ai[1] = 1f;
KeepRefreshingLifetime = false;
Projectile.timeLeft = 30;
SoundEngine.PlaySound(SoundID.DD2_BallistaTowerShot, GunTipPosition); // Placeholder?
float sawDamageMult = MathHelper.Clamp(MathHelper.Lerp(1f, 5f, Time / ChargeupTime), 1f, 5f) / 2f; // The damage must be divided by 2 to offset the holdout having 2x base damage.
int sawPierce = (int)MathHelper.Clamp(MathHelper.Lerp(2f, 6f, Time / ChargeupTime), 2f, 6f);
bool useSmallSlash = (Time / ChargeupTime) >= 0.25f;
bool useLargeSlash = (Time / ChargeupTime) >= 1f;
float ai0 = 0;
if (useSmallSlash)
ai0++;
if (useLargeSlash)
ai0++;
// ai[0] determines which slashes are drawn. ai[1] is the saw's timer variable. ai[2] stores the saw's pierce.
Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, Projectile.velocity.SafeNormalize(Vector2.UnitY) * ElementalSaw.ShootSpeed, ModContent.ProjectileType<ElementalSawProj>(), (int)(Projectile.damage * sawDamageMult), Projectile.knockBack, Main.myPlayer, ai0, 0f, sawPierce);
NoSawOnHoldout = true;
OffsetLengthFromArm -= 4f + 12f * Math.Clamp(Time / ChargeupTime, 0f, 1f);
}
}
// Handle the right-click dash
if (Owner.Calamity().mouseRight && !Owner.HasCooldown(ElementalSawBoost.ID))
{
Owner.AddCooldown(ElementalSawBoost.ID, ElementalSaw.DashCooldown);
Owner.Calamity().sBlasterDashActivated = true;
// TODO - Lingering saw on right click, and empowering saws
// If moving, make particle effects when the dash activates
if (Owner.velocity != Vector2.Zero)
{
int particleAmt = 7;
for (int c = 0; c < particleAmt; c++)
{
Color sparkColor = Color.Lerp(new Color(122, 240, 58), new Color(32, 186, 171), c / (particleAmt - 1));
Particle spark = new CritSpark(Owner.Center, Owner.velocity.RotatedByRandom(MathHelper.ToRadians(13f)) * Main.rand.NextFloat(-2.1f, -4.5f), Color.White, sparkColor, 2f, 45, 2.25f, 2f);
GeneralParticleHandler.SpawnParticle(spark);
}
for (int e = 0; e < particleAmt; e++)
{
Color sparkColor2 = Color.Lerp(new Color(122, 240, 58), new Color(32, 186, 171), e / (particleAmt - 1));
Particle spark2 = new NanoParticle(Owner.Center, Owner.velocity.RotatedByRandom(MathHelper.ToRadians(-MathHelper.PiOver4)) * Main.rand.NextFloat(2.5f, 4.5f), sparkColor2, 1f, 45, Main.rand.NextBool(3));
GeneralParticleHandler.SpawnParticle(spark2);
}
}
}
if (NoSawOnHoldout)
Projectile.frame = 4;
else
{
Projectile.frameCounter++;
if (Projectile.frameCounter >= 3)
{
Projectile.frameCounter = 0;
Projectile.frame++;
if (Projectile.frame > 3)
Projectile.frame = 0;
}
}
}
public override void OnSpawn(IEntitySource source)
{
base.OnSpawn(source);
ExtraBackArmRotation = MathHelper.ToRadians(15f);
}
// The holdout can deal damage; you're literally spinning up a buzzsaw at the end, after all.
public override bool? CanDamage() => !NoSawOnHoldout;
public override void ModifyDamageHitbox(ref Rectangle hitbox)
{
hitbox = new Rectangle((int)GunTipPosition.X - 23, (int)GunTipPosition.Y - 23, 46, 46);
if (Time / ChargeupTime >= 1f)
hitbox.Inflate(70, 70);
else if (Time / ChargeupTime >= 0.25f)
hitbox.Inflate(32, 32);
}
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
{
target.AddBuff(ModContent.BuffType<Laceration>(), 300);
target.AddBuff(ModContent.BuffType<ElementalMix>(), 150);
SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Custom/SwiftSlice") { Volume = 0.7f }, GunTipPosition);
}
public override bool PreDraw(ref Color lightColor)
{
Texture2D texture = ModContent.Request<Texture2D>("CalamityMod/Projectiles/Ranged/ElementalSawHoldout").Value;
Vector2 drawPosition = Projectile.Center - Main.screenPosition;
Rectangle frame = texture.Frame(verticalFrames: Main.projFrames[Type], frameY: Projectile.frame);
float drawRotation = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f);
Vector2 rotationPoint = frame.Size() * 0.5f;
SpriteEffects flipSprite = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None;
if (!NoSawOnHoldout)
{
float shake = Utils.Remap(Time, 0f, ChargeupTime, 0f, 3f);
drawPosition += Main.rand.NextVector2Circular(shake, shake);
}
Main.EntitySpriteDraw(texture, drawPosition, frame, Projectile.GetAlpha(lightColor), drawRotation, rotationPoint, Projectile.scale, flipSprite);
if (Time > 30f && !NoSawOnHoldout)
{
if (Time / ChargeupTime >= 1f)
{
Texture2D largeSlashTexture = ModContent.Request<Texture2D>("CalamityMod/Projectiles/Ranged/ElementalSawLargeSlash").Value;
Color drawColorLarge = new Color(200, 200, 200, 100);
Main.EntitySpriteDraw(largeSlashTexture, GunTipPosition - Main.screenPosition + new Vector2(Main.rand.NextFloat(-8f, 8f), Main.rand.NextFloat(-8f, 8f)), null, drawColorLarge, -(Time * 7f), largeSlashTexture.Size() / 2, 1f, SpriteEffects.None);
}
if (Time / ChargeupTime >= 0.25f)
{
Texture2D smallSlashTexture = ModContent.Request<Texture2D>("CalamityMod/Projectiles/Ranged/ElementalSawSmallSlash").Value;
Color drawColorSmall = new Color(200, 200, 200, 100);
Main.EntitySpriteDraw(smallSlashTexture, GunTipPosition - Main.screenPosition + new Vector2(Main.rand.NextFloat(-5f, 5f), Main.rand.NextFloat(-5f, 5f)), null, drawColorSmall, Time * 7f, smallSlashTexture.Size() / 2, 1f, SpriteEffects.None);
}
}
return false;
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

+159
View File
@@ -0,0 +1,159 @@
using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Particles;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.Audio;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Ranged
{
public class ElementalSawProj : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Ranged";
public static readonly SoundStyle TileCollideGFB = new("CalamityMod/Sounds/Custom/MetalPipeFalling") { Volume = 2f };
// Controls if the saw is returning to the player.
public bool Returning = false;
public int ReturnTimer = 0;
public override void SetDefaults()
{
Projectile.width = Projectile.height = 46;
Projectile.friendly = true;
Projectile.DamageType = DamageClass.Ranged;
Projectile.timeLeft = 480;
Projectile.penetrate = -1; // Saws only pierce a certain number of times before returning, and don't deal direct damage while returning
Projectile.usesLocalNPCImmunity = true;
Projectile.localNPCHitCooldown = 10;
Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration;
}
public override void AI()
{
// dies from cringe (Deadshot Brooch moment)
if (Projectile.MaxUpdates > 1)
Projectile.MaxUpdates = 1;
Projectile.ai[1]++;
Projectile.rotation = Projectile.ai[1] * Projectile.spriteDirection * (MathHelper.Pi / 6);
// Saws automatically return 2 seconds after hitting an enemy.
if (ReturnTimer > 0)
{
ReturnTimer++;
if (ReturnTimer > 120)
Returning = true;
}
if (Returning)
{
// Still need to do this. For now, lemme make sure it enters the return state properly
Main.NewText("Returning");
Projectile.Kill();
}
}
public override bool OnTileCollide(Vector2 oldVelocity)
{
for (int s = 0; s < 7; s++)
{
Vector2 sparkVelocity = new Vector2();
if (Projectile.velocity.X != oldVelocity.X && oldVelocity.X < 0)
sparkVelocity = new Vector2(6.5f, 0f);
else if (Projectile.velocity.X != oldVelocity.X && oldVelocity.X >= 0)
sparkVelocity = new Vector2(-6.5f, 0f);
else if (Projectile.velocity.Y != oldVelocity.Y && oldVelocity.Y < 0)
sparkVelocity = new Vector2(0f, 6.5f);
else if (Projectile.velocity.Y != oldVelocity.Y && oldVelocity.Y >= 0)
sparkVelocity = new Vector2(0f, -6.5f);
Vector2 sparkLocation = sparkVelocity.X > 0f ? new Vector2(Projectile.Center.X - Projectile.width / 2, Projectile.Center.Y) : (sparkVelocity.X < 0f ? new Vector2(Projectile.Center.X + Projectile.width / 2, Projectile.Center.Y) : (sparkVelocity.Y > 0f ? new Vector2(Projectile.Center.X, Projectile.Center.Y - Projectile.height / 2) : new Vector2(Projectile.Center.X, Projectile.Center.Y + Projectile.height / 2)));
sparkVelocity = sparkVelocity.RotatedBy(Main.rand.NextFloat(-MathHelper.PiOver2, MathHelper.PiOver2));
Particle collisionSparks = new AltLineParticle(sparkLocation, sparkVelocity, false, 30, 0.6f, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB));
GeneralParticleHandler.SpawnParticle(collisionSparks);
}
Projectile.ai[2]--;
if (Projectile.ai[2] <= 0)
{
Returning = true;
}
else
{
SoundEngine.PlaySound(Main.zenithWorld ? TileCollideGFB : SoundID.Item178, Projectile.Center); // Placeholder sound
if (Projectile.velocity.X != oldVelocity.X)
Projectile.velocity.X = -oldVelocity.X;
if (Projectile.velocity.Y != oldVelocity.Y)
Projectile.velocity.Y = -oldVelocity.Y;
}
return false;
}
public override bool? CanDamage() => !(Returning && Projectile.ai[2] == 0);
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
{
target.AddBuff(ModContent.BuffType<Laceration>(), 180);
target.AddBuff(ModContent.BuffType<ElementalMix>(), 90);
SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Custom/SwiftSlice"), Projectile.Center);
if (Projectile.numHits < 1)
ReturnTimer = 1;
Projectile.ai[2]--;
if (Projectile.ai[2] <= 0)
Returning = true;
}
public override void OnKill(int timeLeft)
{
SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Custom/CeramicImpact", 2), Projectile.Center);
}
public override void ModifyDamageHitbox(ref Rectangle hitbox)
{
if (Projectile.ai[0] == 2f)
hitbox.Inflate(70, 70);
else if (Projectile.ai[0] == 1f)
hitbox.Inflate(32, 32);
}
public override bool PreDraw(ref Color lightColor)
{
if (Projectile.ai[0] >= 2f)
{
Texture2D largeSlashTexture = ModContent.Request<Texture2D>("CalamityMod/Projectiles/Ranged/ElementalSawLargeSlash").Value;
Color drawColor = new Color(200, 200, 200, 100);
Main.EntitySpriteDraw(largeSlashTexture, Projectile.Center - Main.screenPosition + new Vector2(Main.rand.NextFloat(-8f, 8f), Main.rand.NextFloat(-8f, 8f)), null, drawColor, -(Projectile.ai[1] * 7f), largeSlashTexture.Size() / 2, 1f, SpriteEffects.None);
if (Projectile.ai[1] % 4 == 0)
{
Vector2 randomParticleOffset = new Vector2(Main.rand.NextFloat(-Projectile.width * 1.75f, Projectile.width * 1.75f), Main.rand.NextFloat(-Projectile.width * 1.75f, Projectile.width * 1.75f));
float randomParticleScale = Main.rand.NextFloat(0.65f, 0.95f);
Particle bloomCircle = new BloomParticle(Projectile.Center + randomParticleOffset, Projectile.velocity, Main.rand.NextBool() ? Color.White : new Color(44, 168, 48), randomParticleScale, randomParticleScale, 4, false);
GeneralParticleHandler.SpawnParticle(bloomCircle);
}
}
if (Projectile.ai[0] >= 1f)
{
Texture2D smallSlashTexture = ModContent.Request<Texture2D>("CalamityMod/Projectiles/Ranged/ElementalSawSmallSlash").Value;
Color drawColor = new Color(200, 200, 200, 100);
Main.EntitySpriteDraw(smallSlashTexture, Projectile.Center - Main.screenPosition + new Vector2(Main.rand.NextFloat(-5f, 5f), Main.rand.NextFloat(-5f, 5f)), null, drawColor, Projectile.ai[1] * 7f, smallSlashTexture.Size() / 2, 1f, SpriteEffects.None);
if (Projectile.ai[1] % 4 == 0)
{
Vector2 randomParticleOffset = new Vector2(Main.rand.NextFloat(-Projectile.width, Projectile.width), Main.rand.NextFloat(-Projectile.width, Projectile.width));
float randomParticleScale = Main.rand.NextFloat(0.35f, 0.65f);
Particle bloomCircle = new BloomParticle(Projectile.Center + randomParticleOffset, Projectile.velocity, Main.rand.NextBool() ? Color.White : new Color(44, 168, 48), randomParticleScale, randomParticleScale, 4, false);
GeneralParticleHandler.SpawnParticle(bloomCircle);
}
}
return true;
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

-64
View File
@@ -1,64 +0,0 @@
using CalamityMod.Buffs.DamageOverTime;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Ranged
{
public class RainbowBlast : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Ranged";
public override void SetStaticDefaults()
{
ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10;
ProjectileID.Sets.TrailingMode[Projectile.type] = 0;
}
public override void SetDefaults()
{
Projectile.width = 10;
Projectile.height = 10;
Projectile.friendly = true;
Projectile.penetrate = 1;
Projectile.extraUpdates = 1;
Projectile.DamageType = DamageClass.Ranged;
Projectile.timeLeft = 300;
}
public override void AI()
{
//Rotation
Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt();
Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi);
Lighting.AddLight(Projectile.Center, new Vector3(Main.DiscoR, Main.DiscoG, Main.DiscoB) * (1.5f / 255));
Projectile.localAI[0]++;
if (Projectile.localAI[0] > 5f)
{
Vector2 dspeed = -Projectile.velocity * 0.5f;
int rainbowDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RainbowTorch, dspeed.X, dspeed.Y, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.1f);
Main.dust[rainbowDust].noGravity = true;
Main.dust[rainbowDust].velocity = dspeed;
}
CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 200f, 12f, 20f);
}
public override Color? GetAlpha(Color lightColor)
{
Color color = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB);
return color;
}
public override bool PreDraw(ref Color lightColor)
{
CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1);
return false;
}
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
{
target.AddBuff(ModContent.BuffType<ElementalMix>(), 60);
}
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 174 B