Files
CalamityModPublic/Projectiles/Melee/Iceberg.cs
T
termigator1359 1b22071cf4 squash merge: Removed all unused textures
Removed nearly all unused textures in the entire mod, especially focusing on projectiles.
Apotheosis & the Death Valley Duster weapon line were ignored to prevent merge conflicts.
2020-11-15 14:25:46 -05:00

71 lines
2.5 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.Melee
{
public class Iceberg : ModProjectile
{
public override string Texture => "CalamityMod/Projectiles/Boss/IceBomb";
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Iceberg");
ProjectileID.Sets.TrailCacheLength[projectile.type] = 10;
ProjectileID.Sets.TrailingMode[projectile.type] = 1;
}
public override void SetDefaults()
{
projectile.width = 30;
projectile.height = 30;
projectile.friendly = true;
projectile.melee = true;
projectile.penetrate = 1;
projectile.timeLeft = 300;
projectile.coldDamage = true;
}
public override void AI()
{
projectile.rotation += 0.5f;
int dust = Dust.NewDust(projectile.position, projectile.width, projectile.height, 67, 0f, 0f, 100, default, 1f);
Main.dust[dust].noGravity = true;
Main.dust[dust].velocity *= 0f;
}
public override void Kill(int timeLeft)
{
Main.PlaySound(SoundID.Item27, projectile.position);
for (int k = 0; k < 5; k++)
{
Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 67, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f);
}
}
public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection)
{
double newDamageMult = 1.0 - ((double)projectile.timeLeft / 300.0);
damage = (int)((double)damage * newDamageMult);
knockback = 0f;
if (crit || target.buffImmune[ModContent.BuffType<GlacialState>()])
damage *= 2;
}
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
{
int debuffDuration = 300 - projectile.timeLeft;
if (projectile.timeLeft < 270)
target.AddBuff(ModContent.BuffType<GlacialState>(), debuffDuration);
}
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
{
CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2);
return false;
}
}
}