2 - Stealth no longer gives movement speed. 3 - Moved a bunch of CalamityGlobalProjectile utilities to CalamityUtils where they belong. 4 - Renamed several things in CalamityGlobalProjectile
80 lines
3.6 KiB
C#
80 lines
3.6 KiB
C#
using Microsoft.Xna.Framework;
|
|
using System;
|
|
using Terraria;
|
|
using Terraria.ID;
|
|
using Terraria.ModLoader;
|
|
using Terraria.Audio;
|
|
namespace CalamityMod.Projectiles.Melee
|
|
{
|
|
public class JudgementProj : ModProjectile
|
|
{
|
|
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
|
|
|
|
int whiteLightTimer = 5;
|
|
|
|
public override void SetStaticDefaults()
|
|
{
|
|
DisplayName.SetDefault("Judgement");
|
|
}
|
|
|
|
public override void SetDefaults()
|
|
{
|
|
Projectile.width = 12;
|
|
Projectile.height = 12;
|
|
Projectile.friendly = true;
|
|
Projectile.ignoreWater = true;
|
|
Projectile.penetrate = -1;
|
|
Projectile.timeLeft = 60;
|
|
Projectile.DamageType = DamageClass.Melee;
|
|
}
|
|
|
|
public override void AI()
|
|
{
|
|
whiteLightTimer--;
|
|
if (whiteLightTimer == 0)
|
|
{
|
|
float spread = 180f * 0.0174f;
|
|
double startAngle = Math.Atan2(Projectile.velocity.X, Projectile.velocity.Y) - spread / 2;
|
|
double deltaAngle = spread / 8f;
|
|
double offsetAngle;
|
|
int i;
|
|
if (Projectile.owner == Main.myPlayer)
|
|
{
|
|
for (i = 0; i < 1; i++)
|
|
{
|
|
offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i;
|
|
int projectile1 = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType<WhiteOrb>(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f);
|
|
int projectile2 = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType<WhiteOrb>(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f);
|
|
Main.projectile[projectile1].velocity.X *= 0.1f;
|
|
Main.projectile[projectile1].velocity.Y *= 0.1f;
|
|
Main.projectile[projectile2].velocity.X *= 0.1f;
|
|
Main.projectile[projectile2].velocity.Y *= 0.1f;
|
|
}
|
|
}
|
|
whiteLightTimer = 5;
|
|
}
|
|
|
|
Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.5f / 255f, (255 - Projectile.alpha) * 0.5f / 255f, (255 - Projectile.alpha) * 0.5f / 255f);
|
|
|
|
for (int num457 = 0; num457 < 2; num457++)
|
|
{
|
|
int num458 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 91, 0f, 0f, 100, default, 1.25f);
|
|
Main.dust[num458].noGravity = true;
|
|
Main.dust[num458].velocity *= 0.5f;
|
|
Main.dust[num458].velocity += Projectile.velocity * 0.1f;
|
|
}
|
|
|
|
CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 200f, 9f, 20f);
|
|
}
|
|
|
|
public override void Kill(int timeLeft)
|
|
{
|
|
SoundEngine.PlaySound(SoundID.Item122, Projectile.position);
|
|
if (Projectile.owner == Main.myPlayer)
|
|
{
|
|
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y - 100, 0f, 0f, ModContent.ProjectileType<WhiteBoltAura>(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f);
|
|
}
|
|
}
|
|
}
|
|
}
|