45956 {
45957
45958
45959
45960
45961
45962
45963
45964
45965
45966
45967
45968
45969
45970
45971
45972
45973
45974
45975
45976
45977
45978
45979
45980
45981
45982
45983
45984
45985
45986
45987
45988
45989
45990
45991
45992
45993
45994
45995
45996
45997
45998
45999
46000
46001
46002
46003
46004
46005
46006
46007
46008
46009
46010
46011
46012
46013
46014
46015
46016
46017
46018
46019
46020
46021
46022
46023
46024
46025
46026
46027
46028
46029
46030
46031
46032
46033
46034
46035
46036
46037
46038
46039
46040
46041
46042
46043
46044
46045
46046
46047
46048
46049
46050
46051
46052
46053
46054
46055
46056
46057
46058
46059
46060
46061
46062
46063
46064
46065
46066
46067
46068
46069
46070
46071
46072
46073
46074
46075
46076
46077
46078
46079
46080
46081
46082
46083
46084
46085
46086
46087
46088
46089
46090
46091
46092
46093
46094
46095
46098 _ = Main.expertMode;
46103 {
46108 }
46109 Lighting.AddLight(
base.Center, 1
f, 0.7f, 0.9f);
46112 {
46115 {
46117 if (Main.player[
target].Center.X <
base.Center.X)
46118 {
46120 }
46121 else
46122 {
46124 }
46125 }
46126 }
46128 {
46131 if (Main.netMode != 1)
46132 {
46135 Point point =
base.Center.ToTileCoordinates();
46136 Point
point2 = Main.player[
target].Center.ToTileCoordinates();
46142 bool flag3 =
false;
46143 if (
ai[3] >= 360
f || ((Vector2)(
ref vector)).Length() > 2000
f)
46144 {
46146 {
46148 }
46151 }
46153 {
46158 {
46159 continue;
46160 }
46162 int i = 0;
46163 if (Main.tile[
num32,
num3].nactive() && Main.tileSolid[Main.tile[
num32,
num3].type] && !Main.tileSolidTop[Main.tile[
num32,
num3].type])
46164 {
46165 i = 1;
46166 }
46167 else
46168 {
46169 for (; i < 150 &&
num3 + i < Main.maxTilesY; i++)
46170 {
46172 if (Main.tile[
num32,
num4].nactive() && Main.tileSolid[Main.tile[
num32,
num4].type] && !Main.tileSolidTop[Main.tile[
num32,
num4].type])
46173 {
46174 i--;
46175 break;
46176 }
46177 }
46178 }
46182 {
46184 }
46185 if (
flag4 && !Collision.CanHitLine(
base.Center, 0, 0, Main.player[
target].Center, 0, 0))
46186 {
46188 }
46190 {
46194 break;
46195 }
46196 }
46198 {
46203 }
46204 }
46205 }
46206 if (!
flag2 && (!Collision.CanHitLine(
base.Center, 0, 0, Main.player[
target].Center, 0, 0) ||
Math.Abs(
base.Top.Y - Main.player[
target].Bottom.Y) > 320
f))
46207 {
46209 }
46210 else
46211 {
46215 {
46216 if (Main.netMode != 1 &&
num5 > 0
f)
46217 {
46219 }
46221 }
46222 }
46224 {
46226 {
46228 }
46229 else
46230 {
46232 }
46237 }
46241 {
46244 {
46246 }
46247 if (
ai[0] == 4
f &&
ai[2] == 1
f)
46248 {
46250 }
46251 if (
ai[0] == 5
f &&
ai[2] != 1
f)
46252 {
46254 }
46255 }
46256 switch ((
int)
ai[0])
46257 {
46258 case 0:
46259 {
46261 {
46263 }
46264 else
46265 {
46269 {
46270 velocity.X *= 0.8f;
46272 {
46274 }
46275 }
46276 }
46278 {
46279 break;
46280 }
46284 {
46286 }
46288 {
46289 break;
46290 }
46293 {
46295 if (Main.rand.Next(2) != 1)
46296 {
46298 }
46299 else
46300 {
46302 }
46304 {
46306 if (player !=
null && player.active && !player.dead && (player.Bottom.Y <
base.Bottom.Y ||
Math.Abs(player.Center.X -
base.Center.X) > 250
f))
46307 {
46310 }
46311 }
46312 }
46313 else
46314 {
46315 switch (Main.rand.Next(3))
46316 {
46317 default:
46319 break;
46320 case 1:
46322 break;
46323 case 2:
46325 break;
46326 }
46327 }
46329 break;
46330 }
46331 case 1:
46332 {
46337 if (
ai[1] >= 30
f && Main.netMode != 1)
46338 {
46343 }
46344 if (Main.netMode == 1 &&
ai[1] >= 60
f)
46345 {
46349 }
46353 {
46355 Main.dust[
num20].noGravity =
true;
46357 obj2.velocity *= 2
f;
46358 }
46359 break;
46360 }
46361 case 2:
46367 {
46369 }
46371 {
46373 }
46374 if (
ai[1] >= 60
f && Main.netMode != 1)
46375 {
46380 }
46381 if (Main.netMode == 1 &&
ai[1] >= 120
f)
46382 {
46385 }
46387 {
46390 for (
int n = 0;
n < 10;
n++)
46391 {
46393 Main.dust[
num18].noGravity =
true;
46395 obj.velocity *= 0.5f;
46396 }
46397 }
46398 break;
46399 case 3:
46402 {
46403 velocity.X *= 0.8f;
46404 if ((
double)velocity.X > -0.1 && (double)
velocity.X < 0.1)
46405 {
46407 }
46410 {
46412 }
46414 {
46416 }
46417 if (!(
ai[1] >= 0
f))
46418 {
46419 break;
46420 }
46424 {
46430 {
46432 }
46433 else
46434 {
46436 }
46437 }
46438 else if (
ai[2] == 2
f)
46439 {
46444 }
46445 else
46446 {
46451 }
46452 }
46453 else
46454 {
46456 {
46457 break;
46458 }
46460 if (Main.getGoodWorld)
46461 {
46463 }
46465 {
46467 {
46469 }
46470 else
46471 {
46472 velocity.X *= 0.93f;
46473 }
46474 }
46475 }
46476 break;
46477 case 4:
46478 {
46483 {
46488 {
46490 }
46491 if (Main.getGoodWorld)
46492 {
46494 }
46498 {
46500 }
46502 {
46508 if (Main.netMode != 1)
46509 {
46511 }
46512 for (
int l = 0;
l < 20;
l++)
46513 {
46515 Main.dust[
num14].noGravity =
true;
46516 Main.dust[
num14].velocity.Y = -5
f + Main.rand.NextFloat() * -3
f;
46517 Main.dust[
num14].velocity.X *= 7
f;
46518 }
46519 }
46520 else if (
ai[1] >= (
float)
num13)
46521 {
46522 for (
int m = 0;
m < 4;
m++)
46523 {
46524 Vector2
vector3 = base.Bottom -
new Vector2(Main.rand.NextFloatDirection() * 16
f, (
float)Main.rand.Next(8));
46527 Main.dust[
num15].noGravity =
true;
46528 Main.dust[
num15].velocity.Y = velocity.Y * 0.9f;
46529 Main.dust[
num15].velocity.X = ((Main.rand.Next(2) == 0) ? (-10
f) : 10
f) + Main.rand.NextFloatDirection() * 3
f;
46530 }
46531 }
46532 velocity.X *= 0.8f;
46536 {
46538 {
46540 }
46542 {
46546 velocity.Y *= 0.8f;
46548 break;
46549 }
46552 if (Main.getGoodWorld)
46553 {
46556 }
46558 {
46559 velocity.Y = 0.01f;
46560 }
46562 {
46563 velocity.Y =
num17;
46564 }
46565 }
46566 else
46567 {
46568 velocity.Y *= 0.8f;
46569 }
46570 break;
46571 }
46572 if (Main.netMode != 1 &&
ai[1] == 0
f)
46573 {
46576 }
46578 if (!(
ai[1] >= 30
f))
46579 {
46580 break;
46581 }
46583 {
46585 if (Main.netMode != 1)
46586 {
46591 }
46592 }
46596 {
46598 }
46601 {
46605 }
46606 else
46607 {
46608 velocity.Y *= 0.95f;
46609 }
46610 break;
46611 }
46612 case 5:
46613 {
46618 {
46620 }
46622 {
46624 if (!(
ai[1] >= 10
f))
46625 {
46626 break;
46627 }
46628 if (Main.netMode != 1)
46629 {
46631 if (Main.getGoodWorld)
46632 {
46634 }
46637 {
46639 }
46641 for (
int j = 0;
j <
num7;
j++)
46642 {
46646 }
46647 }
46652 break;
46653 }
46654 if (Main.netMode != 1 &&
ai[1] == 0
f)
46655 {
46658 }
46661 {
46663 if (Main.netMode != 1)
46664 {
46668 }
46669 }
46671 for (
int k = 0;
k < 4;
k++)
46672 {
46673 Vector2
vector2 = base.Center + Main.rand.NextVector2CircularEdge(
num8,
num8);
46675 {
46677 }
46679 v = v.SafeNormalize(Vector2.Zero) * -8
f;
46682 Main.dust[
num9].noGravity =
true;
46683 Main.dust[
num9].alpha = 250;
46684 Main.dust[
num9].velocity = v;
46685 Main.dust[
num9].customData =
this;
46686 }
46688 {
46690 }
46691 break;
46692 }
46693 }
46696 {
46697 position.X +=
width / 2;
46702 position.X -=
width / 2;
46704 }
46706 {
46707 return;
46708 }
46709 if (Main.rand.Next(360) == 0)
46710 {
46712 }
46713 if (Main.netMode == 1)
46714 {
46715 return;
46716 }
46718 {
46724 }
46727 {
46729 }
46731 {
46732 return;
46733 }
46735 int num23 = Main.rand.Next(1, 3);
46737 {
46738 int x = (int)(
position.X + (
float)Main.rand.Next(
width - 32));
46741 switch (Main.rand.Next(3))
46742 {
46743 case 0:
46745 break;
46746 case 1:
46748 break;
46749 case 2:
46751 break;
46752 }
46755 Main.npc[
num26].velocity.X = (float)Main.rand.Next(-15, 16) * 0.1f;
46756 Main.npc[
num26].velocity.Y = (float)Main.rand.Next(-30, 1) * 0.1f;
46757 Main.npc[
num26].ai[0] = -500 * Main.rand.Next(3);
46758 Main.npc[
num26].ai[1] = 0
f;
46759 if (Main.netMode == 2 &&
num26 < 200)
46760 {
46761 NetMessage.SendData(23, -1, -1,
null,
num26);
46762 }
46763 }
46764 }
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.
Vector2 position
The position of this Entity in world coordinates.
int width
The width of this Entity's hitbox, in pixels.
int height
The height of this Entity's hitbox, in pixels.
static readonly SoundStyle Item167
float[] localAI
Acts like F:Terraria.NPC.ai, but does not sync to the server. Many vanilla T:Terraria....
void EncourageDespawn(int despawnTime)
int lifeMax
The maximum life of this NPC.
void TargetClosest(bool faceTarget=true)
static Color AI_121_QueenSlime_GetDustColor()
bool hide
Indicates that this NPC is drawn at a specific layer in the render order. Must use in conjunction wit...
void AI_121_QueenSlime_FlyMovement()
bool noGravity
If true, the npc will not be affected by gravity. Demon Eyes and other floating npc use this....
float[] ai
An array with 4 slots used for any sort of data storage, which is occasionally synced from the server...
float scale
Makes the NPC bigger or smaller. Bigger than 1f is bigger. Defaults to 1f.
IEntitySource GetSpawnSourceForNPCFromNPCAI()
static int NewNPC(IEntitySource source, int X, int Y, int Type, int Start=0, float ai0=0f, float ai1=0f, float ai2=0f, float ai3=0f, int Target=255)
Spawns an NPC into the game world with the given type. This method should not be called on multipla...
bool noTileCollide
If true, the npc does not collide with tiles, making the npc pass through tiles freely....
int life
The current life of the NPC. Automatically set to the value of F:Terraria.NPC.lifeMax at the end of S...
IEntitySource GetSpawnSource_ForProjectile()