Functionality done, placeholder(?) rename
Renamed because of the Starburst mechanic shared through the Stratus set, which also has a shortsword.
This commit is contained in:
1 parent
72231ac123
commit
cdd3bc603f
20 files changed
+748
-286
No files matched your search
@@ -298,10 +298,10 @@ namespace CalamityMod.CalPlayer
|
||||
public bool lucreciaEnergyPaused = false;
|
||||
public bool lucreciaEnergyMaxSFXPlayed = false;
|
||||
private int lucreciaParticleTimer = 0;
|
||||
public int starburstShivElementalMastery = 0;
|
||||
public int starburstShivElementalMasteryTimer = 0;
|
||||
public bool starburstShivElementalMasteryPaused = false;
|
||||
public bool starburstShivElementalMasteryMaxSFXPlayed = false;
|
||||
public int elementalMastery = 0;
|
||||
public int elementalMasteryTimer = 0;
|
||||
public bool elementalMasteryPaused = false;
|
||||
public bool elementalMasterySFXPlayed = false;
|
||||
public float unstableCastersGauntletVis = 0;
|
||||
public int unstableCastersGauntletVisTimer = 0;
|
||||
public int PhotoAudioCooldown = 0;
|
||||
@@ -3268,7 +3268,7 @@ namespace CalamityMod.CalPlayer
|
||||
flareGunOverheat = 0;
|
||||
hellbornShots = 0;
|
||||
lucreciaEnergy = 0;
|
||||
starburstShivElementalMastery = 0;
|
||||
elementalMastery = 0;
|
||||
garandShots = 0;
|
||||
searedPanCounter = 0;
|
||||
searedPanTimer = 0;
|
||||
|
||||
@@ -168,7 +168,7 @@ namespace CalamityMod.CalPlayer
|
||||
UpdateDrawingParameters();
|
||||
|
||||
// Handle Lucrecia's passive energy effects
|
||||
HandleLucreciaEffects();
|
||||
HandleLucreciaLineEffects();
|
||||
|
||||
// Update all particle sets for items.
|
||||
// This must be done here instead of in the item logic because these sets are not properly instanced
|
||||
@@ -431,49 +431,49 @@ namespace CalamityMod.CalPlayer
|
||||
lucreciaEnergyPaused = false;
|
||||
}
|
||||
|
||||
if (Player.HeldItem.type == ModContent.ItemType<StarburstShiv>() && starburstShivElementalMastery > 0)
|
||||
if (Player.HeldItem.type == ModContent.ItemType<Lightspeed>() && elementalMastery > 0)
|
||||
{
|
||||
if (starburstShivElementalMastery == StarburstShiv.MaxEnergy && !starburstShivElementalMasteryPaused)
|
||||
if (elementalMastery == Lightspeed.MaxEnergy && !elementalMasteryPaused)
|
||||
{
|
||||
starburstShivElementalMasteryPaused = true;
|
||||
starburstShivElementalMasteryTimer = 0;
|
||||
elementalMasteryPaused = true;
|
||||
elementalMasteryTimer = 0;
|
||||
}
|
||||
|
||||
starburstShivElementalMasteryTimer++;
|
||||
elementalMasteryTimer++;
|
||||
|
||||
// If the mastery is at max, pause for 180 ticks
|
||||
if (starburstShivElementalMasteryPaused)
|
||||
if (elementalMasteryPaused)
|
||||
{
|
||||
if (starburstShivElementalMasteryTimer >= 1 && !starburstShivElementalMasteryMaxSFXPlayed)
|
||||
if (elementalMasteryTimer >= 1 && !elementalMasterySFXPlayed)
|
||||
{
|
||||
SoundEngine.PlaySound(SoundID.Item79 with { Volume = 1.6f, Pitch = 0.4f }, Player.Center);
|
||||
starburstShivElementalMasteryMaxSFXPlayed = true;
|
||||
elementalMasterySFXPlayed = true;
|
||||
|
||||
}
|
||||
// If the pause is Done, resume decrementing.
|
||||
if (starburstShivElementalMasteryTimer >= 180)
|
||||
if (elementalMasteryTimer >= 180)
|
||||
{
|
||||
starburstShivElementalMasteryPaused = false;
|
||||
starburstShivElementalMasteryTimer = 0;
|
||||
starburstShivElementalMastery--;
|
||||
elementalMasteryPaused = false;
|
||||
elementalMasteryTimer = 0;
|
||||
elementalMastery--;
|
||||
}
|
||||
}
|
||||
else // Decrementing
|
||||
{
|
||||
starburstShivElementalMasteryMaxSFXPlayed = false;
|
||||
// Once every 8 ticks
|
||||
if (starburstShivElementalMasteryTimer >= 8)
|
||||
elementalMasterySFXPlayed = false;
|
||||
// Once every 20 ticks
|
||||
if (elementalMasteryTimer >= 20)
|
||||
{
|
||||
starburstShivElementalMastery--;
|
||||
starburstShivElementalMasteryTimer = 0;
|
||||
elementalMastery--;
|
||||
elementalMasteryTimer = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Reset the timer and pause state if the player isn't holding the weapon.
|
||||
starburstShivElementalMasteryTimer = 0;
|
||||
starburstShivElementalMasteryPaused = false;
|
||||
elementalMasteryTimer = 0;
|
||||
elementalMasteryPaused = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -4540,11 +4540,13 @@ namespace CalamityMod.CalPlayer
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Lucrecia Effects
|
||||
#region Lucrecia Line Effects
|
||||
|
||||
public void HandleLucreciaEffects()
|
||||
public void HandleLucreciaLineEffects()
|
||||
{
|
||||
int lucreciaItemID = ModContent.ItemType<Lucrecia>();
|
||||
int lightspeedItemID = ModContent.ItemType<Lightspeed>();
|
||||
|
||||
if (Player.HeldItem.type == lucreciaItemID && lucreciaEnergy > 0)
|
||||
{
|
||||
lucreciaParticleTimer--;
|
||||
@@ -4573,7 +4575,40 @@ namespace CalamityMod.CalPlayer
|
||||
Vector2 dummyVelocity = Vector2.Zero; // We dont want the argument where this is used to have influence on the actual path
|
||||
float rotationSpeed = 0.04f;
|
||||
|
||||
var particle = new RoundedStarParticle(spawnPosition, dummyVelocity, color, Main.rand.NextFloat(0.05f, 0.065f), Main.rand.Next(30, 60), rotationSpeed, 1f, true, Player.Center, Player.whoAmI);
|
||||
var particle = new RoundedStarParticle(spawnPosition, dummyVelocity, color with { A = 0 }, Main.rand.NextFloat(0.05f, 0.065f), Main.rand.Next(30, 60), rotationSpeed, 1f, true, Player.Center, Player.whoAmI);
|
||||
GeneralParticleHandler.SpawnParticle(particle);
|
||||
}
|
||||
}
|
||||
|
||||
if (Player.HeldItem.type == lightspeedItemID && elementalMastery > 0)
|
||||
{
|
||||
lucreciaParticleTimer--;
|
||||
|
||||
// If the timer is at or below zero, spawn a particle.
|
||||
if (lucreciaParticleTimer <= 0)
|
||||
{
|
||||
// Reset the timer (spawn rate depends on energy)
|
||||
lucreciaParticleTimer = (int)(20 - 15 * (elementalMastery / 60));
|
||||
|
||||
float radius = Main.rand.NextFloat(160f, 190f); // Distance from center
|
||||
float spawnAngle = Main.rand.NextFloat(MathHelper.TwoPi); // Random angle along the whole radius
|
||||
|
||||
Vector2 spawnPosition = Player.Center + spawnAngle.ToRotationVector2() * radius;
|
||||
|
||||
// Scale opacity with energy
|
||||
float opacity = elementalMastery / (float)Lightspeed.MaxEnergy;
|
||||
Color color = Main.rand.NextBool() ? Color.Aqua : Color.OrangeRed;
|
||||
color *= opacity;
|
||||
|
||||
if (elementalMastery >= 100)
|
||||
{
|
||||
color *= 1.6f; // Brighter
|
||||
}
|
||||
|
||||
Vector2 dummyVelocity = Vector2.Zero; // We dont want the argument where this is used to have influence on the actual path
|
||||
float rotationSpeed = 0.04f;
|
||||
|
||||
var particle = new RoundedStarParticle(spawnPosition, dummyVelocity, color with { A = 0 }, Main.rand.NextFloat(0.05f, 0.065f), Main.rand.Next(30, 60), rotationSpeed, 1f, true, Player.Center, Player.whoAmI);
|
||||
GeneralParticleHandler.SpawnParticle(particle);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,8 +89,8 @@ namespace CalamityMod.CalPlayer.DrawLayers
|
||||
glowMask = ModContent.Request<Texture2D>("CalamityMod/Items/Weapons/DraedonsArsenal/PulseRifleGlow").Value;
|
||||
else if (itemType == ModContent.ItemType<SoulPiercer>())
|
||||
glowMask = ModContent.Request<Texture2D>("CalamityMod/Items/Weapons/Magic/SoulPiercerGlow").Value;
|
||||
else if (itemType == ModContent.ItemType<StarburstShiv>())
|
||||
glowMask = ModContent.Request<Texture2D>("CalamityMod/Items/Weapons/Melee/StarburstShivGlow").Value;
|
||||
else if (itemType == ModContent.ItemType<Lightspeed>())
|
||||
glowMask = ModContent.Request<Texture2D>("CalamityMod/Items/Weapons/Melee/LightspeedGlow").Value;
|
||||
else if (itemType == ModContent.ItemType<SubsumingVortex>())
|
||||
glowMask = ModContent.Request<Texture2D>("CalamityMod/Items/Weapons/Magic/SubsumingVortexSmallGlow").Value;
|
||||
else if (itemType == ModContent.ItemType<TerrorBlade>())
|
||||
|
||||
@@ -17,13 +17,13 @@ namespace CalamityMod.Cooldowns
|
||||
{
|
||||
public class ElementalMastery : CooldownHandler
|
||||
{
|
||||
private float AdjustedCompletion => instance.timeLeft / (float) StarburstShiv.MaxEnergy;
|
||||
private float AdjustedCompletion => instance.timeLeft / (float) Lightspeed.MaxEnergy;
|
||||
private Color TextColor => Color.AliceBlue;
|
||||
private Color TextBorderColor = Color.AntiqueWhite;
|
||||
|
||||
public static new string ID => "ElementalMastery";
|
||||
public override bool CanTickDown => false;
|
||||
public override bool ShouldDisplay => instance.player.HeldItem.type == ItemType<StarburstShiv>();
|
||||
public override bool ShouldDisplay => instance.player.HeldItem.type == ItemType<Lightspeed>();
|
||||
public override LocalizedText DisplayName => CalamityUtils.GetText($"UI.Cooldowns.{ID}");
|
||||
public override string Texture => $"CalamityMod/Cooldowns/{ID}";
|
||||
public override string OutlineTexture => $"CalamityMod/Cooldowns/{ID}Outline";
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace CalamityMod.Items.Weapons.Melee
|
||||
public override void AddRecipes()
|
||||
{
|
||||
CreateRecipe().
|
||||
AddIngredient<StarburstShiv>().
|
||||
AddIngredient<Lightspeed>().
|
||||
AddIngredient<CosmiliteBar>(8).
|
||||
AddTile<CosmicAnvil>().
|
||||
Register();
|
||||
|
||||
@@ -144,8 +144,8 @@ namespace CalamityMod.Items.Weapons.Melee
|
||||
{
|
||||
CreateRecipe().
|
||||
AddIngredient<Terratomere>().
|
||||
AddIngredient<Lightspeed>().
|
||||
AddIngredient<EntropicClaymore>().
|
||||
AddIngredient<AnarchyBlade>().
|
||||
AddIngredient<FlarefrostBlade>().
|
||||
AddIngredient<MiracleMatter>().
|
||||
AddTile(TileType<DraedonsForge>()).
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
using CalamityMod.Cooldowns;
|
||||
using CalamityMod.Items.Materials;
|
||||
using CalamityMod.Projectiles.BaseProjectiles;
|
||||
using CalamityMod.Projectiles.DraedonsArsenal;
|
||||
using CalamityMod.Projectiles.Melee;
|
||||
using CalamityMod.Projectiles.Melee.Shortswords;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
@@ -13,7 +9,7 @@ using Terraria.ModLoader;
|
||||
namespace CalamityMod.Items.Weapons.Melee
|
||||
{
|
||||
[LegacyName("ElementalShortsword", "ElementalShiv")]
|
||||
public class StarburstShiv : ModItem, ILocalizedModType
|
||||
public class Lightspeed : ModItem, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Items.Weapons.Melee";
|
||||
|
||||
@@ -24,15 +20,14 @@ namespace CalamityMod.Items.Weapons.Melee
|
||||
Item.width = 74;
|
||||
Item.height = 94;
|
||||
Item.useStyle = ItemUseStyleID.Shoot;
|
||||
Item.damage = 183;
|
||||
Item.DamageType = DamageClass.Melee;
|
||||
Item.damage = 196;
|
||||
Item.DamageType = TrueMeleeDamageClass.Instance;
|
||||
Item.useAnimation = Item.useTime = 20;
|
||||
Item.shootSpeed = 10f;
|
||||
Item.knockBack = 9f;
|
||||
Item.knockBack = 2f;
|
||||
Item.value = CalamityGlobalItem.RarityPurpleBuyPrice;
|
||||
Item.rare = ItemRarityID.Purple;
|
||||
Item.shoot = ModContent.ProjectileType<StarburstShivHoldout>();
|
||||
|
||||
Item.shoot = ModContent.ProjectileType<LightspeedHoldout>();
|
||||
|
||||
Item.noMelee = true;
|
||||
Item.noUseGraphic = true;
|
||||
@@ -47,12 +42,11 @@ namespace CalamityMod.Items.Weapons.Melee
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public override void HoldItem(Player player)
|
||||
{
|
||||
if (player.Calamity().cooldowns.TryGetValue(ElementalMastery.ID, out var cooldown))
|
||||
{
|
||||
cooldown.timeLeft = player.Calamity().starburstShivElementalMastery;
|
||||
cooldown.timeLeft = player.Calamity().elementalMastery;
|
||||
}
|
||||
else
|
||||
{
|
||||
File renamed without changes.
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
File renamed without changes.
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
@@ -793,6 +793,17 @@ LifehuntScythe: {
|
||||
Tooltip: Heals you on hit and shoots an energy scythe
|
||||
}
|
||||
|
||||
Lightspeed: {
|
||||
DisplayName: Lightspeed
|
||||
Tooltip:
|
||||
'''
|
||||
[c/c7f5ff:Unleash a flurry of stabs which build Elemental Mastery on hit]
|
||||
[c/c2fff2:Elemental Mastery is lost over time but briefly stops depleting after reaching its maximum]
|
||||
[c/ffdfba:Press <right> with maximum Elemental Mastery to dash toward your cursor]
|
||||
[c/ffc7c7:Hitting an enemy during the dash refunds some Elemental Mastery]
|
||||
'''
|
||||
}
|
||||
|
||||
LionHeart: {
|
||||
DisplayName: Lion Heart
|
||||
Tooltip:
|
||||
@@ -1171,11 +1182,6 @@ SpineOfThanatos: {
|
||||
'''
|
||||
}
|
||||
|
||||
StarburstShiv: {
|
||||
DisplayName: Starburst Shiv
|
||||
Tooltip: Shoots a rainbow shiv that spawns additional shivs on hit
|
||||
}
|
||||
|
||||
StarnightLance: {
|
||||
DisplayName: Starnight Lance
|
||||
Tooltip: Shoots a frigid starnight beam
|
||||
|
||||
@@ -159,6 +159,7 @@ LamentationsOfTheChained.DisplayName: Lamentations of the Chained
|
||||
LifeScythe.DisplayName: Lifehunt Scythe
|
||||
LightBeam.DisplayName: Light Beam
|
||||
LightningThing.DisplayName: Lightning
|
||||
LightspeedM1Hitbox.DisplayName: Lightspeed Stab
|
||||
LucreciaProj.DisplayName: Lucrecia
|
||||
LucreciaDNATrailCreator.DisplayName: Lucrecia DNA
|
||||
LucreciaDoubleHelix.DisplayName: Lucrecia Helix Comet
|
||||
@@ -309,4 +310,4 @@ WulfrumScrew.DisplayName: Wulfrum Screw
|
||||
WulfrumScrewdriverProj.DisplayName: Wulfrum Screwdriver
|
||||
YinYoDark.DisplayName: Dark Shard
|
||||
YinYoLight.DisplayName: Light Shard
|
||||
StarburstShivM1Hitbox.DisplayName: Lightspeed Stab
|
||||
LightspeedHoldout.DisplayName: Lightspeed Holdout
|
||||
@@ -107,6 +107,7 @@ Cooldowns: {
|
||||
DivingPlatesBroken: Abyssal Diving Suit Broken Plates
|
||||
DSOCritCooldown: Extra Critical Strike Chance
|
||||
ParryCooldown: Parry Ability Cooldown
|
||||
ElementalMastery: Elemental Mastery
|
||||
FleshTotem: Contact Damage Halving Cooldown
|
||||
FuryFuel: Crystal Powder
|
||||
GaelsRage: Gael's Greatsword Rage Cooldown
|
||||
|
||||
@@ -0,0 +1,90 @@
|
||||
using System;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Particles
|
||||
{
|
||||
public class RainbowGlowSparkParticle : Particle
|
||||
{
|
||||
public Color InitialColor;
|
||||
public bool AffectedByGravity;
|
||||
public bool QuickShrink;
|
||||
public bool Glowing;
|
||||
public float ShrinkSpeed = 1;
|
||||
public Vector2 Squash = new Vector2(0.5f, 1.6f);
|
||||
public float HueShift;
|
||||
|
||||
public override bool SetLifetime => true;
|
||||
public override bool UseCustomDraw => true;
|
||||
public override bool UseAdditiveBlend => true;
|
||||
|
||||
|
||||
public override string Texture => "CalamityMod/Particles/GlowSpark";
|
||||
|
||||
public RainbowGlowSparkParticle(Vector2 relativePosition, Vector2 velocity, bool affectedByGravity, int lifetime, float scale, Color initialColor, Vector2 squash, bool quickShrink = false, bool glow = true, float shrinkSpeed = 1, float hueShift = 0)
|
||||
{
|
||||
Position = relativePosition;
|
||||
Velocity = velocity;
|
||||
AffectedByGravity = affectedByGravity;
|
||||
Scale = scale;
|
||||
Lifetime = lifetime;
|
||||
Color = InitialColor = initialColor;
|
||||
Squash = squash;
|
||||
QuickShrink = quickShrink;
|
||||
Glowing = glow;
|
||||
Rotation = Velocity.ToRotation() + MathHelper.PiOver2;
|
||||
ShrinkSpeed = shrinkSpeed;
|
||||
HueShift = hueShift;
|
||||
}
|
||||
|
||||
public override void Update()
|
||||
{
|
||||
Scale *= 0.95f;
|
||||
Velocity *= 0.95f;
|
||||
if (QuickShrink)
|
||||
{
|
||||
if (ShrinkSpeed == 1)
|
||||
{
|
||||
Squash.X *= 0.8f;
|
||||
Squash.Y *= 1.2f;
|
||||
}
|
||||
else
|
||||
{
|
||||
Squash.X *= (1 - 0.2f * ShrinkSpeed);
|
||||
Squash.Y *= (1 + 0.2f * ShrinkSpeed);
|
||||
}
|
||||
}
|
||||
if (Velocity.Length() < 12f && AffectedByGravity)
|
||||
{
|
||||
Velocity.X *= 0.94f;
|
||||
Velocity.Y += 0.25f;
|
||||
}
|
||||
|
||||
Color = Main.hslToRgb(Main.rgbToHsl(Color).X + HueShift, Main.rgbToHsl(Color).Y, Main.rgbToHsl(Color).Z);
|
||||
}
|
||||
|
||||
public override void CustomDraw(SpriteBatch spriteBatch)
|
||||
{
|
||||
Vector2 scale = Squash * Scale;
|
||||
Texture2D texture = ModContent.Request<Texture2D>(Texture).Value;
|
||||
|
||||
float scaleMult = 1;
|
||||
if (Main.zenithWorld)
|
||||
{
|
||||
DateTime day = DateTime.Now;
|
||||
if (day.DayOfWeek == DayOfWeek.Tuesday)
|
||||
{
|
||||
Texture2D joke = ModContent.Request<Texture2D>("CalamityMod/Particles/MammothParticle").Value;
|
||||
scaleMult = (MathHelper.Lerp(texture.Size().X / joke.Size().X, texture.Size().Y / joke.Size().Y, 0.5f));
|
||||
texture = joke;
|
||||
}
|
||||
}
|
||||
|
||||
spriteBatch.Draw(texture, Position - Main.screenPosition, null, Color, Rotation, texture.Size() * 0.5f, scale * scaleMult, 0, 0f);
|
||||
if (Glowing)
|
||||
spriteBatch.Draw(texture, Position - Main.screenPosition, null, Color.Lerp(Color.White, Color.Transparent, (float)Math.Pow(LifetimeCompletion, 3D)), Rotation, texture.Size() * 0.5f, scale * new Vector2(0.45f, 1f) * scaleMult, 0, 0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
using CalamityMod.Items.Weapons.Melee;
|
||||
using CalamityMod.Particles;
|
||||
using CalamityMod.Sounds;
|
||||
using System;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.Melee
|
||||
{
|
||||
public class LightspeedDashHitbox : ModProjectile
|
||||
{
|
||||
public new string LocalizationCategory => "Projectiles.Melee";
|
||||
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
|
||||
public Player Owner => Main.player[Projectile.owner];
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 84;
|
||||
Projectile.height = 64;
|
||||
Projectile.friendly = true;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.DamageType = TrueMeleeNoSpeedDamageClass.Instance;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.timeLeft = 18;
|
||||
Projectile.usesLocalNPCImmunity = true;
|
||||
Projectile.localNPCHitCooldown = -1;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
// Go where the player is going
|
||||
Projectile.Center = Main.player[Projectile.owner].Center;
|
||||
Main.player[Projectile.owner].velocity = Projectile.velocity;
|
||||
}
|
||||
|
||||
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
|
||||
{
|
||||
Vector2 toMouse = Utils.DirectionTo(Owner.Center, Owner.ClampedMouseWorld() + MathHelper.Pi.ToRotationVector2());
|
||||
SoundEngine.PlaySound(CommonCalamitySounds.SwiftSliceSound with { Volume = CommonCalamitySounds.SwiftSliceSound.Volume * 0.33f }, Projectile.Center);
|
||||
|
||||
var player = Main.player[Projectile.owner];
|
||||
var modPlayer = player.Calamity();
|
||||
|
||||
// Refund 20 energy if dash hits. Can get energy from multiple enemies.
|
||||
modPlayer.elementalMastery += 20;
|
||||
modPlayer.elementalMastery = Math.Min(modPlayer.elementalMastery, Lightspeed.MaxEnergy);
|
||||
|
||||
// On-hit cut FX
|
||||
int points = 2;
|
||||
float radians = MathHelper.TwoPi / points;
|
||||
Vector2 spinningPoint = Vector2.Normalize(new Vector2(-1f, -1f)).RotatedByRandom(100);
|
||||
|
||||
for (int k = 0; k < points; k++)
|
||||
{
|
||||
Vector2 velocity = spinningPoint.RotatedBy(radians * k).RotatedBy(-0.45f);
|
||||
|
||||
Particle spark = new RainbowGlowSparkParticle((target.Center + velocity * 7.5f), velocity * 0.5f, false, 14, 0.07f, Color.Aqua, new Vector2(0.55f, 0.825f), true, true, hueShift: 0.05f);
|
||||
GeneralParticleHandler.SpawnParticle(spark);
|
||||
}
|
||||
|
||||
for (int i = 0; i < 12; i++)
|
||||
{
|
||||
Vector2 particleSpeed = Utils.SafeNormalize(target.Center, Vector2.One).RotatedByRandom(MathHelper.TwoPi * 3) * Main.rand.NextFloat(4f, 8f);
|
||||
Particle energyLeak = new SquishyLightParticle(target.Center, particleSpeed, Main.rand.NextFloat(0.4f, 0.9f), Color.OrangeRed, 50, 2, 2.5f, hueShift: 0.06f);
|
||||
GeneralParticleHandler.SpawnParticle(energyLeak);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,425 @@
|
||||
using System;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using CalamityMod.Particles;
|
||||
using static Terraria.Player;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using CalamityMod.Items.Weapons.Melee;
|
||||
using CalamityMod.Graphics.Primitives;
|
||||
using System.Linq;
|
||||
using Terraria.Graphics.Shaders;
|
||||
using static CalamityMod.CalamityUtils;
|
||||
using CalamityMod.Projectiles.DraedonsArsenal;
|
||||
using CalamityMod.Sounds;
|
||||
|
||||
|
||||
namespace CalamityMod.Projectiles.Melee
|
||||
{
|
||||
public class LightspeedHoldout : ModProjectile, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Projectiles.Melee";
|
||||
|
||||
public override string Texture => "CalamityMod/Items/Weapons/Melee/Lightspeed";
|
||||
public ref float attackTimer => ref Projectile.ai[0];
|
||||
public Player Owner => Main.player[Projectile.owner];
|
||||
public int time = 0;
|
||||
|
||||
// Sprite visuals
|
||||
public Vector2 innateOffset = new(23f, -5f);
|
||||
public Vector2 handPos;
|
||||
public float bladeRot = 0;
|
||||
|
||||
// Primary
|
||||
public int primaryStabfireRate => 2;
|
||||
private int stabTimer;
|
||||
public int stabSoundTimer = 3;
|
||||
|
||||
// Secondary
|
||||
public bool pressedRight = false;
|
||||
public bool firstSecondaryIteration = false;
|
||||
public int initialDirectionForThisAnim = 0;
|
||||
public ref float DashState => ref Projectile.ai[1];
|
||||
public ref float DashTimer => ref Projectile.ai[2];
|
||||
private const float DashPrepTime = 40f;
|
||||
private const float DashSpeed = 42f;
|
||||
private const float DashDuration = 36f;
|
||||
private const float DashAcceleration = 0.9865f;
|
||||
private float AltSpinRotation = 0f;
|
||||
public bool createdSmear = false;
|
||||
public float LungeProgression
|
||||
{
|
||||
get
|
||||
{
|
||||
float duration = DashDuration;
|
||||
float elapsed = DashDuration - (DashTimer * 2);
|
||||
return MathHelper.Clamp(elapsed / duration, 0f, 1f);
|
||||
}
|
||||
}
|
||||
|
||||
// General
|
||||
public bool gotEnergyThisSwing = false;
|
||||
public override bool? CanDamage() => false;
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
ProjectileID.Sets.TrailingMode[Type] = 2;
|
||||
ProjectileID.Sets.TrailCacheLength[Type] = 120;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 74;
|
||||
Projectile.height = 94;
|
||||
Projectile.friendly = true;
|
||||
Projectile.DamageType = TrueMeleeNoSpeedDamageClass.Instance;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.extraUpdates = 1;
|
||||
}
|
||||
|
||||
public void Positioning(Vector2 toMouse) // Hand and holdout positioning
|
||||
{
|
||||
if (DashState == 2)
|
||||
{
|
||||
Vector2 dashDirection = Projectile.velocity.SafeNormalize(Vector2.UnitX * Owner.direction);
|
||||
Owner.ChangeDir(Math.Sign(dashDirection.X));
|
||||
|
||||
float dashArmRotation = dashDirection.ToRotation();
|
||||
float dashCompositeArmRotation = dashArmRotation + (MathHelper.TwoPi * 0.75f);
|
||||
|
||||
Owner.SetCompositeArmFront(true, CompositeArmStretchAmount.Full, dashCompositeArmRotation);
|
||||
Owner.SetCompositeArmBack(true, CompositeArmStretchAmount.Full, 0f);
|
||||
|
||||
bladeRot = 0;
|
||||
|
||||
handPos = Owner.GetFrontHandPosition(CompositeArmStretchAmount.Full, dashCompositeArmRotation);
|
||||
|
||||
Projectile.Center = handPos;
|
||||
|
||||
Owner.heldProj = Projectile.whoAmI;
|
||||
Owner.itemTime = Owner.itemAnimation = 2;
|
||||
|
||||
// Visual rotation
|
||||
Projectile.rotation = dashArmRotation;
|
||||
Projectile.rotation = Projectile.velocity.ToRotation() + (Owner.direction == 1 ? MathHelper.PiOver4 : MathHelper.Pi * 0.75f);
|
||||
Projectile.rotation += 0.15f * Owner.direction; // Adjustment to make the tip look like its more directly pointing at cursor
|
||||
|
||||
// Item rotation (for arm positioning)
|
||||
Owner.itemRotation = dashArmRotation + MathHelper.PiOver4;
|
||||
|
||||
if (Owner.direction != 1)
|
||||
{
|
||||
Owner.itemRotation -= MathHelper.TwoPi * 0.75f;
|
||||
}
|
||||
|
||||
Owner.itemRotation = MathHelper.WrapAngle(Owner.itemRotation);
|
||||
}
|
||||
|
||||
else // If not in dash
|
||||
{
|
||||
Owner.ChangeDir(Math.Sign(toMouse.X));
|
||||
|
||||
float baseArmRotation = toMouse.ToRotation();
|
||||
float compositeArmRotation = baseArmRotation + bladeRot - MathHelper.PiOver2;
|
||||
|
||||
Owner.SetCompositeArmFront(true, CompositeArmStretchAmount.Full, compositeArmRotation);
|
||||
Owner.SetCompositeArmBack(true, CompositeArmStretchAmount.Full, 0f);
|
||||
|
||||
Vector2 actualInnateOffset = innateOffset;
|
||||
if (Owner.direction == -1)
|
||||
{
|
||||
actualInnateOffset.X += 1f;
|
||||
actualInnateOffset.Y += 10f;
|
||||
}
|
||||
|
||||
handPos = Owner.GetFrontHandPosition(CompositeArmStretchAmount.Full, compositeArmRotation) + actualInnateOffset.RotatedBy(baseArmRotation);
|
||||
|
||||
Projectile.velocity = toMouse;
|
||||
Projectile.rotation = toMouse.ToRotation() + bladeRot;
|
||||
Projectile.rotation += MathHelper.PiOver2 * 0.5f; // Adjustment made so texture actually faces cursor
|
||||
Projectile.rotation += 0.15f * Owner.direction; // Another to make the tip look like its more directly pointing at cursor
|
||||
|
||||
if (Owner.direction == -1)
|
||||
{
|
||||
Projectile.rotation -= MathHelper.TwoPi * 0.75f;
|
||||
}
|
||||
|
||||
Projectile.Center = handPos;
|
||||
|
||||
Owner.heldProj = Projectile.whoAmI;
|
||||
Owner.itemTime = Owner.itemAnimation = 2;
|
||||
|
||||
// Item rotation (for arm positioning)
|
||||
Owner.itemRotation = Projectile.rotation - MathHelper.PiOver4; // Adjustment undone for arm pos
|
||||
if (Owner.direction == -1)
|
||||
{
|
||||
Owner.itemRotation -= MathHelper.Pi;
|
||||
}
|
||||
else
|
||||
{
|
||||
Owner.itemRotation -= MathHelper.PiOver2;
|
||||
}
|
||||
|
||||
Owner.itemRotation = MathHelper.WrapAngle(Owner.itemRotation);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
Projectile.scale = 0.6f;
|
||||
|
||||
if (!Owner.channel && DashState == 0)
|
||||
{
|
||||
Projectile.Kill();
|
||||
return;
|
||||
}
|
||||
|
||||
Vector2 toMouse = Utils.DirectionTo(Owner.Center, Owner.ClampedMouseWorld());
|
||||
Positioning(toMouse);
|
||||
|
||||
if (DashState == 0)
|
||||
{
|
||||
if (Owner.altFunctionUse == 2 && Owner.Calamity().mouseRight)
|
||||
{
|
||||
// Check if the player has enough EM
|
||||
if (Owner.Calamity().elementalMastery < 100)
|
||||
{
|
||||
Projectile.Kill();
|
||||
return;
|
||||
}
|
||||
|
||||
DashState = 1;
|
||||
DashTimer = DashPrepTime;
|
||||
Projectile.localAI[0] = Owner.direction;
|
||||
Owner.Calamity().elementalMastery = 0; // Reset EM to zero
|
||||
}
|
||||
}
|
||||
|
||||
if (Owner.altFunctionUse == 0 && DashState == 0)
|
||||
{
|
||||
Projectile.Center += (Utils.DirectionTo(Owner.Center, Owner.ClampedMouseWorld()) * Main.rand.NextFloat(-5f, 8f));
|
||||
UsePrimary(toMouse);
|
||||
}
|
||||
|
||||
if (DashState > 0)
|
||||
{
|
||||
UseSecondary();
|
||||
}
|
||||
}
|
||||
|
||||
private void UsePrimary(Vector2 toMouse)
|
||||
{
|
||||
stabTimer++;
|
||||
if (stabTimer % primaryStabfireRate != 0)
|
||||
return;
|
||||
|
||||
float offset = Main.rand.NextFloat(-MathHelper.ToRadians(10f), MathHelper.ToRadians(6f));
|
||||
Vector2 stabDir = toMouse.RotatedBy(offset);
|
||||
|
||||
Vector2 stabOrigin = Owner.MountedCenter;
|
||||
Vector2 stabTip = stabOrigin + stabDir * 100f;
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
Vector2 spawnPos = stabTip + Main.rand.NextVector2Circular(18f, 12f);
|
||||
Vector2 vel = stabDir * Main.rand.NextFloat(5f, 19f);
|
||||
|
||||
Particle spark = new GlowSparkParticle(spawnPos, vel, false, Main.rand.Next(5, 8), Main.rand.NextFloat(0.02f, 0.07f), Color.Lerp(Color.Aqua, Color.OrangeRed, Main.rand.NextFloat(1f)) * 0.55f, new Vector2(Main.rand.NextFloat(0.475f, 0.535f), Main.rand.NextFloat(1.2f, 1.3f)), true, false);
|
||||
GeneralParticleHandler.SpawnParticle(spark);
|
||||
}
|
||||
|
||||
Particle afterImage = new CustomSpark(Projectile.Center + (stabDir * 10f) + Main.rand.NextVector2Circular(4f, 11f), (Projectile.rotation - MathHelper.PiOver2).ToRotationVector2(), new("CalamityMod/Items/Weapons/Melee/Lightspeed"), false, Main.rand.Next(5,9), Projectile.scale * 0.9f, Color.White * Main.rand.NextFloat(0.6f, 0.85f), new Vector2(1, 1), true, false, flipHorizontal: Owner.direction == -1 ? true : false);
|
||||
GeneralParticleHandler.SpawnParticle(afterImage);
|
||||
|
||||
// Make blade randomly vibrate
|
||||
bladeRot = Main.rand.NextFloat(-0.2f, 0.2f) * Owner.direction;
|
||||
Projectile.scale *= Main.rand.NextFloat(0.85f, 1.05f);
|
||||
Projectile.Center += stabDir + Main.rand.NextVector2Circular(9f, 1f);
|
||||
|
||||
// Make arm randomly vibrate
|
||||
if (Main.rand.NextBool())
|
||||
{
|
||||
Owner.SetCompositeArmFront(true, Main.rand.NextBool() ? CompositeArmStretchAmount.ThreeQuarters : CompositeArmStretchAmount.Quarter, Owner.itemRotation + Main.rand.NextFloat(-0.22f, 0.22f));
|
||||
}
|
||||
|
||||
stabSoundTimer++;
|
||||
if (stabSoundTimer % 3 == 0)
|
||||
{
|
||||
SoundEngine.PlaySound(SoundID.Item1 with { Volume = 0.65f, MaxInstances = -1 }, Projectile.Center);
|
||||
stabSoundTimer = 0;
|
||||
}
|
||||
|
||||
// Spawn the hitbox
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Owner.Center + toMouse * 20 * (float)Math.Pow(Projectile.scale, 4), toMouse * 25, ModContent.ProjectileType<LightspeedM1Hitbox>(), Projectile.damage, 0, Projectile.owner);
|
||||
}
|
||||
|
||||
private void UseSecondary()
|
||||
{
|
||||
Vector2 stabOrigin = Owner.MountedCenter;
|
||||
Vector2 stabOffset = stabOrigin + Utils.DirectionTo(Owner.MountedCenter, Owner.ClampedMouseWorld()) * 30f;
|
||||
Projectile.Center = stabOffset;
|
||||
|
||||
|
||||
if (DashState == 1) // Initial delay
|
||||
{
|
||||
DashTimer--;
|
||||
Owner.heldProj = Projectile.whoAmI;
|
||||
Owner.itemTime = Owner.itemAnimation = 2;
|
||||
|
||||
Projectile.scale = 0.6f;
|
||||
|
||||
if (!firstSecondaryIteration)
|
||||
{
|
||||
SoundEngine.PlaySound(CommonCalamitySounds.MeatySlashSound with { Volume = 0.4f, Pitch = -0.05f }, Projectile.Center);
|
||||
initialDirectionForThisAnim = Owner.direction; // Set for rest of the pre-dash anim so weird stuff doesnt happen when changing directions
|
||||
firstSecondaryIteration = true;
|
||||
}
|
||||
|
||||
// Spin the blade around
|
||||
if (DashTimer > 6)
|
||||
{
|
||||
float duration = DashPrepTime - 6;
|
||||
float elapsed = duration - DashTimer;
|
||||
|
||||
float t = MathHelper.Clamp(elapsed / duration, 0f, 1f);
|
||||
float eased = MathF.Pow(t, 1.2f);
|
||||
|
||||
AltSpinRotation = eased * (4f * MathHelper.Pi);
|
||||
float orbitalAngle = AltSpinRotation * initialDirectionForThisAnim + (initialDirectionForThisAnim == -1 ? MathHelper.Pi : 0);
|
||||
float orbitRadius = 40f;
|
||||
|
||||
Projectile.Center = Owner.Center + orbitalAngle.ToRotationVector2() * orbitRadius;
|
||||
float tangentAngle = orbitalAngle + (initialDirectionForThisAnim == 1 ? MathHelper.PiOver4 : -MathHelper.PiOver4 + MathHelper.Pi);
|
||||
Projectile.rotation = tangentAngle;
|
||||
}
|
||||
|
||||
// Mid-spin VFX
|
||||
if (DashTimer < 32 && DashTimer > 8)
|
||||
{
|
||||
if (DashTimer % 4 == 0)
|
||||
{
|
||||
Vector2 pos = Owner.Center + Projectile.rotation.ToRotationVector2() * 60f;
|
||||
Particle sparkle = new CritSpark(pos, new Vector2(7f, 0).RotatedBy(Projectile.rotation), Color.Lerp(Color.Aqua, Color.MediumPurple, Main.rand.NextFloat(1f)), Color.White * 0.33f, 1.2f, 12, 0.3f, 1.2f, hueShift: 0.06f);
|
||||
GeneralParticleHandler.SpawnParticle(sparkle);
|
||||
}
|
||||
|
||||
Particle smear = new CircularSmearVFX(Owner.MountedCenter, Color.Aqua * 0.4f, Projectile.rotation, Projectile.scale * 1.66f);
|
||||
GeneralParticleHandler.SpawnParticle(smear);
|
||||
}
|
||||
|
||||
// Initiate dash
|
||||
if (DashTimer <= 0)
|
||||
{
|
||||
DashState = 2;
|
||||
DashTimer = DashDuration;
|
||||
|
||||
Vector2 toMouse = Owner.Center.DirectionTo(Owner.ClampedMouseWorld());
|
||||
Projectile.velocity = toMouse * DashSpeed;
|
||||
|
||||
Owner.mount?.Dismount(Owner);
|
||||
Owner.RemoveAllGrapplingHooks();
|
||||
|
||||
SoundEngine.PlaySound(Exoblade.DashSound, Owner.Center);
|
||||
|
||||
Owner.immune = true;
|
||||
Owner.immuneNoBlink = true;
|
||||
Owner.immuneTime = (int) DashDuration + 2;
|
||||
for (int k = 0; k < Owner.hurtCooldowns.Length; k++)
|
||||
Owner.hurtCooldowns[k] = Owner.immuneTime;
|
||||
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Owner.Center, Projectile.velocity, ModContent.ProjectileType<LightspeedDashHitbox>(), Projectile.damage * 24, Projectile.knockBack * 4, Projectile.owner);
|
||||
}
|
||||
}
|
||||
|
||||
else if (DashState == 2) // Dashing
|
||||
{
|
||||
DashTimer--;
|
||||
|
||||
Vector2 dashVelocity = Projectile.velocity;
|
||||
Owner.velocity = dashVelocity;
|
||||
Owner.ChangeDir(Math.Sign(dashVelocity.X));
|
||||
|
||||
Projectile.velocity *= DashAcceleration;
|
||||
|
||||
Projectile.scale = MathHelper.Lerp(1f, 0.3f, MathF.Pow(1f - DashTimer / DashDuration, 5));
|
||||
|
||||
Owner.heldProj = Projectile.whoAmI;
|
||||
Owner.itemTime = Owner.itemAnimation = 2;
|
||||
|
||||
if (DashTimer <= 0)
|
||||
{
|
||||
Owner.velocity *= 0.1f;
|
||||
Projectile.Kill();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Drawcode below is mostly based on Exoblade's dash.
|
||||
public float PierceWidthFunction(float completionRatio)
|
||||
{
|
||||
float width = Utils.GetLerpValue(0f, 0.2f, completionRatio, true) * Projectile.scale * 24f;
|
||||
//Fade it out starkly near the end of the lunge
|
||||
width *= (1 - (float)Math.Pow(LungeProgression, 4));
|
||||
return width;
|
||||
}
|
||||
|
||||
public Color PierceColorFunction(float completionRatio) => Color.White * Projectile.Opacity; // The trail color doesnt matter here
|
||||
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
Texture2D texture = ModContent.Request<Texture2D>(Texture).Value;
|
||||
int frameHeight = texture.Height / Main.projFrames[Projectile.type];
|
||||
Rectangle frame = new Rectangle(0, Projectile.frame * frameHeight, texture.Width, frameHeight);
|
||||
Vector2 origin = new Vector2(texture.Width / 2f, frameHeight / 2f);
|
||||
|
||||
SpriteEffects spriteEffects = Owner.direction == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally;
|
||||
lightColor = Color.White; // Fullbright
|
||||
Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, frame, lightColor, Projectile.rotation, origin, Projectile.scale, spriteEffects, 0);
|
||||
|
||||
DrawPierceTrail();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void DrawPierceTrail()
|
||||
{
|
||||
if (DashState != 2)
|
||||
return;
|
||||
|
||||
Main.spriteBatch.EnterShaderRegion();
|
||||
|
||||
Color mainColor = MulticolorLerp((Main.GlobalTimeWrappedHourly * 2f) % 1, Color.Aqua, Color.MediumAquamarine, Color.DarkOrange, Color.OrangeRed);
|
||||
Color secondaryColor = MulticolorLerp((Main.GlobalTimeWrappedHourly * 2f + 0.2f) % 1, Color.Aqua, Color.MediumAquamarine, Color.DarkOrange, Color.OrangeRed);
|
||||
|
||||
mainColor = Color.Lerp(Color.White, mainColor, 0.4f + 0.6f * (float)Math.Pow(LungeProgression, 0.5f));
|
||||
secondaryColor = Color.Lerp(Color.White, secondaryColor, 0.4f + 0.6f * (float)Math.Pow(LungeProgression, 0.5f));
|
||||
|
||||
Vector2 trailOffset = Projectile.Size * 0.5f;
|
||||
GameShaders.Misc["CalamityMod:ExobladePierce"].SetShaderTexture(ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/GreyscaleGradients/EternityStreak"));
|
||||
GameShaders.Misc["CalamityMod:ExobladePierce"].UseImage2("Images/Extra_189");
|
||||
GameShaders.Misc["CalamityMod:ExobladePierce"].UseColor(mainColor);
|
||||
GameShaders.Misc["CalamityMod:ExobladePierce"].UseSecondaryColor(secondaryColor);
|
||||
GameShaders.Misc["CalamityMod:ExobladePierce"].Apply();
|
||||
|
||||
// Lightspeed tracks 120 positions in oldPos.
|
||||
// Provide 60 points for smoothing, but only render 30
|
||||
int numPointsRendered = 30;
|
||||
int numPointsProvided = 60;
|
||||
var positionsToUse = Projectile.oldPos.Take(numPointsProvided).ToArray();
|
||||
PrimitiveRenderer.RenderTrail(positionsToUse, new(PierceWidthFunction, PierceColorFunction, (_) => trailOffset, shader: GameShaders.Misc["CalamityMod:ExobladePierce"]), numPointsRendered);
|
||||
|
||||
Main.spriteBatch.ExitShaderRegion();
|
||||
}
|
||||
public override void OnKill(int timeLeft)
|
||||
{
|
||||
DashState = 0;
|
||||
DashTimer = 0;
|
||||
Projectile.scale = 0.6f;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
using System;
|
||||
using CalamityMod.Items.Weapons.Melee;
|
||||
using CalamityMod.NPCs;
|
||||
using CalamityMod.Particles;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using Terraria.Utilities;
|
||||
|
||||
namespace CalamityMod.Projectiles.Melee
|
||||
{
|
||||
[PierceResistExceptionAttribute(true)]
|
||||
public class LightspeedM1Hitbox : ModProjectile, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Projectiles.Melee";
|
||||
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
|
||||
public Player Owner => Main.player[Projectile.owner];
|
||||
|
||||
public bool gotEnergyThisSwing = false;
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 84;
|
||||
Projectile.height = 64;
|
||||
Projectile.friendly = true;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.timeLeft = 6;
|
||||
Projectile.DamageType = TrueMeleeNoSpeedDamageClass.Instance;
|
||||
Projectile.usesIDStaticNPCImmunity = true;
|
||||
Projectile.idStaticNPCHitCooldown = 4;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
Vector2 toMouse = Utils.DirectionTo(Owner.Center, Owner.ClampedMouseWorld() + MathHelper.Pi.ToRotationVector2());
|
||||
|
||||
float rotation = toMouse.ToRotation();
|
||||
|
||||
Projectile.rotation = rotation;
|
||||
Projectile.velocity = toMouse * 34;
|
||||
}
|
||||
|
||||
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
|
||||
{
|
||||
Vector2 toMouse = Utils.DirectionTo(Owner.Center, Owner.ClampedMouseWorld() + MathHelper.Pi.ToRotationVector2());
|
||||
|
||||
if (!gotEnergyThisSwing)
|
||||
{
|
||||
gotEnergyThisSwing = true;
|
||||
var player = Main.player[Projectile.owner];
|
||||
var modPlayer = player.Calamity();
|
||||
|
||||
// +4 energy on hit
|
||||
modPlayer.elementalMastery += 4;
|
||||
modPlayer.elementalMastery = Math.Min(modPlayer.elementalMastery, Lightspeed.MaxEnergy);
|
||||
}
|
||||
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
Vector2 particleSpeed = Utils.SafeNormalize(target.Center * toMouse, Vector2.One).RotatedByRandom(MathHelper.PiOver4 * 0.8f) * Main.rand.NextFloat(7f, 14f);
|
||||
Particle energyLeak = new SquishyLightParticle(target.Center, particleSpeed, Main.rand.NextFloat(0.25f, 0.5f), Color.OrangeRed, 22, 2, 2.5f, hueShift: 0.06f);
|
||||
GeneralParticleHandler.SpawnParticle(energyLeak);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -134,7 +134,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
if (timer % 8 == 0)
|
||||
{
|
||||
Vector2 pos = player.Center + Projectile.rotation.ToRotationVector2() * 60f;
|
||||
Particle sparkle = new CritSpark(pos, new Vector2(7f, 0).RotatedBy(Projectile.rotation), Color.Lerp(Color.CornflowerBlue, Color.MediumPurple, Main.rand.NextFloat()), Color.White * 0.33f, 1.2f, 12, 0.3f, 1.2f);
|
||||
Particle sparkle = new CritSpark(pos, new Vector2(7f, 0).RotatedBy(Projectile.rotation), Color.Lerp(Color.CornflowerBlue, Color.MediumPurple, Main.rand.NextFloat(1f)), Color.White * 0.33f, 1.2f, 12, 0.3f, 1.2f);
|
||||
GeneralParticleHandler.SpawnParticle(sparkle);
|
||||
}
|
||||
Particle smear = new CircularSmearVFX(player.Center, Color.CornflowerBlue * 0.25f, Projectile.rotation, Projectile.scale * 1.25f);
|
||||
|
||||
@@ -1,189 +0,0 @@
|
||||
using System;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using CalamityMod.Particles;
|
||||
using static Terraria.Player;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using static System.Net.Mime.MediaTypeNames;
|
||||
using CalamityMod.Projectiles.Melee;
|
||||
|
||||
namespace CalamityMod.Projectiles.DraedonsArsenal
|
||||
{
|
||||
public class StarburstShivHoldout : ModProjectile, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Projectiles.Misc";
|
||||
|
||||
public override string Texture => "CalamityMod/Items/Weapons/Melee/StarburstShiv";
|
||||
public ref float attackTimer => ref Projectile.ai[0];
|
||||
public Player Owner => Main.player[Projectile.owner];
|
||||
|
||||
// Sprite visuals
|
||||
public float scaleFx = 0.6f; // Default that looks reasonable size-wise, changes on some attacks
|
||||
|
||||
public Vector2 innateOffset = new(23f, -5f);
|
||||
public Vector2 handPos;
|
||||
|
||||
public int primaryStabfireRate => 2;
|
||||
public int time = 0;
|
||||
|
||||
public float bladeRot = 0;
|
||||
public bool pressedRight = false;
|
||||
|
||||
// Internal control
|
||||
private int stabTimer;
|
||||
|
||||
public override bool? CanDamage() => false;
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 74;
|
||||
Projectile.height = 94;
|
||||
Projectile.friendly = true;
|
||||
Projectile.DamageType = DamageClass.MeleeNoSpeed;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.timeLeft = 5;
|
||||
Projectile.extraUpdates = 1;
|
||||
}
|
||||
public void Positioning(Vector2 toMouse) // Hand and holdout positioning
|
||||
{
|
||||
|
||||
Owner.ChangeDir(Math.Sign(toMouse.X));
|
||||
|
||||
// Calculate the angle for the arm holding the weapon
|
||||
float baseArmRotation = toMouse.ToRotation();
|
||||
float compositeArmRotation = baseArmRotation + bladeRot - MathHelper.PiOver2;
|
||||
|
||||
// Set the front composite arm to point towards the correct direction.
|
||||
Owner.SetCompositeArmFront(true, CompositeArmStretchAmount.Full, compositeArmRotation);
|
||||
Owner.SetCompositeArmBack(true, CompositeArmStretchAmount.Full, 0f);
|
||||
|
||||
Vector2 actualInnateOffset = innateOffset;
|
||||
if (Owner.direction == -1)
|
||||
{
|
||||
actualInnateOffset.X += 1f;
|
||||
actualInnateOffset.Y += 10f;
|
||||
|
||||
}
|
||||
|
||||
handPos = Owner.GetFrontHandPosition(CompositeArmStretchAmount.Full, compositeArmRotation) + actualInnateOffset.RotatedBy(baseArmRotation);
|
||||
|
||||
// Set properties based on the mouse direction
|
||||
Projectile.velocity = toMouse;
|
||||
Projectile.rotation = toMouse.ToRotation() + bladeRot;
|
||||
Projectile.Center = handPos;
|
||||
|
||||
// Same for the owner
|
||||
Owner.heldProj = Projectile.whoAmI;
|
||||
Owner.itemTime = Owner.itemAnimation = 2;
|
||||
|
||||
// Item rotation for the player's sprite display
|
||||
Owner.itemRotation = Projectile.rotation;
|
||||
if (Owner.direction != 1)
|
||||
{
|
||||
Owner.itemRotation -= MathHelper.Pi;
|
||||
}
|
||||
|
||||
Owner.itemRotation = MathHelper.WrapAngle(Owner.itemRotation);
|
||||
}
|
||||
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
Projectile.scale = 1f;
|
||||
|
||||
if (Owner.channel)
|
||||
{
|
||||
Projectile.timeLeft = 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
Projectile.Kill();
|
||||
}
|
||||
|
||||
Vector2 toMouse = Utils.DirectionTo(Owner.Center, Owner.ClampedMouseWorld());
|
||||
Positioning(toMouse);
|
||||
|
||||
if (Owner.altFunctionUse == 0)
|
||||
{
|
||||
UsePrimary(toMouse);
|
||||
|
||||
Vector2 currOffset = Projectile.Center + new Vector2(Main.rand.NextFloat(-4f, 4f), Main.rand.NextFloat(-1f, 7f));
|
||||
Projectile.Center = currOffset;
|
||||
}
|
||||
|
||||
else if (Owner.altFunctionUse == 2)
|
||||
{
|
||||
// Dash functionality
|
||||
}
|
||||
}
|
||||
|
||||
// -- BASIC M1 --
|
||||
private void UsePrimary(Vector2 toMouse)
|
||||
{
|
||||
stabTimer++;
|
||||
if (stabTimer % primaryStabfireRate != 0)
|
||||
return;
|
||||
|
||||
float offset = Main.rand.NextFloat(-MathHelper.ToRadians(6f), MathHelper.ToRadians(6f));
|
||||
Vector2 stabDir = toMouse.RotatedBy(offset);
|
||||
|
||||
// SoundEngine.PlaySound(SoundID.Item1 with { Volume = 0.8f, Pitch = 0.1f, MaxInstances = 6, PitchVariance = 0.1f }, Owner.Center);
|
||||
|
||||
Vector2 stabOrigin = Owner.MountedCenter;
|
||||
Vector2 stabTip = stabOrigin + stabDir * 100f;
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
Vector2 spawnPos = stabTip + Main.rand.NextVector2Circular(18f, 12f);
|
||||
|
||||
Vector2 vel = stabDir * Main.rand.NextFloat(5f, 19f);
|
||||
Color color = Color.Lerp(Color.AliceBlue, Color.OrangeRed, Main.rand.NextFloat(1f));
|
||||
Particle spark = new GlowSparkParticle(spawnPos, vel, false, Main.rand.Next(5, 8), Main.rand.NextFloat(0.02f, 0.07f), color * 0.55f, new Vector2(0.5f, 1.3f), true, false);
|
||||
GeneralParticleHandler.SpawnParticle(spark);
|
||||
}
|
||||
|
||||
|
||||
// Drawing randomness
|
||||
bladeRot = Main.rand.NextFloat(-0.25f, 0.5f) * Owner.direction;
|
||||
Projectile.scale *= Main.rand.NextFloat(0.88f, 1.04f);
|
||||
if (Main.rand.NextBool())
|
||||
{
|
||||
Owner.SetCompositeArmFront(true, Main.rand.NextBool() ? CompositeArmStretchAmount.ThreeQuarters : CompositeArmStretchAmount.Quarter, Owner.itemRotation - (Owner.direction == 1 ? MathHelper.PiOver2 : MathHelper.TwoPi * 0.75f) + Main.rand.NextFloat(-0.22f, 0.22f));
|
||||
}
|
||||
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Owner.Center + toMouse * 20 * (float)Math.Pow(scaleFx, 4), toMouse * 25, ModContent.ProjectileType<StarburstShivM1Hitbox>(), Projectile.damage, 0, Projectile.owner);
|
||||
|
||||
}
|
||||
|
||||
// -- DASH --
|
||||
private void UseSecondary(Vector2 toMouse)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
// Un-jand the rotation that the sprite is drawn to actually point toward the mouse cursor
|
||||
float drawRotation = Projectile.rotation + MathHelper.PiOver4;
|
||||
if (Owner.direction == -1)
|
||||
{
|
||||
drawRotation += MathHelper.PiOver2;
|
||||
}
|
||||
|
||||
Texture2D texture = ModContent.Request<Texture2D>(Texture).Value;
|
||||
int frameHeight = texture.Height / Main.projFrames[Projectile.type];
|
||||
Rectangle frame = new Rectangle(0, Projectile.frame * frameHeight, texture.Width, frameHeight);
|
||||
Vector2 origin = new Vector2(texture.Width / 2f, frameHeight / 2f);
|
||||
|
||||
SpriteEffects spriteEffects = Owner.direction == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally;
|
||||
|
||||
Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, frame, lightColor, drawRotation, origin, Projectile.scale * scaleFx, spriteEffects, 0);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
using System;
|
||||
using CalamityMod.Items.Weapons.Melee;
|
||||
using CalamityMod.NPCs;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using Terraria.Utilities;
|
||||
|
||||
namespace CalamityMod.Projectiles.Melee
|
||||
{
|
||||
[PierceResistExceptionAttribute(true)]
|
||||
public class StarburstShivM1Hitbox : ModProjectile, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Projectiles.Melee";
|
||||
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
|
||||
public Player Owner => Main.player[Projectile.owner];
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 84;
|
||||
Projectile.height = 64;
|
||||
Projectile.friendly = true;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.timeLeft = 6;
|
||||
Projectile.DamageType = DamageClass.Melee;
|
||||
Projectile.usesIDStaticNPCImmunity = true;
|
||||
Projectile.idStaticNPCHitCooldown = 4;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
Vector2 toMouse = Utils.DirectionTo(Owner.Center, Owner.ClampedMouseWorld() + MathHelper.Pi.ToRotationVector2());
|
||||
|
||||
float rotation = toMouse.ToRotation();
|
||||
|
||||
Projectile.rotation = rotation;
|
||||
Projectile.velocity = toMouse * 34;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
Mods.CalamityMod.Projectiles.LightspeedDashHitbox.DisplayName: Lightspeed Dash Hitbox
|
||||
Reference in new issue
Block a user