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

◆ AI_134_Ballista()

void Terraria.Projectile.AI_134_Ballista ( )
inlineprivate

Definition at line 75387 of file Projectile.cs.

75388 {
75389 //IL_000d: Unknown result type (might be due to invalid IL or missing references)
75390 //IL_0012: Unknown result type (might be due to invalid IL or missing references)
75391 //IL_02d4: Unknown result type (might be due to invalid IL or missing references)
75392 //IL_02fa: Unknown result type (might be due to invalid IL or missing references)
75393 //IL_0333: Unknown result type (might be due to invalid IL or missing references)
75394 //IL_030f: Unknown result type (might be due to invalid IL or missing references)
75395 //IL_0314: Unknown result type (might be due to invalid IL or missing references)
75396 //IL_0315: Unknown result type (might be due to invalid IL or missing references)
75397 //IL_031a: Unknown result type (might be due to invalid IL or missing references)
75398 //IL_0326: Unknown result type (might be due to invalid IL or missing references)
75399 //IL_032b: Unknown result type (might be due to invalid IL or missing references)
75400 //IL_0330: Unknown result type (might be due to invalid IL or missing references)
75401 //IL_019a: Unknown result type (might be due to invalid IL or missing references)
75402 //IL_0369: Unknown result type (might be due to invalid IL or missing references)
75403 //IL_036d: Unknown result type (might be due to invalid IL or missing references)
75404 //IL_0372: Unknown result type (might be due to invalid IL or missing references)
75405 //IL_01b2: Unknown result type (might be due to invalid IL or missing references)
75406 //IL_01b7: Unknown result type (might be due to invalid IL or missing references)
75407 //IL_01b8: Unknown result type (might be due to invalid IL or missing references)
75408 //IL_01bd: Unknown result type (might be due to invalid IL or missing references)
75409 //IL_01c2: Unknown result type (might be due to invalid IL or missing references)
75410 //IL_01c7: Unknown result type (might be due to invalid IL or missing references)
75411 //IL_01c8: Unknown result type (might be due to invalid IL or missing references)
75412 //IL_01ca: Unknown result type (might be due to invalid IL or missing references)
75413 //IL_01d3: Unknown result type (might be due to invalid IL or missing references)
75414 //IL_0387: Unknown result type (might be due to invalid IL or missing references)
75415 //IL_0388: Unknown result type (might be due to invalid IL or missing references)
75416 //IL_022b: Unknown result type (might be due to invalid IL or missing references)
75417 float shot_range = 900f;
75418 float deadBottomAngle = 0.75f;
75419 Vector2 center = base.Center;
75420 int num = 680;
75421 int num2 = 12;
75422 float num3 = 16f;
75423 int num4 = 1;
75424 int num5 = 5;
75425 int num6 = 5;
75426 if (Main.player[owner].setSquireT2)
75427 {
75428 num3 = 21f;
75429 }
75431 num2 = num6;
75432 if (type == 677)
75433 {
75434 center.Y -= 4f;
75435 }
75436 if (ai[0] == 0f)
75437 {
75438 direction = (spriteDirection = Main.player[owner].direction);
75439 ai[0] = 1f;
75440 ai[1] = 0f;
75441 netUpdate = true;
75442 if (direction == -1)
75443 {
75444 rotation = (float)Math.PI;
75445 }
75446 }
75447 if (ai[0] == 1f)
75448 {
75449 frame = 0;
75450 bool flag = false;
75451 if (Main.player[owner].ballistaPanic && ai[1] > 60f)
75452 {
75453 ai[1] = 60f;
75454 }
75455 if (Main.player[owner].ballistaPanic && Main.player[owner].setSquireT3 && ai[1] > 30f)
75456 {
75457 ai[1] = 30f;
75458 }
75459 if (ai[1] > 0f)
75460 {
75461 ai[1] -= 1f;
75462 }
75463 else
75464 {
75465 flag = true;
75466 }
75468 if (num7 != -1)
75469 {
75470 Vector2 vector = (vector = (Main.npc[num7].Center - center).SafeNormalize(Vector2.UnitY));
75471 rotation = rotation.AngleLerp(vector.ToRotation(), 0.08f);
75472 if (rotation > (float)Math.PI / 2f || rotation < -(float)Math.PI / 2f)
75473 {
75474 direction = -1;
75475 }
75476 else
75477 {
75478 direction = 1;
75479 }
75480 if (flag && owner == Main.myPlayer)
75481 {
75482 direction = Math.Sign(vector.X);
75483 ai[0] = 2f;
75484 ai[1] = 0f;
75485 netUpdate = true;
75486 }
75487 }
75488 else
75489 {
75490 float targetAngle = 0f;
75491 if (direction == -1)
75492 {
75493 targetAngle = (float)Math.PI;
75494 }
75495 rotation = rotation.AngleLerp(targetAngle, 0.05f);
75496 }
75497 }
75498 else if (ai[0] == 2f)
75499 {
75500 frame = num4 + (int)(ai[1] / (float)num6);
75501 if (ai[1] == (float)num2)
75502 {
75504 Vector2 vector2 = default(Vector2);
75505 ((Vector2)(ref vector2))._002Ector((float)direction, 0f);
75507 if (num8 != -1)
75508 {
75509 vector2 = (Main.npc[num8].Center - center).SafeNormalize(Vector2.UnitX * (float)direction);
75510 }
75511 rotation = vector2.ToRotation();
75512 if (rotation > (float)Math.PI / 2f || rotation < -(float)Math.PI / 2f)
75513 {
75514 direction = -1;
75515 }
75516 else
75517 {
75518 direction = 1;
75519 }
75520 Vector2 vector3 = vector2 * num3;
75521 if (owner == Main.myPlayer)
75522 {
75524 }
75525 }
75526 if ((ai[1] += 1f) >= (float)(num5 * num6))
75527 {
75528 ai[0] = 1f;
75530 }
75531 }
75533 tileCollide = true;
75534 velocity.Y += 0.2f;
75535 }
static SlotId PlayTrackedSound(in SoundStyle style, Vector2? position=null)
static readonly SoundStyle DD2_BallistaTowerShot
Definition SoundID.cs:59
int AI_134_Ballista_FindTarget(float shot_range, float deadBottomAngle, Vector2 shootingSpot)
int owner
The index of the player who owns this projectile. In Multiplayer, Clients "own" projectiles that they...
static int GetBallistraShotDelay(Player player)
int damage
This will always be set in Projectile.NewProjectile based on the weapons damage and player stat modif...
float[] ai
An array with 3 slots used for any sort of data storage, which is occasionally synced to the server....
bool netUpdate
Set manually to true in M:Terraria.ModLoader.ModProjectile.AI once to make it sync its current F:Terr...
IEntitySource GetProjectileSource_FromThis()
int frame
The frame number in the spritesheet that this projectile will be drawn with. Assign in M:Terraria....
float knockBack
This will always be set in Projectile.NewProjectile based on the weapons knockback and player stat mo...
int type
The Projectile ID of this projectile. The Projectile ID is a unique number assigned to each Projectil...
bool tileCollide
If true, the projectile will collide with tiles, usually bouncing or killing the tile depending on M:...
float rotation
Rotation of the projectile. Radians not Degrees. Use T:Microsoft.Xna.Framework.MathHelper if you want...
static int NewProjectile(IEntitySource spawnSource, Vector2 position, Vector2 velocity, int Type, int Damage, float KnockBack, int Owner=-1, float ai0=0f, float ai1=0f, float ai2=0f)
This particular overload uses a Vector2 instead of X and Y to determine the actual spawn position and...

References Terraria.ID.SoundID.DD2_BallistaTowerShot, Terraria.Main.myPlayer, Terraria.Main.npc, Terraria.Main.player, and Terraria.Audio.SoundEngine.PlayTrackedSound().

+ Here is the call graph for this function: