1 - Adjust lightspeed carve to be a negative edge LMB input.

2 - Slight cleanups to code for multiplayer compatibility.
3 - Adjusted tooltip to match new functionality.

TODO: Implement lightspeed carve visuals, rename stealth strike beams
This commit is contained in:
Ozzatron committed 2026-02-07 15:07:14 -05:00
1 parent 23ede90c8a
commit f4cec045b4
4 files changed
+62 -46

No files matched your search

+37 -34
View File
@@ -40,12 +40,14 @@ namespace CalamityMod.Items.Weapons.Rogue
public static int FocusFlurryAttacks = 12;
public static int PerfectLightspeedCarveFrames = 6;
public static int ImperfectLightspeedCarveFrames = 6; // This frame window is immediately after the perfect window.
public static int ArmorPenetration = 30;
// Armor pen declared on projectiles will be added to that of the parent projectile or, failing that, item that spawned it.
public static int ZeroPointArmorPenetration = 120; // Total: 150.
public static int LightspeedCarveArmorPenetration = 120; // Total: 150.
public static float TesselationDamageRatio = 0.25f;
public static float TesselationKnockback = 1.5f;
public override float StealthDamageMultiplier => 1.0f;
@@ -82,40 +84,47 @@ namespace CalamityMod.Items.Weapons.Rogue
if (modPlayer.focusFlurryAttackCount > FocusFlurryAttacks)
modPlayer.focusFlurryAttackCount = FocusFlurryAttacks;
// Nanoblack Reaper has two right click behaviors
if (modPlayer.mouseRight)
// Remainder of behavior should only be called on owning client
if (player.whoAmI != Main.myPlayer)
return;
// Right click behavior: activate Focus Flurry as applicable
if (modPlayer.mouseRight && modPlayer.StealthStrikeAvailable())
{
// "Stealth strikes" with Nanoblack Reaper are Focus Flurries: the next 30 attacks come out very, very quickly.
if (modPlayer.StealthStrikeAvailable())
modPlayer.ConsumeStealthByAttacking();
modPlayer.focusFlurryAttackCount = FocusFlurryAttacks;
SoundStyle flurryActivationSound1 = new("CalamityMod/Sounds/Item/StygianDash");
SoundStyle flurryActivationSound2 = new("CalamityMod/Sounds/Item/HeliumFlashCoreImpact");
float sound2Pitch = Main.rand.NextFloat(0.08f, 0.2f);
SoundEngine.PlaySound(flurryActivationSound1 with { Volume = 1f }, player.Center);
SoundEngine.PlaySound(flurryActivationSound2 with { Volume = 0.3f, Pitch = sound2Pitch }, player.Center);
// Spawn a dramatic void slash particle over the player when this is activated
{
modPlayer.ConsumeStealthByAttacking();
modPlayer.focusFlurryAttackCount = FocusFlurryAttacks;
Color color = NanoblackSlashColor1;
float scale = 0.33f;
Vector2 slashDir = (Main.rand.NextBool() ? -1f : 1f) * Vector2.UnitX;
Vector2 vel = 0.01f * slashDir.RotatedByRandom(MathHelper.Pi / 8f);
SoundStyle flurryActivationSound1 = new("CalamityMod/Sounds/Item/StygianDash");
SoundStyle flurryActivationSound2 = new("CalamityMod/Sounds/Item/HeliumFlashCoreImpact");
float sound2Pitch = Main.rand.NextFloat(0.08f, 0.2f);
SoundEngine.PlaySound(flurryActivationSound1 with { Volume = 1f }, player.Center);
SoundEngine.PlaySound(flurryActivationSound2 with { Volume = 0.3f, Pitch = sound2Pitch }, player.Center);
// scale of void sparks is arbitrarily multiplied by 0.357f. thanks!
float voidScale = scale / 0.357f;
Particle blackSpark = new VoidSparkParticle(player.Center, vel, false, 12, voidScale, color, 1f);
GeneralParticleHandler.SpawnParticle(blackSpark);
// Spawn a dramatic void slash particle over the player when this is activated
{
Color color = NanoblackSlashColor1;
float scale = 0.33f;
Vector2 slashDir = (Main.rand.NextBool() ? -1f : 1f) * Vector2.UnitX;
Vector2 vel = 0.01f * slashDir.RotatedByRandom(MathHelper.Pi / 8f);
// scale of void sparks is arbitrarily multiplied by 0.357f. thanks!
float voidScale = scale / 0.357f;
Particle blackSpark = new VoidSparkParticle(player.Center, vel, false, 12, voidScale, color, 1f);
GeneralParticleHandler.SpawnParticle(blackSpark);
float glowScale = scale * 0.333f;
Vector2 squashStretch = new(1.3333f, 0.8f);
Particle innerSpark = new GlowSparkParticle(player.Center, vel, false, 11, glowScale, color, squashStretch, true, true, 1f);
GeneralParticleHandler.SpawnParticle(innerSpark);
}
float glowScale = scale * 0.333f;
Vector2 squashStretch = new(1.3333f, 0.8f);
Particle innerSpark = new GlowSparkParticle(player.Center, vel, false, 11, glowScale, color, squashStretch, true, true, 1f);
GeneralParticleHandler.SpawnParticle(innerSpark);
}
}
// Negative-edge left click behavior: attempt light-speed carves
// This will evaluate to true for exactly one frame when the player lets go of the left mouse button.
bool leftMouseJustReleased = Main.mouseLeft && Main.mouseLeftRelease;
if (leftMouseJustReleased)
{
int scytheID = ModContent.ProjectileType<NanoblackMain>();
for (int i = 0; i < Main.maxProjectiles; ++i)
{
@@ -123,14 +132,8 @@ namespace CalamityMod.Items.Weapons.Rogue
if (!p.active || p.type != scytheID || p.owner != player.whoAmI)
continue;
// Check each potential carve state individually.
NanoblackMain nr = p.ModProjectile as NanoblackMain;
bool imperfect = nr.LightspeedCarveState == NanoblackMain.LightspeedCarveState_CanImperfect;
bool perfect = nr.LightspeedCarveState == NanoblackMain.LightspeedCarveState_CanPerfect;
// If either occurs, run the logic to perform a lightspeed carve.
if (imperfect || perfect)
nr.PerformLightspeedCarve(perfect);
nr.AttemptLightspeedCarve();
}
}
}
@@ -789,9 +789,8 @@ NanoblackReaper: {
Throws a scythe which rapidly forms a swarm of nanoblack tesselations from hard light
Nanoblack tesselations each emit an instantaneous zero-point energy strike
Zero-point energy strikes have 150 armor penetration and will target bosses whenever possible
Press <right> just as the scythe begins returning to carve through the enemy closest to your cursor at light-speed
Release <left> just as the scythe begins returning to carve through the enemy closest to your cursor at light-speed
Light-speed carves have 150 armor penetration. If timed in a 6-frame window, they supercrit with +100% critical strike chance
Carving with a scythe prevents it from spawning tesselations while returning
<right> with sufficient stealth to massively increase attack speed for a short time
Scythes thrown during flurries cannot be returned manually
'''
+22 -9
View File
@@ -30,9 +30,9 @@ namespace CalamityMod.Projectiles.Rogue
internal ref float TesselationSpawnCooldown => ref Projectile.ai[1];
// 0f = Initial state
// 1f = Can be pulled back, but isn't perfect
// 2f = Can be pulled back, is perfect
// 3f = Has been pulled back
// 1f = Mouse button still held: Can be pulled back, but isn't in the perfect window
// 2f = Mouse button still held: Can be pulled back, will be perfect
// 3f = Mouse button no longer held
internal ref float LightspeedCarveState => ref Projectile.ai[2];
internal const float LightspeedCarveState_Initial = 0f;
internal const float LightspeedCarveState_CanImperfect = 1f;
@@ -111,13 +111,21 @@ namespace CalamityMod.Projectiles.Rogue
if (perfectWindowPassed)
LightspeedCarveState = LightspeedCarveState_CanImperfect;
}
// Also ensure that the Imperfect Lightspeed Carve window expires properly.
else if (LightspeedCarveState == LightspeedCarveState_CanImperfect)
{
bool imperfectWindowPassed = RealFrameCounter > ReboundStartFrame + NanoblackReaper.PerfectLightspeedCarveFrames + NanoblackReaper.ImperfectLightspeedCarveFrames;
if (imperfectWindowPassed)
LightspeedCarveState = LightspeedCarveState_Performed;
}
BoomerangMovement();
}
// Spawn Nanoblack Tesselations at a consistent and overwhelming rate while in flight.
// Tesselations are not spawned if a scythe has been pulled for a Lightspeed Carve.
bool spawnTesselations = Projectile.Calamity().stealthStrike || LightspeedCarveState != LightspeedCarveState_Performed;
// PENDING TESTING: Tesselations are not spawned if a scythe has been pulled for a Lightspeed Carve.
bool spawnTesselations = Projectile.Calamity().stealthStrike || /* LightspeedCarveState != LightspeedCarveState_Performed */ true;
if (spawnTesselations && TesselationSpawnCooldown <= 0f)
{
SpawnTesselation();
@@ -210,7 +218,7 @@ namespace CalamityMod.Projectiles.Rogue
int tessID = ModContent.ProjectileType<NanoblackTesselation>();
int tessDamage = (int)(NanoblackReaper.TesselationDamageRatio * Projectile.damage);
float tessKB = 1.5f;
float tessKB = NanoblackReaper.TesselationKnockback;
// The blade of Nanoblack Reaper is close enough to straight-right +X that using the rotation directly is fine.
float scytheBladeRotation = Projectile.rotation * Projectile.spriteDirection;
@@ -237,13 +245,18 @@ namespace CalamityMod.Projectiles.Rogue
}
}
internal void PerformLightspeedCarve(bool perfect)
internal void AttemptLightspeedCarve()
{
if (perfect)
var lcs = LightspeedCarveState;
if (lcs == LightspeedCarveState_Performed)
return;
else if (lcs == LightspeedCarveState_CanPerfect)
Main.NewText("Jackpot!");
else
else if (lcs == LightspeedCarveState_CanImperfect)
Main.NewText("Lightspeed Carve performed");
// In all cases, all further attempts are blocked permanently.
LightspeedCarveState = LightspeedCarveState_Performed;
Projectile.netUpdate = true;
}
+2 -1
View File
@@ -66,7 +66,8 @@ namespace CalamityMod.Projectiles.Rogue
// Tesselations enable their owner's mouse listener so that the mouse state is synced.
// This is necessary for their targeting algorithm.
Owner.Calamity().mouseWorldListener = true;
if (Owner.whoAmI == Main.myPlayer)
Owner.Calamity().mouseWorldListener = true;
// If the Tesselation cannot attack, then it immediately transitions to vanishing.
bool shouldShutdown = false;