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

◆ AI_015_Flails_Old()

void Terraria.Projectile.AI_015_Flails_Old ( )
inlineprivate

Definition at line 46142 of file Projectile.cs.

46143 {
46144 //IL_0028: Unknown result type (might be due to invalid IL or missing references)
46145 //IL_002e: Unknown result type (might be due to invalid IL or missing references)
46146 //IL_0033: Unknown result type (might be due to invalid IL or missing references)
46147 //IL_0038: Unknown result type (might be due to invalid IL or missing references)
46148 //IL_00e8: Unknown result type (might be due to invalid IL or missing references)
46149 //IL_0126: Unknown result type (might be due to invalid IL or missing references)
46150 //IL_012c: Unknown result type (might be due to invalid IL or missing references)
46151 //IL_0139: Unknown result type (might be due to invalid IL or missing references)
46152 //IL_072e: Unknown result type (might be due to invalid IL or missing references)
46153 //IL_0738: Unknown result type (might be due to invalid IL or missing references)
46154 //IL_076a: Unknown result type (might be due to invalid IL or missing references)
46155 //IL_0770: Unknown result type (might be due to invalid IL or missing references)
46156 //IL_067f: Unknown result type (might be due to invalid IL or missing references)
46157 //IL_0698: Unknown result type (might be due to invalid IL or missing references)
46158 //IL_03c4: Unknown result type (might be due to invalid IL or missing references)
46160 bool flag = Main.player[owner].dead;
46161 if (!flag)
46162 {
46163 Vector2 val = Main.player[owner].Center - base.Center;
46164 flag = ((Vector2)(ref val)).Length() > 2000f;
46165 }
46166 if (flag)
46167 {
46168 Kill();
46169 return;
46170 }
46171 Main.player[owner].SetDummyItemTime(10);
46172 if (position.X + (float)(width / 2) > Main.player[owner].position.X + (float)(Main.player[owner].width / 2))
46173 {
46174 Main.player[owner].ChangeDir(1);
46175 direction = 1;
46176 }
46177 else
46178 {
46179 Main.player[owner].ChangeDir(-1);
46180 direction = -1;
46181 }
46182 Vector2 mountedCenter = Main.player[owner].MountedCenter;
46183 Vector2 vector = default(Vector2);
46184 ((Vector2)(ref vector))._002Ector(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
46185 float num = mountedCenter.X - vector.X;
46186 float num10 = mountedCenter.Y - vector.Y;
46187 float num11 = (float)Math.Sqrt(num * num + num10 * num10);
46188 if (ai[0] == 0f)
46189 {
46190 float num12 = 160f;
46191 if (type == 63)
46192 {
46193 num12 *= 1.5f;
46194 }
46195 if (type == 247)
46196 {
46197 num12 *= 1.5f;
46198 }
46199 if (type == 757)
46200 {
46201 num12 *= 1.5f;
46202 }
46203 tileCollide = true;
46204 if (num11 > num12)
46205 {
46206 ai[0] = 1f;
46207 netUpdate = true;
46208 }
46209 else if (!Main.player[owner].channel)
46210 {
46211 if (velocity.Y < 0f)
46212 {
46213 velocity.Y *= 0.9f;
46214 }
46215 velocity.Y += 1f;
46216 velocity.X *= 0.9f;
46217 }
46218 }
46219 else if (ai[0] == 1f)
46220 {
46221 float meleeSpeed = Main.player[owner].inverseMeleeSpeed;
46222 float num13 = 14f / meleeSpeed;
46223 float num14 = 0.9f / meleeSpeed;
46224 float num15 = 300f / meleeSpeed;
46225 int num16 = 60;
46226 if (type == 63)
46227 {
46228 num15 *= 1.5f;
46229 num13 *= 1.5f;
46230 num14 *= 1.5f;
46231 }
46232 if (type == 247)
46233 {
46234 num15 *= 1.5f;
46235 num13 = 15.9f;
46236 num14 *= 2f;
46237 num16 = 100;
46238 }
46239 if (type == 757)
46240 {
46241 num15 *= 1.5f;
46242 num13 = 15.9f;
46243 num14 *= 2f;
46244 num16 = 100;
46245 }
46246 Math.Abs(num);
46247 Math.Abs(num10);
46248 if (ai[1] == 1f)
46249 {
46250 tileCollide = false;
46251 }
46252 if (!Main.player[owner].channel || num11 > num15 || !tileCollide)
46253 {
46254 ai[1] = 1f;
46255 if (tileCollide)
46256 {
46257 netUpdate = true;
46258 }
46259 tileCollide = false;
46260 if (num11 < 20f)
46261 {
46262 Kill();
46263 }
46264 }
46265 if (!tileCollide)
46266 {
46267 num14 *= 2f;
46268 }
46269 if (num11 > (float)num16 || !tileCollide)
46270 {
46271 num11 = num13 / num11;
46272 num *= num11;
46273 num10 *= num11;
46274 new Vector2(velocity.X, velocity.Y);
46275 float num17 = num - velocity.X;
46276 float num2 = num10 - velocity.Y;
46277 float num3 = (float)Math.Sqrt(num17 * num17 + num2 * num2);
46278 num3 = num14 / num3;
46279 num17 *= num3;
46280 num2 *= num3;
46281 velocity.X *= 0.98f;
46282 velocity.Y *= 0.98f;
46283 velocity.X += num17;
46284 velocity.Y += num2;
46285 }
46286 else
46287 {
46288 if (Math.Abs(velocity.X) + Math.Abs(velocity.Y) < 6f)
46289 {
46290 velocity.X *= 0.96f;
46291 velocity.Y += 0.2f;
46292 }
46293 if (Main.player[owner].velocity.X == 0f)
46294 {
46295 velocity.X *= 0.96f;
46296 }
46297 }
46298 }
46299 if (type == 247)
46300 {
46301 if (velocity.X < 0f)
46302 {
46303 rotation -= (Math.Abs(velocity.X) + Math.Abs(velocity.Y)) * 0.01f;
46304 }
46305 else
46306 {
46307 rotation += (Math.Abs(velocity.X) + Math.Abs(velocity.Y)) * 0.01f;
46308 }
46309 float num4 = position.X;
46310 float num5 = position.Y;
46311 float num6 = 600f;
46312 bool flag2 = false;
46313 if (owner == Main.myPlayer)
46314 {
46315 localAI[1] += 1f;
46316 if (localAI[1] > 20f)
46317 {
46318 localAI[1] = 20f;
46319 for (int i = 0; i < 200; i++)
46320 {
46321 if (Main.npc[i].CanBeChasedBy(this))
46322 {
46323 float num7 = Main.npc[i].position.X + (float)(Main.npc[i].width / 2);
46324 float num8 = Main.npc[i].position.Y + (float)(Main.npc[i].height / 2);
46325 float num9 = Math.Abs(position.X + (float)(width / 2) - num7) + Math.Abs(position.Y + (float)(height / 2) - num8);
46326 if (num9 < num6 && Collision.CanHit(position, width, height, Main.npc[i].position, Main.npc[i].width, Main.npc[i].height))
46327 {
46328 num6 = num9;
46329 num4 = num7;
46330 num5 = num8;
46331 flag2 = true;
46332 }
46333 }
46334 }
46335 }
46336 }
46337 if (flag2)
46338 {
46339 localAI[1] = 0f;
46340 ((Vector2)(ref vector))._002Ector(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
46341 num = num4 - vector.X;
46342 num10 = num5 - vector.Y;
46343 num11 = (float)Math.Sqrt(num * num + num10 * num10);
46344 num11 = 14f / num11;
46345 num *= num11;
46346 num10 *= num11;
46347 NewProjectile(GetProjectileSource_FromThis(), vector.X, vector.Y, num, num10, 248, (int)((double)damage / 1.5), knockBack / 2f, Main.myPlayer);
46348 }
46349 }
46350 else
46351 {
46352 rotation = (float)Math.Atan2(num10, num) - velocity.X * 0.1f;
46353 }
46354 }
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
int height
The height of this Entity's hitbox, in pixels.
Definition Entity.cs:51
int owner
The index of the player who owns this projectile. In Multiplayer, Clients "own" projectiles that they...
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()
float[] localAI
Acts like F:Terraria.Projectile.ai, but does not sync to the server. Many vanilla T: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...
void AI_015_Flails_Dust(bool doFastThrowDust)
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.Collision.CanHit(), Terraria.Main.myPlayer, Terraria.Main.npc, and Terraria.Main.player.

+ Here is the call graph for this function: