Files
CalamityModPublic/Projectiles/Summon/SarosSunfire.cs
T
Memes 48df566aa6 Tweaked Saros Possesion
1 - Removed Scaling.
2 - Made the eclipse projectile the overhead summon.
3 - Renamed some of the projectiles internally.
4 - Made the disk have a sound for when it's thrown.
5 - Consumes 8 minion slots on use and can only be summoned once.
6 - Made the summon a little bit more consistent.
7 - Some code restructure.
2023-02-16 13:12:50 -05:00

71 lines
2.5 KiB
C#

using CalamityMod.Dusts;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.Audio;
namespace CalamityMod.Projectiles.Summon
{
public class SarosSunfire : ModProjectile
{
public Player Owner => Main.player[Projectile.owner];
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Saros Sunfire");
ProjectileID.Sets.MinionShot[Projectile.type] = true;
}
public override void SetDefaults()
{
Projectile.timeLeft = 600;
Projectile.light = 1f;
Projectile.width = Projectile.height = 10;
Projectile.DamageType = DamageClass.Summon;
Projectile.netImportant = true;
Projectile.friendly = true;
Projectile.minion = true;
Projectile.tileCollide = false;
}
public override void AI()
{
NPC target = Projectile.Center.MinionHoming(5000f, Owner); // Detects a target.
// Makes dust because the projectile's sprite is invisible.
for (int moreDust = 0; moreDust < 4; moreDust++)
{
Dust bootlegSprite = Dust.NewDustPerfect(Projectile.Center, (int)CalamityDusts.ProfanedFire);
bootlegSprite.velocity = Vector2.One.RotatedByRandom(MathHelper.TwoPi);
bootlegSprite.scale = bootlegSprite.velocity.Length() * 0.25f;
bootlegSprite.color = Color.Lerp(Color.White, Color.DarkOrange, 0.25f);
bootlegSprite.noGravity = true;
}
// Move towards the target.
if (target != null)
{
Projectile.velocity = Vector2.Lerp(Projectile.velocity, (target.Center - Projectile.Center).SafeNormalize(Vector2.Zero) * 25f, 0.1f);
Projectile.netUpdate = true;
}
}
public override void Kill(int timeLeft) // Makes a dust explosion effect on death.
{
SoundEngine.PlaySound(SoundID.Item14, Projectile.Center);
for (int i = 0; i < 60; i++)
{
Dust dustExplosion = Dust.NewDustPerfect(Projectile.Center, (int)CalamityDusts.ProfanedFire);
dustExplosion.velocity = Vector2.One.RotatedByRandom(MathHelper.TwoPi) * Main.rand.NextFloat(2f, 6f);
dustExplosion.noGravity = true;
}
}
}
}