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

◆ FreeUpPetsAndMinions()

void Terraria.Player.FreeUpPetsAndMinions ( Item sItem)
inlineprivate

Definition at line 52550 of file Player.cs.

52551 {
52553 {
52554 List<int> list = new List<int>();
52555 float num = 0f;
52556 for (int i = 0; i < 1000; i++)
52557 {
52558 if (!Main.projectile[i].active || Main.projectile[i].owner != whoAmI || !Main.projectile[i].minion)
52559 {
52560 continue;
52561 }
52562 int j;
52563 for (j = 0; j < list.Count; j++)
52564 {
52565 if (Main.projectile[list[j]].minionSlots > Main.projectile[i].minionSlots)
52566 {
52567 list.Insert(j, i);
52568 break;
52569 }
52570 }
52571 if (j == list.Count)
52572 {
52573 list.Add(i);
52574 }
52575 num += Main.projectile[i].minionSlots;
52576 }
52578 float num3 = 0f;
52579 int num4 = 388;
52580 int num5 = -1;
52581 for (int k = 0; k < list.Count; k++)
52582 {
52583 int type3 = Main.projectile[list[k]].type;
52584 if (type3 == 626)
52585 {
52586 list.RemoveAt(k);
52587 k--;
52588 }
52589 if (type3 == 627)
52590 {
52591 if (Main.projectile[(int)Main.projectile[list[k]].localAI[1]].type == 628)
52592 {
52593 num5 = list[k];
52594 }
52595 list.RemoveAt(k);
52596 k--;
52597 }
52598 }
52599 if (num5 != -1)
52600 {
52601 list.Add(num5);
52602 list.Add(Projectile.GetByUUID(Main.projectile[num5].owner, Main.projectile[num5].ai[0]));
52603 }
52604 for (int l = 0; l < list.Count; l++)
52605 {
52606 if (!(num - num3 > (float)maxMinions - num2 + 1E-05f))
52607 {
52608 break;
52609 }
52610 int type2 = Main.projectile[list[l]].type;
52611 if (type2 == num4 || type2 == 625 || type2 == 628 || type2 == 623)
52612 {
52613 continue;
52614 }
52615 if (type2 == 388 && num4 == 387)
52616 {
52617 num4 = 388;
52618 }
52619 if (type2 == 387 && num4 == 388)
52620 {
52621 num4 = 387;
52622 }
52623 num3 += Main.projectile[list[l]].minionSlots;
52624 if (type2 == 626 || type2 == 627)
52625 {
52626 Projectile projectile = Main.projectile[list[l]];
52627 int byUUID = Projectile.GetByUUID(projectile.owner, projectile.ai[0]);
52628 if (Main.projectile.IndexInRange(byUUID))
52629 {
52630 Projectile projectile2 = Main.projectile[byUUID];
52631 if (projectile2.type != 625)
52632 {
52633 projectile2.localAI[1] = projectile.localAI[1];
52634 }
52635 projectile2 = Main.projectile[(int)projectile.localAI[1]];
52636 projectile2.ai[0] = projectile.ai[0];
52637 projectile2.ai[1] = 1f;
52638 projectile2.netUpdate = true;
52639 }
52640 }
52641 Main.projectile[list[l]].Kill();
52642 }
52643 list.Clear();
52644 if (num + num2 >= 9f)
52645 {
52647 }
52648 return;
52649 }
52650 for (int m = 0; m < 1000; m++)
52651 {
52652 Projectile projectile3 = Main.projectile[m];
52653 if (projectile3.active && projectile3.owner == whoAmI)
52654 {
52655 if (projectile3.type == sItem.shoot)
52656 {
52657 projectile3.Kill();
52658 }
52659 if (sItem.shoot == 72 && (projectile3.type == 86 || projectile3.type == 87))
52660 {
52661 projectile3.Kill();
52662 }
52663 if (sItem.type == 5131 && (projectile3.type == 881 || projectile3.type == 934))
52664 {
52665 projectile3.Kill();
52666 }
52667 }
52668 }
52669 }
int whoAmI
The index of this Entity within its specific array. These arrays track the entities in the world....
Definition Entity.cs:16
static void HandleSpecialEvent(Player player, int eventID)
static float[] StaffMinionSlotsRequired
How many minion slots one usage of this item will spawn. This is only used when F:Terraria....
Definition ItemID.cs:1363
static bool[] MinionSacrificable
If true for a given projectile type (F:Terraria.Projectile.type), then other minions will be sacrific...
int maxMinions
The maximum value of minions this player can have summoned at once. A minion's value is stored as F...
Definition Player.cs:1433

References Terraria.Projectile.ai, Terraria.Projectile.GetByUUID(), Terraria.GameContent.Achievements.AchievementsHelper.HandleSpecialEvent(), Terraria.Projectile.localAI, Terraria.Player.maxMinions, Terraria.ID.ProjectileID.Sets.MinionSacrificable, Terraria.Projectile.owner, Terraria.Main.projectile, Terraria.ID.ItemID.Sets.StaffMinionSlotsRequired, and Terraria.Entity.whoAmI.

Referenced by Terraria.Player.ItemCheck_Inner().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: