Files
CalamityModPublic/Projectiles/Rogue/ShockGrenadeExplosion.cs
T
Ozzatron 31f396d29b 1 - Replaced AverageDamage with "best class damage"
2 - Shield slams scale with melee instead of anything
3 - A few things scale with summon instead of anything, like Demonshade Red Devil
4 - Hide of Astrum Deus scales with melee instead of anything
5 - Other minor pedantic scaling changes
6 - Hundreds of compile errors
2022-05-22 19:13:21 -04:00

68 lines
2.2 KiB
C#

using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Rogue
{
public class ShockGrenadeExplosion : ModProjectile
{
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
private const float radius = 100f;
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Shock Grenade Explosion");
}
public override void SetDefaults()
{
Projectile.width = 320;
Projectile.height = 320;
Projectile.friendly = true;
Projectile.penetrate = -1;
Projectile.tileCollide = false;
Projectile.ignoreWater = true;
Projectile.timeLeft = 10;
Projectile.usesLocalNPCImmunity = true;
Projectile.localNPCHitCooldown = -1;
Projectile.DamageType = RogueDamageClass.Instance;
}
public override void AI()
{
if (Projectile.timeLeft >= 8)
{
for (int i = 0; i < 50; i++)
{
int dustType = 132;
if (Main.rand.NextBool())
{
dustType = 264;
}
Vector2 dustVelocity = new Vector2(Main.rand.NextFloat(-1, 1), Main.rand.NextFloat(-1, 1));
dustVelocity.Normalize();
dustVelocity *= 8;
int dust = Dust.NewDust(Projectile.Center, 1, 1, dustType, dustVelocity.X, dustVelocity.Y, 0, default, 0.75f);
Main.dust[dust].noGravity = true;
}
}
}
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
{
target.AddBuff(BuffID.Electrified, 180);
}
public override void OnHitPvp(Player target, int damage, bool crit)
{
target.AddBuff(BuffID.Electrified, 180);
}
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, radius, targetHitbox);
}
}