This does nothing for Calamity since we disable Cultist's homing resist. However, since this is effectively used as a homing projectile set, this will help with crossmod compatibility. I ask that everyone else who changes homing projectiles in any way to help maintain this.
66 lines
2.8 KiB
C#
66 lines
2.8 KiB
C#
using Microsoft.Xna.Framework;
|
|
using Terraria;
|
|
using Terraria.Audio;
|
|
using Terraria.ID;
|
|
using Terraria.ModLoader;
|
|
namespace CalamityMod.Projectiles.Typeless
|
|
{
|
|
public class StickyFeatherAero : ModProjectile, ILocalizedModType
|
|
{
|
|
public new string LocalizationCategory => "Projectiles.Typeless";
|
|
public override string Texture => "CalamityMod/Projectiles/Magic/StickyFeather";
|
|
|
|
public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true;
|
|
public override void SetDefaults()
|
|
{
|
|
Projectile.width = 10;
|
|
Projectile.height = 10;
|
|
Projectile.friendly = true;
|
|
Projectile.tileCollide = false;
|
|
Projectile.timeLeft = 360;
|
|
Projectile.penetrate = 3;
|
|
Projectile.alpha = 255;
|
|
Projectile.aiStyle = ProjAIStyleID.Nail;
|
|
AIType = ProjectileID.NailFriendly;
|
|
}
|
|
|
|
public override void AI()
|
|
{
|
|
if (Projectile.timeLeft < 320)
|
|
{
|
|
Projectile.tileCollide = true;
|
|
}
|
|
CalamityUtils.HomeInOnNPC(Projectile, true, 150f, 12f, 20f);
|
|
}
|
|
|
|
public override void OnKill(int timeLeft)
|
|
{
|
|
SoundEngine.PlaySound(SoundID.Item14, Projectile.position);
|
|
Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2);
|
|
Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2);
|
|
Projectile.width = 50;
|
|
Projectile.height = 50;
|
|
Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2);
|
|
Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2);
|
|
for (int i = 0; i < 15; i++)
|
|
{
|
|
int blueDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.UnusedWhiteBluePurple, 0f, 0f, 100, default, 1.2f);
|
|
Main.dust[blueDust].velocity *= 3f;
|
|
if (Main.rand.NextBool())
|
|
{
|
|
Main.dust[blueDust].scale = 0.5f;
|
|
Main.dust[blueDust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f;
|
|
}
|
|
}
|
|
for (int j = 0; j < 30; j++)
|
|
{
|
|
int blueDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.UnusedWhiteBluePurple, 0f, 0f, 100, default, 1.7f);
|
|
Main.dust[blueDust2].noGravity = true;
|
|
Main.dust[blueDust2].velocity *= 5f;
|
|
blueDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.UnusedWhiteBluePurple, 0f, 0f, 100, default, 1f);
|
|
Main.dust[blueDust2].velocity *= 2f;
|
|
}
|
|
}
|
|
}
|
|
}
|