94 lines
3.4 KiB
C#
94 lines
3.4 KiB
C#
using Microsoft.Xna.Framework;
|
|
using System;
|
|
using Terraria;
|
|
using Terraria.Audio;
|
|
using Terraria.ID;
|
|
using Terraria.ModLoader;
|
|
|
|
namespace ForgottenWawiTech.Content.Projectiles.Transcendent
|
|
{
|
|
public class TranscendentNova : ModProjectile
|
|
{
|
|
public override void SetStaticDefaults()
|
|
{
|
|
ProjectileID.Sets.TrailCacheLength[Type] = 10;
|
|
ProjectileID.Sets.TrailingMode[Type] = 2;
|
|
}
|
|
|
|
public override void SetDefaults()
|
|
{
|
|
Projectile.width = 28;
|
|
Projectile.height = 28;
|
|
Projectile.friendly = true;
|
|
Projectile.hostile = false;
|
|
Projectile.penetrate = -1;
|
|
Projectile.timeLeft = 120;
|
|
Projectile.tileCollide = false;
|
|
Projectile.DamageType = DamageClass.Magic;
|
|
Projectile.ignoreWater = true;
|
|
}
|
|
|
|
public override void AI()
|
|
{
|
|
Projectile.rotation += 0.08f;
|
|
Projectile.velocity *= 0.97f;
|
|
Lighting.AddLight(Projectile.Center, 0.55f, 0.35f, 0.75f);
|
|
|
|
if (Projectile.localAI[0]++ > 20f && Main.rand.NextBool(3))
|
|
{
|
|
Dust dust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, DustID.GemAmethyst, Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f, 150, default, 1.3f);
|
|
dust.noGravity = true;
|
|
dust.velocity += Projectile.velocity * 0.1f;
|
|
}
|
|
|
|
if (Projectile.localAI[1]++ >= 8f)
|
|
{
|
|
Projectile.localAI[1] = 0f;
|
|
int healAmount = 1;
|
|
Player owner = Main.player[Projectile.owner];
|
|
if (owner.active && !owner.dead && owner.Distance(Projectile.Center) < 400f)
|
|
{
|
|
owner.statLife = Math.Min(owner.statLife + healAmount, owner.statLifeMax2);
|
|
owner.HealEffect(healAmount);
|
|
}
|
|
}
|
|
}
|
|
|
|
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
|
|
{
|
|
target.AddBuff(BuffID.Daybreak, 300);
|
|
target.AddBuff(ModContent.BuffType<Content.Buffs.Debuffs.TypeNull>(), 300);
|
|
}
|
|
|
|
[Obsolete]
|
|
public override void Kill(int timeLeft)
|
|
{
|
|
SoundEngine.PlaySound(SoundID.Item74, Projectile.Center);
|
|
|
|
for (int i = 0; i < 24; i++)
|
|
{
|
|
Vector2 dustVelocity = Vector2.UnitX.RotatedByRandom(MathHelper.TwoPi) * Main.rand.NextFloat(6f, 12f);
|
|
Dust dust = Dust.NewDustDirect(Projectile.Center, 0, 0, DustID.GemAmethyst, dustVelocity.X, dustVelocity.Y, 120, default, 1.6f);
|
|
dust.noGravity = true;
|
|
}
|
|
|
|
if (Projectile.owner == Main.myPlayer)
|
|
{
|
|
int shardCount = 6;
|
|
for (int i = 0; i < shardCount; i++)
|
|
{
|
|
Vector2 velocity = Vector2.UnitX.RotatedByRandom(MathHelper.TwoPi) * Main.rand.NextFloat(7f, 12f);
|
|
Projectile.NewProjectile(
|
|
Projectile.GetSource_FromThis(),
|
|
Projectile.Center,
|
|
velocity,
|
|
ModContent.ProjectileType<TranscendentBladeShard>(),
|
|
(int)(Projectile.damage * 0.85f),
|
|
Projectile.knockBack,
|
|
Projectile.owner);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|