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

102 lines
3.5 KiB
C#

using CalamityMod.Buffs.DamageOverTime;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.Audio;
namespace CalamityMod.Projectiles.Rogue
{
public class SnapClamProj : ModProjectile
{
public int clamCounter = 0;
public bool openClam = true;
public bool onEnemy = false;
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Snap Clam");
Main.projFrames[Projectile.type] = 2;
}
public override void SetDefaults()
{
Projectile.width = 20;
Projectile.height = 13;
Projectile.friendly = true;
Projectile.DamageType = RogueDamageClass.Instance;
Projectile.ignoreWater = true;
Projectile.penetrate = -1;
}
public override void AI()
{
if (openClam && !onEnemy)
{
++clamCounter;
if (clamCounter >= 30)
{
openClam = false;
Projectile.damage = (int)(Projectile.damage * 0.8);
}
}
if (Projectile.ai[0] == 0f)
{
Projectile.velocity.X = Projectile.velocity.X * 0.99f;
Projectile.velocity.Y = Projectile.velocity.Y + 0.15f;
Projectile.rotation += 0.4f * (float)Projectile.direction;
Projectile.spriteDirection = Projectile.direction;
}
//Sticky Behaviour
Projectile.StickyProjAI(15);
if (openClam && !onEnemy)
{
Projectile.frame = 1;
}
else
{
Projectile.frame = 0;
}
}
public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection)
{
if (openClam)
{
onEnemy = true;
Projectile.ModifyHitNPCSticky(2, false);
}
}
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox)
{
if (targetHitbox.Width > 8 && targetHitbox.Height > 8)
{
targetHitbox.Inflate(-targetHitbox.Width / 8, -targetHitbox.Height / 8);
}
return null;
}
public override void Kill(int timeLeft)
{
SoundEngine.PlaySound(SoundID.Item10, Projectile.position);
Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2);
Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2);
Projectile.width = 13;
Projectile.height = 20;
Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2);
Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2);
for (int num194 = 0; num194 < 20; num194++)
{
int num195 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 14, 0f, 0f, 0, new Color(115, 124, 124), 1f);
Main.dust[num195].noGravity = true;
Main.dust[num195].velocity *= 2f;
}
}
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
{
target.AddBuff(ModContent.BuffType<SnapClamDebuff>(), 240);
}
}
}