Files
CalamityModPublic/Projectiles/Ranged/IcyBulletProj.cs
T
Andrew Marheine e989939849 1 - Bullets work like they should, in terms of velocity.
2 - Eidolic Wail and Hadopelagic Echo improvements.
3 - Providence Guardians circle her and apply different effects to Provi while alive.
2022-01-12 20:15:06 -06:00

88 lines
3.1 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 IcyBulletProj : ModProjectile
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Icy Bullet");
ProjectileID.Sets.TrailCacheLength[projectile.type] = 3;
ProjectileID.Sets.TrailingMode[projectile.type] = 0;
}
public override void SetDefaults()
{
projectile.width = 4;
projectile.height = 4;
projectile.aiStyle = 1;
aiType = ProjectileID.Bullet;
projectile.timeLeft = 600;
projectile.friendly = true;
projectile.ranged = true;
projectile.coldDamage = true;
projectile.penetrate = 3;
projectile.extraUpdates = 3;
projectile.usesLocalNPCImmunity = true;
projectile.localNPCHitCooldown = 20;
projectile.coldDamage = true;
projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration;
}
public override void AI()
{
projectile.localAI[0] += 1f;
if (projectile.localAI[0] > 4f)
{
if (Main.rand.NextBool(3))
{
int index2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 88, projectile.velocity.X, projectile.velocity.Y, 0, default, 1f);
Main.dust[index2].noGravity = true;
}
}
}
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
{
target.AddBuff(BuffID.Frostburn, 180);
target.AddBuff(ModContent.BuffType<GlacialState>(), 30);
}
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
{
CalamityUtils.DrawAfterimagesFromEdge(projectile, 0, lightColor);
return false;
}
public override Color? GetAlpha(Color lightColor)
{
return new Color(200, 200, 200, projectile.alpha);
}
public override void Kill(int timeLeft)
{
Main.PlaySound(SoundID.Item27, projectile.position);
for (int index1 = 0; index1 < 5; ++index1)
{
int index2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 88, 0f, 0f, 0, new Color(), 0.9f);
Main.dust[index2].noGravity = true;
Main.dust[index2].velocity *= 1.5f;
}
if (projectile.owner == Main.myPlayer)
{
for (int index = 0; index < 2; ++index)
{
float SpeedX = -projectile.velocity.X * Main.rand.Next(40, 70) * 0.01f + Main.rand.Next(-20, 21) * 0.4f;
float SpeedY = -projectile.velocity.Y * Main.rand.Next(40, 70) * 0.01f + Main.rand.Next(-20, 21) * 0.4f;
Projectile.NewProjectile(projectile.Center.X + SpeedX, projectile.Center.Y + SpeedY, SpeedX, SpeedY, ProjectileID.CrystalShard, projectile.damage / 2, 0f, projectile.owner);
}
}
}
}
}