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

◆ AI_099_2()

void Terraria.Projectile.AI_099_2 ( )
inlineprivate

Definition at line 74423 of file Projectile.cs.

74424 {
74425 //IL_014a: Unknown result type (might be due to invalid IL or missing references)
74426 //IL_014f: Unknown result type (might be due to invalid IL or missing references)
74427 //IL_017d: Unknown result type (might be due to invalid IL or missing references)
74428 //IL_0194: Unknown result type (might be due to invalid IL or missing references)
74429 //IL_0199: Unknown result type (might be due to invalid IL or missing references)
74430 //IL_0469: Unknown result type (might be due to invalid IL or missing references)
74431 //IL_01b6: Unknown result type (might be due to invalid IL or missing references)
74432 //IL_01bd: Unknown result type (might be due to invalid IL or missing references)
74433 //IL_01c2: Unknown result type (might be due to invalid IL or missing references)
74434 //IL_01c4: Unknown result type (might be due to invalid IL or missing references)
74435 //IL_01c6: Unknown result type (might be due to invalid IL or missing references)
74436 //IL_01c8: Unknown result type (might be due to invalid IL or missing references)
74437 //IL_01cd: Unknown result type (might be due to invalid IL or missing references)
74438 //IL_01a8: Unknown result type (might be due to invalid IL or missing references)
74439 //IL_01af: Unknown result type (might be due to invalid IL or missing references)
74440 //IL_01b4: Unknown result type (might be due to invalid IL or missing references)
74441 //IL_0304: Unknown result type (might be due to invalid IL or missing references)
74442 //IL_030b: Unknown result type (might be due to invalid IL or missing references)
74443 //IL_0310: Unknown result type (might be due to invalid IL or missing references)
74444 //IL_0319: Unknown result type (might be due to invalid IL or missing references)
74445 //IL_0323: Unknown result type (might be due to invalid IL or missing references)
74446 //IL_032c: Unknown result type (might be due to invalid IL or missing references)
74447 //IL_0336: Unknown result type (might be due to invalid IL or missing references)
74448 //IL_033e: Unknown result type (might be due to invalid IL or missing references)
74449 //IL_0345: Unknown result type (might be due to invalid IL or missing references)
74450 //IL_04d5: Unknown result type (might be due to invalid IL or missing references)
74451 //IL_04f4: Unknown result type (might be due to invalid IL or missing references)
74452 //IL_04fa: Unknown result type (might be due to invalid IL or missing references)
74453 //IL_0533: Unknown result type (might be due to invalid IL or missing references)
74454 //IL_0552: Unknown result type (might be due to invalid IL or missing references)
74455 //IL_0558: Unknown result type (might be due to invalid IL or missing references)
74456 //IL_0279: Unknown result type (might be due to invalid IL or missing references)
74457 //IL_0292: Unknown result type (might be due to invalid IL or missing references)
74458 //IL_02ce: Unknown result type (might be due to invalid IL or missing references)
74459 //IL_02d1: Unknown result type (might be due to invalid IL or missing references)
74460 //IL_02d6: Unknown result type (might be due to invalid IL or missing references)
74461 //IL_02db: Unknown result type (might be due to invalid IL or missing references)
74462 //IL_02e4: Unknown result type (might be due to invalid IL or missing references)
74463 //IL_02eb: Unknown result type (might be due to invalid IL or missing references)
74464 //IL_02f0: Unknown result type (might be due to invalid IL or missing references)
74465 //IL_0b72: Unknown result type (might be due to invalid IL or missing references)
74466 //IL_0b78: Unknown result type (might be due to invalid IL or missing references)
74467 //IL_0b7d: Unknown result type (might be due to invalid IL or missing references)
74468 //IL_0b82: Unknown result type (might be due to invalid IL or missing references)
74469 //IL_0685: Unknown result type (might be due to invalid IL or missing references)
74470 //IL_068b: Unknown result type (might be due to invalid IL or missing references)
74471 //IL_0690: Unknown result type (might be due to invalid IL or missing references)
74472 //IL_0695: Unknown result type (might be due to invalid IL or missing references)
74473 //IL_065f: Unknown result type (might be due to invalid IL or missing references)
74474 //IL_0669: Unknown result type (might be due to invalid IL or missing references)
74475 //IL_066e: Unknown result type (might be due to invalid IL or missing references)
74476 //IL_0bb9: Unknown result type (might be due to invalid IL or missing references)
74477 //IL_0bbc: Unknown result type (might be due to invalid IL or missing references)
74478 //IL_0bc1: Unknown result type (might be due to invalid IL or missing references)
74479 //IL_0bc5: Unknown result type (might be due to invalid IL or missing references)
74480 //IL_0bd1: Unknown result type (might be due to invalid IL or missing references)
74481 //IL_0bd6: Unknown result type (might be due to invalid IL or missing references)
74482 //IL_0bd8: Unknown result type (might be due to invalid IL or missing references)
74483 //IL_0bde: Unknown result type (might be due to invalid IL or missing references)
74484 //IL_0be3: Unknown result type (might be due to invalid IL or missing references)
74485 //IL_09e9: Unknown result type (might be due to invalid IL or missing references)
74486 //IL_09ef: Unknown result type (might be due to invalid IL or missing references)
74487 //IL_09f4: Unknown result type (might be due to invalid IL or missing references)
74488 //IL_09f9: Unknown result type (might be due to invalid IL or missing references)
74489 //IL_08b6: Unknown result type (might be due to invalid IL or missing references)
74490 //IL_08cc: Unknown result type (might be due to invalid IL or missing references)
74491 //IL_072e: Unknown result type (might be due to invalid IL or missing references)
74492 //IL_0738: Unknown result type (might be due to invalid IL or missing references)
74493 //IL_073d: Unknown result type (might be due to invalid IL or missing references)
74494 //IL_0742: Unknown result type (might be due to invalid IL or missing references)
74495 //IL_0747: Unknown result type (might be due to invalid IL or missing references)
74496 //IL_075a: Unknown result type (might be due to invalid IL or missing references)
74497 //IL_076b: Unknown result type (might be due to invalid IL or missing references)
74498 //IL_0770: Unknown result type (might be due to invalid IL or missing references)
74499 //IL_0775: Unknown result type (might be due to invalid IL or missing references)
74500 //IL_08ff: Unknown result type (might be due to invalid IL or missing references)
74501 //IL_0915: Unknown result type (might be due to invalid IL or missing references)
74502 //IL_0789: Unknown result type (might be due to invalid IL or missing references)
74503 //IL_078d: Unknown result type (might be due to invalid IL or missing references)
74504 //IL_0792: Unknown result type (might be due to invalid IL or missing references)
74505 //IL_07a0: Unknown result type (might be due to invalid IL or missing references)
74506 //IL_07a5: Unknown result type (might be due to invalid IL or missing references)
74507 //IL_07a7: Unknown result type (might be due to invalid IL or missing references)
74508 //IL_07ac: Unknown result type (might be due to invalid IL or missing references)
74509 //IL_07ae: Unknown result type (might be due to invalid IL or missing references)
74510 //IL_07b7: Unknown result type (might be due to invalid IL or missing references)
74511 //IL_0948: Unknown result type (might be due to invalid IL or missing references)
74512 //IL_095e: Unknown result type (might be due to invalid IL or missing references)
74513 //IL_07df: Unknown result type (might be due to invalid IL or missing references)
74514 //IL_07f0: Unknown result type (might be due to invalid IL or missing references)
74515 //IL_07f5: Unknown result type (might be due to invalid IL or missing references)
74516 //IL_07fa: Unknown result type (might be due to invalid IL or missing references)
74517 //IL_0ae2: Unknown result type (might be due to invalid IL or missing references)
74518 //IL_0aec: Unknown result type (might be due to invalid IL or missing references)
74519 //IL_0af1: Unknown result type (might be due to invalid IL or missing references)
74520 //IL_0a4b: Unknown result type (might be due to invalid IL or missing references)
74521 //IL_0a4f: Unknown result type (might be due to invalid IL or missing references)
74522 //IL_0a54: Unknown result type (might be due to invalid IL or missing references)
74523 //IL_0a58: Unknown result type (might be due to invalid IL or missing references)
74524 //IL_0a64: Unknown result type (might be due to invalid IL or missing references)
74525 //IL_0a69: Unknown result type (might be due to invalid IL or missing references)
74526 //IL_0a6b: Unknown result type (might be due to invalid IL or missing references)
74527 //IL_0a71: Unknown result type (might be due to invalid IL or missing references)
74528 //IL_0a76: Unknown result type (might be due to invalid IL or missing references)
74529 //IL_0991: Unknown result type (might be due to invalid IL or missing references)
74530 //IL_09a7: Unknown result type (might be due to invalid IL or missing references)
74531 //IL_0814: Unknown result type (might be due to invalid IL or missing references)
74532 //IL_081e: Unknown result type (might be due to invalid IL or missing references)
74533 //IL_0823: Unknown result type (might be due to invalid IL or missing references)
74534 //IL_0831: Unknown result type (might be due to invalid IL or missing references)
74535 //IL_0836: Unknown result type (might be due to invalid IL or missing references)
74536 //IL_0838: Unknown result type (might be due to invalid IL or missing references)
74537 //IL_083d: Unknown result type (might be due to invalid IL or missing references)
74538 //IL_0a9b: Unknown result type (might be due to invalid IL or missing references)
74539 //IL_0aa0: Unknown result type (might be due to invalid IL or missing references)
74540 //IL_0aa9: Unknown result type (might be due to invalid IL or missing references)
74541 //IL_0ab2: Unknown result type (might be due to invalid IL or missing references)
74542 //IL_0ab7: Unknown result type (might be due to invalid IL or missing references)
74543 //IL_0abb: Unknown result type (might be due to invalid IL or missing references)
74544 //IL_0ac7: Unknown result type (might be due to invalid IL or missing references)
74545 //IL_0acc: Unknown result type (might be due to invalid IL or missing references)
74546 //IL_0ace: Unknown result type (might be due to invalid IL or missing references)
74547 //IL_0ad4: Unknown result type (might be due to invalid IL or missing references)
74548 //IL_0ad9: Unknown result type (might be due to invalid IL or missing references)
74549 //IL_0b2d: Unknown result type (might be due to invalid IL or missing references)
74550 //IL_0b39: Unknown result type (might be due to invalid IL or missing references)
74551 //IL_0b3e: Unknown result type (might be due to invalid IL or missing references)
74552 bool flag = false;
74553 for (int i = 0; i < whoAmI; i++)
74554 {
74555 if (Main.projectile[i].active && Main.projectile[i].owner == owner && Main.projectile[i].type == type)
74556 {
74557 flag = true;
74558 }
74559 }
74560 if (owner == Main.myPlayer)
74561 {
74562 localAI[0] += 1f;
74563 if (flag)
74564 {
74565 localAI[0] += (float)Main.rand.Next(10, 31) * 0.1f;
74566 }
74567 float num = localAI[0] / 60f;
74568 num /= (1f + Main.player[owner].inverseMeleeSpeed) / 2f;
74570 if (num8 != -1f && num > num8)
74571 {
74572 ai[0] = -1f;
74573 }
74574 }
74575 if (type == 603 && owner == Main.myPlayer)
74576 {
74577 localAI[1] += 1f;
74578 if (localAI[1] >= 6f)
74579 {
74580 float num9 = 400f;
74581 Vector2 vector = velocity;
74582 Vector2 vector2 = default(Vector2);
74583 ((Vector2)(ref vector2))._002Ector((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101));
74584 ((Vector2)(ref vector2)).Normalize();
74585 vector2 *= (float)Main.rand.Next(10, 41) * 0.1f;
74586 if (Main.rand.Next(3) == 0)
74587 {
74588 vector2 *= 2f;
74589 }
74590 vector *= 0.25f;
74591 vector += vector2;
74592 for (int j = 0; j < 200; j++)
74593 {
74594 if (Main.npc[j].CanBeChasedBy(this))
74595 {
74596 float num10 = Main.npc[j].position.X + (float)(Main.npc[j].width / 2);
74597 float num11 = Main.npc[j].position.Y + (float)(Main.npc[j].height / 2);
74598 float num12 = Math.Abs(position.X + (float)(width / 2) - num10) + Math.Abs(position.Y + (float)(height / 2) - num11);
74599 if (num12 < num9 && Collision.CanHit(position, width, height, Main.npc[j].position, Main.npc[j].width, Main.npc[j].height))
74600 {
74601 num9 = num12;
74602 vector.X = num10;
74603 vector.Y = num11;
74604 vector -= base.Center;
74605 ((Vector2)(ref vector)).Normalize();
74606 vector *= 8f;
74607 }
74608 }
74609 }
74610 vector *= 0.8f;
74611 NewProjectile(GetProjectileSource_FromThis(), base.Center.X - vector.X, base.Center.Y - vector.Y, vector.X, vector.Y, 604, damage, knockBack, owner);
74612 localAI[1] = 0f;
74613 }
74614 }
74615 bool flag2 = false;
74616 if (type >= 556 && type <= 561)
74617 {
74618 flag2 = true;
74619 }
74620 if (Main.player[owner].dead)
74621 {
74622 Kill();
74623 return;
74624 }
74625 if (!flag2 && !flag)
74626 {
74627 Main.player[owner].heldProj = whoAmI;
74628 Main.player[owner].SetDummyItemTime(2);
74629 if (position.X + (float)(width / 2) > Main.player[owner].position.X + (float)(Main.player[owner].width / 2))
74630 {
74631 Main.player[owner].ChangeDir(1);
74632 direction = 1;
74633 }
74634 else
74635 {
74636 Main.player[owner].ChangeDir(-1);
74637 direction = -1;
74638 }
74639 }
74640 if (velocity.HasNaNs())
74641 {
74642 Kill();
74643 }
74644 timeLeft = 6;
74645 float num13 = 10f;
74646 float num14 = 10f;
74647 float num15 = 3f;
74648 float num2 = 200f;
74651 if (type == 545)
74652 {
74653 if (Main.rand.Next(6) == 0)
74654 {
74655 int num3 = Dust.NewDust(position, width, height, 6);
74656 Main.dust[num3].noGravity = true;
74657 }
74658 }
74659 else if (type == 553 && Main.rand.Next(2) == 0)
74660 {
74661 int num4 = Dust.NewDust(position, width, height, 6);
74662 Main.dust[num4].noGravity = true;
74663 Main.dust[num4].scale = 1.6f;
74664 }
74665 if (Main.player[owner].yoyoString)
74666 {
74667 num2 = num2 * 1.25f + 30f;
74668 }
74669 num2 /= (1f + Main.player[owner].inverseMeleeSpeed * 3f) / 4f;
74670 num14 /= (1f + Main.player[owner].inverseMeleeSpeed * 3f) / 4f;
74671 num13 = 14f - num14 / 2f;
74672 if (num13 < 1f)
74673 {
74674 num13 = 1f;
74675 }
74676 if (num13 < 1.01f)
74677 {
74678 num13 = 1.01f;
74679 }
74680 num15 = 5f + num14 / 2f;
74681 if (flag)
74682 {
74683 num15 += 20f;
74684 }
74685 if (ai[0] >= 0f)
74686 {
74687 if (((Vector2)(ref velocity)).Length() > num14)
74688 {
74689 velocity *= 0.98f;
74690 }
74691 bool flag3 = false;
74692 bool flag4 = false;
74693 Vector2 vector3 = Main.player[owner].Center - base.Center;
74694 if (((Vector2)(ref vector3)).Length() > num2)
74695 {
74696 flag3 = true;
74697 if ((double)((Vector2)(ref vector3)).Length() > (double)num2 * 1.3)
74698 {
74699 flag4 = true;
74700 }
74701 }
74702 if (owner == Main.myPlayer)
74703 {
74704 if (!Main.player[owner].channel || Main.player[owner].stoned || Main.player[owner].frozen)
74705 {
74706 ai[0] = -1f;
74707 ai[1] = 0f;
74708 netUpdate = true;
74709 }
74710 else
74711 {
74712 Vector2 val = Main.ReverseGravitySupport(Main.MouseScreen) + Main.screenPosition;
74713 float x = val.X;
74714 float y = val.Y;
74715 Vector2 vector4 = new Vector2(x, y) - Main.player[owner].Center;
74716 if (((Vector2)(ref vector4)).Length() > num2)
74717 {
74718 ((Vector2)(ref vector4)).Normalize();
74719 vector4 *= num2;
74720 vector4 = Main.player[owner].Center + vector4;
74721 x = vector4.X;
74722 y = vector4.Y;
74723 }
74724 if (ai[0] != x || ai[1] != y)
74725 {
74726 Vector2 vector5 = new Vector2(x, y) - Main.player[owner].Center;
74727 if (((Vector2)(ref vector5)).Length() > num2 - 1f)
74728 {
74729 ((Vector2)(ref vector5)).Normalize();
74730 vector5 *= num2 - 1f;
74731 Vector2 val2 = Main.player[owner].Center + vector5;
74732 x = val2.X;
74733 y = val2.Y;
74734 }
74735 ai[0] = x;
74736 ai[1] = y;
74737 netUpdate = true;
74738 }
74739 }
74740 }
74741 if (flag4 && owner == Main.myPlayer)
74742 {
74743 ai[0] = -1f;
74744 netUpdate = true;
74745 }
74746 if (ai[0] >= 0f)
74747 {
74748 if (flag3)
74749 {
74750 num13 /= 2f;
74751 num14 *= 2f;
74752 if (base.Center.X > Main.player[owner].Center.X && velocity.X > 0f)
74753 {
74754 velocity.X *= 0.5f;
74755 }
74756 if (base.Center.Y > Main.player[owner].Center.Y && velocity.Y > 0f)
74757 {
74758 velocity.Y *= 0.5f;
74759 }
74760 if (base.Center.X < Main.player[owner].Center.X && velocity.X < 0f)
74761 {
74762 velocity.X *= 0.5f;
74763 }
74764 if (base.Center.Y < Main.player[owner].Center.Y && velocity.Y < 0f)
74765 {
74766 velocity.Y *= 0.5f;
74767 }
74768 }
74769 Vector2 vector6 = new Vector2(ai[0], ai[1]) - base.Center;
74770 if (flag3)
74771 {
74772 num13 = 1f;
74773 }
74774 ((Vector2)(ref velocity)).Length();
74775 float num5 = ((Vector2)(ref vector6)).Length();
74776 if (num5 > num15)
74777 {
74778 ((Vector2)(ref vector6)).Normalize();
74779 float num6 = Math.Min(num5 / 2f, num14);
74780 if (flag3)
74781 {
74782 num6 = Math.Min(num6, num14 / 2f);
74783 }
74784 vector6 *= num6;
74785 velocity = (velocity * (num13 - 1f) + vector6) / num13;
74786 }
74787 else if (flag)
74788 {
74789 if ((double)((Vector2)(ref velocity)).Length() < (double)num14 * 0.6)
74790 {
74791 vector6 = velocity;
74792 ((Vector2)(ref vector6)).Normalize();
74793 vector6 *= num14 * 0.6f;
74794 velocity = (velocity * (num13 - 1f) + vector6) / num13;
74795 }
74796 }
74797 else
74798 {
74799 velocity *= 0.8f;
74800 }
74801 if (flag && !flag3 && (double)((Vector2)(ref velocity)).Length() < (double)num14 * 0.6)
74802 {
74803 ((Vector2)(ref velocity)).Normalize();
74804 velocity *= num14 * 0.6f;
74805 }
74806 }
74807 }
74808 else
74809 {
74810 num13 = (int)((double)num13 * 0.8);
74811 num14 *= 1.5f;
74812 tileCollide = false;
74813 Vector2 vector7 = Main.player[owner].Center - base.Center;
74814 float num7 = ((Vector2)(ref vector7)).Length();
74816 {
74817 Kill();
74818 }
74819 else
74820 {
74821 ((Vector2)(ref vector7)).Normalize();
74822 vector7 *= num14;
74823 velocity = (velocity * (num13 - 1f) + vector7) / num13;
74824 }
74825 }
74826 rotation += 0.45f;
74827 }
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
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 float[] YoyosLifeTimeMultiplier
The lifetime of a yoyo projectile (F:Terraria.ID.ProjAIStyleID.Yoyo) in seconds. A value of -1f mea...
static float[] YoyosTopSpeed
The maximum speed a yoyo projectile (F:Terraria.ID.ProjAIStyleID.Yoyo) can go in pixels per tick....
static float[] YoyosMaximumRange
The maximum distance a yoyo projectile (F:Terraria.ID.ProjAIStyleID.Yoyo) can be from its owner in pi...
int owner
The index of the player who owns this projectile. In Multiplayer, Clients "own" projectiles that they...
int damage
This will always be set in Projectile.NewProjectile based on the weapons damage and player stat modif...
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...
IEntitySource GetProjectileSource_FromThis()
float[] localAI
Acts like F:Terraria.Projectile.ai, but does not sync to the server. Many vanilla T:Terraria....
float knockBack
This will always be set in Projectile.NewProjectile based on the weapons knockback and player stat mo...
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:...
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 NewProjectile(IEntitySource spawnSource, Vector2 position, Vector2 velocity, int Type, int Damage, float KnockBack, int Owner=-1, float ai0=0f, float ai1=0f, float ai2=0f)
This particular overload uses a Vector2 instead of X and Y to determine the actual spawn position and...

References Terraria.Collision.CanHit(), Terraria.Main.dust, Terraria.Main.MouseScreen, Terraria.Main.myPlayer, Terraria.Dust.NewDust(), Terraria.Main.npc, Terraria.Main.player, Terraria.Main.projectile, Terraria.Main.rand, Terraria.Main.ReverseGravitySupport(), Terraria.Main.screenPosition, Terraria.ID.ProjectileID.Sets.YoyosLifeTimeMultiplier, Terraria.ID.ProjectileID.Sets.YoyosMaximumRange, and Terraria.ID.ProjectileID.Sets.YoyosTopSpeed.

+ Here is the call graph for this function: