1 - Housekeeping on Nanoblack Reaper's projectiles and tooltips.
2 - Separated stealth strike supercharged beams from "Lightspeed Carves" (negative edge inputs) 3 - Full mechanical implementation of Lightspeed Carves, missing only VFX and SFX.
This commit is contained in:
1 parent
f4cec045b4
commit
cac91ff2ef
7 files changed
+238
-134
No files matched your search
@@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Rogue
|
||||
internal static readonly Color TesselationParticleColor = new Color(79, 240, 168); // 4FF0A8
|
||||
internal static readonly Color ZeroPointLineColor = new Color(24, 191, 160); // #1FBFA0
|
||||
internal static readonly Color ZeroPointImpactColor = new Color(31, 223, 128, 96); // #1FDF80
|
||||
internal static readonly Color LightspeedCarveColor = new Color(36, 252, 212); // #24FCD4
|
||||
internal static readonly Color PiercingStrikeColor = new Color(36, 252, 212); // #24FCD4
|
||||
|
||||
public bool ShowExtensionIndicator => false;
|
||||
public bool HasFlavorTooltip => true;
|
||||
@@ -41,6 +41,7 @@ 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 float LightspeedCarveKnockback = 7f;
|
||||
|
||||
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.
|
||||
|
||||
@@ -789,10 +789,10 @@ 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
|
||||
Release <left> 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
|
||||
<right> with sufficient stealth to massively increase attack speed for a short time
|
||||
Scythes thrown during flurries cannot be returned manually
|
||||
Scythes thrown during flurries emit supercharged energy strikes but cannot be returned manually
|
||||
'''
|
||||
HoldShiftTooltip:
|
||||
'''
|
||||
|
||||
@@ -186,6 +186,7 @@ NanoblackLightspeedCarve: {
|
||||
}
|
||||
|
||||
NanoblackMain.DisplayName: Nanoblack Reaper
|
||||
NanoblackPiercingStrike.DisplayName: Zero-Point Energy Strike
|
||||
NanoblackStrike.DisplayName: Zero-Point Energy Strike
|
||||
NanoblackTesselation.DisplayName: Nanoblack Tesselation
|
||||
NastyChollaBol.DisplayName: Nasty Cholla
|
||||
|
||||
@@ -1,165 +1,69 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using CalamityMod.Items.Weapons.Rogue;
|
||||
using CalamityMod.Particles;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.GameContent.Shaders;
|
||||
using Terraria.Graphics.Effects;
|
||||
using Terraria.ID;
|
||||
using Terraria.Localization;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.Rogue
|
||||
{
|
||||
// Adopts a lot of code from Last Prism (aka Yharim's Crystal) for beam calculations,
|
||||
// but delivers damage completely differently.
|
||||
public class NanoblackLightspeedCarve : ModProjectile, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Projectiles.Rogue";
|
||||
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
|
||||
public override LocalizedText DisplayName => this.GetLocalization(IsPerfect ? "Perfect" : "Standard");
|
||||
|
||||
internal const float MaxBeamLength = 1800f;
|
||||
private const float BeamTileCollisionWidth = 1f;
|
||||
private const float BeamHitboxCollisionWidth = 40;
|
||||
// Sample points is much higher due to this beam only being cast once instead of every frame.
|
||||
private const int NumSamplePoints = 9;
|
||||
// no BeamLengthChangeFactor due to this beam never moving; it only gets cast once
|
||||
internal const float TargetingRange = 600f;
|
||||
|
||||
private const float BeamLightBrightness = 0.5f;
|
||||
private static float HitboxRadius = 60.0f;
|
||||
internal static float PlacementRandomness = 12f;
|
||||
|
||||
private static int Lifetime = 24;
|
||||
private static int HitboxDuration = 9; // Hits on 0-4-8
|
||||
|
||||
internal bool IsPerfect => Projectile.ai[0] == 1f;
|
||||
internal Vector2 TargetPos => new(Projectile.ai[1], Projectile.ai[2]);
|
||||
internal ref float VisibleCarveLength => ref Projectile.localAI[0];
|
||||
|
||||
// 0f = Beam not calculated yet
|
||||
// 1f = Beam calculated but no damage has been done
|
||||
// 2f = This projectile has had at least 1 frame of active hitbox and has hit N enemies, it no longer does damage
|
||||
internal ref float ProgressiveState => ref Projectile.localAI[1];
|
||||
internal const float ProgressiveState_Initial = 0f;
|
||||
internal const float ProgressiveState_BeamCalculated = 1f;
|
||||
internal const float ProgressiveState_HasDealtDamage = 2f;
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = Projectile.height = 36;
|
||||
Projectile.width = Projectile.height = (int)(2f * HitboxRadius);
|
||||
Projectile.friendly = true;
|
||||
Projectile.DamageType = RogueDamageClass.Instance;
|
||||
Projectile.penetrate = 1;
|
||||
Projectile.penetrate = 1; // Actually three hits, but intentionally obfuscates and violates pierce resistance
|
||||
Projectile.extraUpdates = 0;
|
||||
// Lightspeed Carves completely ignore tiles and are not stopped by them, unlike Last Prism.
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.alpha = 255;
|
||||
Projectile.timeLeft = 6;
|
||||
}
|
||||
Projectile.timeLeft = Lifetime;
|
||||
|
||||
public override void SendExtraAI(BinaryWriter writer) => writer.Write(VisibleCarveLength);
|
||||
public override void ReceiveExtraAI(BinaryReader reader) => VisibleCarveLength = reader.ReadSingle();
|
||||
Projectile.usesLocalNPCImmunity = true;
|
||||
Projectile.localNPCHitCooldown = 4;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
if (Projectile.numHits > 0)
|
||||
ProgressiveState = ProgressiveState_HasDealtDamage;
|
||||
|
||||
// This projectile does not move and its velocity is always zero.
|
||||
// Destination X/Y is stored in AI variables and is computed into a faux velocity.
|
||||
Vector2 fakeVel = (TargetPos - Projectile.Center).SafeNormalize(-Vector2.UnitY);
|
||||
|
||||
// Lightspeed Carves ignore tiles but still perform a Last Prism laser scan to disturb water and cut tiles.
|
||||
if (ProgressiveState == ProgressiveState_Initial)
|
||||
{
|
||||
Vector2 samplingPoint = Projectile.Center;
|
||||
float[] laserScanResults = new float[NumSamplePoints];
|
||||
Collision.LaserScan(samplingPoint, fakeVel, BeamTileCollisionWidth, MaxBeamLength, laserScanResults);
|
||||
|
||||
float averageSampledLength = 0f;
|
||||
for (int i = 0; i < laserScanResults.Length; ++i)
|
||||
averageSampledLength += laserScanResults[i];
|
||||
averageSampledLength /= NumSamplePoints;
|
||||
// There is no lerping of visible beam length because the beam is only sampled once.
|
||||
VisibleCarveLength = averageSampledLength;
|
||||
|
||||
float distToTarget = Projectile.Center.Distance(TargetPos);
|
||||
float minOvershoot = 224f;
|
||||
float maxOvershoot = 320f;
|
||||
|
||||
// If the beam is too short (it got stuck in a wall), force it to be an appropriate length. This item ignores walls.
|
||||
// Similarly, if the beam is far too long, clip it down so it doesn't go ridiculously far past its target.
|
||||
if (VisibleCarveLength < distToTarget || VisibleCarveLength > distToTarget + maxOvershoot)
|
||||
{
|
||||
float randomOvershoot = Main.rand.NextFloat(minOvershoot, maxOvershoot);
|
||||
VisibleCarveLength = distToTarget + randomOvershoot;
|
||||
}
|
||||
|
||||
ProgressiveState = ProgressiveState_BeamCalculated;
|
||||
}
|
||||
|
||||
// X = beam length. Y = beam width.
|
||||
Vector2 beamDims = new(VisibleCarveLength, Projectile.width * Projectile.scale);
|
||||
|
||||
// Cause visual effects based on computed data
|
||||
CarveEffects();
|
||||
|
||||
// If the game is rendering (i.e. isn't a dedicated server), make the beam disturb water.
|
||||
if (Main.netMode != NetmodeID.Server)
|
||||
{
|
||||
WaterShaderData wsd = (WaterShaderData)Filters.Scene["WaterDistortion"].GetShader();
|
||||
// A universal time-based sinusoid which updates extremely rapidly. GlobalTimeWrappedHourly is 0 to 3600, measured in seconds.
|
||||
float waveSine = 0.1f * (float)Math.Sin(Main.GlobalTimeWrappedHourly * 20f);
|
||||
Vector2 ripplePos = Projectile.position + new Vector2(beamDims.X * 0.5f, 0f).RotatedBy(Projectile.rotation);
|
||||
// WaveData is encoded as a Color. Not sure why, considering Vector3 exists.
|
||||
Color waveData = new Color(0.5f, 0.1f * Math.Sign(waveSine) + 0.5f, 0f, 1f) * Math.Abs(waveSine);
|
||||
wsd.QueueRipple(ripplePos, waveData, beamDims, RippleShape.Square, Projectile.rotation);
|
||||
}
|
||||
|
||||
// Make the beam cast light along its length.
|
||||
// v3_1 is an unnamed decompiled variable which is the color of the light cast by DelegateMethods.CastLight
|
||||
Vector2 lightDest = Projectile.Center + fakeVel * VisibleCarveLength;
|
||||
DelegateMethods.v3_1 = NanoblackReaper.LightspeedCarveColor.ToVector3() * BeamLightBrightness;
|
||||
Utils.PlotTileLine(Projectile.Center, lightDest, beamDims.Y, DelegateMethods.CastLight);
|
||||
if (Projectile.timeLeft == Lifetime)
|
||||
FrameOneEffects();
|
||||
}
|
||||
|
||||
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox)
|
||||
private void FrameOneEffects()
|
||||
{
|
||||
// If the target is touching the beam's hitbox (which is a small rectangle vaguely overlapping the host crystal), that's good enough.
|
||||
if (projHitbox.Intersects(targetHitbox))
|
||||
return true;
|
||||
int dustID = IsPerfect ? 99 : 173;
|
||||
int numDust = 96;
|
||||
|
||||
// Otherwise, perform an AABB line collision check to check the whole beam.
|
||||
float _ = float.NaN;
|
||||
Vector2 fakeVel = (TargetPos - Projectile.Center).SafeNormalize(-Vector2.UnitY);
|
||||
Vector2 endPoint = Projectile.Center + fakeVel * VisibleCarveLength;
|
||||
return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, endPoint, BeamHitboxCollisionWidth * Projectile.scale, ref _);
|
||||
Vector2 p = Projectile.Center;
|
||||
for (int i = 0; i < numDust; ++i)
|
||||
{
|
||||
p = Projectile.Center + (Vector2.UnitX * HitboxRadius).RotatedBy(i * MathHelper.TwoPi / numDust);
|
||||
Dust.NewDust(p, 1, 1, dustID, 0f, 0f, 0, default, 2f);
|
||||
}
|
||||
}
|
||||
|
||||
public override bool? CanHitNPC(NPC target) => ProgressiveState == ProgressiveState_HasDealtDamage ? false : null;
|
||||
|
||||
// This projectile does not die upon landing a hit so that it may persist for visual reasons.
|
||||
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => Projectile.penetrate++;
|
||||
|
||||
private void CarveEffects()
|
||||
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
|
||||
{
|
||||
Vector2 fakeVel = (TargetPos - Projectile.Center).SafeNormalize(-Vector2.UnitY);
|
||||
Vector2 endPoint = Projectile.Center + fakeVel * VisibleCarveLength;
|
||||
if (Projectile.timeLeft > Lifetime - HitboxDuration)
|
||||
Projectile.penetrate++;
|
||||
|
||||
// 0 to 5
|
||||
int iter = 5 - Projectile.timeLeft;
|
||||
|
||||
float startLerp = iter * 0.15f;
|
||||
float endLerp = 0.6f + iter * 0.15f;
|
||||
Vector2 segmentStart = Vector2.Lerp(Projectile.Center, endPoint, startLerp);
|
||||
Vector2 segmentEnd = Vector2.Lerp(Projectile.Center, endPoint, endLerp);
|
||||
float particleSpeed = Main.rand.NextFloat(34f, 40f);
|
||||
Vector2 particleVel = fakeVel.RotatedByRandom(MathHelper.Pi / 30f) * particleSpeed;
|
||||
|
||||
int lifetime = 5;
|
||||
float xScale = 0.017f;
|
||||
float xShrink = 0.66f;
|
||||
|
||||
Particle carveParticle = new StaticGlowLine(segmentStart, segmentEnd, particleVel, lifetime, xScale, xShrink, NanoblackReaper.LightspeedCarveColor, true);
|
||||
GeneralParticleHandler.SpawnParticle(carveParticle);
|
||||
Main.NewText("bazinga");
|
||||
}
|
||||
|
||||
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, HitboxRadius, targetHitbox);
|
||||
}
|
||||
}
|
||||
@@ -85,6 +85,11 @@ namespace CalamityMod.Projectiles.Rogue
|
||||
if (Projectile.timeLeft == InternalLifetime)
|
||||
FrameOneEffects();
|
||||
|
||||
// Nanoblack Reaper enables its owner's mouse listener so that the mouse state is synced.
|
||||
// This is necessary for its targeting algorithm.
|
||||
if (Owner.whoAmI == Main.myPlayer)
|
||||
Owner.Calamity().mouseWorldListener = true;
|
||||
|
||||
InFlightVisualEffects();
|
||||
UpdateAIVariables();
|
||||
|
||||
@@ -251,10 +256,40 @@ namespace CalamityMod.Projectiles.Rogue
|
||||
if (lcs == LightspeedCarveState_Performed)
|
||||
return;
|
||||
|
||||
else if (lcs == LightspeedCarveState_CanPerfect)
|
||||
Main.NewText("Jackpot!");
|
||||
else if (lcs == LightspeedCarveState_CanImperfect)
|
||||
Main.NewText("Lightspeed Carve performed");
|
||||
if (lcs != LightspeedCarveState_Initial && Projectile.owner == Main.myPlayer)
|
||||
{
|
||||
int projType = ModContent.ProjectileType<NanoblackLightspeedCarve>();
|
||||
int damage = Projectile.damage * 6;
|
||||
float kb = NanoblackReaper.LightspeedCarveKnockback;
|
||||
var source = Projectile.GetSource_FromThis();
|
||||
|
||||
Vector2 pos = Projectile.Center;
|
||||
|
||||
// As is Nanoblack tradition, Lightspeed Carves prefer to target bosses whenever possible.
|
||||
NPC target = Owner.ClampedMouseWorld().ClosestNPCAt(NanoblackLightspeedCarve.TargetingRange, bossPriority: true);
|
||||
|
||||
// If the first cursor-based targeting attempt fails, try again near the Tesselation itself.
|
||||
if (target is null || !target.active)
|
||||
target = Projectile.Center.ClosestNPCAt(NanoblackLightspeedCarve.TargetingRange, bossPriority: true);
|
||||
|
||||
if (target is not null && target.active)
|
||||
pos = target.Center;
|
||||
|
||||
float fuzz = NanoblackLightspeedCarve.PlacementRandomness;
|
||||
pos += Main.rand.NextVector2Circular(fuzz, fuzz);
|
||||
|
||||
if (lcs == LightspeedCarveState_CanPerfect)
|
||||
{
|
||||
Projectile perf = Projectile.NewProjectileDirect(source, pos, Vector2.Zero, projType, damage, kb, Projectile.owner, ai0: 1f);
|
||||
var cgp = perf.Calamity();
|
||||
cgp.supercritHits = -1;
|
||||
cgp.bonusCritDamage += 1f;
|
||||
}
|
||||
else if (lcs == LightspeedCarveState_CanImperfect)
|
||||
{
|
||||
Projectile.NewProjectile(source, pos, Vector2.Zero, projType, damage, kb, Projectile.owner, ai0: 0f);
|
||||
}
|
||||
}
|
||||
|
||||
// In all cases, all further attempts are blocked permanently.
|
||||
LightspeedCarveState = LightspeedCarveState_Performed;
|
||||
|
||||
@@ -0,0 +1,163 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using CalamityMod.Items.Weapons.Rogue;
|
||||
using CalamityMod.Particles;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.GameContent.Shaders;
|
||||
using Terraria.Graphics.Effects;
|
||||
using Terraria.ID;
|
||||
using Terraria.Localization;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.Rogue
|
||||
{
|
||||
// Adopts a lot of code from Last Prism (aka Yharim's Crystal) for beam calculations,
|
||||
// but delivers damage completely differently.
|
||||
public class NanoblackPiercingStrike : ModProjectile, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Projectiles.Rogue";
|
||||
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
|
||||
|
||||
internal const float MaxBeamLength = 1800f;
|
||||
private const float BeamTileCollisionWidth = 1f;
|
||||
private const float BeamHitboxCollisionWidth = 40;
|
||||
// Sample points is much higher due to this beam only being cast once instead of every frame.
|
||||
private const int NumSamplePoints = 9;
|
||||
// no BeamLengthChangeFactor due to this beam never moving; it only gets cast once
|
||||
|
||||
private const float BeamLightBrightness = 0.5f;
|
||||
|
||||
internal Vector2 TargetPos => new(Projectile.ai[1], Projectile.ai[2]);
|
||||
internal ref float VisibleBeamLength => ref Projectile.localAI[0];
|
||||
|
||||
// 0f = Beam not calculated yet
|
||||
// 1f = Beam calculated but no damage has been done
|
||||
// 2f = This projectile has had at least 1 frame of active hitbox and has hit N enemies, it no longer does damage
|
||||
internal ref float ProgressiveState => ref Projectile.localAI[1];
|
||||
internal const float ProgressiveState_Initial = 0f;
|
||||
internal const float ProgressiveState_BeamCalculated = 1f;
|
||||
internal const float ProgressiveState_HasDealtDamage = 2f;
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = Projectile.height = 36;
|
||||
Projectile.friendly = true;
|
||||
Projectile.DamageType = RogueDamageClass.Instance;
|
||||
Projectile.penetrate = 1;
|
||||
Projectile.extraUpdates = 0;
|
||||
// Completely ignores tiles and is not stopped by them, unlike Last Prism.
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.alpha = 255;
|
||||
Projectile.timeLeft = 6;
|
||||
}
|
||||
|
||||
public override void SendExtraAI(BinaryWriter writer) => writer.Write(VisibleBeamLength);
|
||||
public override void ReceiveExtraAI(BinaryReader reader) => VisibleBeamLength = reader.ReadSingle();
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
if (Projectile.numHits > 0)
|
||||
ProgressiveState = ProgressiveState_HasDealtDamage;
|
||||
|
||||
// This projectile does not move and its velocity is always zero.
|
||||
// Destination X/Y is stored in AI variables and is computed into a faux velocity.
|
||||
Vector2 fakeVel = (TargetPos - Projectile.Center).SafeNormalize(-Vector2.UnitY);
|
||||
|
||||
// Supercharged Nanoblack Strikes ignore tiles but still perform a Last Prism laser scan to disturb water and cut tiles.
|
||||
if (ProgressiveState == ProgressiveState_Initial)
|
||||
{
|
||||
Vector2 samplingPoint = Projectile.Center;
|
||||
float[] laserScanResults = new float[NumSamplePoints];
|
||||
Collision.LaserScan(samplingPoint, fakeVel, BeamTileCollisionWidth, MaxBeamLength, laserScanResults);
|
||||
|
||||
float averageSampledLength = 0f;
|
||||
for (int i = 0; i < laserScanResults.Length; ++i)
|
||||
averageSampledLength += laserScanResults[i];
|
||||
averageSampledLength /= NumSamplePoints;
|
||||
// There is no lerping of visible beam length because the beam is only sampled once.
|
||||
VisibleBeamLength = averageSampledLength;
|
||||
|
||||
float distToTarget = Projectile.Center.Distance(TargetPos);
|
||||
float minOvershoot = 224f;
|
||||
float maxOvershoot = 320f;
|
||||
|
||||
// If the beam is too short (it got stuck in a wall), force it to be an appropriate length. This item ignores walls.
|
||||
// Similarly, if the beam is far too long, clip it down so it doesn't go ridiculously far past its target.
|
||||
if (VisibleBeamLength < distToTarget || VisibleBeamLength > distToTarget + maxOvershoot)
|
||||
{
|
||||
float randomOvershoot = Main.rand.NextFloat(minOvershoot, maxOvershoot);
|
||||
VisibleBeamLength = distToTarget + randomOvershoot;
|
||||
}
|
||||
|
||||
ProgressiveState = ProgressiveState_BeamCalculated;
|
||||
}
|
||||
|
||||
// X = beam length. Y = beam width.
|
||||
Vector2 beamDims = new(VisibleBeamLength, Projectile.width * Projectile.scale);
|
||||
|
||||
// Cause visual effects based on computed data
|
||||
PiercingStrikeEffects();
|
||||
|
||||
// If the game is rendering (i.e. isn't a dedicated server), make the beam disturb water.
|
||||
if (Main.netMode != NetmodeID.Server)
|
||||
{
|
||||
WaterShaderData wsd = (WaterShaderData)Filters.Scene["WaterDistortion"].GetShader();
|
||||
// A universal time-based sinusoid which updates extremely rapidly. GlobalTimeWrappedHourly is 0 to 3600, measured in seconds.
|
||||
float waveSine = 0.1f * (float)Math.Sin(Main.GlobalTimeWrappedHourly * 20f);
|
||||
Vector2 ripplePos = Projectile.position + new Vector2(beamDims.X * 0.5f, 0f).RotatedBy(Projectile.rotation);
|
||||
// WaveData is encoded as a Color. Not sure why, considering Vector3 exists.
|
||||
Color waveData = new Color(0.5f, 0.1f * Math.Sign(waveSine) + 0.5f, 0f, 1f) * Math.Abs(waveSine);
|
||||
wsd.QueueRipple(ripplePos, waveData, beamDims, RippleShape.Square, Projectile.rotation);
|
||||
}
|
||||
|
||||
// Make the beam cast light along its length.
|
||||
// v3_1 is an unnamed decompiled variable which is the color of the light cast by DelegateMethods.CastLight
|
||||
Vector2 lightDest = Projectile.Center + fakeVel * VisibleBeamLength;
|
||||
DelegateMethods.v3_1 = NanoblackReaper.PiercingStrikeColor.ToVector3() * BeamLightBrightness;
|
||||
Utils.PlotTileLine(Projectile.Center, lightDest, beamDims.Y, DelegateMethods.CastLight);
|
||||
}
|
||||
|
||||
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox)
|
||||
{
|
||||
// If the target is touching the beam's hitbox (which is a small rectangle vaguely overlapping the host crystal), that's good enough.
|
||||
if (projHitbox.Intersects(targetHitbox))
|
||||
return true;
|
||||
|
||||
// Otherwise, perform an AABB line collision check to check the whole beam.
|
||||
float _ = float.NaN;
|
||||
Vector2 fakeVel = (TargetPos - Projectile.Center).SafeNormalize(-Vector2.UnitY);
|
||||
Vector2 endPoint = Projectile.Center + fakeVel * VisibleBeamLength;
|
||||
return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, endPoint, BeamHitboxCollisionWidth * Projectile.scale, ref _);
|
||||
}
|
||||
|
||||
public override bool? CanHitNPC(NPC target) => ProgressiveState == ProgressiveState_HasDealtDamage ? false : null;
|
||||
|
||||
// This projectile does not die upon landing a hit so that it may persist for visual reasons.
|
||||
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => Projectile.penetrate++;
|
||||
|
||||
private void PiercingStrikeEffects()
|
||||
{
|
||||
Vector2 fakeVel = (TargetPos - Projectile.Center).SafeNormalize(-Vector2.UnitY);
|
||||
Vector2 endPoint = Projectile.Center + fakeVel * VisibleBeamLength;
|
||||
|
||||
// 0 to 5
|
||||
int iter = 5 - Projectile.timeLeft;
|
||||
|
||||
float startLerp = iter * 0.15f;
|
||||
float endLerp = 0.6f + iter * 0.15f;
|
||||
Vector2 segmentStart = Vector2.Lerp(Projectile.Center, endPoint, startLerp);
|
||||
Vector2 segmentEnd = Vector2.Lerp(Projectile.Center, endPoint, endLerp);
|
||||
float particleSpeed = Main.rand.NextFloat(34f, 40f);
|
||||
Vector2 particleVel = fakeVel.RotatedByRandom(MathHelper.Pi / 30f) * particleSpeed;
|
||||
|
||||
int lifetime = 5;
|
||||
float xScale = 0.017f;
|
||||
float xShrink = 0.66f;
|
||||
|
||||
Particle carveParticle = new StaticGlowLine(segmentStart, segmentEnd, particleVel, lifetime, xScale, xShrink, NanoblackReaper.PiercingStrikeColor, true);
|
||||
GeneralParticleHandler.SpawnParticle(carveParticle);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -189,7 +189,7 @@ namespace CalamityMod.Projectiles.Rogue
|
||||
// Stealth strike attack: Lightspeed carve
|
||||
if (stealthStrikeAttack)
|
||||
{
|
||||
int carveID = ModContent.ProjectileType<NanoblackLightspeedCarve>();
|
||||
int carveID = ModContent.ProjectileType<NanoblackPiercingStrike>();
|
||||
int carveDamage = Projectile.damage; // same damage ratio as the tesselation itself
|
||||
float carveKB = 0f;
|
||||
|
||||
|
||||
Reference in new issue
Block a user