Files
CalamityModPublic/NPCs/Providence/ProvSky.cs
T
Andrew Marheine d4ff3084e6 1 - Providence makes headcrab and darkness effects gradually fade in when you get close to Holy Inferno barrier.
2 - Aorta now fires blood clots.
3 - Biome Blade inflicts debuffs for a shorter duration, replaced Plague with Venom and cut Glacial State debuff time in half.
4 - Buffed Biome Blade damage by 5.
5 - Dark Energies spread out less and inflilct Distorted for a third of its original duration.
6 - SCal bros move properly now.
7 - Aureus makes laser fire noise when stomping now.
8 - Old Duke spends less time lining up his charge in phase 3.
9 - Increased Cnidarian range, reduced Microwave aura damage, increased Riptide range, reduced Sulphurous Grabber bubble amount, increased Verdant speed and leaf damage.
2020-11-04 18:08:12 -06:00

106 lines
3.1 KiB
C#

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.Graphics.Effects;
using Terraria.ModLoader;
namespace CalamityMod.NPCs.Providence
{
public class ProvSky : CustomSky
{
private bool isActive = false;
private float intensity = 0f;
private int ProvIndex = -1;
public override void Update(GameTime gameTime)
{
if (isActive && intensity < 1f)
{
intensity += 0.01f;
}
else if (!isActive && intensity > 0f)
{
intensity -= 0.01f;
}
}
private float GetIntensity()
{
if (UpdatePIndex())
{
float x = 0f;
if (ProvIndex != -1)
x = Vector2.Distance(Main.player[Main.myPlayer].Center, Main.npc[ProvIndex].Center);
float spawnAnimationTimer = 180f;
float intensityScalar = 0.25f;
if (Main.npc[ProvIndex].Calamity().newAI[3] < spawnAnimationTimer)
intensityScalar = MathHelper.Lerp(0f, intensityScalar, Main.npc[ProvIndex].Calamity().newAI[3] / spawnAnimationTimer);
return (1f - Utils.SmoothStep(3000f, 6000f, x)) * intensityScalar;
}
return 0f;
}
public override Color OnTileColor(Color inColor)
{
float intensity = GetIntensity();
return new Color(Vector4.Lerp(new Vector4(0.5f, 0.8f, 1f, 1f), inColor.ToVector4(), 1f - intensity));
}
private bool UpdatePIndex()
{
int ProvType = ModContent.NPCType<Providence>();
if (ProvIndex >= 0 && Main.npc[ProvIndex].active && Main.npc[ProvIndex].type == ProvType)
{
return true;
}
ProvIndex = -1;
for (int i = 0; i < Main.npc.Length; i++)
{
if (Main.npc[i].active && Main.npc[i].type == ProvType)
{
ProvIndex = i;
break;
}
}
return ProvIndex != -1;
}
public override void Draw(SpriteBatch spriteBatch, float minDepth, float maxDepth)
{
if (maxDepth >= 0 && minDepth < 0)
{
float intensity = GetIntensity();
Color color = Main.dayTime ? new Color(255, 200, 100) : new Color(100, 150, 255);
spriteBatch.Draw(Main.blackTileTexture, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), color * intensity);
}
}
public override float GetCloudAlpha()
{
return 0f;
}
public override void Activate(Vector2 position, params object[] args)
{
isActive = true;
}
public override void Deactivate(params object[] args)
{
isActive = false;
}
public override void Reset()
{
isActive = false;
}
public override bool IsActive()
{
return isActive || intensity > 0f;
}
}
}