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

◆ FreeUpPetsAndMinions()

void Terraria.Player.FreeUpPetsAndMinions ( Item sItem)
inlineprivate

Definition at line 48495 of file Player.cs.

48496 {
48498 {
48499 List<int> list = new List<int>();
48500 float num = 0f;
48501 for (int i = 0; i < 1000; i++)
48502 {
48503 if (!Main.projectile[i].active || Main.projectile[i].owner != whoAmI || !Main.projectile[i].minion)
48504 {
48505 continue;
48506 }
48507 int j;
48508 for (j = 0; j < list.Count; j++)
48509 {
48510 if (Main.projectile[list[j]].minionSlots > Main.projectile[i].minionSlots)
48511 {
48512 list.Insert(j, i);
48513 break;
48514 }
48515 }
48516 if (j == list.Count)
48517 {
48518 list.Add(i);
48519 }
48520 num += Main.projectile[i].minionSlots;
48521 }
48523 float num3 = 0f;
48524 int num4 = 388;
48525 int num5 = -1;
48526 for (int k = 0; k < list.Count; k++)
48527 {
48528 int type = Main.projectile[list[k]].type;
48529 if (type == 626)
48530 {
48531 list.RemoveAt(k);
48532 k--;
48533 }
48534 if (type == 627)
48535 {
48536 if (Main.projectile[(int)Main.projectile[list[k]].localAI[1]].type == 628)
48537 {
48538 num5 = list[k];
48539 }
48540 list.RemoveAt(k);
48541 k--;
48542 }
48543 }
48544 if (num5 != -1)
48545 {
48546 list.Add(num5);
48547 list.Add(Projectile.GetByUUID(Main.projectile[num5].owner, Main.projectile[num5].ai[0]));
48548 }
48549 for (int l = 0; l < list.Count; l++)
48550 {
48551 if (!(num - num3 > (float)maxMinions - num2))
48552 {
48553 break;
48554 }
48555 int type2 = Main.projectile[list[l]].type;
48556 if (type2 == num4 || type2 == 625 || type2 == 628 || type2 == 623)
48557 {
48558 continue;
48559 }
48560 if (type2 == 388 && num4 == 387)
48561 {
48562 num4 = 388;
48563 }
48564 if (type2 == 387 && num4 == 388)
48565 {
48566 num4 = 387;
48567 }
48568 num3 += Main.projectile[list[l]].minionSlots;
48569 if (type2 == 626 || type2 == 627)
48570 {
48571 Projectile projectile = Main.projectile[list[l]];
48572 int byUUID = Projectile.GetByUUID(projectile.owner, projectile.ai[0]);
48573 if (Main.projectile.IndexInRange(byUUID))
48574 {
48575 Projectile projectile2 = Main.projectile[byUUID];
48576 if (projectile2.type != 625)
48577 {
48578 projectile2.localAI[1] = projectile.localAI[1];
48579 }
48580 projectile2 = Main.projectile[(int)projectile.localAI[1]];
48581 projectile2.ai[0] = projectile.ai[0];
48582 projectile2.ai[1] = 1f;
48583 projectile2.netUpdate = true;
48584 }
48585 }
48586 Main.projectile[list[l]].Kill();
48587 }
48588 list.Clear();
48589 if (num + num2 >= 9f)
48590 {
48592 }
48593 return;
48594 }
48595 for (int m = 0; m < 1000; m++)
48596 {
48597 Projectile projectile3 = Main.projectile[m];
48598 if (projectile3.active && projectile3.owner == whoAmI)
48599 {
48600 if (projectile3.type == sItem.shoot)
48601 {
48602 projectile3.Kill();
48603 }
48604 if (sItem.shoot == 72 && (projectile3.type == 86 || projectile3.type == 87))
48605 {
48606 projectile3.Kill();
48607 }
48608 if (sItem.type == 5131 && (projectile3.type == 881 || projectile3.type == 934))
48609 {
48610 projectile3.Kill();
48611 }
48612 }
48613 }
48614 }
void Add(TKey key, TValue value)
static void HandleSpecialEvent(Player player, int eventID)
static int[] StaffMinionSlotsRequired
Definition ItemID.cs:1054

References System.Collections.Generic.Dictionary< TKey, TValue >.Add(), Terraria.Projectile.ai, System.Collections.Generic.Dictionary< TKey, TValue >.Count, Terraria.Projectile.GetByUUID(), Terraria.GameContent.Achievements.AchievementsHelper.HandleSpecialEvent(), System.list, Terraria.Projectile.localAI, Terraria.ID.ProjectileID.Sets.MinionSacrificable, Terraria.Projectile.owner, Terraria.Main.projectile, Terraria.ID.ItemID.Sets.StaffMinionSlotsRequired, and System.type.