Files
CalamityModPublic/Projectiles/Rogue/SandDollarStealth.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

71 lines
2.4 KiB
C#

using CalamityMod.Projectiles.Ranged;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Rogue
{
public class SandDollarStealth : ModProjectile
{
public override string Texture => "CalamityMod/Items/Weapons/Rogue/SandDollar";
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Sand Dollar");
}
public override void SetDefaults()
{
Projectile.width = 30;
Projectile.height = 28;
Projectile.DamageType = RogueDamageClass.Instance;
Projectile.friendly = true;
Projectile.penetrate = -1;
Projectile.aiStyle = 3;
Projectile.timeLeft = 300;
AIType = ProjectileID.Bananarang;
Projectile.usesLocalNPCImmunity = true;
Projectile.localNPCHitCooldown = 10;
}
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
{
OnHitEffects();
}
public override void OnHitPvp(Player target, int damage, bool crit)
{
OnHitEffects();
}
private void OnHitEffects()
{
int coralAmt = Main.rand.Next(1, 4);
if (Projectile.owner == Main.myPlayer && Projectile.Calamity().stealthStrike)
{
for (int coralCount = 0; coralCount < coralAmt; coralCount++)
{
Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f);
int coral = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType<SmallCoral>(), Projectile.damage / 3, 0f, Projectile.owner);
if (coral.WithinBounds(Main.maxProjectiles))
Main.projectile[coral].Calamity().forceRogue = true;
}
}
}
public override bool OnTileCollide(Vector2 oldVelocity)
{
Projectile.ai[0] += 0.1f;
if (Projectile.velocity.X != oldVelocity.X)
{
Projectile.velocity.X = -oldVelocity.X;
}
if (Projectile.velocity.Y != oldVelocity.Y)
{
Projectile.velocity.Y = -oldVelocity.Y;
}
return false;
}
}
}