Files
CalamityModPublic/Projectiles/Ranged/PlanarRipperExplosion.cs
T
Andrew Marheine 9c21774b9a 1 - Nerfed Lion Heart.
2 - Old Duke resists Last Mourning projectiles.
3 - Edited all Demonshade enrage AIs.
4 - Profaned Energy flames are no longer cyan when it's night.
2021-06-06 23:57:50 -05:00

80 lines
2.8 KiB
C#

using Microsoft.Xna.Framework;
using System;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Ranged
{
public class PlanarRipperExplosion : ModProjectile
{
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Explosion");
}
public override void SetDefaults()
{
projectile.width = 50;
projectile.height = 50;
projectile.friendly = true;
projectile.ignoreWater = true;
projectile.tileCollide = false;
projectile.ranged = true;
projectile.penetrate = -1;
projectile.timeLeft = 30;
projectile.usesLocalNPCImmunity = true;
projectile.localNPCHitCooldown = -1;
}
public override void AI()
{
Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.01f / 255f, (255 - projectile.alpha) * 0.05f / 255f, (255 - projectile.alpha) * 0.15f / 255f);
float num461 = 25f;
if (projectile.ai[0] > 180f)
{
num461 -= (projectile.ai[0] - 180f) / 2f;
}
if (num461 <= 0f)
{
num461 = 0f;
projectile.Kill();
}
num461 *= 0.7f;
projectile.ai[0] += 4f;
int num462 = 0;
while ((float)num462 < num461)
{
float num463 = (float)Main.rand.Next(-10, 11);
float num464 = (float)Main.rand.Next(-10, 11);
float num465 = (float)Main.rand.Next(3, 9);
float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464));
num466 = num465 / num466;
num463 *= num466;
num464 *= num466;
int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 132, 0f, 0f, 100, default, 0.5f);
Dust dust = Main.dust[num467];
dust.noGravity = true;
dust.position.X = projectile.Center.X;
dust.position.Y = projectile.Center.Y;
dust.position.X += (float)Main.rand.Next(-10, 11);
dust.position.Y += (float)Main.rand.Next(-10, 11);
dust.velocity.X = num463;
dust.velocity.Y = num464;
num462++;
}
}
public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection)
{
projectile.damage = (int)(projectile.damage * 0.75);
}
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
{
target.AddBuff(BuffID.Electrified, 180);
}
}
}