Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ UpdateNPC_BuffApplyVFX()

void Terraria.NPC.UpdateNPC_BuffApplyVFX ( )
inlineprivate

Definition at line 87875 of file NPC.cs.

87876 {
87877 if (!canDisplayBuffs)
87878 {
87879 return;
87880 }
87882 if (markedByScytheWhip && Main.rand.Next(3) == 0)
87883 {
87885 {
87886 MovementVector = Main.rand.NextVector2Circular(1f, 1f),
87887 PositionInWorld = Main.rand.NextVector2FromRectangle(base.Hitbox)
87888 });
87889 }
87890 if (poisoned && Main.rand.Next(30) == 0)
87891 {
87892 Dust dust = Dust.NewDustDirect(position, width, height, 46, 0f, 0f, 120, default(Color), 0.2f);
87893 dust.noGravity = true;
87894 dust.fadeIn = 1.9f;
87895 }
87896 if (venom && Main.rand.Next(10) == 0)
87897 {
87898 Dust dust2 = Dust.NewDustDirect(position, width, height, 171, 0f, 0f, 100, default(Color), 0.5f);
87899 dust2.noGravity = true;
87900 dust2.fadeIn = 1.5f;
87901 }
87902 if (shadowFlame && Main.rand.Next(5) < 4)
87903 {
87904 Dust dust3 = Dust.NewDustDirect(new Vector2(position.X - 2f, position.Y - 2f), width + 4, height + 4, 27, velocity.X * 0.4f, velocity.Y * 0.4f, 180, default(Color), 1.95f);
87905 dust3.noGravity = true;
87906 dust3.velocity *= 0.75f;
87907 dust3.velocity.X *= 0.75f;
87908 dust3.velocity.Y -= 1f;
87909 if (Main.rand.Next(4) == 0)
87910 {
87911 dust3.noGravity = false;
87912 dust3.scale *= 0.5f;
87913 }
87914 }
87915 if (onFire)
87916 {
87917 if (Main.rand.Next(4) < 3)
87918 {
87919 Dust dust4 = Dust.NewDustDirect(new Vector2(position.X - 2f, position.Y - 2f), width + 4, height + 4, 6, velocity.X * 0.4f, velocity.Y * 0.4f, 100, default(Color), 3.5f);
87920 dust4.noGravity = true;
87921 dust4.velocity *= 1.8f;
87922 dust4.velocity.Y -= 0.5f;
87923 if (Main.rand.Next(4) == 0)
87924 {
87925 dust4.noGravity = false;
87926 dust4.scale *= 0.5f;
87927 }
87928 }
87929 Lighting.AddLight((int)(position.X / 16f), (int)(position.Y / 16f + 1f), 1f, 0.3f, 0.1f);
87930 }
87931 if (onFire3)
87932 {
87933 if (Main.rand.Next(4) < 3)
87934 {
87935 Dust dust5 = Dust.NewDustDirect(new Vector2(position.X - 2f, position.Y - 2f), width + 4, height + 4, 6, velocity.X * 0.4f, velocity.Y * 0.4f, 100, default(Color), 3.5f);
87936 dust5.noGravity = true;
87937 dust5.velocity *= 1.8f;
87938 dust5.velocity.Y -= 0.5f;
87939 if (Main.rand.Next(4) == 0)
87940 {
87941 dust5.noGravity = false;
87942 dust5.scale *= 0.5f;
87943 }
87944 dust5.customData = 0;
87945 }
87946 Lighting.AddLight((int)(position.X / 16f), (int)(position.Y / 16f + 1f), 1f, 0.3f, 0.1f);
87947 }
87948 if (daybreak)
87949 {
87950 if (Main.rand.Next(4) < 3)
87951 {
87952 Dust dust6 = Dust.NewDustDirect(new Vector2(position.X - 2f, position.Y - 2f), width + 4, height + 4, 158, velocity.X * 0.4f, velocity.Y * 0.4f, 100, default(Color), 3.5f);
87953 dust6.noGravity = true;
87954 dust6.velocity *= 2.8f;
87955 dust6.velocity.Y -= 0.5f;
87956 if (Main.rand.Next(4) == 0)
87957 {
87958 dust6.noGravity = false;
87959 dust6.scale *= 0.5f;
87960 }
87961 }
87962 Lighting.AddLight((int)(position.X / 16f), (int)(position.Y / 16f + 1f), 1f, 0.3f, 0.1f);
87963 }
87964 if (betsysCurse)
87965 {
87966 if (Main.rand.Next(4) < 3)
87967 {
87968 Dust dust7 = Dust.NewDustDirect(new Vector2(position.X - 2f, position.Y - 2f), width + 4, height + 4, 55, velocity.X * 0.4f, velocity.Y * 0.4f, 100, default(Color), 3.5f);
87969 dust7.noGravity = true;
87970 dust7.velocity *= 2.8f;
87971 dust7.velocity.Y -= 1.5f;
87972 dust7.noGravity = false;
87973 dust7.scale = 0.9f;
87974 dust7.color = new Color(0, 0, 180, 255);
87975 dust7.velocity *= 0.2f;
87976 }
87977 Lighting.AddLight((int)(position.X / 16f), (int)(position.Y / 16f + 1f), 0.6f, 0.1f, 0.9f);
87978 }
87979 if (oiled && Main.rand.Next(3) != 0)
87980 {
87981 int num = 175;
87982 Color newColor = new Color(0, 0, 0, 250);
87984 vector.X -= 2f;
87985 vector.Y -= 2f;
87986 if (Main.rand.Next(2) == 0)
87987 {
87988 Dust dust8 = Dust.NewDustDirect(vector, width + 4, height + 2, 4, 0f, 0f, num, newColor, 1.4f);
87989 if (Main.rand.Next(2) == 0)
87990 {
87991 dust8.alpha += 25;
87992 }
87993 if (Main.rand.Next(2) == 0)
87994 {
87995 dust8.alpha += 25;
87996 }
87997 dust8.noLight = true;
87998 dust8.velocity *= 0.2f;
87999 dust8.velocity.Y += 0.2f;
88000 dust8.velocity += velocity;
88001 }
88002 }
88003 if (dryadWard && velocity.X != 0f && Main.rand.Next(4) == 0)
88004 {
88005 Dust dust9 = Dust.NewDustDirect(new Vector2(position.X - 2f, position.Y + (float)height - 2f), width + 4, 4, 163, velocity.X * 0.4f, velocity.Y * 0.4f, 100, default(Color), 1.5f);
88006 dust9.noGravity = true;
88007 dust9.noLight = true;
88008 dust9.velocity *= 0f;
88009 }
88010 if (dryadBane && Main.rand.Next(4) == 0)
88011 {
88012 Dust dust10 = Dust.NewDustDirect(new Vector2(position.X - 2f, position.Y), width + 4, height, 163, velocity.X * 0.4f, velocity.Y * 0.4f, 100, default(Color), 1.5f);
88013 dust10.noGravity = true;
88014 dust10.velocity *= new Vector2(Main.rand.NextFloat() * 4f - 2f, 0f);
88015 dust10.noLight = true;
88016 }
88017 if (loveStruck && Main.rand.Next(5) == 0)
88018 {
88019 Vector2 vector2 = new Vector2(Main.rand.Next(-10, 11), Main.rand.Next(-10, 11));
88020 vector2.Normalize();
88021 vector2.X *= 0.66f;
88022 int num2 = Gore.NewGore(position + new Vector2(Main.rand.Next(width + 1), Main.rand.Next(height + 1)), vector2 * Main.rand.Next(3, 6) * 0.33f, 331, (float)Main.rand.Next(40, 121) * 0.01f);
88023 Main.gore[num2].sticky = false;
88024 Main.gore[num2].velocity *= 0.4f;
88025 Main.gore[num2].velocity.Y -= 0.6f;
88026 }
88027 if (stinky && Main.rand.Next(5) == 0)
88028 {
88029 Vector2 vector3 = new Vector2(Main.rand.Next(-10, 11), Main.rand.Next(-10, 11));
88030 vector3.Normalize();
88031 vector3.X *= 0.66f;
88032 vector3.Y = Math.Abs(vector3.Y);
88033 Vector2 vector4 = vector3 * Main.rand.Next(3, 5) * 0.25f;
88034 Dust dust11 = Dust.NewDustDirect(position, width, height, 188, vector4.X, vector4.Y * 0.5f, 100, default(Color), 1.5f);
88035 dust11.velocity *= 0.1f;
88036 dust11.velocity.Y -= 0.5f;
88037 }
88038 if (dripping && Main.rand.Next(4) != 0)
88039 {
88041 vector5.X -= 2f;
88042 vector5.Y -= 2f;
88043 if (Main.rand.Next(2) == 0)
88044 {
88045 Dust dust12 = Dust.NewDustDirect(vector5, width + 4, height + 2, 211, 0f, 0f, 50, default(Color), 0.8f);
88046 if (Main.rand.Next(2) == 0)
88047 {
88048 dust12.alpha += 25;
88049 }
88050 if (Main.rand.Next(2) == 0)
88051 {
88052 dust12.alpha += 25;
88053 }
88054 dust12.noLight = true;
88055 dust12.velocity *= 0.2f;
88056 dust12.velocity.Y += 0.2f;
88057 dust12.velocity += velocity;
88058 }
88059 else
88060 {
88061 Dust dust13 = Dust.NewDustDirect(vector5, width + 8, height + 8, 211, 0f, 0f, 50, default(Color), 1.1f);
88062 if (Main.rand.Next(2) == 0)
88063 {
88064 dust13.alpha += 25;
88065 }
88066 if (Main.rand.Next(2) == 0)
88067 {
88068 dust13.alpha += 25;
88069 }
88070 dust13.noLight = true;
88071 dust13.noGravity = true;
88072 dust13.velocity *= 0.2f;
88073 dust13.velocity.Y += 1f;
88074 dust13.velocity += velocity;
88075 }
88076 }
88077 if (drippingSlime && Main.rand.Next(4) != 0)
88078 {
88079 int num3 = 175;
88080 Color newColor2 = new Color(0, 80, 255, 100);
88082 vector6.X -= 2f;
88083 vector6.Y -= 2f;
88084 if (Main.rand.Next(2) == 0)
88085 {
88086 Dust dust14 = Dust.NewDustDirect(vector6, width + 4, height + 2, 4, 0f, 0f, num3, newColor2, 1.4f);
88087 if (Main.rand.Next(2) == 0)
88088 {
88089 dust14.alpha += 25;
88090 }
88091 if (Main.rand.Next(2) == 0)
88092 {
88093 dust14.alpha += 25;
88094 }
88095 dust14.noLight = true;
88096 dust14.velocity *= 0.2f;
88097 dust14.velocity.Y += 0.2f;
88098 dust14.velocity += velocity;
88099 }
88100 }
88101 if (drippingSparkleSlime && Main.rand.Next(4) != 0)
88102 {
88103 int num4 = 150;
88105 vector7.X -= 2f;
88106 vector7.Y -= 2f;
88107 if (Main.rand.Next(2) == 0)
88108 {
88109 Dust dust15 = Dust.NewDustDirect(vector7, width + 4, height + 2, 243, 0f, 0f, num4);
88110 if (Main.rand.Next(2) == 0)
88111 {
88112 dust15.alpha += 25;
88113 }
88114 if (Main.rand.Next(2) == 0)
88115 {
88116 dust15.alpha += 25;
88117 }
88118 dust15.noLight = true;
88119 dust15.velocity *= 0.2f;
88120 dust15.velocity.Y += 0.2f;
88121 dust15.velocity += velocity;
88122 }
88123 }
88124 if (onFrostBurn)
88125 {
88126 if (Main.rand.Next(4) < 3)
88127 {
88128 Dust dust16 = Dust.NewDustDirect(new Vector2(position.X - 2f, position.Y - 2f), width + 4, height + 4, 135, velocity.X * 0.4f, velocity.Y * 0.4f, 100, default(Color), 3.5f);
88129 dust16.noGravity = true;
88130 dust16.velocity *= 1.8f;
88131 dust16.velocity.Y -= 0.5f;
88132 if (Main.rand.Next(4) == 0)
88133 {
88134 dust16.noGravity = false;
88135 dust16.scale *= 0.5f;
88136 }
88137 }
88138 Lighting.AddLight((int)(position.X / 16f), (int)(position.Y / 16f + 1f), 0.1f, 0.6f, 1f);
88139 }
88140 if (onFrostBurn2)
88141 {
88142 if (Main.rand.Next(4) < 3)
88143 {
88144 Dust dust17 = Dust.NewDustDirect(new Vector2(position.X - 2f, position.Y - 2f), width + 4, height + 4, 135, velocity.X * 0.4f, velocity.Y * 0.4f, 100, default(Color), 3.5f);
88145 dust17.noGravity = true;
88146 dust17.velocity *= 1.8f;
88147 dust17.velocity.Y -= 0.5f;
88148 if (Main.rand.Next(4) == 0)
88149 {
88150 dust17.noGravity = false;
88151 dust17.scale *= 0.5f;
88152 }
88153 }
88154 Lighting.AddLight((int)(position.X / 16f), (int)(position.Y / 16f + 1f), 0.1f, 0.6f, 1f);
88155 }
88156 if (onFire2)
88157 {
88158 if (Main.rand.Next(4) < 3)
88159 {
88160 Dust dust18 = Dust.NewDustDirect(new Vector2(position.X - 2f, position.Y - 2f), width + 4, height + 4, 75, velocity.X * 0.4f, velocity.Y * 0.4f, 100, default(Color), 3.5f);
88161 dust18.noGravity = true;
88162 dust18.velocity *= 1.8f;
88163 dust18.velocity.Y -= 0.5f;
88164 if (Main.rand.Next(4) == 0)
88165 {
88166 dust18.noGravity = false;
88167 dust18.scale *= 0.5f;
88168 }
88169 }
88170 Lighting.AddLight((int)(position.X / 16f), (int)(position.Y / 16f + 1f), 1f, 0.3f, 0.1f);
88171 }
88172 netShimmer = false;
88173 if (shimmering)
88174 {
88175 shimmerTransparency += 0.01f;
88176 if (Main.netMode != 1 && (double)shimmerTransparency > 0.9)
88177 {
88178 GetShimmered();
88179 }
88180 if (shimmerTransparency > 1f)
88181 {
88183 }
88184 }
88185 else if (shimmerTransparency > 0f)
88186 {
88187 if (justHit)
88188 {
88189 shimmerTransparency -= 0.1f;
88190 }
88191 if (buffImmune[353])
88192 {
88193 shimmerTransparency -= 0.015f;
88194 }
88195 else
88196 {
88197 shimmerTransparency -= 0.001f;
88198 }
88199 if (shimmerTransparency < 0f)
88200 {
88202 }
88203 }
88205 }
static double Abs(double value)
Vector2 velocity
Definition Entity.cs:16
Vector2 position
Definition Entity.cs:14
static void RequestParticleSpawn(bool clientOnly, ParticleOrchestraType type, ParticleOrchestraSettings settings, int? overrideInvokingPlayerIndex=null)
Vector2 netOffset
Definition NPC.cs:103
bool drippingSparkleSlime
Definition NPC.cs:93
bool dryadBane
Definition NPC.cs:275
bool onFire2
Definition NPC.cs:227
bool venom
Definition NPC.cs:239
bool stinky
Definition NPC.cs:257
bool poisoned
Definition NPC.cs:235
bool dryadWard
Definition NPC.cs:259
bool markedByScytheWhip
Definition NPC.cs:237
void GetShimmered()
Definition NPC.cs:88207
bool canDisplayBuffs
Definition NPC.cs:219
bool netShimmer
Definition NPC.cs:577
bool oiled
Definition NPC.cs:283
bool onFire
Definition NPC.cs:225
bool betsysCurse
Definition NPC.cs:281
float shimmerTransparency
Definition NPC.cs:207
bool shimmering
Definition NPC.cs:245
bool[] buffImmune
Definition NPC.cs:217
bool justHit
Definition NPC.cs:455
bool dripping
Definition NPC.cs:89
bool drippingSlime
Definition NPC.cs:91
bool shadowFlame
Definition NPC.cs:241
bool onFrostBurn2
Definition NPC.cs:233
bool daybreak
Definition NPC.cs:277
bool loveStruck
Definition NPC.cs:255
bool onFire3
Definition NPC.cs:229
bool onFrostBurn
Definition NPC.cs:231

References System.Math.Abs(), Terraria.Lighting.AddLight(), Microsoft.Xna.Framework.Graphics.Color, Terraria.Main.gore, Terraria.Main.netMode, Terraria.Dust.NewDustDirect(), Terraria.Gore.NewGore(), Terraria.Main.rand, Terraria.GameContent.Drawing.ParticleOrchestrator.RequestParticleSpawn(), and Microsoft.Xna.Framework.Graphics.Vector2.