Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
GolemHeadProgressBar.cs
Go to the documentation of this file.
4using Terraria.ID;
5
7
9{
11
13
14 private HashSet<int> ValidIds = new HashSet<int> { 246, 245 };
15
17 {
18 _referenceDummy = new NPC();
19 }
20
22 {
23 if (info.npcIndexToAimAt < 0 || info.npcIndexToAimAt > 200)
24 {
25 return false;
26 }
27 NPC nPC = Main.npc[info.npcIndexToAimAt];
28 if (!nPC.active && !TryFindingAnotherGolemPiece(ref info))
29 {
30 return false;
31 }
32 int num = 0;
33 _referenceDummy.SetDefaults(245, nPC.GetMatchingSpawnParams());
35 _referenceDummy.SetDefaults(246, nPC.GetMatchingSpawnParams());
37 float num2 = 0f;
38 for (int i = 0; i < 200; i++)
39 {
40 NPC nPC2 = Main.npc[i];
41 if (nPC2.active && ValidIds.Contains(nPC2.type))
42 {
43 num2 += (float)nPC2.life;
44 }
45 }
46 _cache.SetLife(num2, num);
47 return true;
48 }
49
50 public void Draw(ref BigProgressBarInfo info, SpriteBatch spriteBatch)
51 {
52 int num = NPCID.Sets.BossHeadTextures[246];
53 Texture2D value = TextureAssets.NpcHeadBoss[num].Value;
54 Rectangle barIconFrame = value.Frame();
56 }
57
59 {
60 for (int i = 0; i < 200; i++)
61 {
62 NPC nPC = Main.npc[i];
63 if (nPC.active && ValidIds.Contains(nPC.type))
64 {
65 info.npcIndexToAimAt = i;
66 return true;
67 }
68 }
69 return false;
70 }
71}
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
void SetDefaults(int Type, NPCSpawnParams spawnparams=default(NPCSpawnParams))
Definition NPC.cs:2523
int lifeMax
Definition NPC.cs:479