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

◆ AI_121_StardustDragon()

void Terraria.Projectile.AI_121_StardustDragon ( )
inlineprivate

Definition at line 44267 of file Projectile.cs.

44268 {
44269 //IL_062c: Unknown result type (might be due to invalid IL or missing references)
44270 //IL_0631: Unknown result type (might be due to invalid IL or missing references)
44271 //IL_0633: Unknown result type (might be due to invalid IL or missing references)
44272 //IL_0156: Unknown result type (might be due to invalid IL or missing references)
44273 //IL_015b: Unknown result type (might be due to invalid IL or missing references)
44274 //IL_016f: Unknown result type (might be due to invalid IL or missing references)
44275 //IL_017e: Unknown result type (might be due to invalid IL or missing references)
44276 //IL_00b0: Unknown result type (might be due to invalid IL or missing references)
44277 //IL_00d3: Unknown result type (might be due to invalid IL or missing references)
44278 //IL_00d9: Unknown result type (might be due to invalid IL or missing references)
44279 //IL_010b: Unknown result type (might be due to invalid IL or missing references)
44280 //IL_0110: Unknown result type (might be due to invalid IL or missing references)
44281 //IL_0115: Unknown result type (might be due to invalid IL or missing references)
44282 //IL_0117: Unknown result type (might be due to invalid IL or missing references)
44283 //IL_011e: Unknown result type (might be due to invalid IL or missing references)
44284 //IL_01a6: Unknown result type (might be due to invalid IL or missing references)
44285 //IL_012d: Unknown result type (might be due to invalid IL or missing references)
44286 //IL_0134: Unknown result type (might be due to invalid IL or missing references)
44287 //IL_0368: Unknown result type (might be due to invalid IL or missing references)
44288 //IL_036b: Unknown result type (might be due to invalid IL or missing references)
44289 //IL_0370: Unknown result type (might be due to invalid IL or missing references)
44290 //IL_0375: Unknown result type (might be due to invalid IL or missing references)
44291 //IL_024e: Unknown result type (might be due to invalid IL or missing references)
44292 //IL_0254: Unknown result type (might be due to invalid IL or missing references)
44293 //IL_0259: Unknown result type (might be due to invalid IL or missing references)
44294 //IL_025e: Unknown result type (might be due to invalid IL or missing references)
44295 //IL_0260: Unknown result type (might be due to invalid IL or missing references)
44296 //IL_0274: Unknown result type (might be due to invalid IL or missing references)
44297 //IL_08a5: Unknown result type (might be due to invalid IL or missing references)
44298 //IL_08aa: Unknown result type (might be due to invalid IL or missing references)
44299 //IL_08af: Unknown result type (might be due to invalid IL or missing references)
44300 //IL_08b2: Unknown result type (might be due to invalid IL or missing references)
44301 //IL_08b7: Unknown result type (might be due to invalid IL or missing references)
44302 //IL_08bc: Unknown result type (might be due to invalid IL or missing references)
44303 //IL_06e6: Unknown result type (might be due to invalid IL or missing references)
44304 //IL_06eb: Unknown result type (might be due to invalid IL or missing references)
44305 //IL_06ef: Unknown result type (might be due to invalid IL or missing references)
44306 //IL_08f5: Unknown result type (might be due to invalid IL or missing references)
44307 //IL_0909: Unknown result type (might be due to invalid IL or missing references)
44308 //IL_090e: Unknown result type (might be due to invalid IL or missing references)
44309 //IL_0938: Unknown result type (might be due to invalid IL or missing references)
44310 //IL_0942: Unknown result type (might be due to invalid IL or missing references)
44311 //IL_0944: Unknown result type (might be due to invalid IL or missing references)
44312 //IL_08d8: Unknown result type (might be due to invalid IL or missing references)
44313 //IL_08e5: Unknown result type (might be due to invalid IL or missing references)
44314 //IL_08eb: Unknown result type (might be due to invalid IL or missing references)
44315 //IL_08ed: Unknown result type (might be due to invalid IL or missing references)
44316 //IL_08f2: Unknown result type (might be due to invalid IL or missing references)
44317 //IL_0826: Unknown result type (might be due to invalid IL or missing references)
44318 //IL_084a: Unknown result type (might be due to invalid IL or missing references)
44319 //IL_0850: Unknown result type (might be due to invalid IL or missing references)
44320 //IL_02c2: Unknown result type (might be due to invalid IL or missing references)
44321 //IL_02c7: Unknown result type (might be due to invalid IL or missing references)
44322 //IL_0200: Unknown result type (might be due to invalid IL or missing references)
44323 //IL_0973: Unknown result type (might be due to invalid IL or missing references)
44324 //IL_0951: Unknown result type (might be due to invalid IL or missing references)
44325 //IL_0953: Unknown result type (might be due to invalid IL or missing references)
44326 //IL_0955: Unknown result type (might be due to invalid IL or missing references)
44327 //IL_095c: Unknown result type (might be due to invalid IL or missing references)
44328 //IL_0963: Unknown result type (might be due to invalid IL or missing references)
44329 //IL_0968: Unknown result type (might be due to invalid IL or missing references)
44330 //IL_03b2: Unknown result type (might be due to invalid IL or missing references)
44331 //IL_03ba: Unknown result type (might be due to invalid IL or missing references)
44332 //IL_02da: Unknown result type (might be due to invalid IL or missing references)
44333 //IL_02df: Unknown result type (might be due to invalid IL or missing references)
44334 //IL_02e1: Unknown result type (might be due to invalid IL or missing references)
44335 //IL_02e8: Unknown result type (might be due to invalid IL or missing references)
44336 //IL_02f2: Unknown result type (might be due to invalid IL or missing references)
44337 //IL_02f7: Unknown result type (might be due to invalid IL or missing references)
44338 //IL_02fc: Unknown result type (might be due to invalid IL or missing references)
44339 //IL_0302: Unknown result type (might be due to invalid IL or missing references)
44340 //IL_0307: Unknown result type (might be due to invalid IL or missing references)
44341 //IL_0211: Unknown result type (might be due to invalid IL or missing references)
44342 //IL_045c: Unknown result type (might be due to invalid IL or missing references)
44343 //IL_0466: Unknown result type (might be due to invalid IL or missing references)
44344 //IL_046b: Unknown result type (might be due to invalid IL or missing references)
44345 //IL_03fc: Unknown result type (might be due to invalid IL or missing references)
44346 //IL_0404: Unknown result type (might be due to invalid IL or missing references)
44347 //IL_03e0: Unknown result type (might be due to invalid IL or missing references)
44348 //IL_03e8: Unknown result type (might be due to invalid IL or missing references)
44349 //IL_04cb: Unknown result type (might be due to invalid IL or missing references)
44350 //IL_0346: Unknown result type (might be due to invalid IL or missing references)
44351 //IL_034b: Unknown result type (might be due to invalid IL or missing references)
44352 //IL_0352: Unknown result type (might be due to invalid IL or missing references)
44353 //IL_0357: Unknown result type (might be due to invalid IL or missing references)
44354 //IL_0317: Unknown result type (might be due to invalid IL or missing references)
44355 //IL_0321: Unknown result type (might be due to invalid IL or missing references)
44356 //IL_0326: Unknown result type (might be due to invalid IL or missing references)
44357 //IL_042a: Unknown result type (might be due to invalid IL or missing references)
44358 //IL_0432: Unknown result type (might be due to invalid IL or missing references)
44359 //IL_04b3: Unknown result type (might be due to invalid IL or missing references)
44360 //IL_04b8: Unknown result type (might be due to invalid IL or missing references)
44361 //IL_04bf: Unknown result type (might be due to invalid IL or missing references)
44362 //IL_04c4: Unknown result type (might be due to invalid IL or missing references)
44363 //IL_0537: Unknown result type (might be due to invalid IL or missing references)
44364 //IL_053c: Unknown result type (might be due to invalid IL or missing references)
44365 //IL_0572: Unknown result type (might be due to invalid IL or missing references)
44366 //IL_05a3: Unknown result type (might be due to invalid IL or missing references)
44367 //IL_05c7: Unknown result type (might be due to invalid IL or missing references)
44368 //IL_05cd: Unknown result type (might be due to invalid IL or missing references)
44369 Player player = Main.player[owner];
44370 if ((int)Main.timeForVisualEffects % 120 == 0)
44371 {
44372 netUpdate = true;
44373 }
44374 if (!player.active)
44375 {
44376 active = false;
44377 return;
44378 }
44379 bool num26 = type == 625;
44380 bool flag = type == 625 || type == 626 || type == 627 || type == 628;
44381 int num19 = 10;
44382 if (flag)
44383 {
44384 if (player.dead)
44385 {
44386 player.stardustDragon = false;
44387 }
44388 if (player.stardustDragon)
44389 {
44390 timeLeft = 2;
44391 }
44392 num19 = 30;
44393 if (Main.rand.Next(30) == 0)
44394 {
44395 int num21 = Dust.NewDust(position, width, height, 135, 0f, 0f, 0, default(Color), 2f);
44396 Main.dust[num21].noGravity = true;
44397 Main.dust[num21].fadeIn = 2f;
44398 Point point = Main.dust[num21].position.ToTileCoordinates();
44399 if (WorldGen.InWorld(point.X, point.Y, 5) && WorldGen.SolidTile(point.X, point.Y))
44400 {
44401 Main.dust[num21].noLight = true;
44402 }
44403 }
44404 }
44405 Vector2 center2;
44406 if (num26)
44407 {
44408 Vector2 center = player.Center;
44409 float num22 = 700f;
44410 float num23 = 1000f;
44411 int num24 = -1;
44412 if (Distance(center) > 2000f)
44413 {
44414 base.Center = center;
44415 netUpdate = true;
44416 }
44418 if (ownerMinionAttackTargetNPC != null && ownerMinionAttackTargetNPC.CanBeChasedBy(this) && Distance(ownerMinionAttackTargetNPC.Center) < num22 * 2f)
44419 {
44422 {
44424 }
44425 else
44426 {
44428 }
44429 }
44430 if (num24 < 0)
44431 {
44432 for (int i = 0; i < 200; i++)
44433 {
44434 NPC nPC = Main.npc[i];
44435 if (nPC.CanBeChasedBy(this) && player.Distance(nPC.Center) < num23 && Distance(nPC.Center) < num22)
44436 {
44437 num24 = i;
44438 _ = nPC.boss;
44439 }
44440 }
44441 }
44442 if (num24 != -1)
44443 {
44444 NPC nPC2 = Main.npc[num24];
44445 Vector2 vector = nPC2.Center - base.Center;
44446 (vector.X > 0f).ToDirectionInt();
44447 (vector.Y > 0f).ToDirectionInt();
44448 float num25 = 0.4f;
44449 if (((Vector2)(ref vector)).Length() < 600f)
44450 {
44451 num25 = 0.6f;
44452 }
44453 if (((Vector2)(ref vector)).Length() < 300f)
44454 {
44455 num25 = 0.8f;
44456 }
44457 float num27 = ((Vector2)(ref vector)).Length();
44458 center2 = nPC2.Size;
44459 if (num27 > ((Vector2)(ref center2)).Length() * 0.75f)
44460 {
44461 velocity += Vector2.Normalize(vector) * num25 * 1.5f;
44462 if (Vector2.Dot(velocity, vector) < 0.25f)
44463 {
44464 velocity *= 0.8f;
44465 }
44466 }
44467 float num10 = 30f;
44468 if (((Vector2)(ref velocity)).Length() > num10)
44469 {
44470 velocity = Vector2.Normalize(velocity) * num10;
44471 }
44472 }
44473 else
44474 {
44475 float num11 = 0.2f;
44476 Vector2 vector2 = center - base.Center;
44477 if (((Vector2)(ref vector2)).Length() < 200f)
44478 {
44479 num11 = 0.12f;
44480 }
44481 if (((Vector2)(ref vector2)).Length() < 140f)
44482 {
44483 num11 = 0.06f;
44484 }
44485 if (((Vector2)(ref vector2)).Length() > 100f)
44486 {
44487 if (Math.Abs(center.X - base.Center.X) > 20f)
44488 {
44489 velocity.X += num11 * (float)Math.Sign(center.X - base.Center.X);
44490 }
44491 if (Math.Abs(center.Y - base.Center.Y) > 10f)
44492 {
44493 velocity.Y += num11 * (float)Math.Sign(center.Y - base.Center.Y);
44494 }
44495 }
44496 else if (((Vector2)(ref velocity)).Length() > 2f)
44497 {
44498 velocity *= 0.96f;
44499 }
44500 if (Math.Abs(velocity.Y) < 1f)
44501 {
44502 velocity.Y -= 0.1f;
44503 }
44504 float num12 = 15f;
44505 if (((Vector2)(ref velocity)).Length() > num12)
44506 {
44507 velocity = Vector2.Normalize(velocity) * num12;
44508 }
44509 }
44510 rotation = velocity.ToRotation() + (float)Math.PI / 2f;
44511 int num28 = direction;
44512 direction = (spriteDirection = ((velocity.X > 0f) ? 1 : (-1)));
44513 if (num28 != direction)
44514 {
44515 netUpdate = true;
44516 }
44517 float num13 = MathHelper.Clamp(localAI[0], 0f, 50f);
44518 position = base.Center;
44519 scale = 1f + num13 * 0.01f;
44520 width = (height = (int)((float)num19 * scale));
44521 base.Center = position;
44522 if (alpha > 0)
44523 {
44524 for (int j = 0; j < 2; j++)
44525 {
44526 int num14 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 135, 0f, 0f, 100, default(Color), 2f);
44527 Main.dust[num14].noGravity = true;
44528 Main.dust[num14].noLight = true;
44529 }
44530 alpha -= 42;
44531 if (alpha < 0)
44532 {
44533 alpha = 0;
44534 }
44535 }
44536 }
44537 else
44538 {
44539 bool flag2 = false;
44540 Vector2 vector3 = Vector2.Zero;
44541 _ = Vector2.Zero;
44542 float num15 = 0f;
44543 float num16 = 0f;
44544 float num17 = 1f;
44545 if (ai[1] == 1f)
44546 {
44547 ai[1] = 0f;
44548 netUpdate = true;
44549 }
44550 int byUUID = GetByUUID(owner, (int)ai[0]);
44551 if (Main.projectile.IndexInRange(byUUID))
44552 {
44553 Projectile projectile = Main.projectile[byUUID];
44554 if (flag && projectile.active && (projectile.type == 625 || projectile.type == 626 || projectile.type == 627))
44555 {
44556 flag2 = true;
44557 vector3 = projectile.Center;
44558 _ = projectile.velocity;
44559 num15 = projectile.rotation;
44560 num17 = MathHelper.Clamp(projectile.scale, 0f, 50f);
44561 num16 = 16f;
44562 _ = projectile.alpha;
44563 projectile.localAI[0] = localAI[0] + 1f;
44564 if (projectile.type != 625)
44565 {
44566 projectile.localAI[1] = whoAmI;
44567 }
44568 if (owner == Main.myPlayer && type == 628 && projectile.type == 625)
44569 {
44570 projectile.Kill();
44571 Kill();
44572 return;
44573 }
44574 }
44575 }
44576 if (!flag2)
44577 {
44578 for (int k = 0; k < 1000; k++)
44579 {
44580 Projectile projectile2 = Main.projectile[k];
44581 if (projectile2.active && projectile2.owner == owner && ProjectileID.Sets.StardustDragon[projectile2.type] && projectile2.localAI[1] == ai[0])
44582 {
44583 ai[0] = projectile2.projUUID;
44584 projectile2.localAI[1] = whoAmI;
44585 netUpdate = true;
44586 }
44587 }
44588 return;
44589 }
44590 if (alpha > 0)
44591 {
44592 for (int l = 0; l < 2; l++)
44593 {
44594 int num18 = Dust.NewDust(position, width, height, 135, 0f, 0f, 100, default(Color), 2f);
44595 Main.dust[num18].noGravity = true;
44596 Main.dust[num18].noLight = true;
44597 }
44598 }
44599 alpha -= 42;
44600 if (alpha < 0)
44601 {
44602 alpha = 0;
44603 }
44604 velocity = Vector2.Zero;
44605 Vector2 vector4 = vector3 - base.Center;
44606 if (num15 != rotation)
44607 {
44608 float num20 = MathHelper.WrapAngle(num15 - rotation);
44609 Vector2 spinningpoint = vector4;
44610 double radians = num20 * 0.1f;
44611 center2 = default(Vector2);
44612 vector4 = spinningpoint.RotatedBy(radians, center2);
44613 }
44614 rotation = vector4.ToRotation() + (float)Math.PI / 2f;
44615 position = base.Center;
44616 scale = num17;
44617 width = (height = (int)((float)num19 * scale));
44618 base.Center = position;
44619 if (vector4 != Vector2.Zero)
44620 {
44621 base.Center = vector3 - Vector2.Normalize(vector4) * num16 * num17;
44622 }
44623 spriteDirection = ((vector4.X > 0f) ? 1 : (-1));
44624 }
44625 position.X = MathHelper.Clamp(position.X, 160f, (float)(Main.maxTilesX * 16 - 160));
44626 position.Y = MathHelper.Clamp(position.Y, 160f, (float)(Main.maxTilesY * 16 - 160));
44627 }
int whoAmI
The index of this Entity within its specific array. These arrays track the entities in the world....
Definition Entity.cs:16
Vector2 velocity
The velocity of this Entity in world coordinates per tick.
Definition Entity.cs:33
float Distance(Vector2 Other)
Definition Entity.cs:275
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
bool active
If true, the Entity actually exists within the game world. Within the specific entity array,...
Definition Entity.cs:21
int height
The height of this Entity's hitbox, in pixels.
Definition Entity.cs:51
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...
int alpha
How transparent to draw this projectile. 0 to 255. 255 is completely transparent. ExampleBulletsets...
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...
int timeLeft
Time in ticks before this projectile will naturally despawn. Each update timeLeft is decreased by 1...
float rotation
Rotation of the projectile. Radians not Degrees. Use T:Microsoft.Xna.Framework.MathHelper if you want...
static int GetByUUID(int owner, float uuid)
float scale
Scales how large the projectile will be drawn. Will also affect the hitbox (F:Terraria....

References Terraria.Entity.active, Terraria.Projectile.alpha, Terraria.Entity.Center, Terraria.Player.dead, Terraria.Entity.Distance(), Terraria.Main.dust, Terraria.WorldGen.InWorld(), Terraria.Projectile.Kill(), Terraria.Projectile.localAI, Terraria.Main.myPlayer, Terraria.Dust.NewDust(), Terraria.Main.npc, Terraria.Main.player, Terraria.Main.projectile, Terraria.Main.rand, Terraria.Projectile.rotation, Terraria.Projectile.scale, Terraria.WorldGen.SolidTile(), Terraria.ID.ProjectileID.Sets.StardustDragon, Terraria.Player.stardustDragon, Terraria.Main.timeForVisualEffects, Terraria.Projectile.type, and Terraria.Entity.velocity.

+ Here is the call graph for this function: