Initial
This commit is contained in:
1 parent
a143ae271f
commit
dc57a9a89d
20 files changed
+859
-162
No files matched your search
@@ -176,9 +176,6 @@ namespace CalamityMod.Balancing
|
||||
// 35% resist to Flying Dragon.
|
||||
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.Ravager, Do(new ProjectileResistBalancingRule(0.65f, ProjectileID.DD2SquireSonicBoom))));
|
||||
|
||||
// 25% resist to Lucrecia.
|
||||
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.Ravager, Do(new ProjectileResistBalancingRule(0.75f, ProjectileType<DNA>()))));
|
||||
|
||||
// 20% resist to Aurora Blazer.
|
||||
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.Ravager, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType<AuroraFire>()))));
|
||||
|
||||
|
||||
@@ -273,6 +273,12 @@ namespace CalamityMod.CalPlayer
|
||||
public int deadSunCounter = 6;
|
||||
public int DragonsBreathAudioCooldown = 0;
|
||||
public int DragonsBreathAudioCooldown2 = 0;
|
||||
public int lucreciaEnergy = 0;
|
||||
public int lucreciaEnergyTimer = 0;
|
||||
public bool lucreciaEnergyPaused = false;
|
||||
public int lucreciaEnergyMax = 100;
|
||||
public bool lucreciaEnergyMaxSFXPlayed = false;
|
||||
private int lucreciaParticleTimer = 0;
|
||||
public int PhotoAudioCooldown = 0;
|
||||
public int PhotoTimer = 90;
|
||||
/// <summary> Cooldown variable used to add a delay between Anahita's Arpeggio uses. </summary>
|
||||
@@ -3220,6 +3226,7 @@ namespace CalamityMod.CalPlayer
|
||||
burningSeaBurnOut = 0;
|
||||
flareGunOverheat = 0;
|
||||
hellbornShots = 0;
|
||||
lucreciaEnergy = 0;
|
||||
searedPanCounter = 0;
|
||||
searedPanTimer = 0;
|
||||
potionTimer = 0;
|
||||
|
||||
@@ -162,6 +162,9 @@ namespace CalamityMod.CalPlayer
|
||||
// Drawing parameters
|
||||
UpdateDrawingParameters();
|
||||
|
||||
// Handle Lucrecia's passive energy effects
|
||||
HandleLucreciaEffects();
|
||||
|
||||
// Update all particle sets for items.
|
||||
// This must be done here instead of in the item logic because these sets are not properly instanced
|
||||
// in the global classes. Attempting to update them there will cause multiple updates to one set for multiple items.
|
||||
@@ -367,6 +370,52 @@ namespace CalamityMod.CalPlayer
|
||||
Lighting.AddLight(Player.Center, Color.MediumOrchid.ToVector3());
|
||||
}
|
||||
|
||||
if (Player.HeldItem.type == ModContent.ItemType<Lucrecia>() && lucreciaEnergy > 0)
|
||||
{
|
||||
if (lucreciaEnergy == lucreciaEnergyMax && !lucreciaEnergyPaused)
|
||||
{
|
||||
lucreciaEnergyPaused = true;
|
||||
lucreciaEnergyTimer = 0;
|
||||
}
|
||||
|
||||
lucreciaEnergyTimer++;
|
||||
|
||||
// If the energy is at max, pause for 180 ticks
|
||||
if (lucreciaEnergyPaused)
|
||||
{
|
||||
if (lucreciaEnergyTimer >= 1 && !lucreciaEnergyMaxSFXPlayed)
|
||||
{
|
||||
SoundEngine.PlaySound(SoundID.Item79 with { Volume = 1.6f, Pitch = 0.4f }, Player.Center);
|
||||
lucreciaEnergyMaxSFXPlayed = true;
|
||||
|
||||
}
|
||||
// If the pause is Done, resume decrementing.
|
||||
if (lucreciaEnergyTimer >= 180)
|
||||
{
|
||||
lucreciaEnergyPaused = false;
|
||||
lucreciaEnergyTimer = 0;
|
||||
lucreciaEnergy--;
|
||||
}
|
||||
}
|
||||
else // Decrementing
|
||||
{
|
||||
lucreciaEnergyMaxSFXPlayed = false;
|
||||
// Once every 6 ticks
|
||||
if (lucreciaEnergyTimer >= 6)
|
||||
{
|
||||
lucreciaEnergy--;
|
||||
lucreciaEnergyTimer = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Reset the timer and pause state if the player isn't holding the weapon.
|
||||
lucreciaEnergyTimer = 0;
|
||||
lucreciaEnergyPaused = false;
|
||||
}
|
||||
|
||||
|
||||
if (lAmbergris)
|
||||
{
|
||||
if (dashStart)
|
||||
@@ -4509,6 +4558,47 @@ namespace CalamityMod.CalPlayer
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Lucrecia Effects
|
||||
|
||||
public void HandleLucreciaEffects()
|
||||
{
|
||||
int lucreciaItemID = ModContent.ItemType<Lucrecia>();
|
||||
if (Player.HeldItem.type == lucreciaItemID && lucreciaEnergy > 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 * (lucreciaEnergy / 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 = lucreciaEnergy / (float)lucreciaEnergyMax;
|
||||
Color color = Main.rand.NextBool() ? Color.MediumPurple : Color.CornflowerBlue;
|
||||
color *= opacity;
|
||||
|
||||
if (lucreciaEnergy >= 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, Main.rand.NextFloat(0.05f, 0.065f), Main.rand.Next(30, 60), rotationSpeed, 1f, true, Player.Center, Player.whoAmI);
|
||||
GeneralParticleHandler.SpawnParticle(particle);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
#region Energy Shields
|
||||
private void EnergyShields()
|
||||
{
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
using System;
|
||||
using CalamityMod.CalPlayer;
|
||||
using CalamityMod.Items.Weapons.Melee;
|
||||
using CalamityMod.Projectiles.Melee.Shortswords;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria.Audio;
|
||||
using Terraria;
|
||||
using Terraria.GameContent;
|
||||
using Terraria.Localization;
|
||||
using Terraria.ModLoader;
|
||||
using static Terraria.ModLoader.ModContent;
|
||||
|
||||
namespace CalamityMod.Cooldowns
|
||||
{
|
||||
public class LucreciaEnergy : CooldownHandler
|
||||
{
|
||||
public float CompletionPercentage => MathF.Round(instance.Completion * 100);
|
||||
private bool IsEmpty => CompletionPercentage == 100;
|
||||
private float TextXOffset => -5.8f;
|
||||
private Vector2 TextPosition => new(TextXOffset, 15);
|
||||
private Color TextColor => Color.MediumPurple;
|
||||
private Color TextBorderColor = Color.AntiqueWhite;
|
||||
|
||||
public static new string ID => "LucreciaEnergy";
|
||||
public override bool CanTickDown => false;
|
||||
public override LocalizedText DisplayName => CalamityUtils.GetText($"UI.Cooldowns.{ID}");
|
||||
public override bool ShouldDisplay => instance.player.HeldItem.type == ItemType<Lucrecia>();
|
||||
public override string Texture => "CalamityMod/Cooldowns/" + ID;
|
||||
|
||||
public override Color CooldownStartColor => IsEmpty ? Color.DimGray : Color.Lerp(Color.Purple, Color.SlateGray, instance.Completion);
|
||||
public override Color CooldownEndColor => IsEmpty ? Color.DimGray : Color.Lerp(Color.DarkBlue, Color.SlateGray, instance.Completion);
|
||||
|
||||
public override void DrawExpanded(SpriteBatch spriteBatch, Vector2 position, float opacity, float scale)
|
||||
{
|
||||
base.DrawExpanded(spriteBatch, position, opacity, scale);
|
||||
CalamityUtils.DrawBorderStringEightWay(spriteBatch, FontAssets.MouseText.Value, instance.player.Calamity().lucreciaEnergy.ToString(), position + TextPosition, TextColor, TextBorderColor);
|
||||
}
|
||||
|
||||
public override void DrawCompact(SpriteBatch spriteBatch, Vector2 position, float opacity, float scale)
|
||||
{
|
||||
base.DrawCompact(spriteBatch, position, opacity, scale);
|
||||
CalamityUtils.DrawBorderStringEightWay(spriteBatch, FontAssets.MouseText.Value, instance.player.Calamity().lucreciaEnergy.ToString(), position + TextPosition, TextColor, TextBorderColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 385 B |
Binary file not shown.
|
After Width: | Height: | Size: 179 B |
Binary file not shown.
|
After Width: | Height: | Size: 163 B |
@@ -1,41 +1,66 @@
|
||||
using CalamityMod.Items.Materials;
|
||||
using CalamityMod.Projectiles.Melee.Shortswords;
|
||||
using CalamityMod.Cooldowns;
|
||||
using CalamityMod.Items.Materials;
|
||||
using CalamityMod.Projectiles.BaseProjectiles;
|
||||
using CalamityMod.Projectiles.Melee;
|
||||
using CalamityMod.Projectiles.Melee.Spears;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Items.Weapons.Melee
|
||||
{
|
||||
public class Lucrecia : ModItem, ILocalizedModType
|
||||
public class Lucrecia : BaseSwordHoldoutItem, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Items.Weapons.Melee";
|
||||
|
||||
public override int ProjectileType => ModContent.ProjectileType<LucreciaProj>();
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Item.width = 54;
|
||||
Item.height = 54;
|
||||
Item.noMelee = true;
|
||||
Item.noUseGraphic = true;
|
||||
Item.autoReuse = true;
|
||||
Item.useStyle = ItemUseStyleID.Rapier;
|
||||
Item.damage = 90;
|
||||
Item.useStyle = ItemUseStyleID.Shoot;
|
||||
Item.damage = 67;
|
||||
Item.DamageType = DamageClass.Melee;
|
||||
Item.useAnimation = Item.useTime = 30;
|
||||
Item.shoot = ModContent.ProjectileType<LucreciaProj>();
|
||||
Item.shootSpeed = 4.2f;
|
||||
Item.useAnimation = Item.useTime = 34;
|
||||
Item.shootSpeed = 10f;
|
||||
Item.knockBack = 8.25f;
|
||||
Item.UseSound = SoundID.Item1;
|
||||
Item.value = CalamityGlobalItem.RarityYellowBuyPrice;
|
||||
Item.rare = ItemRarityID.Yellow;
|
||||
|
||||
Item.autoReuse = true;
|
||||
Item.channel = true;
|
||||
// Item.noMelee = true;
|
||||
// Item.noUseGraphic = true;
|
||||
base.SetDefaults();
|
||||
|
||||
}
|
||||
|
||||
public override bool MeleePrefix() => true;
|
||||
public override bool AltFunctionUse(Player player)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public override void HoldItem(Player player)
|
||||
{
|
||||
if (player.Calamity().cooldowns.TryGetValue(LucreciaEnergy.ID, out var cooldown))
|
||||
{
|
||||
cooldown.timeLeft = player.Calamity().lucreciaEnergy;
|
||||
}
|
||||
else
|
||||
{
|
||||
player.AddCooldown(LucreciaEnergy.ID, 0);
|
||||
}
|
||||
}
|
||||
|
||||
// public override bool MeleePrefix() => true;
|
||||
|
||||
public override void AddRecipes()
|
||||
{
|
||||
CreateRecipe().
|
||||
AddIngredient<LifeAlloy>(5).
|
||||
AddIngredient<CoreofCalamity>().
|
||||
AddIngredient(ItemID.FallenStar, 10).
|
||||
AddIngredient(ItemID.SoulofLight, 5).
|
||||
AddIngredient(ItemID.SoulofNight, 5).
|
||||
AddTile(TileID.MythrilAnvil).
|
||||
|
||||
@@ -800,8 +800,10 @@ Lucrecia: {
|
||||
DisplayName: Lucrecia
|
||||
Tooltip:
|
||||
'''
|
||||
Fires a DNA chain
|
||||
Finesse
|
||||
[c/9370db:Fires a spiraling darklight shard when swung]
|
||||
[c/837ce4:Hits with the blade itself build energy]
|
||||
[c/7489ee:Energy is lost over time but briefly stops depleting after reaching its maximum]
|
||||
[c/6495f7:Press <right> with maximum energy to fire a double helix comet]
|
||||
'''
|
||||
}
|
||||
|
||||
|
||||
@@ -306,3 +306,6 @@ MirrorBladeProjectile.DisplayName: Mirror Blade
|
||||
MirrorBladeSlash.DisplayName: Mirror Blade Slash
|
||||
MirrorBladeSlashCreator.DisplayName: Mirror Blade Slash Creator
|
||||
GildedProboscisProj.DisplayName: Gilded Proboscis
|
||||
LucreciaProj.DisplayName: Lucrecia Proj
|
||||
LucreciaDoubleHelix.DisplayName: Lucrecia Double Helix
|
||||
LucreciaSmallProjectile.DisplayName: Lucrecia Small Projectile
|
||||
@@ -119,6 +119,7 @@ Cooldowns: {
|
||||
KillModeCooldown: Kill Mode Cooldown
|
||||
LifeSteal: Life Steal Cooldown
|
||||
LionHeartShield: Energy Shell Cooldown
|
||||
LucreciaEnergy: Lucrecia Energy
|
||||
MasterChefShieldDurability: MJOLNIR Shield Level
|
||||
MasterChefShieldRecharge: MJOLNIR Shield Recharge
|
||||
NebulousCore: Nebulous Core Cooldown
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 10 KiB |
@@ -0,0 +1,82 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using CalamityMod.Particles;
|
||||
using Terraria.ModLoader;
|
||||
using System;
|
||||
|
||||
namespace CalamityMod.Particles
|
||||
{
|
||||
public class RoundedStarParticle : Particle
|
||||
{
|
||||
public override string Texture => "CalamityMod/Particles/RoundedStar";
|
||||
|
||||
public float RotationSpeed;
|
||||
public float Deceleration;
|
||||
|
||||
public bool UseSpiralAI;
|
||||
private int OwnerIndex;
|
||||
private float InitialRadius;
|
||||
private float OrbitalAngle;
|
||||
|
||||
public override bool UseCustomDraw => true;
|
||||
public RoundedStarParticle(Vector2 position, Vector2 velocity, Color color, float scale, int lifetime, float rotationSpeed, float deceleration, bool useSpiralAI, Vector2 spiralTarget, int ownerIndex)
|
||||
{
|
||||
Position = position;
|
||||
Velocity = velocity;
|
||||
Color = color;
|
||||
Scale = scale;
|
||||
Lifetime = lifetime;
|
||||
RotationSpeed = rotationSpeed;
|
||||
Deceleration = deceleration;
|
||||
UseSpiralAI = useSpiralAI;
|
||||
OwnerIndex = ownerIndex;
|
||||
|
||||
if (UseSpiralAI)
|
||||
{
|
||||
// Store the initial radius and angle relative to the player
|
||||
Vector2 directionToPlayer = Position - Main.player[OwnerIndex].Center;
|
||||
InitialRadius = directionToPlayer.Length();
|
||||
OrbitalAngle = directionToPlayer.ToRotation();
|
||||
}
|
||||
}
|
||||
|
||||
public override void Update()
|
||||
{
|
||||
if (UseSpiralAI)
|
||||
{
|
||||
OrbitalAngle += RotationSpeed;
|
||||
|
||||
float fadeScale = 1f - (Time / (float)Lifetime);
|
||||
float currentRadius = InitialRadius * fadeScale;
|
||||
|
||||
Vector2 playerCenter = Main.player[OwnerIndex].Center;
|
||||
|
||||
Vector2 newRelativePosition = OrbitalAngle.ToRotationVector2() * currentRadius;
|
||||
|
||||
// Update the particle's position.
|
||||
Position = playerCenter + newRelativePosition;
|
||||
}
|
||||
else
|
||||
{
|
||||
// If not using the spiral AI, apply deceleration
|
||||
Velocity *= Deceleration;
|
||||
Position += Velocity;
|
||||
}
|
||||
|
||||
Rotation += RotationSpeed;
|
||||
Time++;
|
||||
if (Time >= Lifetime)
|
||||
Kill();
|
||||
}
|
||||
|
||||
public override void CustomDraw(SpriteBatch spriteBatch)
|
||||
{
|
||||
float fade = 1f - (Time / (float)Lifetime);
|
||||
float scaleFade = Scale * fade;
|
||||
|
||||
Texture2D tex = ModContent.Request<Texture2D>(Texture).Value;
|
||||
spriteBatch.Draw(tex, Position - Main.screenPosition, null, Color * fade, Rotation, tex.Size() / 2f, Scale, SpriteEffects.None, 0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,86 +0,0 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.Melee
|
||||
{
|
||||
public class DNA : ModProjectile, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Projectiles.Melee";
|
||||
|
||||
public static int TotalSegments = 10;
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 22;
|
||||
Projectile.height = 72;
|
||||
Projectile.friendly = true;
|
||||
Projectile.alpha = 255;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.DamageType = DamageClass.Melee;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.usesIDStaticNPCImmunity = true;
|
||||
Projectile.idStaticNPCHitCooldown = 6;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2;
|
||||
if (Projectile.ai[1] == 0f)
|
||||
{
|
||||
Projectile.alpha -= 100;
|
||||
if (Projectile.alpha <= 0)
|
||||
{
|
||||
Projectile.alpha = 0;
|
||||
Projectile.ai[1] = 1f;
|
||||
|
||||
// This projectile normally does not move by itself, so this will manually move it one time only
|
||||
// This is only for the first segment
|
||||
if (Projectile.ai[0] == 0f)
|
||||
{
|
||||
Projectile.ai[0]++;
|
||||
Projectile.position += Projectile.velocity;
|
||||
}
|
||||
|
||||
// Spawn the next segment
|
||||
if (Main.myPlayer == Projectile.owner && Projectile.ai[0] < TotalSegments)
|
||||
{
|
||||
int nextSegment = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center + Projectile.velocity, Projectile.velocity, Projectile.type, Projectile.damage, Projectile.knockBack, Projectile.owner, Projectile.ai[0] + 1f);
|
||||
NetMessage.SendData(MessageID.SyncProjectile, -1, -1, null, nextSegment);
|
||||
}
|
||||
}
|
||||
}
|
||||
else // Begin fading out
|
||||
{
|
||||
int AlphaPerFrame = 15;
|
||||
Projectile.alpha += AlphaPerFrame;
|
||||
if (Projectile.alpha == AlphaPerFrame * 14)
|
||||
{
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
Dust dust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, DustID.BoneTorch, Projectile.velocity.X * 0.005f, Projectile.velocity.Y * 0.005f, 200, default, 1f);
|
||||
dust.noGravity = true;
|
||||
dust.velocity *= 0.5f;
|
||||
}
|
||||
}
|
||||
|
||||
if (Projectile.alpha >= 255)
|
||||
Projectile.Kill();
|
||||
}
|
||||
if (Main.rand.NextBool(10))
|
||||
Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.BoneTorch, Projectile.velocity.X * 0.005f, Projectile.velocity.Y * 0.005f);
|
||||
}
|
||||
|
||||
// This is essential for Vilethorn-type projectiles, as velocity is a stored parameter and isn't supposed to actually move the projectile
|
||||
public override bool ShouldUpdatePosition() => false;
|
||||
|
||||
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => Projectile.RotatingHitboxCollision(targetHitbox);
|
||||
|
||||
public override void OnKill(int timeLeft)
|
||||
{
|
||||
Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.BoneTorch, Projectile.oldVelocity.X * 0.005f, Projectile.oldVelocity.Y * 0.005f);
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 678 B |
@@ -0,0 +1,119 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using CalamityMod.Graphics.Primitives;
|
||||
using CalamityMod.Items.Weapons.Melee;
|
||||
using CalamityMod.Particles;
|
||||
using CalamityMod.Projectiles.BaseProjectiles;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using ReLogic.Content;
|
||||
using Terraria;
|
||||
using Terraria.Graphics.Shaders;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.Melee.Shortswords
|
||||
{
|
||||
public class LucreciaDNATrailCreator : ModProjectile
|
||||
{
|
||||
private List<Vector2> oldPositionsLeft = new List<Vector2>();
|
||||
private List<Vector2> oldPositionsRight = new List<Vector2>();
|
||||
private int trailTimer = 0;
|
||||
// The timer is initialized with a delay. It will reset to 6 after the first shot.
|
||||
private int middleStreakTimer = 40;
|
||||
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 200;
|
||||
Projectile.height = 170;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.hostile = false;
|
||||
Projectile.friendly = true;
|
||||
Projectile.extraUpdates = 12;
|
||||
Projectile.timeLeft = 2400;
|
||||
Projectile.minion = true; // Scuffed but it prevents the projectile from being culled in a few situations
|
||||
Projectile.alpha = 255;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
Player owner = Main.player[Projectile.owner];
|
||||
trailTimer++;
|
||||
|
||||
// Very volatile values...
|
||||
float amplitude = 86f;
|
||||
float frequency = 0.039f;
|
||||
|
||||
// Makes a perpendicular/mirrored trail, AKA a double helix
|
||||
Vector2 perpendicular = Vector2.Normalize(new Vector2(-Projectile.velocity.Y, Projectile.velocity.X));
|
||||
|
||||
// Calculate the sine wave value.
|
||||
float sineWave = (float)Math.Cos(trailTimer * frequency);
|
||||
|
||||
// Calculate offset based on the pattern of the sinewave and subtract the proj's dimensions to be accurate
|
||||
Vector2 offsetLeft = (perpendicular * amplitude * sineWave) - new Vector2(Projectile.width, Projectile.height);
|
||||
Vector2 offsetRight = (-perpendicular * amplitude * sineWave) - new Vector2(Projectile.width, Projectile.height);
|
||||
|
||||
oldPositionsLeft.Add(Projectile.Center + offsetLeft);
|
||||
oldPositionsRight.Add(Projectile.Center + offsetRight);
|
||||
|
||||
// The timer will now correctly decrease once per AI update.
|
||||
middleStreakTimer--;
|
||||
|
||||
if (middleStreakTimer <= 0)
|
||||
{
|
||||
// Reset the timer for the next shot.
|
||||
middleStreakTimer = 6;
|
||||
|
||||
// Spawn the main trail
|
||||
Particle spark = new CustomSpark(Projectile.Center, Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(-170f)), "CalamityMod/Particles/BloomCircle", false, 18, 0.24f, Color.MediumPurple * 1.3f, new Vector2(1f, 2.5f), true, true, shrinkSpeed: 0.25f, glowOpacity: 0.4f);
|
||||
GeneralParticleHandler.SpawnParticle(spark);
|
||||
Particle spark2 = new CustomSpark(Projectile.Center + perpendicular, Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(170f)), "CalamityMod/Particles/BloomCircle", false, 18, 0.24f, Color.CornflowerBlue * 1.3f, new Vector2(1f, 2.5f), true, true, shrinkSpeed: 0.25f, glowOpacity: 0.4f);
|
||||
GeneralParticleHandler.SpawnParticle(spark2);
|
||||
}
|
||||
|
||||
|
||||
// Remove old positions after 120
|
||||
int maxTrailLength = 120;
|
||||
if (oldPositionsLeft.Count > maxTrailLength)
|
||||
oldPositionsLeft.RemoveAt(0);
|
||||
if (oldPositionsRight.Count > maxTrailLength)
|
||||
oldPositionsRight.RemoveAt(0);
|
||||
}
|
||||
|
||||
private float WidthFunction(float completionRatio)
|
||||
{
|
||||
return MathHelper.Lerp(12f, 0f, completionRatio);
|
||||
}
|
||||
|
||||
|
||||
private Color LeftColorFunction(float completionRatio)
|
||||
{
|
||||
Color baseColor = Color.MediumPurple * 1.3f;
|
||||
|
||||
float alphaScaling = -4 * completionRatio * (completionRatio - 1);
|
||||
return baseColor * alphaScaling;
|
||||
}
|
||||
private Color RightColorFunction(float completionRatio)
|
||||
{
|
||||
Color baseColor = Color.CornflowerBlue * 1.3f;
|
||||
|
||||
float alphaScaling = -4 * completionRatio * (completionRatio - 1);
|
||||
return baseColor * alphaScaling;
|
||||
}
|
||||
|
||||
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
MiscShaderData trailShader = GameShaders.Misc["CalamityMod:TrailStreak"];
|
||||
trailShader.SetShaderTexture(ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/Trails/SylvestaffStreak"));
|
||||
|
||||
// Use the separate color functions for each trail
|
||||
PrimitiveRenderer.RenderTrail(oldPositionsLeft, new PrimitiveSettings(WidthFunction, LeftColorFunction, (_) => Projectile.Size * 1f, pixelate: false, shader: trailShader));
|
||||
PrimitiveRenderer.RenderTrail(oldPositionsRight, new PrimitiveSettings(WidthFunction, RightColorFunction, (_) => Projectile.Size * 1f, pixelate: false, shader: trailShader));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,153 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using CalamityMod.Buffs.DamageOverTime;
|
||||
using CalamityMod.Dusts;
|
||||
using CalamityMod.Graphics.Primitives;
|
||||
using CalamityMod.Items.Materials;
|
||||
using CalamityMod.Items.Weapons.Melee;
|
||||
using CalamityMod.Particles;
|
||||
using CalamityMod.Projectiles.Typeless;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using ReLogic.Content;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.Graphics.Shaders;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using static CalamityMod.CalamityUtils;
|
||||
using static Terraria.ModLoader.ModContent;
|
||||
|
||||
namespace CalamityMod.Projectiles.Melee
|
||||
{
|
||||
public class LucreciaSmallProjectile : ModProjectile, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Projectiles.Melee";
|
||||
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
|
||||
public int TargetIndex = -1;
|
||||
|
||||
public static float MaxWidth = 30;
|
||||
public ref float Time => ref Projectile.ai[0];
|
||||
|
||||
public static Asset<Texture2D> BloomTex;
|
||||
public static Asset<Texture2D> SlashTex;
|
||||
public static Asset<Texture2D> TrailTex;
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
ProjectileID.Sets.CultistIsResistantTo[Type] = true;
|
||||
ProjectileID.Sets.TrailCacheLength[Type] = 13;
|
||||
ProjectileID.Sets.TrailingMode[Type] = 2;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 19;
|
||||
Projectile.height = 22;
|
||||
Projectile.friendly = true;
|
||||
Projectile.DamageType = DamageClass.MeleeNoSpeed;
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.tileCollide = true;
|
||||
Projectile.penetrate = 1;
|
||||
Projectile.extraUpdates = 1;
|
||||
Projectile.alpha = 255;
|
||||
Projectile.timeLeft = 420;
|
||||
Projectile.usesLocalNPCImmunity = true;
|
||||
Projectile.localNPCHitCooldown = Projectile.MaxUpdates * 12;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
// Little bit of ambient lighting as it travels
|
||||
Lighting.AddLight(Projectile.Center, Color.WhiteSmoke.ToVector3() * 0.4f);
|
||||
|
||||
Projectile.rotation = Projectile.velocity.ToRotation();
|
||||
Projectile.velocity *= 1.01f;
|
||||
Projectile.scale = Utils.GetLerpValue(0f, 0.1f, Projectile.timeLeft / 600f, true);
|
||||
|
||||
if (Projectile.FinalExtraUpdate())
|
||||
Time++;
|
||||
|
||||
// CRUCIAL so that oldPos isnt initialized incorrectly when drawing
|
||||
if (Projectile.localAI[0] == 0f)
|
||||
{
|
||||
for (int i = 0; i < Projectile.oldPos.Length; i++)
|
||||
{
|
||||
Projectile.oldPos[i] = Projectile.position;
|
||||
}
|
||||
Projectile.localAI[0] = 1f;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
|
||||
{
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
float variance = Main.rand.NextFloat(-0.6f, 0.6f);
|
||||
int dustStyle = ModContent.DustType<SquashDust>();
|
||||
Dust dust2 = Dust.NewDustPerfect(target.Center, dustStyle);
|
||||
dust2.scale = Main.rand.NextFloat(1.2f, 1.6f) - Math.Abs(variance);
|
||||
dust2.velocity = (Projectile.velocity * 1.5f).RotatedBy(variance) * Main.rand.NextFloat(1.2f, 1.5f) * (1 - Math.Abs(variance));
|
||||
dust2.noGravity = true;
|
||||
dust2.color = Color.Lerp(Color.MediumPurple, Color.CornflowerBlue, Main.rand.NextFloat(0f, 1f));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public override Color? GetAlpha(Color lightColor) => Color.Lerp(Color.MediumPurple, Color.CornflowerBlue, 0.5f) with { A = 0 } * Projectile.Opacity;
|
||||
|
||||
public float TrailWidth(float completionRatio)
|
||||
{
|
||||
float width = Utils.GetLerpValue(1f, 0.4f, completionRatio, true) * (float)Math.Sin(Math.Acos(1 - Utils.GetLerpValue(0f, 0.08f, completionRatio, true)));
|
||||
|
||||
width *= Utils.GetLerpValue(0f, 0.1f, Projectile.timeLeft / 600f, true);
|
||||
|
||||
return width * (MaxWidth * .265f);
|
||||
}
|
||||
public Color TrailColor(float completionRatio)
|
||||
{
|
||||
Color baseColor = Color.Lerp(Color.MediumPurple, Color.CornflowerBlue, completionRatio);
|
||||
|
||||
return baseColor * 0.2f;
|
||||
}
|
||||
|
||||
public float MiniTrailWidth(float completionRatio) => TrailWidth(completionRatio) * 5.5f;
|
||||
public Color MiniTrailColor(float completionRatio) => Color.Lerp(Color.MediumPurple, Color.CornflowerBlue, completionRatio);
|
||||
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
if (Projectile.timeLeft > 412)
|
||||
return false;
|
||||
|
||||
Color mainColor = Color.Lerp(Color.MediumPurple, Color.CornflowerBlue, ((float)Main.timeForVisualEffects * 0.5f + Projectile.whoAmI * 0.12f) % 1);
|
||||
Color secondaryColor = Color.Lerp(Color.MediumPurple, Color.CornflowerBlue, ((float)Main.timeForVisualEffects * 0.5f + Projectile.whoAmI * 0.12f + 0.2f) % 1);
|
||||
|
||||
Main.spriteBatch.EnterShaderRegion();
|
||||
|
||||
if (TrailTex == null)
|
||||
TrailTex = Request<Texture2D>("CalamityMod/ExtraTextures/Trails/BasicTrail");
|
||||
|
||||
GameShaders.Misc["CalamityMod:ExobladePierce"].SetShaderTexture(TrailTex);
|
||||
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();
|
||||
|
||||
Vector2 offset = Projectile.Size * 0.5f;
|
||||
|
||||
// Apply the offset to the projectile's old position
|
||||
Vector2[] oldPosWithOffset = Projectile.oldPos.Select(p => p - offset).ToArray();
|
||||
|
||||
PrimitiveRenderer.RenderTrail(oldPosWithOffset, new(TrailWidth, TrailColor, (_) => Projectile.Size * 1f, shader: GameShaders.Misc["CalamityMod:ExobladePierce"]), 30);
|
||||
|
||||
GameShaders.Misc["CalamityMod:ExobladePierce"].UseColor(mainColor);
|
||||
GameShaders.Misc["CalamityMod:ExobladePierce"].UseSecondaryColor(secondaryColor);
|
||||
|
||||
PrimitiveRenderer.RenderTrail(oldPosWithOffset, new(MiniTrailWidth, MiniTrailColor, (_) => Projectile.Size * 1f, shader: GameShaders.Misc["CalamityMod:ExobladePierce"]), 30);
|
||||
|
||||
Main.spriteBatch.ExitShaderRegion();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,314 @@
|
||||
using System;
|
||||
using CalamityMod.Items.Weapons.Melee;
|
||||
using CalamityMod.Particles;
|
||||
using CalamityMod.Projectiles.BaseProjectiles;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.DataStructures;
|
||||
using Terraria.ID;
|
||||
using Terraria.Localization;
|
||||
using Terraria.ModLoader;
|
||||
using CalamityMod.CalPlayer;
|
||||
using CalamityMod.Buffs.StatBuffs;
|
||||
using CalamityMod.Projectiles.Melee.Shortswords;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace CalamityMod.Projectiles.Melee
|
||||
{
|
||||
public class LucreciaProj : BaseSwordHoldoutProjectile, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Projectiles.Melee";
|
||||
public override bool useMeleeSpeed => true;
|
||||
public override bool useMeleeSize => false;
|
||||
public override int swingWidth => 310;
|
||||
public override Item BaseItem => ModContent.GetModItem(ModContent.ItemType<Lucrecia>()).Item;
|
||||
public override string Texture => "CalamityMod/Items/Weapons/Melee/Lucrecia";
|
||||
public override SoundStyle? UseSound => SoundID.Item71 with { Volume = 0.9f };
|
||||
public override int StartupTime { get; set; }
|
||||
public override int CooldownTime { get; set; }
|
||||
public override int swingTime { get; set; } = 15;
|
||||
public override bool AlternateSwings { get => base.AlternateSwings; set => base.AlternateSwings = value; }
|
||||
public override float lineCollisionLength => 82;
|
||||
|
||||
// Boolshit
|
||||
public bool helixFired = false;
|
||||
public bool gotEnergyThisSwing = false;
|
||||
public bool trailFXTriggered = false;
|
||||
public bool particlesSpawned = false;
|
||||
public bool sparkTriggered = false;
|
||||
private bool IsThrusting => Projectile.localAI[0] == 1;
|
||||
|
||||
public bool IsAlternateThrust { get; set; }
|
||||
public int thrustPullbackTime = 26;
|
||||
public int thrustForwardTime = 13;
|
||||
public int thrustCooldownTime = 20;
|
||||
|
||||
public override void Defaults()
|
||||
{
|
||||
Projectile.extraUpdates = 6;
|
||||
Projectile.noEnchantmentVisuals = true;
|
||||
Projectile.Opacity = 0.2f; // Starting point, fades in quickly upon startup
|
||||
Projectile.width = Projectile.height = 54;
|
||||
}
|
||||
|
||||
public override void Spawn(IEntitySource source)
|
||||
{
|
||||
var player = Main.player[Projectile.owner];
|
||||
var modplayer = player.GetModPlayer<BaseSwordHoldoutPlayer>();
|
||||
var calamityPlayer = player.Calamity();
|
||||
|
||||
if (player.altFunctionUse == 2)
|
||||
{
|
||||
// Check for energy before the projectile exists
|
||||
if (calamityPlayer.lucreciaEnergy < 100)
|
||||
{
|
||||
Projectile.Kill();
|
||||
return;
|
||||
}
|
||||
|
||||
IsAlternateThrust = true;
|
||||
StartupTime = thrustPullbackTime;
|
||||
swingTime = thrustForwardTime;
|
||||
CooldownTime = thrustCooldownTime;
|
||||
Projectile.DamageType = DamageClass.Melee;
|
||||
Projectile.width = Projectile.height = 36;
|
||||
useMeleeSize = true;
|
||||
UseSound = SoundID.DD2_JavelinThrowersAttack;
|
||||
OffsetDistance = -30;
|
||||
RotateInStartup = 0.8f;
|
||||
RotateInCooldown = 1f;
|
||||
Projectile.knockBack = 15f;
|
||||
|
||||
calamityPlayer.lucreciaEnergy = 0; // Remove energy for startup
|
||||
}
|
||||
else
|
||||
{
|
||||
IsAlternateThrust = false;
|
||||
StartupTime = 8;
|
||||
CooldownTime = 5;
|
||||
swingTime = 15;
|
||||
OffsetDistance = 36;
|
||||
RotateInStartup = 0.8f;
|
||||
RotateInCooldown = 0;
|
||||
}
|
||||
|
||||
if (swingTime > 0)
|
||||
swingTime = (int)(swingTime / player.GetAttackSpeed(DamageClass.Melee));
|
||||
|
||||
// rest of the original Spawn method
|
||||
if (AlternateSwings)
|
||||
modplayer.swingNum = (modplayer.swingNum + 1) % 2;
|
||||
}
|
||||
|
||||
public override void AdditionalAI()
|
||||
{
|
||||
if (IsAlternateThrust)
|
||||
{
|
||||
if (inStartup)
|
||||
{
|
||||
trailFXTriggered = false; // Reset bool just in case
|
||||
Projectile.Opacity += 0.01f; // Fade in
|
||||
|
||||
// Pullback
|
||||
float eased = MathF.Pow(StartupCompletion, 0.3f);
|
||||
OffsetDistance = (int)MathHelper.Lerp(44, 34, eased);
|
||||
Projectile.scale = baseScale * MathHelper.Lerp(1f, 0.85f, eased);
|
||||
|
||||
|
||||
if (!sparkTriggered && Projectile.scale < 0.96f) // Right before thrusting forward
|
||||
{
|
||||
// Won't happen again this right-click
|
||||
sparkTriggered = true;
|
||||
|
||||
GenericSparkle sparker = new GenericSparkle(Projectile.Center, Vector2.Zero, Color.AntiqueWhite, Color.Lerp(Color.MediumPurple, Color.CornflowerBlue, 0.5f) * 0.3f, 2f, 8, Projectile.velocity.ToRotation() + (Main.rand.NextBool() ? -0.25f : 0.25f), 1f);
|
||||
GeneralParticleHandler.SpawnParticle(sparker);
|
||||
}
|
||||
}
|
||||
|
||||
else if (timer < StartupTime + swingTime)
|
||||
{
|
||||
Projectile.extraUpdates = 18;
|
||||
|
||||
// Thrust forward
|
||||
OffsetDistance = (int)MathHelper.Lerp(34, 60, SwingCompletion);
|
||||
Main.player[Projectile.owner].Calamity().GeneralScreenShakePower = 3;
|
||||
|
||||
// Scaling adjustments
|
||||
var t = MathHelper.Clamp(SwingCompletion, 0f, 1f);
|
||||
var eased = MathF.Pow(t, 0.125f);
|
||||
Projectile.scale = baseScale * MathHelper.Lerp(0.9f, 1.6f, eased);
|
||||
|
||||
// VFX vars
|
||||
Player player = Main.player[Projectile.owner];
|
||||
Vector2 mousePosition = Main.MouseWorld;
|
||||
Vector2 fireDirection = Vector2.Normalize(mousePosition - player.Center);
|
||||
|
||||
// Fire the bigass projectile
|
||||
if (!trailFXTriggered)
|
||||
{
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), player.Center, fireDirection * 5, ModContent.ProjectileType<LucreciaDNATrailCreator>(), Projectile.damage * 21, Projectile.knockBack, Projectile.owner, 0f, 0f);
|
||||
|
||||
SoundStyle swish = new("CalamityMod/Sounds/Custom/MeatySlash");
|
||||
SoundEngine.PlaySound(swish with { Volume = 0.45f, Pitch = Main.rand.NextFloat(-0.1f, 0.1f) }, Projectile.Center);
|
||||
|
||||
SoundStyle projectile = new("CalamityMod/Sounds/Item/OmicronBeam");
|
||||
SoundEngine.PlaySound(projectile with { Volume = 0.75f, Pitch = Main.rand.NextFloat(0.15f, 0.2f) }, Projectile.Center);
|
||||
}
|
||||
|
||||
trailFXTriggered = true;
|
||||
|
||||
// Some sparks from the blade
|
||||
if (!particlesSpawned)
|
||||
{
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
Vector2 particleOrigin = Projectile.Center;
|
||||
Vector2 particleSpeed = fireDirection.RotatedByRandom(MathHelper.ToRadians(46f)) * Main.rand.NextFloat(20f, 37f);
|
||||
Particle sparks = new CritSpark(particleOrigin, particleSpeed, Color.Lerp(Color.CornflowerBlue, Color.MediumPurple, Main.rand.NextFloat(0f, 1f)), Color.NavajoWhite * 0.7f, Main.rand.NextFloat(0.9f, 2f), Main.rand.Next(38, 50), 0.1f, 1.5f, hueShift: 0.01f);
|
||||
GeneralParticleHandler.SpawnParticle(sparks);
|
||||
}
|
||||
particlesSpawned = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
Projectile.extraUpdates = 7;
|
||||
Projectile.Opacity -= 0.012f;
|
||||
|
||||
// During cooldown, pull back slightly
|
||||
Projectile.scale = baseScale * MathHelper.Lerp(1.6f, 1.55f, CooldownCompletion);
|
||||
OffsetDistance = (int)MathHelper.Lerp(60, 52, CooldownCompletion);
|
||||
}
|
||||
}
|
||||
|
||||
else // Primary
|
||||
{
|
||||
Projectile.Opacity += 0.03f; //fade in effect to look smoother for repeated use
|
||||
|
||||
if (inStartup)
|
||||
{
|
||||
gotEnergyThisSwing = false;
|
||||
helixFired = false;
|
||||
AfterImageLength = 0;
|
||||
Projectile.scale = baseScale * MathHelper.Lerp(0.625f, 0.8f, StartupCompletion);
|
||||
}
|
||||
|
||||
else if (inCooldown)
|
||||
{
|
||||
helixFired = false;
|
||||
Projectile.Opacity -= 0.09f;
|
||||
AfterImageLength = 0;
|
||||
Projectile.extraUpdates = 6;
|
||||
Projectile.scale = baseScale * MathHelper.Lerp(0.85f, 0.625f, CooldownCompletion);
|
||||
}
|
||||
|
||||
else if (inSwing)
|
||||
{
|
||||
if (!helixFired)
|
||||
{
|
||||
helixFired = true;
|
||||
var player = Main.player[Projectile.owner];
|
||||
var mousePosition = Main.MouseWorld;
|
||||
var fireDirection = Vector2.Normalize(mousePosition - player.Center);
|
||||
var helixSpeed = 12f;
|
||||
var helixVelocity = fireDirection * helixSpeed;
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), player.Center + fireDirection * 3, helixVelocity, ModContent.ProjectileType<LucreciaSmallProjectile>(), Projectile.damage * 3, Projectile.knockBack, Projectile.owner);
|
||||
}
|
||||
AfterImageLength = 32;
|
||||
Projectile.extraUpdates = 10;
|
||||
var t = MathHelper.Clamp(SwingCompletion, 0f, 1f);
|
||||
var parabola = 1f - MathF.Pow(t - 0.5f, 2f) * 4f;
|
||||
OffsetDistance = (int)MathHelper.Lerp(36 * 1f, 36 * 1.435f, parabola);
|
||||
var upPhase = t <= 0.5f ? t / 0.5f : (1f - t) / 0.5f;
|
||||
var eased = MathF.Pow(upPhase, 2.6f);
|
||||
Projectile.scale = baseScale * MathHelper.Lerp(0.8f, 1.4f, eased);
|
||||
|
||||
}
|
||||
}
|
||||
base.AdditionalAI();
|
||||
}
|
||||
|
||||
public override float SwingFunction()
|
||||
{
|
||||
var player = Main.player[Projectile.owner];
|
||||
|
||||
if (IsAlternateThrust)
|
||||
{
|
||||
var modplayer = player.GetModPlayer<BaseSwordHoldoutPlayer>();
|
||||
float swingDirection = Projectile.spriteDirection;
|
||||
|
||||
if (inStartup)
|
||||
{
|
||||
return 0f;
|
||||
}
|
||||
|
||||
if (timer < StartupTime + swingTime)
|
||||
{
|
||||
return 0f;
|
||||
}
|
||||
|
||||
else
|
||||
return 0f; // Just retract and fade out without moving the angle
|
||||
}
|
||||
|
||||
else // Primary swing
|
||||
{
|
||||
var modplayer = player.GetModPlayer<BaseSwordHoldoutPlayer>();
|
||||
float swingDirection = Projectile.spriteDirection;
|
||||
if (modplayer.swingNum == 1)
|
||||
swingDirection *= -1;
|
||||
|
||||
var parabolicFactorPrimary = 1f - MathF.Pow(SwingCompletion - 0.5f, 2f) * 4f;
|
||||
parabolicFactorPrimary = MathHelper.Clamp(parabolicFactorPrimary, 0f, 1f);
|
||||
Projectile.localAI[0] = parabolicFactorPrimary;
|
||||
|
||||
var startAnglePrimary = -swingWidth / 2.15f;
|
||||
var endAnglePrimary = swingWidth / 2.15f;
|
||||
var trueAnglePrimary = MathHelper.Lerp(startAnglePrimary, endAnglePrimary, SwingCompletion);
|
||||
|
||||
return MathHelper.ToRadians(trueAnglePrimary * -swingDirection);
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
|
||||
{
|
||||
// Add energy for the primary attack
|
||||
if (!IsAlternateThrust && !gotEnergyThisSwing)
|
||||
{
|
||||
gotEnergyThisSwing = true;
|
||||
var player = Main.player[Projectile.owner];
|
||||
var modPlayer = player.Calamity();
|
||||
|
||||
// +22 energy on hit
|
||||
modPlayer.lucreciaEnergy += 22;
|
||||
modPlayer.lucreciaEnergy = Math.Min(modPlayer.lucreciaEnergy, modPlayer.lucreciaEnergyMax);
|
||||
|
||||
// On-hit cut FX
|
||||
int points = 2;
|
||||
float radians = MathHelper.TwoPi / points;
|
||||
Vector2 spinningPoint = Vector2.Normalize(new Vector2(-1f, -1f)).RotatedByRandom(100);
|
||||
|
||||
var modplayer = player.GetModPlayer<BaseSwordHoldoutPlayer>();
|
||||
Color useColor = modplayer.swingNum == 1 ? Color.CornflowerBlue : Color.MediumPurple; // Alternate each swing
|
||||
|
||||
for (int k = 0; k < points; k++)
|
||||
{
|
||||
Vector2 velocity = spinningPoint.RotatedBy(radians * k).RotatedBy(-0.45f);
|
||||
Particle spark = new GlowSparkParticle((target.Center + velocity * 7.5f), velocity * 0.5f, false, 9, 0.05f, useColor, new Vector2(0.5f, 0.4f), true, false);
|
||||
GeneralParticleHandler.SpawnParticle(spark);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Draw fullbright
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
lightColor = Color.White;
|
||||
return base.PreDraw(ref lightColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,57 +0,0 @@
|
||||
using System;
|
||||
using CalamityMod.Items.Weapons.Melee;
|
||||
using CalamityMod.Projectiles.BaseProjectiles;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.Localization;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.Melee.Shortswords
|
||||
{
|
||||
public class LucreciaProj : BaseShortswordProjectile
|
||||
{
|
||||
public override LocalizedText DisplayName => CalamityUtils.GetItemName<Lucrecia>();
|
||||
public override string Texture => "CalamityMod/Items/Weapons/Melee/Lucrecia";
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = Projectile.height = 28;
|
||||
Projectile.friendly = true;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.DamageType = DamageClass.Melee;
|
||||
Projectile.ownerHitCheck = true;
|
||||
Projectile.timeLeft = 360;
|
||||
Projectile.hide = true;
|
||||
Projectile.ownerHitCheck = true;
|
||||
Projectile.usesLocalNPCImmunity = true;
|
||||
Projectile.localNPCHitCooldown = 8;
|
||||
}
|
||||
|
||||
public override Action<Projectile> EffectBeforePullback => (proj) =>
|
||||
{
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity * 10f, ModContent.ProjectileType<DNA>(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f);
|
||||
};
|
||||
|
||||
|
||||
public override void SetVisualOffsets()
|
||||
{
|
||||
const int HalfSpriteWidth = 62 / 2;
|
||||
const int HalfSpriteHeight = 62 / 2;
|
||||
|
||||
int HalfProjWidth = Projectile.width / 2;
|
||||
int HalfProjHeight = Projectile.height / 2;
|
||||
|
||||
DrawOriginOffsetX = 0;
|
||||
DrawOffsetX = -(HalfSpriteWidth - HalfProjWidth);
|
||||
DrawOriginOffsetY = -(HalfSpriteHeight - HalfProjHeight);
|
||||
}
|
||||
|
||||
public override void ExtraBehavior()
|
||||
{
|
||||
if (Main.rand.NextBool(5))
|
||||
Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.BoneTorch);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
Mods.CalamityMod.Projectiles.LucreciaDNATrailCreator.DisplayName: Lucrecia D N A Trail Creator
|
||||
Reference in new issue
Block a user