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

◆ AI_145_BookStaffStorm()

void Terraria.Projectile.AI_145_BookStaffStorm ( )
inlineprivate

Definition at line 59148 of file Projectile.cs.

59149 {
59150 //IL_003e: Unknown result type (might be due to invalid IL or missing references)
59151 //IL_0027: Unknown result type (might be due to invalid IL or missing references)
59152 //IL_002c: Unknown result type (might be due to invalid IL or missing references)
59153 //IL_008d: Unknown result type (might be due to invalid IL or missing references)
59154 //IL_0092: Unknown result type (might be due to invalid IL or missing references)
59155 float num = 300f;
59156 SlotId val;
59157 if (soundDelay == 0)
59158 {
59159 soundDelay = -1;
59160 float[] array = localAI;
59162 array[1] = ((SlotId)(ref val)).ToFloat();
59163 }
59165 if (activeSound != null)
59166 {
59167 activeSound.Position = base.Center;
59168 activeSound.Volume = 1f - Math.Max(ai[0] - (num - 15f), 0f) / 15f;
59169 }
59170 else
59171 {
59172 float[] array2 = localAI;
59173 val = SlotId.Invalid;
59174 array2[1] = ((SlotId)(ref val)).ToFloat();
59175 }
59176 if (localAI[0] >= 16f && ai[0] < num - 15f)
59177 {
59178 ai[0] = num - 15f;
59179 }
59180 ai[0] += 1f;
59181 if (ai[0] >= num)
59182 {
59183 Kill();
59184 }
59185 Vector2 top = base.Top;
59186 Vector2 bottom = base.Bottom;
59187 Vector2 vector = Vector2.Lerp(top, bottom, 0.5f);
59188 Vector2 vector2 = new Vector2(0f, bottom.Y - top.Y);
59189 vector2.X = vector2.Y * 0.2f;
59190 int num2 = 16;
59191 int num3 = 160;
59192 for (int i = 0; i < 1; i++)
59193 {
59194 Vector2 vector3 = new Vector2(base.Center.X - (float)(num2 / 2), position.Y + (float)height - (float)num3);
59195 if (Collision.SolidCollision(vector3, num2, num3) || Collision.WetCollision(vector3, num2, num3))
59196 {
59197 if (velocity.Y > 0f)
59198 {
59199 velocity.Y = 0f;
59200 }
59201 if (velocity.Y > -4f)
59202 {
59203 velocity.Y -= 2f;
59204 }
59205 else
59206 {
59207 velocity.Y -= 4f;
59208 localAI[0] += 2f;
59209 }
59210 if (velocity.Y < -16f)
59211 {
59212 velocity.Y = -16f;
59213 }
59214 continue;
59215 }
59216 localAI[0] -= 1f;
59217 if (localAI[0] < 0f)
59218 {
59219 localAI[0] = 0f;
59220 }
59221 if (velocity.Y < 0f)
59222 {
59223 velocity.Y = 0f;
59224 }
59225 if (velocity.Y < 4f)
59226 {
59227 velocity.Y += 2f;
59228 }
59229 else
59230 {
59231 velocity.Y += 4f;
59232 }
59233 if (velocity.Y > 16f)
59234 {
59235 velocity.Y = 16f;
59236 }
59237 }
59238 if (ai[0] < num - 30f)
59239 {
59240 for (int j = 0; j < 1; j++)
59241 {
59242 float value = -1f;
59243 float value2 = 0.9f;
59244 float amount = Main.rand.NextFloat();
59245 Vector2 vector4 = new Vector2(MathHelper.Lerp(0.1f, 1f, Main.rand.NextFloat()), MathHelper.Lerp(value, value2, amount));
59246 vector4.X *= MathHelper.Lerp(2.2f, 0.6f, amount);
59247 vector4.X *= -1f;
59248 Vector2 vector5 = new Vector2(6f, 10f);
59250 Dust dust = Main.dust[Dust.NewDust(vector6, 0, 0, 274)];
59251 dust.position = vector6;
59252 dust.fadeIn = 1.3f;
59253 dust.scale = 0.87f;
59254 dust.alpha = 211;
59255 if (vector4.X > -1.2f)
59256 {
59257 dust.velocity.X = 1f + Main.rand.NextFloat();
59258 }
59259 dust.noGravity = true;
59260 dust.velocity.Y = Main.rand.NextFloat() * -0.5f - 1.3f;
59261 dust.velocity.X += velocity.X * 2.1f;
59262 dust.noLight = true;
59263 }
59264 }
59265 Vector2 vector7 = base.Bottom + new Vector2(-25f, -25f);
59266 for (int k = 0; k < 4; k++)
59267 {
59268 Dust dust2 = Dust.NewDustDirect(vector7, 50, 25, 31, velocity.X, -2f, 100);
59269 dust2.fadeIn = 1.1f;
59270 dust2.noGravity = true;
59271 }
59272 for (int l = 0; l < 1; l++)
59273 {
59274 if (Main.rand.Next(5) == 0)
59275 {
59276 Gore gore = Gore.NewGoreDirect(base.TopLeft + Main.rand.NextVector2Square(0f, 1f) * base.Size, new Vector2(velocity.X * 1.5f, (0f - Main.rand.NextFloat()) * 16f), Utils.SelectRandom<int>(Main.rand, 1007, 1008, 1008));
59277 gore.timeLeft = 60;
59278 gore.alpha = 50;
59279 gore.velocity.X += velocity.X;
59280 }
59281 }
59282 for (int m = 0; m < 1; m++)
59283 {
59284 if (Main.rand.Next(7) == 0)
59285 {
59286 Gore gore2 = Gore.NewGoreDirect(base.TopLeft + Main.rand.NextVector2Square(0f, 1f) * base.Size, new Vector2(velocity.X * 1.5f, (0f - Main.rand.NextFloat()) * 16f), Utils.SelectRandom<int>(Main.rand, 1007, 1008, 1008));
59287 gore2.timeLeft = 0;
59288 gore2.alpha = 80;
59289 }
59290 }
59291 for (int n = 0; n < 1; n++)
59292 {
59293 if (Main.rand.Next(7) == 0)
59294 {
59295 Gore gore3 = Gore.NewGoreDirect(base.TopLeft + Main.rand.NextVector2Square(0f, 1f) * base.Size, new Vector2(velocity.X * 1.5f, (0f - Main.rand.NextFloat()) * 16f), Utils.SelectRandom<int>(Main.rand, 1007, 1008, 1008));
59296 gore3.timeLeft = 0;
59297 gore3.alpha = 80;
59298 }
59299 }
59300 }
static float Lerp(float value1, float value2, float amount)
Definition MathHelper.cs:53
static byte Max(byte val1, byte val2)
Definition Math.cs:738
static SlotId PlayTrackedSound(SoundStyle style, Vector2 position)
static ActiveSound GetActiveSound(SlotId id)
Vector2 velocity
Definition Entity.cs:16
Vector2 position
Definition Entity.cs:14
static readonly LegacySoundStyle DD2_BookStaffTwisterLoop
Definition SoundID.cs:936
static Vector2 Lerp(Vector2 value1, Vector2 value2, float amount)
Definition Vector2.cs:227
static readonly SlotId Invalid
Definition SlotId.cs:5
static SlotId FromFloat(float value)
Definition SlotId.cs:80

References System.array, Terraria.ID.SoundID.DD2_BookStaffTwisterLoop, Terraria.Main.dust, ReLogic.Utilities.SlotId.FromFloat(), Terraria.Audio.SoundEngine.GetActiveSound(), ReLogic.Utilities.SlotId.Invalid, Microsoft.Xna.Framework.MathHelper.Lerp(), Microsoft.Xna.Framework.Vector2.Lerp(), System.Math.Max(), Terraria.Dust.NewDust(), Terraria.Dust.NewDustDirect(), Terraria.Gore.NewGoreDirect(), Terraria.Audio.SoundEngine.PlayTrackedSound(), Terraria.Main.rand, Terraria.Collision.SolidCollision(), System.value, Terraria.Collision.WetCollision(), and Microsoft.Xna.Framework.Vector2.Y.