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

◆ AI_047_MagnetSphere()

void Terraria.Projectile.AI_047_MagnetSphere ( )
inlineprivate

Definition at line 33789 of file Projectile.cs.

33790 {
33791 if (ai[0] == 0f)
33792 {
33793 ai[0] = velocity.X;
33794 ai[1] = velocity.Y;
33795 }
33796 if (velocity.X > 0f)
33797 {
33798 rotation += (Math.Abs(velocity.Y) + Math.Abs(velocity.X)) * 0.001f;
33799 }
33800 else
33801 {
33802 rotation -= (Math.Abs(velocity.Y) + Math.Abs(velocity.X)) * 0.001f;
33803 }
33804 frameCounter++;
33805 if (frameCounter > 6)
33806 {
33807 frameCounter = 0;
33808 frame++;
33809 if (frame > 4)
33810 {
33811 frame = 0;
33812 }
33813 }
33814 if (velocity.Length() > 2f)
33815 {
33816 velocity *= 0.98f;
33817 }
33818 for (int i = 0; i < 1000; i++)
33819 {
33820 if (i != whoAmI)
33821 {
33822 Projectile projectile = Main.projectile[i];
33823 if (projectile.active && projectile.owner == owner && projectile.type == type && timeLeft > Main.projectile[i].timeLeft && Main.projectile[i].timeLeft > 30)
33824 {
33825 Main.projectile[i].timeLeft = 30;
33826 }
33827 }
33828 }
33830 }
static double Abs(double value)
Vector2 velocity
Definition Entity.cs:16
void AI_047_MagnetSphere_TryAttacking()

References System.Math.Abs(), Terraria.Entity.active, Terraria.Projectile.owner, Terraria.Main.projectile, System.type, and Terraria.Projectile.type.