Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
EaterOfWorldsProgressBar.cs
Go to the documentation of this file.
3using Terraria.ID;
4
6
8{
10
12
14 {
16 }
17
19 {
20 if (info.npcIndexToAimAt < 0 || info.npcIndexToAimAt > 200)
21 {
22 return false;
23 }
24 NPC nPC = Main.npc[info.npcIndexToAimAt];
25 if (!nPC.active && !TryFindingAnotherEOWPiece(ref info))
26 {
27 return false;
28 }
29 int num = 2;
30 int num2 = NPC.GetEaterOfWorldsSegmentsCount() + num;
32 int num3 = 0;
33 int num4 = _segmentForReference.lifeMax * num2;
34 for (int i = 0; i < 200; i++)
35 {
36 NPC nPC2 = Main.npc[i];
37 if (nPC2.active && nPC2.type >= 13 && nPC2.type <= 15)
38 {
39 num3 += nPC2.life;
40 }
41 }
42 int num5 = num3;
43 int num6 = num4;
44 _cache.SetLife(num5, num6);
45 return true;
46 }
47
48 public void Draw(ref BigProgressBarInfo info, SpriteBatch spriteBatch)
49 {
50 int num = NPCID.Sets.BossHeadTextures[13];
51 Texture2D value = TextureAssets.NpcHeadBoss[num].Value;
52 Rectangle barIconFrame = value.Frame();
53 BigProgressBarHelper.DrawFancyBar(spriteBatch, _cache.LifeCurrent, _cache.LifeMax, value, barIconFrame);
54 }
55
57 {
58 for (int i = 0; i < 200; i++)
59 {
60 NPC nPC = Main.npc[i];
61 if (nPC.active && nPC.type >= 13 && nPC.type <= 15)
62 {
63 info.npcIndexToAimAt = i;
64 return true;
65 }
66 }
67 return false;
68 }
69}
static Asset< Texture2D >[] NpcHeadBoss
static void DrawFancyBar(SpriteBatch spriteBatch, float lifeAmount, float lifeMax, Texture2D barIconTexture, Rectangle barIconFrame)
void Draw(ref BigProgressBarInfo info, SpriteBatch spriteBatch)
static int[] BossHeadTextures
Definition NPCID.cs:4240
static NPC[] npc
Definition Main.cs:1685
NPCSpawnParams GetMatchingSpawnParams()
Definition NPC.cs:12140
void SetDefaults(int Type, NPCSpawnParams spawnparams=default(NPCSpawnParams))
Definition NPC.cs:2523
static int GetEaterOfWorldsSegmentsCount()
Definition NPC.cs:44171
int type
Definition NPC.cs:445
int life
Definition NPC.cs:477