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

◆ CastSuperCartLaser()

void Terraria.Mount.CastSuperCartLaser ( Player mountedPlayer)
inlineprivate

Definition at line 4411 of file Mount.cs.

4412 {
4413 int num = Math.Sign(mountedPlayer.velocity.X);
4414 if (num == 0)
4415 {
4416 num = mountedPlayer.direction;
4417 }
4418 if (mountedPlayer.whoAmI != Main.myPlayer || mountedPlayer.velocity.X == 0f)
4419 {
4420 return;
4421 }
4423 int damage = 60;
4424 int num2 = 0;
4425 float num3 = 0f;
4426 for (int i = 0; i < 200; i++)
4427 {
4428 NPC nPC = Main.npc[i];
4429 if (nPC.active && nPC.immune[mountedPlayer.whoAmI] <= 0 && !nPC.dontTakeDamage && nPC.Distance(minecartMechPoint) < 300f && nPC.CanBeChasedBy(mountedPlayer) && Collision.CanHitLine(nPC.position, nPC.width, nPC.height, minecartMechPoint, 0, 0) && Math.Abs(MathHelper.WrapAngle(MathHelper.WrapAngle(nPC.AngleFrom(minecartMechPoint)) - MathHelper.WrapAngle((mountedPlayer.fullRotation + (float)num == -1f) ? ((float)Math.PI) : 0f))) < (float)Math.PI / 4f)
4430 {
4432 Vector2 v = nPC.position + nPC.Size * Utils.RandomVector2(Main.rand, 0f, 1f) - minecartMechPoint;
4433 num3 += v.ToRotation();
4434 num2++;
4435 int num4 = Projectile.NewProjectile(GetProjectileSpawnSource(mountedPlayer), minecartMechPoint.X, minecartMechPoint.Y, v.X, v.Y, 591, 0, 0f, mountedPlayer.whoAmI, mountedPlayer.whoAmI);
4436 Main.projectile[num4].Center = nPC.Center;
4437 Main.projectile[num4].damage = damage;
4438 Main.projectile[num4].Damage();
4439 Main.projectile[num4].damage = 0;
4440 Main.projectile[num4].Center = minecartMechPoint;
4441 }
4442 }
4443 }
static float WrapAngle(float angle)
Definition MathHelper.cs:87
static double Abs(double value)
const double PI
Definition Math.cs:16
static int Sign(decimal value)
Definition Math.cs:1202
static Vector2 GetMinecartMechPoint(Player mountedPlayer, int offX, int offY)
Definition Mount.cs:4445
IEntitySource GetProjectileSpawnSource(Player mountedPlayer)
Definition Mount.cs:2401

References System.Math.Abs(), Terraria.Collision.CanHitLine(), Terraria.Mount.GetMinecartMechPoint(), Terraria.Mount.GetProjectileSpawnSource(), Terraria.Main.myPlayer, Terraria.Projectile.NewProjectile(), Terraria.Main.npc, System.Math.PI, Terraria.Main.projectile, Terraria.Main.rand, Terraria.Utils.RandomVector2(), System.Math.Sign(), Microsoft.Xna.Framework.MathHelper.WrapAngle(), Microsoft.Xna.Framework.Vector2.X, and Microsoft.Xna.Framework.Vector2.Y.

Referenced by Terraria.Mount.UpdateEffects().