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

DeathMod

【Terraria】DeathMod (now aka Soul Harvest)

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

XFEstudio/DeathMod

拆分全屏领域与安魂曲并强化显化层次

4b594fc
XFE工作室室长 <mail@xfegzs.com>
提交于

代码差异

6 个文件 +48 -40
Modified Common/DeathDomainBackdropTextureSystem.cs +35 -34
@@ -119,40 +119,41 @@ internal sealed class DeathDomainBackdropTextureSystem : ModSystem
119 119 if (radialDistance > reach)
120 120 return;
121 121
122 float cosine = (float)Math.Cos(tilt);
123 float sine = (float)Math.Sin(tilt);
124 float localX = dx * cosine + dy * sine;
125 float localY = -dx * sine + dy * cosine;
126 float angle = (float)Math.Atan2(dy, dx);
127
128 // The surrounding stars and nebula are dimmed before the event horizon,
129 // suggesting gravitational lensing without requiring a distortion shader.
130 float gravityWell = 1f - SmoothRange(radius * 1.05f, reach, radialDistance);
131 color *= 1f - gravityWell * 0.52f;
132
133 float coreDistance = (float)Math.Sqrt(localX * localX + localY * localY * 1.16f);
134 float core = 1f - SmoothRange(radius * 0.7f, radius, coreDistance);
135 color = Vector3.Lerp(color, new Vector3(0.0008f, 0f, 0.004f), core * 0.985f);
136
137 float photonRing = SmoothRange(radius * 0.84f, radius * 1.02f, radialDistance)
138 * (1f - SmoothRange(radius * 1.02f, radius * 1.17f, radialDistance));
139 float brokenArc = 0.3f + 0.7f * Smooth01(
140 ((float)Math.Sin(angle * 7f + seed) + 0.42f) / 1.42f);
141 color += new Vector3(0.92f, 0.018f, 0.11f) * photonRing * brokenArc * 0.92f;
142
143 // A thin, tilted accretion disc crosses the core. Its rear half is muted so
144 // the black centre remains readable instead of becoming a bright red dot.
145 float discDistance = (float)Math.Sqrt(localX * localX + localY * localY * 24f);
146 float disc = SmoothRange(radius * 1.04f, radius * 1.28f, discDistance)
147 * (1f - SmoothRange(radius * 2.35f, radius * 2.8f, discDistance));
148 float discBreakup = 0.48f + 0.52f * Smooth01(
149 ((float)Math.Sin(localX / radius * 15f + seed * 2.1f) + 0.7f) / 1.7f);
150 float rearFade = localY < 0f ? 0.48f : 1f;
151 color += new Vector3(0.74f, 0.006f, 0.075f) * disc * discBreakup * rearFade * 0.76f;
152
153 float lensHalo = SmoothRange(radius * 1.12f, radius * 1.45f, radialDistance)
154 * (1f - SmoothRange(radius * 2.15f, radius * 3f, radialDistance));
155 color += new Vector3(0.12f, 0.008f, 0.09f) * lensHalo * (0.28f + brokenArc * 0.24f);
122 float angle = (float)Math.Atan2(dy, dx) - tilt;
123
124 float normalizedRadius = radialDistance / radius;
125 float edgeNoise = (float)Math.Sin(angle * 5f + seed) * 0.095f
126 + (float)Math.Sin(angle * 11f - seed * 1.7f) * 0.042f;
127 float noisyEventHorizon = radius * (1f + edgeNoise);
128
129 // Match the player's domain core: a circular, noisy event horizon rather
130 // than an edge-on astronomical accretion disc.
131 float gravityWell = 1f - SmoothRange(radius * 0.96f, reach, radialDistance);
132 color *= 1f - gravityWell * 0.58f;
133 float core = 1f - SmoothRange(noisyEventHorizon * 0.78f, noisyEventHorizon, radialDistance);
134 color = Vector3.Lerp(color, new Vector3(0.0006f, 0f, 0.0035f), core * 0.992f);
135
136 float boundaryDistance = Math.Abs(radialDistance - noisyEventHorizon);
137 float noisyBoundary = 1f - SmoothRange(radius * 0.035f, radius * 0.19f, boundaryDistance);
138 float brokenBoundary = 0.48f + 0.52f * Smooth01(
139 ((float)Math.Sin(angle * 9f + seed * 2.2f) + 0.55f) / 1.55f);
140 color += new Vector3(0.96f, 0.012f, 0.095f) * noisyBoundary * brokenBoundary * 0.82f;
141
142 // Five contracting spiral arms echo the suction waves around the player.
143 float spiralEnvelope = SmoothRange(0.94f, 1.08f, normalizedRadius)
144 * (1f - SmoothRange(2.75f, 3.35f, normalizedRadius));
145 float spiralPhase = angle * 5f - normalizedRadius * 10.5f + seed;
146 float spiralRidge = Smooth01(((float)Math.Sin(spiralPhase) + 0.3f) / 1.3f);
147 spiralRidge *= spiralRidge * spiralRidge;
148 float secondaryRidge = Smooth01(
149 ((float)Math.Sin(spiralPhase + 1.25f + normalizedRadius * 1.7f) + 0.55f) / 1.55f);
150 secondaryRidge *= secondaryRidge;
151 color += new Vector3(0.72f, 0.008f, 0.07f)
152 * spiralEnvelope
153 * (spiralRidge * 0.72f + secondaryRidge * 0.2f);
154
155 float centralGlow = 1f - SmoothRange(0f, radius * 0.58f, radialDistance);
156 color += new Vector3(0.16f, 0.0015f, 0.028f) * centralGlow * centralGlow * 0.42f;
156 157 }
157 158
158 159 private static Color BuildMiddlePixel(float u, float v)
Modified Common/DeathDomainVisualSystem.cs +8 -2
@@ -124,12 +124,18 @@ internal class DeathDomainVisualSystem : ModSystem
124 124 {
125 125 float time = Main.GlobalTimeWrappedHourly;
126 126 float reveal = MathHelper.SmoothStep(0f, 1f, animation);
127 float rangeProgress = MathHelper.Clamp(
128 (targetRadius - 160f) / (DeathNecklace.RadiusGrowthPerLevel * (DeathNecklace.MaxCoreLevel - 1)),
129 0f,
130 1f);
131 float manifestation = MathHelper.Lerp(0.38f, 1f, rangeProgress);
132 float manifestedReveal = reveal * manifestation;
127 133 float expansion = 1f - (float)Math.Pow(1f - reveal, 3f);
128 134 float overshoot = 1f + (float)Math.Sin(reveal * MathHelper.Pi) * 0.035f;
129 135 float radius = MathHelper.Lerp(8f, targetRadius, expansion) * overshoot;
130 float pulse = (0.82f + (float)Math.Sin(time * 3.2f) * 0.12f) * reveal;
136 float pulse = (0.82f + (float)Math.Sin(time * 3.2f) * 0.12f) * manifestedReveal;
131 137 float masteryProgress = GetMasteryProgress(mastery);
132 DrawBlackHoleField(batch, pixel, center, radius, masteryProgress, pulse, time, reveal);
138 DrawBlackHoleField(batch, pixel, center, radius, masteryProgress, pulse, time, manifestedReveal);
133 139 DrawNoiseBoundary(batch, pixel, center, radius + 3f, time, 0.4f, 12f, 9f, 0.18f * pulse, masteryProgress, gaps: true);
134 140 DrawNoiseBoundary(batch, pixel, center, radius, time, 1.7f, 9f, 5f, 0.42f * pulse, masteryProgress, gaps: true);
135 141 DrawNoiseBoundary(batch, pixel, center, radius - 2f, time, 3.3f, 7f, 2.7f + masteryProgress, 0.94f * pulse, masteryProgress, gaps: false);
Modified Common/MyPlayer.cs +1 -1
@@ -448,7 +448,7 @@ public class MyPlayer : ModPlayer
448 448 }
449 449
450 450 deathDomainVolleyCounter++;
451 bool requiem = necklace.IsFullScreenDomain && deathDomainVolleyCounter % 4 == 0;
451 bool requiem = necklace.DeathRequiemUnlocked && deathDomainVolleyCounter % 4 == 0;
452 452 foreach (NPC target in targets)
453 453 {
454 454 float rotation = deathDomainPendingCuts.TryGetValue(target.whoAmI, out PendingDeathDomainCut pending)
Modified Items/DeathNecklace.cs +2 -1
@@ -46,7 +46,8 @@ public class DeathNecklace : ModItem, IDeathAltarUpgradeable
46 46 public float NormalSlashLifeRatio => DamageLevel * 0.01f;
47 47 public float BossSlashLifeRatio => DamageLevel * 0.0001f;
48 48 public int SlashCount => VolleyLevel;
49 public bool IsFullScreenDomain => SovereigntyUnlocked && AllCoreStatsMaxed;
49 public bool IsFullScreenDomain => RadiusLevel >= MaxCoreLevel;
50 public bool DeathRequiemUnlocked => SovereigntyUnlocked && AllCoreStatsMaxed;
50 51 public int MasteryScore => RadiusLevel + FrequencyLevel + DamageLevel + VolleyLevel * 2 + LifeStealLevel + (SovereigntyUnlocked ? 30 : 0);
51 52 public IReadOnlyList<DeathAltarUpgradeType> AltarUpgradeTypes => UpgradeTypes;
52 53
Modified Localization/en-US.hjson +1 -1
@@ -154,7 +154,7 @@ Mods: {
154 154 NecklaceStats: Domain {0:0.#} tiles | Interval {1:0.##}s | Normal slash {2:0.##}% | Boss slash {3:0.###}% | Multislash ×{4} | Life steal {5}% | Sovereignty: {6}
155 155 NecklaceSlashDamage: Normal {0:0.##}% / Boss {1:0.###}%
156 156 DeathDomainToggleHint: Press the Death Domain keybind to enable or disable the field
157 FullScreenRequiem: Full screen + Death Requiem
157 FullScreenRequiem: Death Requiem
158 158 AltarHint: Right-click a Death Altar to open its modification interface
159 159 SoulCount: Souls: {0}
160 160 SoulJarHint:
Modified Localization/zh-Hans.hjson +1 -1
@@ -154,7 +154,7 @@ Mods: {
154 154 NecklaceStats: 领域 {0:0.#}格 | 间隔 {1:0.##}秒 | 小怪斩击 {2:0.##}% | Boss斩击 {3:0.###}% | 多重斩击 ×{4} | 吸血 {5}% | 主权:{6}
155 155 NecklaceSlashDamage: 小怪 {0:0.##}% / Boss {1:0.###}%
156 156 DeathDomainToggleHint: 按“开关死亡领域”快捷键展开或收回领域
157 FullScreenRequiem: 全屏领域 + 死亡安魂曲
157 FullScreenRequiem: 死亡安魂曲
158 158 AltarHint: 在死神祭坛右键打开改造界面
159 159 SoulCount: 灵魂:{0}
160 160 SoulJarHint: