Files
CalamityModPublic/Projectiles/Typeless/DarkIce.cs
T
Doze-Zoze 1c5e9594e5 Replaced Global Iframes
replaced all (i think?) instances of global iframes on projectiles that damage enemies with an equivalent amount of static iframes. Some projectile types, such as Bees and Giant bees, I gave shared static iframes to.

About 650 projectiles were changed here.
2025-03-11 17:09:55 -05:00

73 lines
2.5 KiB
C#

using System;
using CalamityMod.Buffs.StatDebuffs;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.Audio;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Typeless
{
public class DarkIce : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Typeless";
public override string Texture => "CalamityMod/Projectiles/Melee/DarkIceZero";
public override void SetDefaults()
{
Projectile.width = 28;
Projectile.height = 28;
Projectile.aiStyle = ProjAIStyleID.Arrow;
AIType = ProjectileID.Bullet;
Projectile.friendly = true;
Projectile.penetrate = -1;
Projectile.ignoreWater = true;
Projectile.extraUpdates = 1;
Projectile.coldDamage = true;
Projectile.npcProj = true;
Projectile.usesIDStaticNPCImmunity = true;
Projectile.idStaticNPCHitCooldown = 10;
}
public override void AI()
{
if (Projectile.localAI[0] != 1f)
{
Projectile.localAI[0] = 1f;
SoundEngine.PlaySound(SoundID.Item8, Projectile.Center);
}
if (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y) < 16f)
{
Projectile.velocity *= 1.04f;
}
//make pretty dust
int index2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.DungeonWater, Projectile.velocity.X, Projectile.velocity.Y, 0, default, 1.25f);
Main.dust[index2].noGravity = true;
}
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
{
target.AddBuff(BuffID.Frostburn2, 180);
target.AddBuff(ModContent.BuffType<GlacialState>(), 30);
}
public override Color? GetAlpha(Color lightColor)
{
return new Color(198, 197, 246);
}
public override void OnKill(int timeLeft)
{
SoundEngine.PlaySound(SoundID.Item27, Projectile.position);
for (int i = 0; i < 30; i++)
{
int index2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.DungeonWater, 0f, 0f, 0, default, Main.rand.NextFloat(1f, 2f));
Main.dust[index2].noGravity = true;
Main.dust[index2].velocity *= 4f;
}
}
}
}