Files
CalamityModPublic/Projectiles/Rogue/DeepSeaDumbbellWeight.cs
T
DominicKarma42 55e89c9b98 Replaced (hopefully) every magic number with a constant
Note: Does not include item rarities, and appears to shown nonexistant using directive movement in the commit. This does not really affect anything, however.
2020-05-30 17:56:36 -04:00

75 lines
2.7 KiB
C#

using CalamityMod.Buffs.DamageOverTime;
using Microsoft.Xna.Framework;
using System;
using Terraria;
using Terraria.ModLoader;
using Terraria.ID;
namespace CalamityMod.Projectiles.Rogue
{
public class DeepSeaDumbbellWeight : ModProjectile
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Deep Sea Dumbbell");
}
public override void SetDefaults()
{
projectile.width = 14;
projectile.height = 14;
projectile.friendly = true;
projectile.Calamity().rogue = true;
projectile.ignoreWater = true;
projectile.penetrate = 1;
}
public override void AI()
{
projectile.rotation += Math.Abs(projectile.velocity.X) * 0.04f * (float)projectile.direction;
projectile.velocity.Y = projectile.velocity.Y + 0.4f;
projectile.velocity.X = projectile.velocity.X * 0.99f;
if (projectile.velocity.Y > 16f)
{
projectile.velocity.Y = 16f;
}
}
public override void Kill(int timeLeft)
{
Main.PlaySound(SoundID.NPCKilled, (int)projectile.position.X, (int)projectile.position.Y, 43, 0.35f, 0f);
projectile.position = projectile.Center;
projectile.width = projectile.height = 36;
projectile.position.X = projectile.position.X - (float)(projectile.width / 2);
projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2);
int num226 = 36;
for (int num227 = 0; num227 < num226; num227++)
{
Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.25f;
vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center;
Vector2 vector7 = vector6 - projectile.Center;
int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 33, vector7.X, vector7.Y, 100, default, 1f);
Main.dust[num228].noGravity = true;
Main.dust[num228].velocity = vector7;
}
projectile.Damage();
}
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
{
if (target.defense > 0)
target.defense -= 15;
target.AddBuff(ModContent.BuffType<CrushDepth>(), 600);
}
public override void OnHitPvp(Player target, int damage, bool crit)
{
target.AddBuff(ModContent.BuffType<CrushDepth>(), 600);
}
}
}