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

DeathMod

【Terraria】DeathMod (now aka Soul Harvest)

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

XFEstudio/DeathMod

裁剪领域斩击黑核内的红色刀光

9b543a1
XFE工作室室长 <mail@xfegzs.com>
提交于

代码差异

1 个文件 +56 -16
Modified Projectiles/DeathDomainHarvestSlashProjectile.cs +56 -16
@@ -129,38 +129,44 @@ public class DeathDomainHarvestSlashProjectile : ModProjectile
129 129 float width = (21f + Mastery * 13f + (IsRequiem ? 8f : 0f)) * Projectile.scale;
130 130 Vector2 center = Projectile.Center - Main.screenPosition;
131 131
132 // Draw the long blood-line first. The red-black execution blade is layered
133 // over it below, allowing the crimson line to extend beyond both tips while
134 // the pure-black core remains completely unbroken.
135 132 Vector2 direction = rotation.ToRotationVector2();
136 133 float bloodReveal = Smooth01((progress - 0.005f) / 0.12f);
137 134 float bloodFade = 1f - Smooth01((progress - 0.16f) / 0.80f);
138 135 float bloodStrength = bloodReveal * bloodFade;
139 136 float bloodLength = length * (3f + Mastery * 0.47f + (IsRequiem ? 0.3f : 0f));
140 137 Vector2 bloodStart = center - direction * bloodLength * 0.5f;
141 DeathDomainPrimitiveTextureSystem.DrawBlade(
138
139 // Draw the execution body first. The crossing blood-line is split around
140 // the currently visible black core below, so no crimson pixels are ever
141 // submitted beneath that area; the darkness no longer depends on overdraw.
142 DrawTaperedBladeLayer(center, rotation, length, width * 1.52f * impactPulse, reveal,
143 new Color(92, 0, 22, 0) * (strength * 0.54f));
144 DrawTaperedBladeLayer(center, rotation, length, width * impactPulse, reveal,
145 new Color(255, 8, 48, 255) * strength);
146 float blackCoreLength = length * 0.985f;
147 DrawTaperedBladeLayer(center, rotation, blackCoreLength, width * 0.62f * impactPulse, reveal,
148 Color.Black * Math.Min(1f, strength * 1.32f));
149
150 Vector2 blackCoreStart = center - direction * blackCoreLength * 0.5f;
151 float blackCoreVisibleLength = blackCoreLength * reveal;
152 DrawBladeOutsideSpan(
142 153 bloodStart,
143 154 rotation,
144 155 bloodLength,
145 156 (10f + Mastery * 3.5f) * Projectile.scale,
146 157 new Color(95, 0, 24, 0) * (bloodStrength * 0.72f),
147 bloodReveal);
148 DeathDomainPrimitiveTextureSystem.DrawBlade(
158 bloodReveal,
159 blackCoreStart,
160 blackCoreVisibleLength);
161 DrawBladeOutsideSpan(
149 162 bloodStart,
150 163 rotation,
151 164 bloodLength,
152 165 (2.4f + Mastery * 0.85f) * Projectile.scale,
153 166 new Color(255, 0, 38, 0) * bloodStrength,
154 bloodReveal);
155
156 // The red-black body follows the same start-to-end path and is drawn after
157 // the blood-line so its pure-black core always wins the overlap.
158 DrawTaperedBladeLayer(center, rotation, length, width * 1.52f * impactPulse, reveal,
159 new Color(92, 0, 22, 0) * (strength * 0.54f));
160 DrawTaperedBladeLayer(center, rotation, length, width * impactPulse, reveal,
161 new Color(255, 8, 48, 255) * strength);
162 DrawTaperedBladeLayer(center, rotation, length * 0.985f, width * 0.62f * impactPulse, reveal,
163 Color.Black * Math.Min(1f, strength * 1.32f));
167 bloodReveal,
168 blackCoreStart,
169 blackCoreVisibleLength);
164 170 }
165 171
166 172 private static void DrawTaperedBladeLayer(Vector2 center, float rotation, float length, float maximumWidth, float reveal, Color color)
@@ -172,6 +178,40 @@ public class DeathDomainHarvestSlashProjectile : ModProjectile
172 178 DeathDomainPrimitiveTextureSystem.DrawBlade(start, rotation, length, maximumWidth, color, reveal);
173 179 }
174 180
181 private static void DrawBladeOutsideSpan(
182 Vector2 start,
183 float rotation,
184 float length,
185 float width,
186 Color color,
187 float reveal,
188 Vector2 excludedStart,
189 float excludedLength)
190 {
191 float visibleLength = length * MathHelper.Clamp(reveal, 0f, 1f);
192 if (visibleLength <= 0.05f || width <= 0.05f)
193 return;
194
195 Vector2 direction = rotation.ToRotationVector2();
196 float exclusionStart = Vector2.Dot(excludedStart - start, direction);
197 float exclusionEnd = exclusionStart + Math.Max(0f, excludedLength);
198 float firstLength = MathHelper.Clamp(exclusionStart, 0f, visibleLength);
199 if (firstLength > 0.05f)
200 DeathDomainPrimitiveTextureSystem.DrawBlade(start, rotation, firstLength, width, color);
201
202 float secondStart = MathHelper.Clamp(exclusionEnd, 0f, visibleLength);
203 float secondLength = visibleLength - secondStart;
204 if (secondLength > 0.05f)
205 {
206 DeathDomainPrimitiveTextureSystem.DrawBlade(
207 start + direction * secondStart,
208 rotation,
209 secondLength,
210 width,
211 color);
212 }
213 }
214
175 215 private void ApplyHarvestDamage()
176 216 {
177 217 if (Projectile.owner < 0