XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet

DeathMod

【Terraria】DeathMod (now aka Soul Harvest)

公开
关注 0 Fork 0 Star 0
返回提交历史

XFEstudio/DeathMod

为死亡领域增加边缘吸入波纹

782fda5
XFE工作室室长 <mail@xfegzs.com>
提交于

代码差异

1 个文件 +56 -0
Modified Common/DeathDomainVisualSystem.cs +56 -0
@@ -187,6 +187,7 @@ internal class DeathDomainVisualSystem : ModSystem
187 187 float blackOpacity = MathHelper.Lerp(0.50f, 0.96f, mastery) * reveal;
188 188 DrawFilledNoiseDisc(batch, pixel, center, coreRadius, coreNoiseTime, coreNoiseSeed, coreNoiseAmplitude, Color.Black * blackOpacity);
189 189 DrawNoiseBoundary(batch, pixel, center, coreRadius, coreNoiseTime, coreNoiseSeed, coreNoiseAmplitude, 2.2f, 0.76f * pulse, mastery, gaps: false);
190 DrawInwardSuctionWaves(batch, pixel, center, radius, coreRadius, time, mastery, pulse);
190 191 }
191 192
192 193 private static void DrawSovereignSeal(SpriteBatch batch, Texture2D pixel, Vector2 center, int mastery, float animation)
@@ -319,6 +320,61 @@ internal class DeathDomainVisualSystem : ModSystem
319 320 return low + middle + high + grain;
320 321 }
321 322
323 private static void DrawInwardSuctionWaves(
324 SpriteBatch batch,
325 Texture2D pixel,
326 Vector2 center,
327 float edgeRadius,
328 float coreRadius,
329 float time,
330 float mastery,
331 float pulse)
332 {
333 int streamCount = 11 + (int)Math.Round(mastery * 7f);
334 float outerRadius = edgeRadius + MathHelper.Lerp(26f, 42f, mastery);
335 float innerRadius = Math.Max(4f, coreRadius - MathHelper.Lerp(4f, 12f, mastery));
336 for (int stream = 0; stream < streamCount; stream++)
337 {
338 float seed = stream * 4.731f + 2.4f;
339 float progress = PositiveModulo(time * MathHelper.Lerp(0.42f, 0.68f, mastery) + stream / (float)streamCount, 1f);
340 float inwardProgress = MathHelper.SmoothStep(0f, 1f, progress);
341 float waveRadius = MathHelper.Lerp(outerRadius, innerRadius, inwardProgress);
342 float baseAngle = stream * MathHelper.TwoPi / streamCount
343 - time * (0.18f + mastery * 0.12f)
344 + inwardProgress * (0.28f + mastery * 0.2f)
345 + BoundaryNoise(stream, time * 0.24f, seed) * 0.07f;
346 float halfArc = MathHelper.Lerp(0.17f, 0.055f, inwardProgress);
347 float fade = (float)Math.Sin(progress * MathHelper.Pi) * pulse;
348 float width = MathHelper.Lerp(4.6f + mastery * 1.8f, 1.1f, inwardProgress);
349 Color outerColor = Color.Lerp(new Color(118, 4, 30), new Color(245, 22, 70), mastery);
350 Color innerColor = Color.Lerp(new Color(245, 28, 70), new Color(255, 115, 155), mastery);
351 Color color = Color.Lerp(outerColor, innerColor, inwardProgress) * (fade * 0.62f);
352
353 const int points = 9;
354 Vector2 previous = Vector2.Zero;
355 for (int point = 0; point < points; point++)
356 {
357 float alongArc = point / (points - 1f) * 2f - 1f;
358 float angle = baseAngle + alongArc * halfArc;
359 float taperedRadius = waveRadius
360 + BoundaryNoise(angle, -time * 1.35f, seed) * MathHelper.Lerp(3.8f, 1.2f, inwardProgress)
361 - Math.Abs(alongArc) * MathHelper.Lerp(1f, 4f, inwardProgress);
362 Vector2 current = center + angle.ToRotationVector2() * taperedRadius;
363 if (point > 0)
364 {
365 float taper = 1f - Math.Abs(alongArc) * 0.46f;
366 DrawSegment(batch, pixel, previous, current - previous, color * taper, width * taper);
367 }
368 previous = current;
369 }
370
371 // A short inward hook makes the direction of travel readable even in a still frame.
372 Vector2 hookStart = center + baseAngle.ToRotationVector2() * (waveRadius + width * 0.4f);
373 Vector2 hookEnd = center + (baseAngle + 0.035f).ToRotationVector2() * (waveRadius - MathHelper.Lerp(5f, 11f, inwardProgress));
374 DrawSegment(batch, pixel, hookStart, hookEnd - hookStart, color * 0.72f, Math.Max(0.8f, width * 0.62f));
375 }
376 }
377
322 378 private static void DrawAccretionSpiral(SpriteBatch batch, Texture2D pixel, Vector2 center, float coreRadius, float outerRadius, float time, int arm, float mastery, float pulse)
323 379 {
324 380 const int points = 34;