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

◆ AI_009_MagicMissiles_Old()

void Terraria.Projectile.AI_009_MagicMissiles_Old ( )
inlineprivate

Definition at line 45179 of file Projectile.cs.

45180 {
45181 //IL_0567: Unknown result type (might be due to invalid IL or missing references)
45182 //IL_056d: Unknown result type (might be due to invalid IL or missing references)
45183 //IL_0572: Unknown result type (might be due to invalid IL or missing references)
45184 //IL_0577: Unknown result type (might be due to invalid IL or missing references)
45185 //IL_07b0: Unknown result type (might be due to invalid IL or missing references)
45186 //IL_0668: Unknown result type (might be due to invalid IL or missing references)
45187 //IL_0679: Unknown result type (might be due to invalid IL or missing references)
45188 //IL_0594: Unknown result type (might be due to invalid IL or missing references)
45189 //IL_059b: Unknown result type (might be due to invalid IL or missing references)
45190 //IL_05a0: Unknown result type (might be due to invalid IL or missing references)
45191 //IL_05a4: Unknown result type (might be due to invalid IL or missing references)
45192 //IL_05ae: Unknown result type (might be due to invalid IL or missing references)
45193 //IL_05b3: Unknown result type (might be due to invalid IL or missing references)
45194 //IL_05b5: Unknown result type (might be due to invalid IL or missing references)
45195 //IL_05bf: Unknown result type (might be due to invalid IL or missing references)
45196 //IL_05c4: Unknown result type (might be due to invalid IL or missing references)
45197 //IL_035e: Unknown result type (might be due to invalid IL or missing references)
45198 //IL_0379: Unknown result type (might be due to invalid IL or missing references)
45199 //IL_0c03: Unknown result type (might be due to invalid IL or missing references)
45200 //IL_0c08: Unknown result type (might be due to invalid IL or missing references)
45201 //IL_0aa1: Unknown result type (might be due to invalid IL or missing references)
45202 //IL_0acf: Unknown result type (might be due to invalid IL or missing references)
45203 //IL_0ad5: Unknown result type (might be due to invalid IL or missing references)
45204 //IL_0aea: Unknown result type (might be due to invalid IL or missing references)
45205 //IL_0af4: Unknown result type (might be due to invalid IL or missing references)
45206 //IL_0af9: Unknown result type (might be due to invalid IL or missing references)
45207 //IL_0b00: Unknown result type (might be due to invalid IL or missing references)
45208 //IL_0b14: Unknown result type (might be due to invalid IL or missing references)
45209 //IL_0b19: Unknown result type (might be due to invalid IL or missing references)
45210 //IL_0b1e: Unknown result type (might be due to invalid IL or missing references)
45211 //IL_0b24: Unknown result type (might be due to invalid IL or missing references)
45212 //IL_0b2a: Unknown result type (might be due to invalid IL or missing references)
45213 //IL_0b34: Unknown result type (might be due to invalid IL or missing references)
45214 //IL_0b39: Unknown result type (might be due to invalid IL or missing references)
45215 //IL_0b3e: Unknown result type (might be due to invalid IL or missing references)
45216 //IL_0a60: Unknown result type (might be due to invalid IL or missing references)
45217 //IL_0a65: Unknown result type (might be due to invalid IL or missing references)
45218 //IL_095f: Unknown result type (might be due to invalid IL or missing references)
45219 //IL_0980: Unknown result type (might be due to invalid IL or missing references)
45220 //IL_0986: Unknown result type (might be due to invalid IL or missing references)
45221 //IL_099d: Unknown result type (might be due to invalid IL or missing references)
45222 //IL_09a7: Unknown result type (might be due to invalid IL or missing references)
45223 //IL_09ac: Unknown result type (might be due to invalid IL or missing references)
45224 //IL_0a3a: Unknown result type (might be due to invalid IL or missing references)
45225 //IL_0a4e: Unknown result type (might be due to invalid IL or missing references)
45226 //IL_0a53: Unknown result type (might be due to invalid IL or missing references)
45227 //IL_0a58: Unknown result type (might be due to invalid IL or missing references)
45228 //IL_093c: Unknown result type (might be due to invalid IL or missing references)
45229 //IL_07df: Unknown result type (might be due to invalid IL or missing references)
45230 //IL_080d: Unknown result type (might be due to invalid IL or missing references)
45231 //IL_0827: Unknown result type (might be due to invalid IL or missing references)
45232 //IL_0831: Unknown result type (might be due to invalid IL or missing references)
45233 //IL_0836: Unknown result type (might be due to invalid IL or missing references)
45234 //IL_0844: Unknown result type (might be due to invalid IL or missing references)
45235 //IL_084a: Unknown result type (might be due to invalid IL or missing references)
45236 //IL_0854: Unknown result type (might be due to invalid IL or missing references)
45237 //IL_0859: Unknown result type (might be due to invalid IL or missing references)
45238 //IL_085e: Unknown result type (might be due to invalid IL or missing references)
45239 //IL_03b3: Unknown result type (might be due to invalid IL or missing references)
45240 //IL_00bb: Unknown result type (might be due to invalid IL or missing references)
45241 //IL_00c0: Unknown result type (might be due to invalid IL or missing references)
45242 //IL_00d4: Unknown result type (might be due to invalid IL or missing references)
45243 //IL_00da: Unknown result type (might be due to invalid IL or missing references)
45244 //IL_00e3: Unknown result type (might be due to invalid IL or missing references)
45245 //IL_00e9: Unknown result type (might be due to invalid IL or missing references)
45246 //IL_0c16: Unknown result type (might be due to invalid IL or missing references)
45247 //IL_0bdd: Unknown result type (might be due to invalid IL or missing references)
45248 //IL_0be2: Unknown result type (might be due to invalid IL or missing references)
45249 //IL_0b55: Unknown result type (might be due to invalid IL or missing references)
45250 //IL_0b83: Unknown result type (might be due to invalid IL or missing references)
45251 //IL_0b89: Unknown result type (might be due to invalid IL or missing references)
45252 //IL_0b97: Unknown result type (might be due to invalid IL or missing references)
45253 //IL_0bab: Unknown result type (might be due to invalid IL or missing references)
45254 //IL_0bb0: Unknown result type (might be due to invalid IL or missing references)
45255 //IL_0bb5: Unknown result type (might be due to invalid IL or missing references)
45256 //IL_0bbb: Unknown result type (might be due to invalid IL or missing references)
45257 //IL_0bc1: Unknown result type (might be due to invalid IL or missing references)
45258 //IL_0bcb: Unknown result type (might be due to invalid IL or missing references)
45259 //IL_0bd0: Unknown result type (might be due to invalid IL or missing references)
45260 //IL_0bd5: Unknown result type (might be due to invalid IL or missing references)
45261 //IL_0a73: Unknown result type (might be due to invalid IL or missing references)
45262 //IL_0462: Unknown result type (might be due to invalid IL or missing references)
45263 //IL_0485: Unknown result type (might be due to invalid IL or missing references)
45264 //IL_0bf0: Unknown result type (might be due to invalid IL or missing references)
45265 //IL_06c9: Unknown result type (might be due to invalid IL or missing references)
45266 //IL_0705: Unknown result type (might be due to invalid IL or missing references)
45267 //IL_070b: Unknown result type (might be due to invalid IL or missing references)
45268 //IL_0722: Unknown result type (might be due to invalid IL or missing references)
45269 //IL_072c: Unknown result type (might be due to invalid IL or missing references)
45270 //IL_0731: Unknown result type (might be due to invalid IL or missing references)
45271 //IL_0746: Unknown result type (might be due to invalid IL or missing references)
45272 //IL_074c: Unknown result type (might be due to invalid IL or missing references)
45273 //IL_0751: Unknown result type (might be due to invalid IL or missing references)
45274 //IL_075b: Unknown result type (might be due to invalid IL or missing references)
45275 //IL_0760: Unknown result type (might be due to invalid IL or missing references)
45276 //IL_0150: Unknown result type (might be due to invalid IL or missing references)
45277 //IL_015a: Unknown result type (might be due to invalid IL or missing references)
45278 //IL_015f: Unknown result type (might be due to invalid IL or missing references)
45279 //IL_017f: Unknown result type (might be due to invalid IL or missing references)
45280 //IL_0185: Unknown result type (might be due to invalid IL or missing references)
45281 //IL_018a: Unknown result type (might be due to invalid IL or missing references)
45282 //IL_0236: Unknown result type (might be due to invalid IL or missing references)
45283 //IL_0240: Unknown result type (might be due to invalid IL or missing references)
45284 //IL_0245: Unknown result type (might be due to invalid IL or missing references)
45285 //IL_0247: Unknown result type (might be due to invalid IL or missing references)
45286 //IL_0251: Unknown result type (might be due to invalid IL or missing references)
45287 //IL_0256: Unknown result type (might be due to invalid IL or missing references)
45288 if (Main.myPlayer == owner && ai[0] <= 0f)
45289 {
45290 if (Main.player[owner].channel && Main.player[owner].HeldItem.shoot == type)
45291 {
45292 float num = 12f;
45293 if (type == 16)
45294 {
45295 num = 15f;
45296 }
45297 if (type == 491)
45298 {
45299 num = 20f;
45300 }
45301 Vector2 vector = default(Vector2);
45302 ((Vector2)(ref vector))._002Ector(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
45303 Vector2 pointPoisition = Main.MouseWorld;
45304 Main.player[owner].LimitPointToPlayerReachableArea(ref pointPoisition);
45305 float num11 = pointPoisition.X - vector.X;
45306 float num12 = pointPoisition.Y - vector.Y;
45307 float num13 = (float)Math.Sqrt(num11 * num11 + num12 * num12);
45308 if (ai[0] < 0f)
45309 {
45310 ai[0] += 1f;
45311 }
45312 if (type == 491 && num13 < 100f)
45313 {
45314 if (((Vector2)(ref velocity)).Length() < num)
45315 {
45316 velocity *= 1.1f;
45317 if (((Vector2)(ref velocity)).Length() > num)
45318 {
45319 ((Vector2)(ref velocity)).Normalize();
45320 velocity *= num;
45321 }
45322 }
45323 if (ai[0] == 0f)
45324 {
45325 ai[0] = -10f;
45326 }
45327 }
45328 else if (num13 > num)
45329 {
45330 num13 = num / num13;
45331 num11 *= num13;
45332 num12 *= num13;
45333 int num17 = (int)(num11 * 1000f);
45334 int num14 = (int)(velocity.X * 1000f);
45335 int num15 = (int)(num12 * 1000f);
45336 int num16 = (int)(velocity.Y * 1000f);
45337 if (num17 != num14 || num15 != num16)
45338 {
45339 netUpdate = true;
45340 }
45341 if (type == 491)
45342 {
45343 Vector2 vector2 = default(Vector2);
45344 ((Vector2)(ref vector2))._002Ector(num11, num12);
45345 velocity = (velocity * 4f + vector2) / 5f;
45346 }
45347 else
45348 {
45349 velocity.X = num11;
45350 velocity.Y = num12;
45351 }
45352 }
45353 else
45354 {
45355 int num18 = (int)(num11 * 1000f);
45356 int num2 = (int)(velocity.X * 1000f);
45357 int num3 = (int)(num12 * 1000f);
45358 int num4 = (int)(velocity.Y * 1000f);
45359 if (num18 != num2 || num3 != num4)
45360 {
45361 netUpdate = true;
45362 }
45363 velocity.X = num11;
45364 velocity.Y = num12;
45365 }
45366 }
45367 else if (ai[0] <= 0f)
45368 {
45369 netUpdate = true;
45370 if (type != 491)
45371 {
45372 Vector2 vector3 = default(Vector2);
45373 ((Vector2)(ref vector3))._002Ector(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
45374 float num5 = (float)Main.mouseX + Main.screenPosition.X - vector3.X;
45375 float num6 = (float)Main.mouseY + Main.screenPosition.Y - vector3.Y;
45376 if (Main.player[owner].gravDir == -1f)
45377 {
45378 num6 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector3.Y;
45379 }
45380 float num7 = (float)Math.Sqrt(num5 * num5 + num6 * num6);
45381 if (num7 == 0f || ai[0] < 0f)
45382 {
45383 ((Vector2)(ref vector3))._002Ector(Main.player[owner].position.X + (float)(Main.player[owner].width / 2), Main.player[owner].position.Y + (float)(Main.player[owner].height / 2));
45384 num5 = position.X + (float)width * 0.5f - vector3.X;
45385 num6 = position.Y + (float)height * 0.5f - vector3.Y;
45386 num7 = (float)Math.Sqrt(num5 * num5 + num6 * num6);
45387 }
45388 num7 = 12f / num7;
45389 num5 *= num7;
45390 num6 *= num7;
45391 velocity.X = num5;
45392 velocity.Y = num6;
45393 if (velocity.X == 0f && velocity.Y == 0f)
45394 {
45395 Kill();
45396 }
45397 }
45398 ai[0] = 1f;
45399 }
45400 }
45401 bool flag = false;
45402 if (type == 491)
45403 {
45404 localAI[0] += 1f;
45405 if (ai[0] > 0f && localAI[0] > 15f)
45406 {
45407 tileCollide = false;
45408 Vector2 vector4 = Main.player[owner].Center - base.Center;
45409 if (((Vector2)(ref vector4)).Length() < 20f)
45410 {
45411 Kill();
45412 }
45413 ((Vector2)(ref vector4)).Normalize();
45414 vector4 *= 25f;
45415 velocity = (velocity * 5f + vector4) / 6f;
45416 }
45417 flag = true;
45418 if (ai[0] < 0f || (velocity.X == 0f && velocity.Y == 0f))
45419 {
45420 rotation += 0.3f;
45421 }
45422 else if (ai[0] > 0f)
45423 {
45424 rotation += 0.3f * (float)direction;
45425 }
45426 else
45427 {
45428 rotation = (float)Math.Atan2(velocity.Y, velocity.X) + 1.57f;
45429 }
45430 if (Vector2.Distance(base.Center, Main.player[owner].Center) > 2000f)
45431 {
45432 Kill();
45433 }
45434 if (Main.rand.Next(2) == 0)
45435 {
45436 int num19 = Main.rand.Next(3);
45437 int num8 = Dust.NewDust(position, width, height, num19 switch
45438 {
45439 0 => 15,
45440 1 => 57,
45441 _ => 58,
45442 }, velocity.X * 0.25f, velocity.Y * 0.25f, 255, default(Color), 0.7f);
45443 Dust obj = Main.dust[num8];
45444 obj.velocity *= 0.25f;
45445 Main.dust[num8].position = (Main.dust[num8].position + position) / 2f;
45446 }
45447 }
45448 if (type == 79)
45449 {
45450 if (soundDelay == 0 && Math.Abs(velocity.X) + Math.Abs(velocity.Y) > 2f)
45451 {
45452 soundDelay = 10;
45454 }
45455 for (int i = 0; i < 1; i++)
45456 {
45457 int num9 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 2.5f);
45458 Dust obj2 = Main.dust[num9];
45459 obj2.velocity *= 0.1f;
45460 Dust obj3 = Main.dust[num9];
45461 obj3.velocity += velocity * 0.2f;
45462 Main.dust[num9].position.X = position.X + (float)(width / 2) + 4f + (float)Main.rand.Next(-2, 3);
45463 Main.dust[num9].position.Y = position.Y + (float)(height / 2) + (float)Main.rand.Next(-2, 3);
45464 Main.dust[num9].noGravity = true;
45465 }
45466 }
45467 if (type == 16)
45468 {
45469 if (soundDelay == 0 && Math.Abs(velocity.X) + Math.Abs(velocity.Y) > 2f)
45470 {
45471 soundDelay = 10;
45473 }
45474 if (Main.rand.Next(9) == 0)
45475 {
45476 int num10 = Dust.NewDust(position, width, height, 15, 0f, 0f, 100, default(Color), 2f);
45477 Dust obj4 = Main.dust[num10];
45478 obj4.velocity *= 0.3f;
45479 Main.dust[num10].position.X = position.X + (float)(width / 2) + 4f + (float)Main.rand.Next(-4, 5);
45480 Main.dust[num10].position.Y = position.Y + (float)(height / 2) + (float)Main.rand.Next(-4, 5);
45481 Main.dust[num10].noGravity = true;
45482 Dust obj5 = Main.dust[num10];
45483 obj5.velocity += Main.rand.NextVector2Circular(2f, 2f);
45484 }
45485 flag = true;
45486 if (velocity != Vector2.Zero)
45487 {
45488 rotation = velocity.ToRotation();
45489 }
45490 }
45491 if (type == 34)
45492 {
45493 if (Main.rand.Next(12) == 0)
45494 {
45495 Dust dust = Dust.NewDustDirect(base.Center, 0, 0, 6, velocity.X * 0.2f, velocity.Y * 0.2f, 100, default(Color), 3.5f);
45496 dust.noGravity = true;
45497 dust.velocity *= 1.4f;
45498 dust.velocity += Main.rand.NextVector2Circular(1f, 1f);
45499 dust.velocity += velocity * 0.15f;
45500 }
45501 if (Main.rand.Next(24) == 0)
45502 {
45503 Dust dust2 = Dust.NewDustDirect(base.Center, 0, 0, 6, velocity.X * 0.2f, velocity.Y * 0.2f, 100, default(Color), 1.5f);
45504 dust2.velocity += Main.rand.NextVector2Circular(1f, 1f);
45505 dust2.velocity += velocity * 0.15f;
45506 }
45507 flag = true;
45508 if (velocity != Vector2.Zero)
45509 {
45510 rotation = velocity.ToRotation();
45511 }
45512 }
45513 if (!flag && velocity != Vector2.Zero)
45514 {
45515 rotation = velocity.ToRotation() - (float)Math.PI + (float)Math.PI / 4f;
45516 }
45517 if (velocity.Y > 16f)
45518 {
45519 velocity.Y = 16f;
45520 }
45521 }
static SlotId PlaySound(in SoundStyle? style, Vector2? position=null, SoundUpdateCallback? updateCallback=null)
Attempts to play a sound style with the provided sound style (if it's not null), and returns a valid ...
Vector2 velocity
The velocity of this Entity in world coordinates per tick.
Definition Entity.cs:33
Vector2 position
The position of this Entity in world coordinates.
Definition Entity.cs:28
int width
The width of this Entity's hitbox, in pixels.
Definition Entity.cs:46
int height
The height of this Entity's hitbox, in pixels.
Definition Entity.cs:51
static readonly SoundStyle Item9
Definition SoundID.cs:695
int owner
The index of the player who owns this projectile. In Multiplayer, Clients "own" projectiles that they...
float[] ai
An array with 3 slots used for any sort of data storage, which is occasionally synced to the server....
bool netUpdate
Set manually to true in M:Terraria.ModLoader.ModProjectile.AI once to make it sync its current F:Terr...
float[] localAI
Acts like F:Terraria.Projectile.ai, but does not sync to the server. Many vanilla T:Terraria....
int type
The Projectile ID of this projectile. The Projectile ID is a unique number assigned to each Projectil...
bool tileCollide
If true, the projectile will collide with tiles, usually bouncing or killing the tile depending on M:...
float rotation
Rotation of the projectile. Radians not Degrees. Use T:Microsoft.Xna.Framework.MathHelper if you want...

References Terraria.Main.DiscoB, Terraria.Main.DiscoG, Terraria.Main.DiscoR, Terraria.Main.dust, Terraria.ID.SoundID.Item9, Terraria.Main.MouseWorld, Terraria.Main.mouseX, Terraria.Main.mouseY, Terraria.Main.myPlayer, Terraria.Dust.NewDust(), Terraria.Dust.NewDustDirect(), Terraria.Main.player, Terraria.Audio.SoundEngine.PlaySound(), Terraria.Main.rand, Terraria.Main.screenHeight, and Terraria.Main.screenPosition.

+ Here is the call graph for this function: