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

DeathMod

【Terraria】DeathMod (now aka Soul Harvest)

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

XFEstudio/DeathMod

修正死神镰刀尺寸与刀刃领域轨迹

707b91d
XFE工作室室长 <mail@xfegzs.com>
提交于

代码差异

6 个文件 +43 -28
Modified Common/DeathDomainCrescentVisualSystem.cs +5 -5
@@ -18,7 +18,7 @@ internal sealed class DeathDomainCrescentVisualSystem : ModSystem
18 18 {
19 19 private const int AngularSegments = 128;
20 20 private const int DepthBands = 18;
21 private const float HalfSweep = 2.43f;
21 private const float HalfSweep = ReaperCombatRegistry.DeathPrimaryHalfSweep;
22 22 private const float OuterRadiusRatio = 0.91f;
23 23 private const float MaximumThicknessRatio = 0.405f;
24 24
@@ -157,10 +157,10 @@ internal sealed class DeathDomainCrescentVisualSystem : ModSystem
157 157 float taper = (float)Math.Pow(Math.Max(0f,
158 158 Math.Sin(progress * MathHelper.Pi)), 0.67f);
159 159 taper *= 1f + 0.22f * (progress * 2f - 1f);
160 float outerRadius = state.Radius * (OuterRadiusRatio
161 + (float)Math.Sin(progress * 29f
162 + (float)Math.Sin(progress * 8f) * 1.3f)
163 * 0.0032f * taper);
160 // The textured interior and the separately drawn hot blade edge must
161 // share this exact boundary. Noise belongs inside the material;
162 // perturbing the outer radius creates a visible air gap at the rim.
163 float outerRadius = state.Radius * OuterRadiusRatio;
164 164 float innerDistortion = ((float)Math.Sin(progress * 23f + 0.7f)
165 165 + (float)Math.Sin(progress * 47f - 1.4f) * 0.42f)
166 166 * state.Radius * 0.018f * taper;
Modified Common/DeathDomainTrailVisualSystem.cs +1 -1
@@ -15,7 +15,7 @@ namespace DeathMod.Common;
15 15 [Autoload(Side = ModSide.Client)]
16 16 internal sealed class DeathDomainTrailVisualSystem : ModSystem
17 17 {
18 private const int MaximumPoints = 24;
18 private const int MaximumPoints = 72;
19 19 private static readonly Dictionary<long, TrailDrawState> drawStates = [];
20 20 private static readonly VertexPositionColorTexture[] vertices =
21 21 new VertexPositionColorTexture[MaximumPoints * 2];
Modified Common/ReaperCombatDefinitions.cs +10 -5
@@ -128,15 +128,20 @@ public readonly record struct SickleCombatSnapshot(
128 128
129 129 public static class ReaperCombatRegistry
130 130 {
131 // Death is intentionally presented at a boss-weapon scale. Keep the held,
132 // special, ultimate and phantom renderers on this single value so its blade
133 // can never drift away from the matching crescent/collision reach again.
131 // Death is intentionally presented at a boss-weapon scale. This value only
132 // scales the weapon sprite; it must never be reused as an attack-range
133 // multiplier.
134 134 public const float DeathWeaponDrawScale = 2.58f;
135 135 public const float CrescentOuterRadiusRatio = 0.91f;
136 public const float DeathPrimaryCrescentRadius = 645f;
136 public const float DeathPrimaryHalfSweep = 2.43f;
137 // The 100x160 Death sprite reaches roughly 406 world pixels from its handle
138 // at the presentation scale above. A 447px crescent places its 91% hot rim
139 // on that cutting edge while remaining close to the original 430px attack
140 // presentation instead of inheriting the weapon's +50% scale.
141 public const float DeathPrimaryCrescentRadius = 447f;
137 142 public const float DeathPrimaryBladeReach = DeathPrimaryCrescentRadius
138 143 * CrescentOuterRadiusRatio;
139 public const float DeathPrimaryCollisionReach = 645f;
144 public const float DeathPrimaryCollisionReach = 430f;
140 145
141 146 public static ReaperFormId ResolveUsableForm(ReaperProgressionState progression)
142 147 {
Modified Common/ReaperCombatService.cs +0 -7
@@ -514,13 +514,6 @@ public static class ReaperCombatService
514 514 modPlayer.RecordDeathCycleHit(data.ReaperPhase);
515 515 modPlayer.QueueDeathNecklaceHarvestFromReaperHit(target,
516 516 data.AttackAngle);
517 float primaryTempo = projectile.ModProjectile
518 is SickleSwingProjectile swing ? swing.DeathTempo : 1f;
519 ReaperDeathPhantomProjectile.Spawn(
520 projectile.GetSource_FromThis(), player.whoAmI, snapshot,
521 target.Center, data.AttackAngle.ToRotationVector2(),
522 primaryTempo, unchecked(data.ReaperActionId * 509
523 + target.whoAmI * 31 + data.ReaperPhase));
524 517 if (data.ReaperPhase == 1)
525 518 player.GetModPlayer<ReaperCombatPlayer>().ApplyDeathBloodHealing(damageDone);
526 519 if (data.ReaperPhase == 2)
Modified Projectiles/ReaperDeathDomainRiftProjectile.cs +6 -7
@@ -18,7 +18,7 @@ namespace DeathMod.Projectiles;
18 18 public sealed class ReaperDeathDomainRiftProjectile : ModProjectile
19 19 {
20 20 private const int Lifetime = 300;
21 private const int MaximumPoints = 24;
21 private const int MaximumPoints = 72;
22 22 private const float TrailWidth = 30f;
23 23 private readonly int[] harvestCooldowns = new int[Main.maxNPCs];
24 24 private readonly List<Vector2> points = [];
@@ -34,17 +34,16 @@ public sealed class ReaperDeathDomainRiftProjectile : ModProjectile
34 34
35 35 internal static int Spawn(Terraria.DataStructures.IEntitySource source,
36 36 int owner, in SickleCombatSnapshot snapshot,
37 Vector2[] newestFirstPoints, int validPointCount, int phase, int actionId)
37 IReadOnlyList<Vector2> orderedPoints, int phase, int actionId)
38 38 {
39 if (Main.netMode == NetmodeID.MultiplayerClient || validPointCount < 2)
39 if (Main.netMode == NetmodeID.MultiplayerClient || orderedPoints.Count < 2)
40 40 return -1;
41 41
42 42 List<Vector2> ordered = [];
43 int usable = Math.Min(Math.Min(validPointCount, newestFirstPoints.Length),
44 MaximumPoints);
45 for (int index = usable - 1; index >= 0; index--)
43 int usable = Math.Min(orderedPoints.Count, MaximumPoints);
44 for (int index = 0; index < usable; index++)
46 45 {
47 Vector2 point = newestFirstPoints[index];
46 Vector2 point = orderedPoints[index];
48 47 if (!float.IsFinite(point.X) || !float.IsFinite(point.Y))
49 48 continue;
50 49 if (ordered.Count == 0
Modified Projectiles/SickleSwingProjectile.cs +21 -3
@@ -531,7 +531,8 @@ public sealed class SickleSwingProjectile : ModProjectile
531 531 _ = phase;
532 532 // A fixed sweep is what lets the weapon, revealed crescent, swept damage
533 533 // sector and max-tempo residual all describe the exact same blade-tip arc.
534 SetArc(-2.43f, 2.43f, eased, direction);
534 SetArc(-ReaperCombatRegistry.DeathPrimaryHalfSweep,
535 ReaperCombatRegistry.DeathPrimaryHalfSweep, eased, direction);
535 536 }
536 537
537 538 private void SetArc(float startOffset, float endOffset, float progress, int direction)
@@ -1020,9 +1021,26 @@ public sealed class SickleSwingProjectile : ModProjectile
1020 1021
1021 1022 private void SpawnDeathDomainRift()
1022 1023 {
1024 // Max tempo only has six or seven animation frames. Connecting those
1025 // sparse history samples turns a circular swing into several enormous
1026 // straight chords. Reconstruct the exact immutable blade-tip locus at
1027 // high resolution from the same pose equation used by UpdateDeathPose.
1028 const int sampleCount = 65;
1029 Vector2[] bladePath = new Vector2[sampleCount];
1030 float traversed = SmoothStep(animationProgress);
1031 for (int index = 0; index < sampleCount; index++)
1032 {
1033 float progress = index / (float)(sampleCount - 1) * traversed;
1034 float offset = MathHelper.Lerp(
1035 -ReaperCombatRegistry.DeathPrimaryHalfSweep,
1036 ReaperCombatRegistry.DeathPrimaryHalfSweep, progress)
1037 * SwingDirection;
1038 float angle = aimRotation + offset;
1039 bladePath[index] = grip + angle.ToRotationVector2()
1040 * ReaperCombatRegistry.DeathPrimaryBladeReach;
1041 }
1023 1042 ReaperDeathDomainRiftProjectile.Spawn(Projectile.GetSource_FromThis(),
1024 Projectile.owner, snapshot, tipHistory, validHistorySamples, phase,
1025 Projectile.identity);
1043 Projectile.owner, snapshot, bladePath, phase, Projectile.identity);
1026 1044 }
1027 1045
1028 1046 private void DrawBaseTrail()