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

◆ AI_125_ClumsySlimeBalloon()

void Terraria.NPC.AI_125_ClumsySlimeBalloon ( )
inlineprivate

Definition at line 44008 of file NPC.cs.

44009 {
44010 //IL_0065: Unknown result type (might be due to invalid IL or missing references)
44011 //IL_006a: Unknown result type (might be due to invalid IL or missing references)
44012 //IL_0076: Unknown result type (might be due to invalid IL or missing references)
44013 //IL_007c: Unknown result type (might be due to invalid IL or missing references)
44014 //IL_0081: Unknown result type (might be due to invalid IL or missing references)
44015 //IL_0086: Unknown result type (might be due to invalid IL or missing references)
44016 //IL_0087: Unknown result type (might be due to invalid IL or missing references)
44017 //IL_0173: Unknown result type (might be due to invalid IL or missing references)
44018 //IL_00ad: Unknown result type (might be due to invalid IL or missing references)
44019 //IL_0094: Unknown result type (might be due to invalid IL or missing references)
44020 //IL_03b2: Unknown result type (might be due to invalid IL or missing references)
44021 //IL_03cf: Unknown result type (might be due to invalid IL or missing references)
44022 //IL_040f: Unknown result type (might be due to invalid IL or missing references)
44023 //IL_049e: Unknown result type (might be due to invalid IL or missing references)
44024 if (localAI[0] == 0f && Main.netMode != 1)
44025 {
44026 TargetClosest();
44027 localAI[0] = 1f;
44028 netUpdate = true;
44029 }
44031 rotation = velocity.X * 0.05f;
44033 float num = float.PositiveInfinity;
44034 int num2 = 0;
44035 Vector2 zero = Vector2.Zero;
44036 if (!targetData.Invalid)
44037 {
44038 zero = targetData.Center - base.Bottom;
44039 if (zero.Y < 0f)
44040 {
44041 num2 = (int)zero.Y / -16;
44042 }
44043 num = ((Vector2)(ref zero)).Length();
44044 if (direction != Math.Sign(zero.X))
44045 {
44046 num2 = 0;
44047 }
44048 }
44049 if (wet || collideX || (collideY && oldVelocity.Y < 0f))
44050 {
44051 float num3 = oldVelocity.X + (float)(direction * 8);
44052 position.X -= num3;
44054 direction *= -1;
44055 velocity.X = direction * 2;
44056 life = -1;
44057 HitEffect();
44058 active = false;
44059 netUpdate = true;
44061 return;
44062 }
44063 if (collideY)
44064 {
44065 velocity.Y = ((oldVelocity.Y > 0f) ? 1 : (-1));
44067 }
44068 float num4 = 3f + Math.Abs(Main.windSpeedTarget) * 2f;
44069 if (Math.Sign(velocity.X) != direction || Math.Abs(velocity.X) < num4)
44070 {
44071 velocity.X += (float)direction * 0.04f;
44072 if (velocity.X * (float)direction < 0f)
44073 {
44074 if (Math.Abs(velocity.X) > num4)
44075 {
44076 velocity.X += (float)direction * 0.15f;
44077 }
44078 else
44079 {
44080 velocity.X += (float)direction * 0.1f;
44081 }
44082 }
44083 else if (Math.Abs(velocity.X) > num4)
44084 {
44085 velocity.X = (float)direction * num4;
44086 }
44087 }
44088 int num5 = (int)((position.X + (float)(width / 2)) / 16f) + direction;
44089 int num6 = (int)((position.Y + (float)height) / 16f);
44090 bool flag = true;
44091 int num7 = 8 + num2;
44092 bool flag2 = false;
44093 for (int i = num6; i < num6 + num7; i++)
44094 {
44095 if (Main.tile[num5, i] == null)
44096 {
44097 Main.tile[num5, i] = default(Tile);
44098 }
44099 if ((Main.tile[num5, i].nactive() && Main.tileSolid[Main.tile[num5, i].type]) || Main.tile[num5, i].liquid > 0)
44100 {
44101 if (i < num6 + 5 + num2)
44102 {
44103 flag2 = true;
44104 }
44105 flag = false;
44106 break;
44107 }
44108 }
44109 if (num < 400f && Collision.CanHit(position, width, height, Main.player[target].position, Main.player[target].width, Main.player[target].height))
44110 {
44111 float num8 = 2f;
44112 float num9 = 0.035f;
44113 if (base.Center.Y + (float)(height / 4) > Main.player[target].position.Y + (float)(Main.player[target].height / 4) && velocity.Y > 0f - num8)
44114 {
44115 velocity.Y -= num9;
44116 if (velocity.Y > 0f)
44117 {
44118 velocity.Y -= num9;
44119 }
44120 }
44121 else if (base.Center.Y + (float)(height / 4) < Main.player[target].position.Y + (float)(Main.player[target].height / 4) && velocity.Y < num8)
44122 {
44123 velocity.Y += num9;
44124 if (velocity.Y < 0f)
44125 {
44126 velocity.Y += num9;
44127 }
44128 }
44129 }
44130 else
44131 {
44132 if (flag)
44133 {
44134 velocity.Y += 0.05f;
44135 }
44136 else
44137 {
44138 velocity.Y -= 0.1f;
44139 }
44140 if (flag2)
44141 {
44142 velocity.Y -= 0.2f;
44143 }
44144 if (velocity.Y > 2f)
44145 {
44146 velocity.Y = 2f;
44147 }
44148 if (velocity.Y < -4f)
44149 {
44150 velocity.Y = -4f;
44151 }
44152 }
44153 }
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 ...
bool wet
The Entity is currently in water. Projectile: Affects movement speed and some projectiles die when ...
Definition Entity.cs:57
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
Vector2 oldVelocity
Definition Entity.cs:37
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
int height
The height of this Entity's hitbox, in pixels.
Definition Entity.cs:51
float[] localAI
Acts like F:Terraria.NPC.ai, but does not sync to the server. Many vanilla T:Terraria....
Definition NPC.cs:1003
int spriteDirection
Definition NPC.cs:1143
void TargetClosest(bool faceTarget=true)
Definition NPC.cs:83247
NPCAimedTarget GetTargetData(bool ignorePlayerTankPets=true)
Definition NPC.cs:1668
bool collideX
Definition NPC.cs:1134
bool collideY
Definition NPC.cs:1136
float rotation
Definition NPC.cs:1116
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
SoundStyle? DeathSound
The sound that plays when this npc dies. Set this to an existing T:Terraria.ID.SoundID entry or assig...
Definition NPC.cs:1067
bool netUpdate
Definition NPC.cs:1130
int target
Definition NPC.cs:1019
void HitEffect(int hitDirection=0, double dmg=10.0, bool? instantKill=null)
Definition NPC.cs:92191

References Terraria.Entity.active, Terraria.Collision.CanHit(), Terraria.NPC.collideX, Terraria.NPC.collideY, Terraria.NPC.DeathSound, Terraria.Entity.direction, Terraria.NPC.GetTargetData(), Terraria.Entity.height, Terraria.NPC.HitEffect(), Terraria.NPC.life, Terraria.NPC.localAI, Terraria.Main.netMode, Terraria.NPC.netUpdate, Terraria.Entity.oldVelocity, Terraria.Main.player, Terraria.Audio.SoundEngine.PlaySound(), Terraria.Entity.position, Terraria.NPC.rotation, Terraria.NPC.spriteDirection, Terraria.NPC.target, Terraria.NPC.TargetClosest(), Terraria.Main.tile, Terraria.Main.tileSolid, Terraria.Entity.velocity, Terraria.Entity.wet, Terraria.Entity.width, and Terraria.Main.windSpeedTarget.

Referenced by Terraria.NPC.VanillaAI_Inner().

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