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

DeathMod

【Terraria】DeathMod (now aka Soul Harvest)

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

XFEstudio/DeathMod

fix: normalize combat effect rendering

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

代码差异

5 个文件 +32 -41
Modified Projectiles/LifeStealWispProjectile.cs +17 -33
@@ -1,7 +1,5 @@
1 1 using Microsoft.Xna.Framework;
2 using Microsoft.Xna.Framework.Graphics;
3 2 using Terraria;
4 using Terraria.GameContent;
5 3 using Terraria.ID;
6 4 using Terraria.ModLoader;
7 5
@@ -56,6 +54,7 @@ public class LifeStealWispProjectile : ModProjectile
56 54 Projectile.penetrate = -1;
57 55 Projectile.netImportant = false;
58 56 Projectile.extraUpdates = 1;
57 Projectile.hide = true;
59 58 }
60 59
61 60 public override void AI()
@@ -82,10 +81,24 @@ public class LifeStealWispProjectile : ModProjectile
82 81
83 82 Color color = Color.Lerp(new Color(215, 20, 45), new Color(255, 105, 195), LifeStealLevel / 5f);
84 83 Lighting.AddLight(Projectile.Center, color.ToVector3() * (0.18f + LifeStealLevel * 0.06f));
85 if (Main.rand.NextBool(System.Math.Max(1, 5 - LifeStealLevel)))
84 int particleCount = LifeStealLevel >= 4 ? 2 : 1;
85 for (int index = 0; index < particleCount; index++)
86 86 {
87 Dust dust = Dust.NewDustPerfect(Projectile.Center, DustID.Blood, -Projectile.velocity * 0.08f, 80, color, 0.7f + LifeStealLevel * 0.08f);
87 if (!Main.rand.NextBool(System.Math.Max(1, 4 - LifeStealLevel / 2)))
88 continue;
89
90 Vector2 offset = Main.rand.NextVector2Circular(2.5f + LifeStealLevel * 0.35f, 2.5f + LifeStealLevel * 0.35f);
91 Dust dust = Dust.NewDustPerfect(Projectile.Center + offset, DustID.Blood,
92 -Projectile.velocity * Main.rand.NextFloat(0.025f, 0.075f), 80, color,
93 0.65f + LifeStealLevel * 0.07f + Main.rand.NextFloat(0.12f));
88 94 dust.noGravity = true;
95
96 if (LifeStealLevel >= 3 && Main.rand.NextBool(3))
97 {
98 Dust core = Dust.NewDustPerfect(Projectile.Center - offset * 0.3f, DustID.AncientLight,
99 -Projectile.velocity * 0.018f, 110, Color.Lerp(color, Color.White, 0.45f), 0.42f + LifeStealLevel * 0.04f);
100 core.noGravity = true;
101 }
89 102 }
90 103
91 104 if (toPlayer.LengthSquared() > 16f * 16f)
@@ -99,33 +112,4 @@ public class LifeStealWispProjectile : ModProjectile
99 112 Projectile.Kill();
100 113 }
101 114
102 public override bool PreDraw(ref Color lightColor)
103 {
104 Texture2D pixel = TextureAssets.MagicPixel.Value;
105 Color color = Color.Lerp(new Color(220, 20, 45), new Color(255, 125, 215), LifeStealLevel / 5f) with { A = 0 };
106 int trailLength = 4 + LifeStealLevel;
107 for (int index = trailLength; index >= 1; index--)
108 {
109 Vector2 position = Projectile.oldPos[index] + Projectile.Size / 2f - Main.screenPosition;
110 float strength = (trailLength - index + 1f) / trailLength;
111 float size = (1.6f + LifeStealLevel * 0.34f) * strength;
112 Main.EntitySpriteDraw(pixel, position, null, color * strength * 0.48f,
113 MathHelper.PiOver4 + index * 0.18f, new Vector2(0.5f), new Vector2(size), SpriteEffects.None);
114 if (LifeStealLevel >= 3 && index % 2 == 0)
115 {
116 Vector2 orbitOffset = (Projectile.ai[1] + index * 1.7f).ToRotationVector2() * (2f + LifeStealLevel * 0.45f);
117 Main.EntitySpriteDraw(pixel, position + orbitOffset, null, Color.White * strength * 0.32f,
118 MathHelper.PiOver4, new Vector2(0.5f), new Vector2(size * 0.45f), SpriteEffects.None);
119 }
120 }
121
122 Vector2 center = Projectile.Center - Main.screenPosition;
123 float pulse = 1f + (float)System.Math.Sin(Projectile.localAI[0] * 0.24f) * 0.16f;
124 float coreSize = (3.5f + LifeStealLevel * 0.65f) * pulse;
125 Main.EntitySpriteDraw(pixel, center, null, color * 0.9f, MathHelper.PiOver4,
126 new Vector2(0.5f), new Vector2(coreSize), SpriteEffects.None);
127 Main.EntitySpriteDraw(pixel, center, null, Color.White * 0.72f, -MathHelper.PiOver4,
128 new Vector2(0.5f), new Vector2(coreSize * 0.38f), SpriteEffects.None);
129 return false;
130 }
131 115 }
Modified Projectiles/SickleSwingProjectile.cs +12 -5
@@ -458,7 +458,8 @@ public class SickleSwingProjectile : ModProjectile
458 458 Vector2 oldTip = gripHistory[index + 1] + angleHistory[index + 1].ToRotationVector2() * sickle.SickleReach;
459 459 Vector2 difference = oldTip - currentTip;
460 460 float length = difference.Length();
461 if (length < 0.5f || length > sickle.SickleReach * 1.2f)
461 float maximumSegmentLength = 28f + sickle.SickleTier * 4f;
462 if (length < 0.5f || length > maximumSegmentLength)
462 463 continue;
463 464
464 465 float strength = 1f - index / (float)segmentCount;
@@ -488,16 +489,21 @@ public class SickleSwingProjectile : ModProjectile
488 489 Vector2 midpoint = currentTip + difference * 0.5f;
489 490 float moteSize = 2.5f + strength * 4f;
490 491 Main.EntitySpriteDraw(pixel, midpoint - Main.screenPosition, null, sickle.SickleSecondaryColor with { A = 0 },
491 MathHelper.PiOver4, new Vector2(0.5f), new Vector2(moteSize), SpriteEffects.None);
492 MathHelper.PiOver4, pixel.Size() * 0.5f,
493 new Vector2(moteSize / pixel.Width, moteSize / pixel.Height), SpriteEffects.None);
492 494 }
493 495 }
494 496 }
495 497
496 498 private static void DrawTrailSegment(Texture2D pixel, Vector2 start, Vector2 difference, Color color, float width, float opacity)
497 499 {
500 float length = difference.Length();
501 if (length <= 0.5f)
502 return;
503
498 504 Main.EntitySpriteDraw(pixel, start - Main.screenPosition, null, color * opacity,
499 difference.ToRotation(), new Vector2(0f, 0.5f),
500 new Vector2(difference.Length(), Math.Max(1f, width)), SpriteEffects.None);
505 difference.ToRotation(), new Vector2(0f, pixel.Height * 0.5f),
506 new Vector2(length / pixel.Width, Math.Max(1f, width) / pixel.Height), SpriteEffects.None);
501 507 }
502 508
503 509 private static void DrawWeapon(Texture2D texture, NormalSickle sickle, Vector2 position, float angle, bool flipped, Color color, float opacity, float scale)
@@ -529,7 +535,8 @@ public class SickleSwingProjectile : ModProjectile
529 535 float moteScale = 2f + chargeRatio * 3f + index % 2;
530 536 Color color = Color.Lerp(sickle.SickleColor, sickle.SickleSecondaryColor, index % 2) with { A = 0 };
531 537 Main.EntitySpriteDraw(pixel, position, null, color * (0.55f + chargeRatio * 0.4f), angle + MathHelper.PiOver4,
532 new Vector2(0.5f), new Vector2(moteScale), SpriteEffects.None);
538 pixel.Size() * 0.5f,
539 new Vector2(moteScale / pixel.Width, moteScale / pixel.Height), SpriteEffects.None);
533 540 }
534 541 }
535 542
Modified README.md +1 -1
@@ -4,7 +4,7 @@
4 4
5 5 Soul Harvest(内部模组名:`DeathMod`)是一款面向 Terraria tModLoader 的死神装备成长模组。玩家使用本模组的镰刀收割灵魂,将灵魂凝聚为灵魂精华,再通过死神祭坛培养镰刀、死神长袍与死亡之翼。
6 6
7 当前版本:`2.3`
7 当前版本:`2.3.1`
8 8
9 9 作者:XFEstudio
10 10
Modified build.txt +1 -1
@@ -1,5 +1,5 @@
1 1 displayName = Soul Harvest
2 2 author = XFEstudio
3 version = 2.3
3 version = 2.3.1
4 4 homepage = https://www.xfegzs.com/
5 5 includeSource = true
Modified docs/PLAY_GUIDE.md +1 -1
@@ -2,7 +2,7 @@
2 2
3 3 [返回 README](../README.md)
4 4
5 本教程基于 Soul Harvest 2.3 的当前实现,介绍从新人物开局到培养镰刀、死神长袍和死亡之翼的完整流程。
5 本教程基于 Soul Harvest 2.3.1 的当前实现,介绍从新人物开局到培养镰刀、死神长袍和死亡之翼的完整流程。
6 6
7 7 ## 一、人物开局
8 8