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

◆ UpdateNPC_BuffApplyDOTs()

void Terraria.NPC.UpdateNPC_BuffApplyDOTs ( )
inlineprivate

Definition at line 108598 of file NPC.cs.

108599 {
108600 //IL_089a: Unknown result type (might be due to invalid IL or missing references)
108601 //IL_089f: Unknown result type (might be due to invalid IL or missing references)
108602 //IL_0793: Unknown result type (might be due to invalid IL or missing references)
108603 //IL_0798: Unknown result type (might be due to invalid IL or missing references)
108604 if (dontTakeDamage)
108605 {
108606 return;
108607 }
108609 if (poisoned)
108610 {
108611 if (lifeRegen > 0)
108612 {
108613 lifeRegen = 0;
108614 }
108615 lifeRegen -= 12;
108616 }
108617 if (onFire)
108618 {
108619 if (lifeRegen > 0)
108620 {
108621 lifeRegen = 0;
108622 }
108623 lifeRegen -= 8;
108624 }
108625 if (onFire3)
108626 {
108627 if (lifeRegen > 0)
108628 {
108629 lifeRegen = 0;
108630 }
108631 lifeRegen -= 30;
108632 if (num < 5)
108633 {
108634 num = 5;
108635 }
108636 }
108637 if (onFrostBurn)
108638 {
108639 if (lifeRegen > 0)
108640 {
108641 lifeRegen = 0;
108642 }
108643 lifeRegen -= 16;
108644 if (num < 2)
108645 {
108646 num = 2;
108647 }
108648 }
108649 if (onFrostBurn2)
108650 {
108651 if (lifeRegen > 0)
108652 {
108653 lifeRegen = 0;
108654 }
108655 lifeRegen -= 50;
108656 if (num < 10)
108657 {
108658 num = 10;
108659 }
108660 }
108661 if (onFire2)
108662 {
108663 if (lifeRegen > 0)
108664 {
108665 lifeRegen = 0;
108666 }
108667 lifeRegen -= 48;
108668 if (num < 10)
108669 {
108670 num = 10;
108671 }
108672 }
108673 if (venom)
108674 {
108675 if (lifeRegen > 0)
108676 {
108677 lifeRegen = 0;
108678 }
108679 lifeRegen -= 60;
108680 if (num < 15)
108681 {
108682 num = 15;
108683 }
108684 }
108685 if (shadowFlame)
108686 {
108687 if (lifeRegen > 0)
108688 {
108689 lifeRegen = 0;
108690 }
108691 lifeRegen -= 30;
108692 if (num < 5)
108693 {
108694 num = 5;
108695 }
108696 }
108698 {
108699 if (lifeRegen > 0)
108700 {
108701 lifeRegen = 0;
108702 }
108703 lifeRegen -= 50;
108704 if (num < 10)
108705 {
108706 num = 10;
108707 }
108708 }
108709 if (javelined)
108710 {
108711 if (lifeRegen > 0)
108712 {
108713 lifeRegen = 0;
108714 }
108715 int num7 = 0;
108716 int num8 = 1;
108717 for (int i = 0; i < 1000; i++)
108718 {
108719 if (Main.projectile[i].active && Main.projectile[i].type == 598 && Main.projectile[i].ai[0] == 1f && Main.projectile[i].ai[1] == (float)whoAmI)
108720 {
108721 num7++;
108722 }
108723 }
108724 lifeRegen -= num7 * 2 * 3;
108725 if (num < num7 * 3 / num8)
108726 {
108727 num = num7 * 3 / num8;
108728 }
108729 }
108730 if (tentacleSpiked)
108731 {
108732 if (lifeRegen > 0)
108733 {
108734 lifeRegen = 0;
108735 }
108736 int num9 = 0;
108737 int num10 = 1;
108738 for (int j = 0; j < 1000; j++)
108739 {
108740 if (Main.projectile[j].active && Main.projectile[j].type == 971 && Main.projectile[j].ai[0] == 1f && Main.projectile[j].ai[1] == (float)whoAmI)
108741 {
108742 num9++;
108743 }
108744 }
108745 lifeRegen -= num9 * 2 * 3;
108746 if (num < num9 * 3 / num10)
108747 {
108748 num = num9 * 3 / num10;
108749 }
108750 }
108751 if (bloodButchered)
108752 {
108753 if (lifeRegen > 0)
108754 {
108755 lifeRegen = 0;
108756 }
108757 int num11 = 0;
108758 int num12 = 1;
108759 for (int k = 0; k < 1000; k++)
108760 {
108761 if (Main.projectile[k].active && Main.projectile[k].type == 975 && Main.projectile[k].ai[0] == 1f && Main.projectile[k].ai[1] == (float)whoAmI)
108762 {
108763 num11++;
108764 }
108765 }
108766 lifeRegen -= num11 * 2 * 4;
108767 if (num < num11 * 4 / num12)
108768 {
108769 num = num11 * 4 / num12;
108770 }
108771 }
108772 if (daybreak)
108773 {
108774 if (lifeRegen > 0)
108775 {
108776 lifeRegen = 0;
108777 }
108778 int num13 = 0;
108779 int num14 = 4;
108780 for (int l = 0; l < 1000; l++)
108781 {
108782 if (Main.projectile[l].active && Main.projectile[l].type == 636 && Main.projectile[l].ai[0] == 1f && Main.projectile[l].ai[1] == (float)whoAmI)
108783 {
108784 num13++;
108785 }
108786 }
108787 if (num13 == 0)
108788 {
108789 num13 = 1;
108790 }
108791 lifeRegen -= num13 * 2 * 100;
108792 if (num < num13 * 100 / num14)
108793 {
108794 num = num13 * 100 / num14;
108795 }
108796 }
108797 if (celled)
108798 {
108799 if (lifeRegen > 0)
108800 {
108801 lifeRegen = 0;
108802 }
108803 int num2 = 0;
108804 for (int m = 0; m < 1000; m++)
108805 {
108806 if (Main.projectile[m].active && Main.projectile[m].type == 614 && Main.projectile[m].ai[0] == 1f && Main.projectile[m].ai[1] == (float)whoAmI)
108807 {
108808 num2++;
108809 }
108810 }
108811 lifeRegen -= num2 * 2 * 20;
108812 if (num < num2 * 20)
108813 {
108814 num = num2 * 20 / 2;
108815 }
108816 }
108817 if (dryadBane)
108818 {
108819 int num3 = 4;
108820 float num4 = 1f;
108821 if (lifeRegen > 0)
108822 {
108823 lifeRegen = 0;
108824 }
108825 if (downedBoss1)
108826 {
108827 num4 += 0.1f;
108828 }
108829 if (downedBoss2)
108830 {
108831 num4 += 0.1f;
108832 }
108833 if (downedBoss3)
108834 {
108835 num4 += 0.1f;
108836 }
108837 if (downedQueenBee)
108838 {
108839 num4 += 0.1f;
108840 }
108841 if (Main.hardMode)
108842 {
108843 num4 += 0.4f;
108844 }
108845 if (downedMechBoss1)
108846 {
108847 num4 += 0.15f;
108848 }
108849 if (downedMechBoss2)
108850 {
108851 num4 += 0.15f;
108852 }
108853 if (downedMechBoss3)
108854 {
108855 num4 += 0.15f;
108856 }
108857 if (downedPlantBoss)
108858 {
108859 num4 += 0.15f;
108860 }
108861 if (downedGolemBoss)
108862 {
108863 num4 += 0.15f;
108864 }
108866 {
108867 num4 += 0.15f;
108868 }
108869 if (Main.expertMode)
108870 {
108871 num4 *= Main.GameModeInfo.TownNPCDamageMultiplier;
108872 }
108873 num3 = (int)((float)num3 * num4);
108874 lifeRegen -= 2 * num3;
108875 if (num < num3)
108876 {
108877 num = num3 / 3;
108878 }
108879 }
108880 if (soulDrain && realLife == -1)
108881 {
108882 if (lifeRegen > 0)
108883 {
108884 lifeRegen = 0;
108885 }
108886 lifeRegen -= 50;
108887 if (num < 5)
108888 {
108889 num = 5;
108890 }
108891 }
108893 if (lifeRegen <= -240 && num < 2)
108894 {
108895 num = 2;
108896 }
108898 while (lifeRegenCount >= 120)
108899 {
108900 lifeRegenCount -= 120;
108901 if (!immortal)
108902 {
108903 if (life < lifeMax)
108904 {
108905 life++;
108906 }
108907 if (life > lifeMax)
108908 {
108909 life = lifeMax;
108910 }
108911 }
108912 }
108913 if (num > 0)
108914 {
108915 while (lifeRegenCount <= -120 * num)
108916 {
108917 lifeRegenCount += 120 * num;
108918 int num5 = whoAmI;
108919 if (realLife >= 0)
108920 {
108921 num5 = realLife;
108922 }
108923 if (!Main.npc[num5].immortal)
108924 {
108925 Main.npc[num5].life -= num;
108926 }
108927 CombatText.NewText(new Rectangle((int)position.X, (int)position.Y, width, height), CombatText.LifeRegenNegative, num, dramatic: false, dot: true);
108928 if (Main.npc[num5].life > 0 || Main.npc[num5].immortal)
108929 {
108930 continue;
108931 }
108932 Main.npc[num5].life = 1;
108933 if (Main.netMode != 1)
108934 {
108935 Main.npc[num5].StrikeNPCNoInteraction(9999, 0f, 0);
108936 if (Main.netMode == 2)
108937 {
108938 NetMessage.SendData(28, -1, -1, null, num5, 9999f);
108939 }
108940 }
108941 }
108942 return;
108943 }
108944 while (lifeRegenCount <= -120)
108945 {
108946 lifeRegenCount += 120;
108947 int num6 = whoAmI;
108948 if (realLife >= 0)
108949 {
108950 num6 = realLife;
108951 }
108952 if (!Main.npc[num6].immortal)
108953 {
108954 Main.npc[num6].life--;
108955 }
108956 CombatText.NewText(new Rectangle((int)position.X, (int)position.Y, width, height), CombatText.LifeRegenNegative, 1, dramatic: false, dot: true);
108957 if (Main.npc[num6].life > 0 || Main.npc[num6].immortal)
108958 {
108959 continue;
108960 }
108961 Main.npc[num6].life = 1;
108962 if (Main.netMode != 1)
108963 {
108964 Main.npc[num6].StrikeNPCNoInteraction(9999, 0f, 0);
108965 if (Main.netMode == 2)
108966 {
108967 NetMessage.SendData(28, -1, -1, null, num6, 9999f);
108968 }
108969 }
108970 }
108971 }
int whoAmI
The index of this Entity within its specific array. These arrays track the entities in the world....
Definition Entity.cs:16
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 void UpdateLifeRegen(NPC npc, ref int damage)
Definition NPCLoader.cs:686
This serves as the central class from which NPC-related functions are carried out....
Definition NPCLoader.cs:26
bool dryadBane
Definition NPC.cs:714
bool immortal
Definition NPC.cs:700
static bool downedMechBoss2
Denotes whether or not the Twins have been defeated at least once in the current world.
Definition NPC.cs:959
bool onFire2
Definition NPC.cs:666
bool venom
Definition NPC.cs:678
bool soulDrain
Definition NPC.cs:682
static bool downedBoss2
Denotes whether or not the Eater of Worlds OR the Brain of Cthulhu have been defeated at least once i...
Definition NPC.cs:796
bool poisoned
Definition NPC.cs:674
int lifeMax
The maximum life of this NPC.
Definition NPC.cs:1077
int lifeRegenExpectedLossPerSecond
Definition NPC.cs:690
bool oiled
Definition NPC.cs:722
static bool downedBoss1
Denotes whether or not the Eye of Cthulhu has been defeated at least once in the current world.
Definition NPC.cs:790
bool dontTakeDamage
Definition NPC.cs:1160
static bool downedMechBoss3
Denotes whether or not Skeletron Prime has been defeated at least once in the current world.
Definition NPC.cs:964
bool onFire
Definition NPC.cs:664
int lifeRegen
Definition NPC.cs:686
static bool downedQueenBee
Denotes whether or not at least one Queen Bee has been defeated in the current world.
Definition NPC.cs:806
bool bloodButchered
Definition NPC.cs:710
bool tentacleSpiked
Definition NPC.cs:708
static bool downedGolemBoss
Denotes whether or not Golem has been defeated at least once in the current world.
Definition NPC.cs:842
bool celled
Definition NPC.cs:712
bool javelined
Definition NPC.cs:706
static bool downedAncientCultist
Denotes whether or not the Lunatic Cultist has been defeated at least once in the current world.
Definition NPC.cs:882
static bool downedBoss3
Denotes whether or not Skeletron has been defeated at least once in the current world.
Definition NPC.cs:801
int life
The current life of the NPC. Automatically set to the value of F:Terraria.NPC.lifeMax at the end of S...
Definition NPC.cs:1072
static bool downedPlantBoss
Denotes whether or not Plantera has been defeated at least once in the current world.
Definition NPC.cs:837
bool shadowFlame
Definition NPC.cs:680
bool onFrostBurn2
Definition NPC.cs:672
bool daybreak
Definition NPC.cs:716
bool onFire3
Definition NPC.cs:668
int realLife
Stores the index (the F:Terraria.Entity.whoAmI) of a single NPC. This NPC will then share a health po...
Definition NPC.cs:604
bool onFrostBurn
Definition NPC.cs:670
static bool downedMechBoss1
Denotes whether or not the Destroyer has been defeated at least once in the current world.
Definition NPC.cs:954
int lifeRegenCount
Definition NPC.cs:688

References Terraria.Main.expertMode, Terraria.Main.GameModeInfo, Terraria.Main.hardMode, Terraria.CombatText.LifeRegenNegative, Terraria.Main.netMode, Terraria.CombatText.NewText(), Terraria.Main.npc, Terraria.Main.projectile, Terraria.NetMessage.SendData(), and Terraria.ModLoader.NPCLoader.UpdateLifeRegen().

+ Here is the call graph for this function: