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

◆ AI_047_GolemFist()

void Terraria.NPC.AI_047_GolemFist ( )
inlineprivate

Definition at line 14029 of file NPC.cs.

14030 {
14031 //IL_0048: Unknown result type (might be due to invalid IL or missing references)
14032 //IL_00d6: Unknown result type (might be due to invalid IL or missing references)
14033 //IL_00dc: Unknown result type (might be due to invalid IL or missing references)
14034 //IL_00e1: Unknown result type (might be due to invalid IL or missing references)
14035 //IL_00f7: Unknown result type (might be due to invalid IL or missing references)
14036 //IL_00fc: Unknown result type (might be due to invalid IL or missing references)
14037 //IL_0101: Unknown result type (might be due to invalid IL or missing references)
14038 //IL_0128: Unknown result type (might be due to invalid IL or missing references)
14039 //IL_012a: Unknown result type (might be due to invalid IL or missing references)
14040 //IL_012f: Unknown result type (might be due to invalid IL or missing references)
14041 //IL_0134: Unknown result type (might be due to invalid IL or missing references)
14042 //IL_0420: Unknown result type (might be due to invalid IL or missing references)
14043 //IL_0432: Unknown result type (might be due to invalid IL or missing references)
14044 //IL_0437: Unknown result type (might be due to invalid IL or missing references)
14045 //IL_09ba: Unknown result type (might be due to invalid IL or missing references)
14046 //IL_09c5: Unknown result type (might be due to invalid IL or missing references)
14047 //IL_09e0: Unknown result type (might be due to invalid IL or missing references)
14048 //IL_09ea: Unknown result type (might be due to invalid IL or missing references)
14049 //IL_0a00: Unknown result type (might be due to invalid IL or missing references)
14050 //IL_0a0a: Unknown result type (might be due to invalid IL or missing references)
14051 //IL_07fd: Unknown result type (might be due to invalid IL or missing references)
14052 //IL_0465: Unknown result type (might be due to invalid IL or missing references)
14053 //IL_046a: Unknown result type (might be due to invalid IL or missing references)
14054 //IL_046c: Unknown result type (might be due to invalid IL or missing references)
14055 //IL_0473: Unknown result type (might be due to invalid IL or missing references)
14056 //IL_047d: Unknown result type (might be due to invalid IL or missing references)
14057 //IL_0482: Unknown result type (might be due to invalid IL or missing references)
14058 //IL_0493: Unknown result type (might be due to invalid IL or missing references)
14059 //IL_0498: Unknown result type (might be due to invalid IL or missing references)
14060 //IL_049b: Unknown result type (might be due to invalid IL or missing references)
14061 //IL_04a0: Unknown result type (might be due to invalid IL or missing references)
14062 //IL_04a2: Unknown result type (might be due to invalid IL or missing references)
14063 //IL_04a7: Unknown result type (might be due to invalid IL or missing references)
14064 //IL_04a9: Unknown result type (might be due to invalid IL or missing references)
14065 //IL_04ae: Unknown result type (might be due to invalid IL or missing references)
14066 //IL_04b0: Unknown result type (might be due to invalid IL or missing references)
14067 //IL_04ba: Unknown result type (might be due to invalid IL or missing references)
14068 //IL_04c4: Unknown result type (might be due to invalid IL or missing references)
14069 //IL_04ca: Unknown result type (might be due to invalid IL or missing references)
14070 //IL_01e1: Unknown result type (might be due to invalid IL or missing references)
14071 //IL_01ea: Unknown result type (might be due to invalid IL or missing references)
14072 //IL_081c: Unknown result type (might be due to invalid IL or missing references)
14073 //IL_0826: Unknown result type (might be due to invalid IL or missing references)
14074 //IL_082b: Unknown result type (might be due to invalid IL or missing references)
14075 //IL_083c: Unknown result type (might be due to invalid IL or missing references)
14076 //IL_0841: Unknown result type (might be due to invalid IL or missing references)
14077 //IL_0844: Unknown result type (might be due to invalid IL or missing references)
14078 //IL_0849: Unknown result type (might be due to invalid IL or missing references)
14079 //IL_084b: Unknown result type (might be due to invalid IL or missing references)
14080 //IL_0850: Unknown result type (might be due to invalid IL or missing references)
14081 //IL_0852: Unknown result type (might be due to invalid IL or missing references)
14082 //IL_085c: Unknown result type (might be due to invalid IL or missing references)
14083 //IL_0864: Unknown result type (might be due to invalid IL or missing references)
14084 //IL_0919: Unknown result type (might be due to invalid IL or missing references)
14085 //IL_0924: Unknown result type (might be due to invalid IL or missing references)
14086 //IL_08b2: Unknown result type (might be due to invalid IL or missing references)
14087 //IL_08bd: Unknown result type (might be due to invalid IL or missing references)
14088 //IL_05e2: Unknown result type (might be due to invalid IL or missing references)
14089 //IL_05ed: Unknown result type (might be due to invalid IL or missing references)
14090 //IL_0608: Unknown result type (might be due to invalid IL or missing references)
14091 //IL_0612: Unknown result type (might be due to invalid IL or missing references)
14092 //IL_0628: Unknown result type (might be due to invalid IL or missing references)
14093 //IL_0632: Unknown result type (might be due to invalid IL or missing references)
14094 //IL_094a: Unknown result type (might be due to invalid IL or missing references)
14095 //IL_0955: Unknown result type (might be due to invalid IL or missing references)
14096 //IL_08e6: Unknown result type (might be due to invalid IL or missing references)
14097 //IL_08f1: Unknown result type (might be due to invalid IL or missing references)
14098 //IL_02e5: Unknown result type (might be due to invalid IL or missing references)
14099 //IL_0301: Unknown result type (might be due to invalid IL or missing references)
14100 //IL_031b: Unknown result type (might be due to invalid IL or missing references)
14101 //IL_0337: Unknown result type (might be due to invalid IL or missing references)
14102 float num = GetMyBalance();
14103 if (Main.getGoodWorld)
14104 {
14105 num += 3f;
14106 }
14107 if ((!Main.player[target].ZoneLihzhardTemple && !Main.player[target].ZoneJungle) || (double)Main.player[target].Center.Y < Main.worldSurface * 16.0)
14108 {
14109 num *= 2f;
14110 }
14111 if (golemBoss < 0)
14112 {
14113 StrikeNPCNoInteraction(9999, 0f, 0);
14114 return;
14115 }
14116 if (alpha > 0)
14117 {
14118 alpha -= 10;
14119 if (alpha < 0)
14120 {
14121 alpha = 0;
14122 }
14123 ai[1] = 0f;
14124 }
14125 Player player = Main.player[target];
14126 NPC nPC = Main.npc[golemBoss];
14127 Vector2 vector = nPC.Center + nPC.velocity + new Vector2(0f, -9f * scale);
14128 vector.X += (float)((type == 247) ? (-84) : 78) * scale;
14129 Vector2 vector2 = vector - base.Center;
14130 float num6 = ((Vector2)(ref vector2)).Length();
14131 if (ai[0] == 0f)
14132 {
14133 noTileCollide = true;
14134 float num7 = 14f;
14135 if (life < lifeMax / 2)
14136 {
14137 num7 += 3f;
14138 }
14139 if (life < lifeMax / 4)
14140 {
14141 num7 += 3f;
14142 }
14143 if (Main.npc[golemBoss].life < Main.npc[golemBoss].lifeMax)
14144 {
14145 num7 += 8f;
14146 }
14147 num7 *= (num + 3f) / 4f;
14148 if (num7 > 32f)
14149 {
14150 num7 = 32f;
14151 }
14152 float x = vector2.X;
14153 float y = vector2.Y;
14154 float num8 = num6;
14155 if (num8 < 12f + num7)
14156 {
14157 rotation = 0f;
14158 velocity.X = x;
14159 velocity.Y = y;
14160 float num9 = num;
14161 ai[1] += num9;
14162 if (life < lifeMax / 2)
14163 {
14164 ai[1] += num9;
14165 }
14166 if (life < lifeMax / 4)
14167 {
14168 ai[1] += num9;
14169 }
14170 if (Main.npc[golemBoss].life < Main.npc[golemBoss].lifeMax)
14171 {
14172 ai[1] += 10f * num9;
14173 }
14174 if (ai[1] >= 60f)
14175 {
14176 TargetClosest();
14177 if ((type == 247 && base.Center.X + 100f > Main.player[target].Center.X) || (type == 248 && base.Center.X - 100f < Main.player[target].Center.X))
14178 {
14179 ai[1] = 0f;
14180 ai[0] = 1f;
14181 }
14182 else
14183 {
14184 ai[1] = 0f;
14185 }
14186 }
14187 }
14188 else
14189 {
14190 num8 = num7 / num8;
14191 velocity.X = x * num8;
14192 velocity.Y = y * num8;
14193 rotation = (float)Math.Atan2(0f - velocity.Y, 0f - velocity.X);
14194 if (type == 247)
14195 {
14196 rotation = (float)Math.Atan2(velocity.Y, velocity.X);
14197 }
14198 }
14199 }
14200 else if (ai[0] == 1f)
14201 {
14202 ai[1] += 1f;
14203 base.Center = vector;
14204 rotation = 0f;
14205 velocity = Vector2.Zero;
14206 if (ai[1] <= 15f)
14207 {
14208 for (int i = 0; i < 1; i++)
14209 {
14210 Vector2 vector3 = Main.rand.NextVector2Circular(80f, 80f);
14211 Vector2 vector4 = vector3 * -1f * 0.05f;
14212 Vector2 vector5 = Main.rand.NextVector2Circular(20f, 20f);
14213 Dust dust = Dust.NewDustPerfect(base.Center + vector4 + vector3 + vector5, 228, vector4);
14214 dust.fadeIn = 1.5f;
14215 dust.scale = 0.5f;
14216 if (Main.getGoodWorld)
14217 {
14218 dust.noLight = true;
14219 }
14220 dust.noGravity = true;
14221 }
14222 }
14223 if (ai[1] >= 30f)
14224 {
14225 noTileCollide = true;
14226 collideX = false;
14227 collideY = false;
14228 ai[0] = 2f;
14229 ai[1] = 0f;
14230 float num10 = 12f;
14231 if (life < lifeMax / 2)
14232 {
14233 num10 += 4f;
14234 }
14235 if (life < lifeMax / 4)
14236 {
14237 num10 += 4f;
14238 }
14239 if (Main.npc[golemBoss].life < Main.npc[golemBoss].lifeMax)
14240 {
14241 num10 += 10f;
14242 }
14243 num10 *= (num + 3f) / 4f;
14244 if (num10 > 48f)
14245 {
14246 num10 = 48f;
14247 }
14248 Vector2 vector6 = default(Vector2);
14249 ((Vector2)(ref vector6))._002Ector(base.Center.X, base.Center.Y);
14250 float num11 = Main.player[target].Center.X - vector6.X;
14251 float num12 = Main.player[target].Center.Y - vector6.Y;
14252 float num13 = (float)Math.Sqrt(num11 * num11 + num12 * num12);
14253 num13 = num10 / num13;
14254 velocity.X = num11 * num13;
14255 velocity.Y = num12 * num13;
14256 rotation = (float)Math.Atan2(velocity.Y, velocity.X);
14257 if (type == 247)
14258 {
14259 rotation = (float)Math.Atan2(0f - velocity.Y, 0f - velocity.X);
14260 }
14261 }
14262 }
14263 else if (ai[0] == 2f)
14264 {
14265 if (Main.netMode != 1 && Main.getGoodWorld)
14266 {
14267 for (int j = (int)(position.X / 16f) - 1; (float)j < (position.X + (float)width) / 16f + 1f; j++)
14268 {
14269 for (int k = (int)(position.Y / 16f) - 1; (float)k < (position.Y + (float)width) / 16f + 1f; k++)
14270 {
14271 if (Main.tile[j, k].type == 4)
14272 {
14273 Main.tile[j, k].active(active: false);
14274 if (Main.netMode == 2)
14275 {
14276 NetMessage.SendTileSquare(-1, j, k);
14277 }
14278 }
14279 }
14280 }
14281 }
14282 ai[1] += 1f;
14283 if (ai[1] == 1f)
14284 {
14286 }
14287 if (Main.rand.Next(2) == 0)
14288 {
14289 Vector2 vector7 = velocity * 0.5f;
14290 Vector2 vector8 = Main.rand.NextVector2Circular(20f, 20f);
14291 Dust.NewDustPerfect(base.Center + vector7 + vector8, 306, vector7, 0, Main.OurFavoriteColor).scale = 2f;
14292 }
14293 if (Math.Abs(velocity.X) > Math.Abs(velocity.Y))
14294 {
14295 if (velocity.X > 0f && base.Center.X > player.Center.X)
14296 {
14297 noTileCollide = false;
14298 }
14299 if (velocity.X < 0f && base.Center.X < player.Center.X)
14300 {
14301 noTileCollide = false;
14302 }
14303 }
14304 else
14305 {
14306 if (velocity.Y > 0f && base.Center.Y > player.Center.Y)
14307 {
14308 noTileCollide = false;
14309 }
14310 if (velocity.Y < 0f && base.Center.Y < player.Center.Y)
14311 {
14312 noTileCollide = false;
14313 }
14314 }
14315 if (num6 > 700f || collideX || collideY)
14316 {
14317 noTileCollide = true;
14318 ai[0] = 0f;
14319 }
14320 }
14321 else
14322 {
14323 if (ai[0] != 3f)
14324 {
14325 return;
14326 }
14327 noTileCollide = true;
14328 float num2 = 0.4f;
14329 Vector2 vector9 = default(Vector2);
14330 ((Vector2)(ref vector9))._002Ector(base.Center.X, base.Center.Y);
14331 float num3 = Main.player[target].Center.X - vector9.X;
14332 float num4 = Main.player[target].Center.Y - vector9.Y;
14333 float num5 = (float)Math.Sqrt(num3 * num3 + num4 * num4);
14334 num5 = 12f / num5;
14335 num3 *= num5;
14336 num4 *= num5;
14337 if (velocity.X < num3)
14338 {
14339 velocity.X += num2;
14340 if (velocity.X < 0f && num3 > 0f)
14341 {
14342 velocity.X += num2 * 2f;
14343 }
14344 }
14345 else if (velocity.X > num3)
14346 {
14347 velocity.X -= num2;
14348 if (velocity.X > 0f && num3 < 0f)
14349 {
14350 velocity.X -= num2 * 2f;
14351 }
14352 }
14353 if (velocity.Y < num4)
14354 {
14355 velocity.Y += num2;
14356 if (velocity.Y < 0f && num4 > 0f)
14357 {
14358 velocity.Y += num2 * 2f;
14359 }
14360 }
14361 else if (velocity.Y > num4)
14362 {
14363 velocity.Y -= num2;
14364 if (velocity.Y > 0f && num4 < 0f)
14365 {
14366 velocity.Y -= num2 * 2f;
14367 }
14368 }
14369 rotation = (float)Math.Atan2(velocity.Y, velocity.X);
14370 if (type == 247)
14371 {
14372 rotation = (float)Math.Atan2(0f - velocity.Y, 0f - velocity.X);
14373 }
14374 }
14375 }
static SlotId PlaySound(in SoundStyle? style, Vector2? position=null, SoundUpdateCallback? updateCallback=null)
Attempts to play a sound style with the provided sound style (if it's not null), and returns a valid ...
Vector2 velocity
The velocity of this Entity in world coordinates per tick.
Definition Entity.cs:33
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
bool active
If true, the Entity actually exists within the game world. Within the specific entity array,...
Definition Entity.cs:21
static readonly SoundStyle Item14
Definition SoundID.cs:705
float GetMyBalance()
Definition NPC.cs:13190
int lifeMax
The maximum life of this NPC.
Definition NPC.cs:1077
void TargetClosest(bool faceTarget=true)
Definition NPC.cs:83247
float[] ai
An array with 4 slots used for any sort of data storage, which is occasionally synced from the server...
Definition NPC.cs:997
float scale
Makes the NPC bigger or smaller. Bigger than 1f is bigger. Defaults to 1f.
Definition NPC.cs:1104
bool collideX
Definition NPC.cs:1134
bool collideY
Definition NPC.cs:1136
int type
The NPC ID of this NPC. The NPC ID is a unique number assigned to each NPC loaded into the game....
Definition NPC.cs:990
int alpha
0 is opaque, and 255 is transparent. Note that this is the opposite of how alpha is typically express...
Definition NPC.cs:1092
float rotation
Definition NPC.cs:1116
bool noTileCollide
If true, the npc does not collide with tiles, making the npc pass through tiles freely....
Definition NPC.cs:1128
static int golemBoss
Definition NPC.cs:586
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
int StrikeNPCNoInteraction(int Damage, float knockBack, int hitDirection)
Definition NPC.cs:91674
int target
Definition NPC.cs:1019

References Terraria.Entity.active, Terraria.NPC.ai, Terraria.NPC.alpha, Terraria.Entity.Center, Terraria.NPC.collideX, Terraria.NPC.collideY, Terraria.Main.getGoodWorld, Terraria.NPC.GetMyBalance(), Terraria.NPC.golemBoss, Terraria.ID.SoundID.Item14, Terraria.NPC.life, Terraria.NPC.lifeMax, Terraria.Main.netMode, Terraria.Dust.NewDustPerfect(), Terraria.NPC.noTileCollide, Terraria.Main.npc, Terraria.Main.OurFavoriteColor, Terraria.Main.player, Terraria.Audio.SoundEngine.PlaySound(), Terraria.Entity.position, Terraria.Main.rand, Terraria.NPC.rotation, Terraria.NPC.scale, Terraria.NetMessage.SendTileSquare(), Terraria.NPC.StrikeNPCNoInteraction(), Terraria.NPC.target, Terraria.NPC.TargetClosest(), Terraria.Main.tile, Terraria.NPC.type, Terraria.Entity.velocity, Terraria.Entity.width, and Terraria.Main.worldSurface.

Referenced by Terraria.NPC.VanillaAI_Inner().

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