90 lines
3.3 KiB
C#
90 lines
3.3 KiB
C#
using CalamityMod.Buffs.StatDebuffs;
|
|
using Microsoft.Xna.Framework;
|
|
using Microsoft.Xna.Framework.Graphics;
|
|
using Terraria;
|
|
using Terraria.ID;
|
|
using Terraria.ModLoader;
|
|
|
|
namespace CalamityMod.Projectiles.Ranged
|
|
{
|
|
public class FrostsparkBulletProj : ModProjectile
|
|
{
|
|
public override void SetStaticDefaults()
|
|
{
|
|
DisplayName.SetDefault("Bullet");
|
|
ProjectileID.Sets.TrailCacheLength[projectile.type] = 6;
|
|
ProjectileID.Sets.TrailingMode[projectile.type] = 0;
|
|
}
|
|
|
|
public override void SetDefaults()
|
|
{
|
|
projectile.width = 8;
|
|
projectile.height = 8;
|
|
projectile.aiStyle = 1;
|
|
projectile.friendly = true;
|
|
projectile.ranged = true;
|
|
projectile.penetrate = 1;
|
|
projectile.timeLeft = 600;
|
|
projectile.extraUpdates = 1;
|
|
aiType = ProjectileID.Bullet;
|
|
}
|
|
|
|
public override void AI()
|
|
{
|
|
Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0f / 255f, (255 - projectile.alpha) * 0.15f / 255f, (255 - projectile.alpha) * 0.15f / 255f);
|
|
if (Main.rand.NextBool(2))
|
|
{
|
|
int dustType = Main.rand.Next(3);
|
|
if (dustType == 0)
|
|
{
|
|
dustType = 67;
|
|
}
|
|
else
|
|
{
|
|
dustType = 6;
|
|
}
|
|
int num137 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), 1, 1, dustType, 0f, 0f, 0, default, 0.5f);
|
|
Main.dust[num137].alpha = projectile.alpha;
|
|
Main.dust[num137].velocity *= 0f;
|
|
Main.dust[num137].noGravity = true;
|
|
}
|
|
}
|
|
|
|
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
|
|
{
|
|
CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1);
|
|
return false;
|
|
}
|
|
|
|
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
|
|
{
|
|
target.AddBuff(BuffID.OnFire, 240);
|
|
target.AddBuff(BuffID.Frostburn, 240);
|
|
target.AddBuff(ModContent.BuffType<GlacialState>(), 120);
|
|
}
|
|
|
|
public override void Kill(int timeLeft)
|
|
{
|
|
Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 27);
|
|
// DEFECT -- BoltExplosion does not exist.
|
|
// Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType<BoltExplosion>(), (int)((double)projectile.damage * 0.5), 0f, projectile.owner, 0f, 0f);
|
|
int num212 = Main.rand.Next(10, 20);
|
|
for (int num213 = 0; num213 < num212; num213++)
|
|
{
|
|
int dustType = Main.rand.Next(2);
|
|
if (dustType == 0)
|
|
{
|
|
dustType = 67;
|
|
}
|
|
else
|
|
{
|
|
dustType = 6;
|
|
}
|
|
int num214 = Dust.NewDust(projectile.Center - projectile.velocity / 2f, 0, 0, dustType, 0f, 0f, 100, default, 2f);
|
|
Main.dust[num214].velocity *= 2f;
|
|
Main.dust[num214].noGravity = true;
|
|
}
|
|
}
|
|
}
|
|
}
|