Files
CalamityModPublic/Projectiles/Typeless/RelicOfConvergenceCrystal.cs
T
Andrew Marheine 778c089075 1 - Removed Bloodflare mana star drops.
2 - Increased Bloodflare heart drop timer from 3 to 5 seconds.
3 - Moved Revivify, Daedalus Absorb and Absorber healing to Hurt instead of PreHurt.
4 - Reduced various life steal/healing bonuses, made their caps more strict and increased their cooldowns.
5 - Changed Baleful Harvester to be true melee and increased skull velocity and changed the skull AI.
6 - Nerfed RE weapons but made their ammo sold by the Arms Dealer and not drop from bosses.
7 - Adjusted more OOA armors by moving stats from the armor pieces to the set bonuses.
8 - Buffed Relic of Convergence healing, because it wasn't good.
9 - Adjusted DoG phase 2 AI to transition phases at different HP intervals, teleport rift creates a fireball explosion when DoG teleports to it when he's below 60% HP.
10 - Hive Cyst, Perforator Cyst and ??? no longer spawn while the pillars are active.
11 - Nerfed some Malice Mode AIs again and buffed others.
12 - Added new Perforator Hive spore attack, it's scuffed as fuck atm because it's using a placeholder sprite and projectile lol.
13 - Polter movement changed when lining up a charge.
14 - Nerfed Event Horizon homing range and black hole duration.
15 - Nerfed several other projectile homing ranges.
16 - Reduced Venom Staff buff from 66% to 33%.
2021-05-09 19:19:47 -05:00

143 lines
5.8 KiB
C#

using CalamityMod.Dusts;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Typeless
{
public class RelicOfConvergenceCrystal : ModProjectile
{
public const int SoundInterval = 15;
public const int TotalCrystalsToDraw = 3;
public const int CrystalsDrawTime = 90;
public const float MaxCrystalOffsetRadius = 80f;
public const float MaxDustOffsetRadius = 70f;
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Relic of Convergence");
}
public override void SetDefaults()
{
projectile.width = 32;
projectile.height = 46;
projectile.penetrate = -1;
projectile.tileCollide = false;
projectile.ignoreWater = true;
projectile.timeLeft = 240;
}
public override void AI()
{
Player player = Main.player[projectile.owner];
if (!player.channel)
{
projectile.Kill();
return;
}
// Restrict player movement (as a penalty).
player.velocity.X = MathHelper.Clamp(player.velocity.X, -5f, 5f);
if (player.velocity.Y < 0f)
{
player.velocity.Y = MathHelper.Clamp(player.velocity.Y, -6f, 0f);
}
UpdatePlayerVisuals(player);
// Make a constant "magical" sound.
if (projectile.soundDelay <= 0)
{
Main.PlaySound(SoundID.Item4, projectile.Center);
projectile.soundDelay = SoundInterval;
}
projectile.ai[0]++;
// Make a sound when fully charged.
if (projectile.ai[0] == CrystalsDrawTime)
{
Main.PlaySound(SoundID.DD2_DarkMageHealImpact, projectile.Center);
}
// Create a circle of dust. The circle expands outward at first until it reaches its "destination" radius.
// Once the circle is at its maximum size, some of the dust moves inward.
if (projectile.ai[0] >= CrystalsDrawTime)
{
GeneratePassiveDust(player);
}
if (projectile.timeLeft == 1)
{
for (int i = 0; i < 45; i++)
{
Dust dust = Dust.NewDustPerfect(projectile.Center, (int)CalamityDusts.ProfanedFire);
dust.velocity = Utils.NextVector2Circular(Main.rand, 28f, 28f);
dust.fadeIn = Main.rand.NextFloat(3f, 4f);
dust.noGravity = true;
}
player.HealEffect(70, false);
player.statLife += 70;
if (player.statLife > player.statLifeMax2)
{
player.statLife = player.statLifeMax2;
}
Main.PlaySound(SoundID.DD2_DarkMageHealImpact, projectile.Center);
}
}
public void UpdatePlayerVisuals(Player player)
{
projectile.Center = player.Center + Vector2.UnitX * 15f * player.direction;
// The crystal is a holdout projectile, so change the player's variables to reflect that
player.heldProj = projectile.whoAmI;
player.itemTime = 2;
player.itemAnimation = 2;
}
public void GeneratePassiveDust(Player player)
{
float radius = 45f;
if (projectile.ai[0] < CrystalsDrawTime + 30f)
{
radius = MathHelper.Lerp(0f, 45f, (projectile.ai[0] - CrystalsDrawTime) / 30f);
}
for (float angle = 0f; angle <= MathHelper.TwoPi; angle += MathHelper.ToRadians(Main.rand.NextFloat(6f, 8f)))
{
Dust dust = Dust.NewDustPerfect(projectile.Center + angle.ToRotationVector2() * radius, (int)CalamityDusts.ProfanedFire);
dust.position = projectile.Center + angle.ToRotationVector2() * radius;
dust.scale = Main.rand.NextFloat(0.8f, 1.1f);
dust.noGravity = true;
dust.velocity = player.velocity;
if (Main.rand.NextBool(15) || projectile.timeLeft == 1)
{
dust.velocity = projectile.DirectionFrom(dust.position) * Main.rand.NextFloat(4f, 5f);
if (projectile.timeLeft == 1)
dust.velocity *= 1.7f;
}
}
}
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
{
if (projectile.ai[0] >= CrystalsDrawTime)
return true;
float opacity = projectile.ai[0] / CrystalsDrawTime;
Texture2D crystalTexture = ModContent.GetTexture(Texture);
for (int i = 0; i < TotalCrystalsToDraw; i++)
{
float angle = MathHelper.TwoPi / TotalCrystalsToDraw * i + projectile.ai[0] / 10f;
float radius = MathHelper.Lerp(MaxCrystalOffsetRadius, 0f, projectile.ai[0] / CrystalsDrawTime);
Vector2 drawPositionOffset = angle.ToRotationVector2() * radius;
Vector2 drawPosition = projectile.Center + drawPositionOffset;
spriteBatch.Draw(crystalTexture,
drawPosition - Main.screenPosition,
null,
Color.White * opacity,
projectile.rotation,
projectile.Size * 0.5f,
projectile.scale,
SpriteEffects.None,
0f);
}
return false;
}
}
}