Files
CalamityModPublic/NPCs/Signus/SignusSky.cs
T
Andrew Marheine de49f1a3ff 1 - Fixed Third Sage healing for sure now.
2 - Reworked Cal Clone's AI completely.
3 - Reworked Cryogen's attacks to be cooler...get it?
4 - Malice Mode affects more things.
5 - Malice Mode can be used outside of Rev Mode.
6 - Wall of Flesh shoots a demon scythe from its mouth in rev+ when it belches out leeches.
7 - Made some Malice Mode bosses harder and some easier.
8 - Malice Mode increases certain projectile speeds by 25%.
9 - Malice Mode increases boss damage by 35%.
10 - Rev+ Golem falls faster.
11 - Golem Head hitbox is remaining fucked because I hate the glowmask code, I'm not touching it.
12 - Malice Mode bosses have increased timed DR.
2021-04-29 14:06:18 -05:00

108 lines
3.0 KiB
C#

using CalamityMod.World;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.Graphics.Effects;
using Terraria.ModLoader;
namespace CalamityMod.NPCs.Signus
{
public class SignusSky : CustomSky
{
private bool isActive = false;
private float intensity = 0f;
private int SignusIndex = -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 (this.UpdateSIndex())
{
float x = 0f;
if (this.SignusIndex != -1)
{
x = Vector2.Distance(Main.player[Main.myPlayer].Center, Main.npc[this.SignusIndex].Center);
}
float maxIntensity = 0.1f;
if (CalamityWorld.revenge || CalamityWorld.malice)
{
maxIntensity = 1f - (float)Main.npc[this.SignusIndex].life / (float)Main.npc[this.SignusIndex].lifeMax;
}
return (1f - Utils.SmoothStep(3000f, 6000f, x)) * maxIntensity;
}
return 0f;
}
public override Color OnTileColor(Color inColor)
{
float intensity = this.GetIntensity();
return new Color(Vector4.Lerp(new Vector4(0.5f, 0.8f, 1f, 1f), inColor.ToVector4(), 1f - intensity));
}
private bool UpdateSIndex()
{
int SignusType = ModContent.NPCType<Signus>();
if (SignusIndex >= 0 && Main.npc[SignusIndex].active && Main.npc[SignusIndex].type == SignusType)
{
return true;
}
SignusIndex = -1;
for (int i = 0; i < Main.npc.Length; i++)
{
if (Main.npc[i].active && Main.npc[i].type == SignusType)
{
SignusIndex = i;
break;
}
}
return SignusIndex != -1;
}
public override void Draw(SpriteBatch spriteBatch, float minDepth, float maxDepth)
{
if (maxDepth >= 0 && minDepth < 0)
{
float intensity = this.GetIntensity();
spriteBatch.Draw(Main.blackTileTexture, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), Color.Black * 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;
}
}
}