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

◆ UpdateTorchLuck_ConsumeCountersAndCalculate()

void Terraria.Player.UpdateTorchLuck_ConsumeCountersAndCalculate ( )
inlineprivate

Definition at line 17600 of file Player.cs.

17601 {
17603 torchLuck = 0f;
17605 if (inventory[selectedItem].createTile == 4 && inventory[selectedItem].placeStyle < TorchID.Count)
17606 {
17608 }
17609 float num = 0f;
17610 float num2 = 0f;
17612 {
17613 if (nearbyTorch[9])
17614 {
17615 if (ZoneSnow)
17616 {
17617 num2 += 1f;
17618 }
17619 else
17620 {
17621 num += 1f;
17622 }
17623 }
17624 if (nearbyTorch[16])
17625 {
17626 if (ZoneDesert)
17627 {
17628 num2 += 1f;
17629 }
17630 else
17631 {
17632 num += 1f;
17633 }
17634 }
17635 if (nearbyTorch[17])
17636 {
17637 if (WorldGen.oceanDepths((int)base.Center.X / 16, (int)base.Center.Y / 16))
17638 {
17639 num2 += 1f;
17640 }
17641 else if (dryCoralTorch)
17642 {
17643 num += 1f;
17644 }
17645 }
17646 if (nearbyTorch[21])
17647 {
17648 if (ZoneJungle)
17649 {
17650 num2 += 1f;
17651 }
17652 else
17653 {
17654 num += 1f;
17655 }
17656 }
17657 if (nearbyTorch[22])
17658 {
17659 if (ZoneGlowshroom)
17660 {
17661 num2 += 1f;
17662 }
17663 else
17664 {
17665 num += 1f;
17666 }
17667 }
17668 if (nearbyTorch[18])
17669 {
17670 if (ZoneCorrupt)
17671 {
17672 num2 += 1f;
17673 }
17674 else
17675 {
17676 num += 1f;
17677 }
17678 }
17679 if (nearbyTorch[8] && ZoneCorrupt)
17680 {
17681 num2 += 1f;
17682 }
17683 if (nearbyTorch[19])
17684 {
17685 if (ZoneCrimson)
17686 {
17687 num2 += 1f;
17688 }
17689 else
17690 {
17691 num += 1f;
17692 }
17693 }
17694 if (nearbyTorch[11] && ZoneCrimson)
17695 {
17696 num2 += 1f;
17697 }
17698 if (nearbyTorch[20])
17699 {
17700 if (ZoneHallow)
17701 {
17702 num2 += 1f;
17703 }
17704 else
17705 {
17706 num += 1f;
17707 }
17708 }
17710 {
17711 num2 += 0.5f;
17712 }
17713 if (nearbyTorch[0])
17714 {
17715 if (ZoneSnow)
17716 {
17717 num += 2f;
17718 }
17719 else if (ZoneDesert || ZoneCorrupt || ZoneCrimson || ZoneHallow)
17720 {
17721 num += 0.5f;
17722 }
17723 }
17724 }
17725 if (num2 >= 1f)
17726 {
17727 torchLuck += 1f;
17728 }
17729 else if (num2 > 0f)
17730 {
17731 torchLuck += 0.5f;
17732 }
17733 if (num >= 2f)
17734 {
17735 torchLuck += -1.5f;
17736 }
17737 else if (num >= 1f)
17738 {
17739 torchLuck += -1f;
17740 }
17741 else if (num > 0f)
17742 {
17743 torchLuck += -0.5f;
17744 }
17745 dryCoralTorch = false;
17746 for (int i = 0; i < TorchID.Count; i++)
17747 {
17748 nearbyTorch[i] = false;
17749 }
17750 if (torchLuck < 0f)
17751 {
17752 torchLuck = 0f;
17753 }
17755 {
17756 bool flag = false;
17757 for (int j = 0; j < inventory.Length; j++)
17758 {
17759 if (inventory[j].type == 5043)
17760 {
17761 flag = true;
17762 break;
17763 }
17764 }
17765 if (!flag)
17766 {
17767 happyFunTorchTime = true;
17769 }
17770 }
17771 nearbyTorches = 0;
17772 }
Vector2 position
Definition Entity.cs:14
static readonly short Count
Definition TorchID.cs:132
int placeStyle
Definition Item.cs:165
int luckyTorchCounter
Definition Player.cs:2617
bool happyFunTorchTime
Definition Player.cs:2625
bool[] nearbyTorch
Definition Player.cs:2613
Vector2 _nextTorchLuckCheckCenter
Definition Player.cs:2623
int numberOfTorchAttacksMade
Definition Player.cs:2631
bool ZoneLihzhardTemple
Definition Player.cs:3253
bool dryCoralTorch
Definition Player.cs:2615
bool ZoneGlowshroom
Definition Player.cs:3073
Item[] inventory
Definition Player.cs:1257
float torchLuck
Definition Player.cs:2621

References Terraria.ID.TorchID.Count, Terraria.WorldGen.oceanDepths(), Terraria.Item.placeStyle, System.type, and Terraria.Main.worldSurface.