Files
CalamityModPublic/Projectiles/Magic/BeamingBolt.cs
T
mountaindrew10 f629e9cfb7 1 - Yharon sun during bullet hell.
2 - Pulse Pistol uses 6 mana.
3 - Barracuda Gun can latch both barracudas onto the same enemy and the spread is consistent now.
4 - Cryogen gets reduced defense as it continues to crack.
5 - Rev+ Golem free head uses new movement that's hopefully way less jank and smoother.
6 - Thorn Blossom and Arch Amarylis bolts move like they're supposed to.
7 - Icebreaker moves far faster and lasts a bit longer.
2022-05-13 10:51:21 -05:00

86 lines
3.7 KiB
C#

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.Audio;
namespace CalamityMod.Projectiles.Magic
{
public class BeamingBolt : ModProjectile
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Beaming Bolt");
}
public override void SetDefaults()
{
Projectile.width = Projectile.height = 30;
Projectile.friendly = true;
Projectile.timeLeft = 120;
Projectile.penetrate = -1;
Projectile.DamageType = DamageClass.Magic;
}
public override bool PreDraw(ref Color lightColor)
{
Texture2D tex = ModContent.Request<Texture2D>(Texture).Value;
if (Projectile.ai[0] == 1f)
tex = ModContent.Request<Texture2D>("CalamityMod/Projectiles/Magic/BeamingThornBlossom").Value;
Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0);
return false;
}
public override void AI()
{
Projectile.rotation += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.01f * (float)Projectile.direction;
Projectile.velocity *= 0.98f;
for (int dust = 0; dust < 2; dust++)
{
int randomDust = Utils.SelectRandom(Main.rand, new int[]
{
164,
58,
204
});
Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, randomDust, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f);
}
}
public override void Kill(int timeLeft)
{
for (int k = 0; k < 6; k++)
{
int randomDust = Utils.SelectRandom(Main.rand, new int[]
{
164,
58,
204
});
Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, randomDust, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f);
}
float spread = 90f * 0.0174f;
double startAngle = Math.Atan2(Projectile.velocity.X, Projectile.velocity.Y) - spread / 2;
double deltaAngle = spread / 8f;
double offsetAngle;
if (Projectile.owner == Main.myPlayer)
{
for (int i = 0; i < 4; i++)
{
offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i;
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType<BeamingBolt2>(), (int)(Projectile.damage * 0.75), Projectile.knockBack, Projectile.owner, Projectile.ai[0], 0f);
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType<BeamingBolt2>(), (int)(Projectile.damage * 0.75), Projectile.knockBack, Projectile.owner, Projectile.ai[0], 0f);
}
}
SoundEngine.PlaySound(SoundID.Item105, Projectile.position);
}
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
{
target.immune[Projectile.owner] = 7;
}
}
}