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

◆ UpdateTorchLuck_ConsumeCountersAndCalculate()

void Terraria.Player.UpdateTorchLuck_ConsumeCountersAndCalculate ( )
inlineprivate

Definition at line 16406 of file Player.cs.

16407 {
16408 //IL_0014: Unknown result type (might be due to invalid IL or missing references)
16409 //IL_0019: Unknown result type (might be due to invalid IL or missing references)
16410 //IL_0119: Unknown result type (might be due to invalid IL or missing references)
16411 //IL_0128: Unknown result type (might be due to invalid IL or missing references)
16413 torchLuck = 0f;
16415 if (inventory[selectedItem].createTile == 4 && inventory[selectedItem].placeStyle < TorchID.Count)
16416 {
16418 }
16420 if (modTile != null && TileID.Sets.Torch[modTile.Type])
16421 {
16422 NearbyModTorch.Add(modTile.Type);
16423 }
16424 float num = 0f;
16425 float num2 = 0f;
16427 {
16428 if (nearbyTorch[9])
16429 {
16430 if (ZoneSnow)
16431 {
16432 num2 += 1f;
16433 }
16434 else
16435 {
16436 num += 1f;
16437 }
16438 }
16439 if (nearbyTorch[16])
16440 {
16441 if (ZoneDesert)
16442 {
16443 num2 += 1f;
16444 }
16445 else
16446 {
16447 num += 1f;
16448 }
16449 }
16450 if (nearbyTorch[17])
16451 {
16452 if (WorldGen.oceanDepths((int)base.Center.X / 16, (int)base.Center.Y / 16))
16453 {
16454 num2 += 1f;
16455 }
16456 else if (dryCoralTorch)
16457 {
16458 num += 1f;
16459 }
16460 }
16461 if (nearbyTorch[21])
16462 {
16463 if (ZoneJungle)
16464 {
16465 num2 += 1f;
16466 }
16467 else
16468 {
16469 num += 1f;
16470 }
16471 }
16472 if (nearbyTorch[22])
16473 {
16474 if (ZoneGlowshroom)
16475 {
16476 num2 += 1f;
16477 }
16478 else
16479 {
16480 num += 1f;
16481 }
16482 }
16483 if (nearbyTorch[18])
16484 {
16485 if (ZoneCorrupt)
16486 {
16487 num2 += 1f;
16488 }
16489 else
16490 {
16491 num += 1f;
16492 }
16493 }
16494 if (nearbyTorch[8] && ZoneCorrupt)
16495 {
16496 num2 += 1f;
16497 }
16498 if (nearbyTorch[19])
16499 {
16500 if (ZoneCrimson)
16501 {
16502 num2 += 1f;
16503 }
16504 else
16505 {
16506 num += 1f;
16507 }
16508 }
16509 if (nearbyTorch[11] && ZoneCrimson)
16510 {
16511 num2 += 1f;
16512 }
16513 if (nearbyTorch[20])
16514 {
16515 if (ZoneHallow)
16516 {
16517 num2 += 1f;
16518 }
16519 else
16520 {
16521 num += 1f;
16522 }
16523 }
16525 {
16526 num2 += 0.5f;
16527 }
16528 if (nearbyTorch[0])
16529 {
16530 if (ZoneSnow)
16531 {
16532 num += 2f;
16533 }
16534 else if (ZoneDesert || ZoneCorrupt || ZoneCrimson || ZoneHallow)
16535 {
16536 num += 0.5f;
16537 }
16538 }
16539 }
16541 if (num2 >= 1f)
16542 {
16543 torchLuck += 1f;
16544 }
16545 else if (num2 > 0f)
16546 {
16547 torchLuck += 0.5f;
16548 }
16549 if (num >= 2f)
16550 {
16551 torchLuck += -1.5f;
16552 }
16553 else if (num >= 1f)
16554 {
16555 torchLuck += -1f;
16556 }
16557 else if (num > 0f)
16558 {
16559 torchLuck += -0.5f;
16560 }
16561 dryCoralTorch = false;
16562 for (int i = 0; i < TorchID.Count; i++)
16563 {
16564 nearbyTorch[i] = false;
16565 }
16566 NearbyModTorch.Clear();
16567 if (torchLuck < 0f)
16568 {
16569 torchLuck = 0f;
16570 }
16571 if (torchGodCooldown <= 0 && !unlockedBiomeTorches && nearbyTorches > 100 && !happyFunTorchTime && (double)position.Y > Main.worldSurface * 16.0)
16572 {
16573 bool flag = false;
16574 for (int j = 0; j < inventory.Length; j++)
16575 {
16576 if (inventory[j].type == 5043)
16577 {
16578 flag = true;
16579 break;
16580 }
16581 }
16582 if (!flag)
16583 {
16584 happyFunTorchTime = true;
16586 }
16587 }
16588 nearbyTorches = 0;
16589 }
Vector2 position
The position of this Entity in world coordinates.
Definition Entity.cs:28
static bool[] Torch
Whether or not this tile behaves like a torch. If you are making a torch tile, then setting this to t...
Definition TileID.cs:428
static readonly short Count
Definition TorchID.cs:132
int placeStyle
The style of the tile being placed. Used for tiles that have a different look depending on the item u...
Definition Item.cs:448
This class represents a type of tile that can be added by a mod. Only one instance of this class will...
Definition ModTile.cs:19
static ModTile GetTile(int type)
Gets the ModTile instance with the given type. If no ModTile with the given type exists,...
static void ModifyTorchLuck(Player player, ref float positiveLuck, ref float negativeLuck)
This serves as the central class from which tile-related functions are supported and carried out.
Definition TileLoader.cs:23
int luckyTorchCounter
Definition Player.cs:3177
bool happyFunTorchTime
Definition Player.cs:3185
bool[] nearbyTorch
Definition Player.cs:3173
Vector2 _nextTorchLuckCheckCenter
Definition Player.cs:3183
int numberOfTorchAttacksMade
Definition Player.cs:3191
bool ZoneLihzhardTemple
Definition Player.cs:4116
bool dryCoralTorch
Definition Player.cs:3175
bool ZoneGlowshroom
Definition Player.cs:3920
HashSet< int > NearbyModTorch
Definition Player.cs:4569
Item[] inventory
The player's normal inventory. Indexes 0-9 hold the hotbar items, 10-49 the rest of the main inventor...
Definition Player.cs:1767
float torchLuck
Definition Player.cs:3181

References Terraria.Player._nextTorchLuckCheckCenter, Terraria.ID.TorchID.Count, Terraria.Player.dryCoralTorch, Terraria.ModLoader.TileLoader.GetTile(), Terraria.Player.happyFunTorchTime, Terraria.Player.inventory, Terraria.Player.luckyTorchCounter, Terraria.ModLoader.TileLoader.ModifyTorchLuck(), Terraria.Player.NearbyModTorch, Terraria.Player.nearbyTorch, Terraria.Player.nearbyTorches, Terraria.Player.numberOfTorchAttacksMade, Terraria.WorldGen.oceanDepths(), Terraria.Item.placeStyle, Terraria.Entity.position, Terraria.Player.selectedItem, Terraria.ID.TileID.Sets.Torch, Terraria.Player.torchLuck, Terraria.Main.worldSurface, Terraria.Player.ZoneCorrupt, Terraria.Player.ZoneCrimson, Terraria.Player.ZoneDesert, Terraria.Player.ZoneDungeon, Terraria.Player.ZoneGlowshroom, Terraria.Player.ZoneHallow, Terraria.Player.ZoneJungle, Terraria.Player.ZoneLihzhardTemple, and Terraria.Player.ZoneSnow.

Referenced by Terraria.Player.TryRecalculatingTorchLuck().

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