Replaced Providence's darkness effect with player ignition

This commit is contained in:
Dominic authored and Cameron Ewell committed 2021-07-31 12:17:21 -04:00
1 parent 8d8c3da76b
commit 7c1962cdd5
5 files changed
+87 -89

No files matched your search

+7
View File
@@ -42,6 +42,7 @@ using CalamityMod.NPCs.SulphurousSea;
using CalamityMod.NPCs.SunkenSea;
using CalamityMod.NPCs.SupremeCalamitas;
using CalamityMod.NPCs.Yharon;
using CalamityMod.Particles;
using CalamityMod.Projectiles.Boss;
using CalamityMod.Projectiles.DraedonsArsenal;
using CalamityMod.Projectiles.Enemy;
@@ -72,6 +73,8 @@ using Terraria.Localization;
using Terraria.ModLoader;
using Terraria.ModLoader.IO;
using ProvidenceBoss = CalamityMod.NPCs.Providence.Providence;
namespace CalamityMod.CalPlayer
{
public partial class CalamityPlayer : ModPlayer
@@ -1055,6 +1058,10 @@ namespace CalamityMod.CalPlayer
public bool lecherousOrbEnchant = false;
#endregion Calamitas Enchant Effects
#region Draw Effects
public FireParticleSet ProvidenceBurnEffectDrawer = new FireParticleSet(-1, 1, Color.Yellow, Color.Red * 1.2f, 10f, 0.65f);
#endregion Draw Effects
#endregion
#region SavingAndLoading
+9 -1
View File
@@ -4,8 +4,8 @@ using CalamityMod.Items.Weapons.Magic;
using CalamityMod.Items.Weapons.Melee;
using CalamityMod.Items.Weapons.Ranged;
using CalamityMod.Items.Weapons.Summon;
using CalamityMod.NPCs;
using CalamityMod.Projectiles.Summon;
using CalamityMod.Projectiles.Typeless;
using CalamityMod.World;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
@@ -17,6 +17,8 @@ using Terraria.DataStructures;
using Terraria.ID;
using Terraria.ModLoader;
using ProvidenceBoss = CalamityMod.NPCs.Providence.Providence;
namespace CalamityMod.CalPlayer
{
public class CalamityPlayerDrawEffects : ModPlayer
@@ -71,8 +73,14 @@ namespace CalamityMod.CalPlayer
{
if (drawInfo.shadow != 0f)
return;
Player drawPlayer = drawInfo.drawPlayer;
CalamityPlayer modPlayer = drawPlayer.Calamity();
modPlayer.ProvidenceBurnEffectDrawer.DrawSet(drawPlayer.Bottom - Vector2.UnitY * 10f);
modPlayer.ProvidenceBurnEffectDrawer.SpawnAreaCompactness = 18f;
modPlayer.ProvidenceBurnEffectDrawer.RelativePower = 0.4f;
if (modPlayer.sirenIce)
{
Texture2D texture = ModContent.GetTexture("CalamityMod/ExtraTextures/IceShield");
+31 -42
View File
@@ -46,6 +46,8 @@ using Terraria.Graphics.Shaders;
using Terraria.ID;
using Terraria.ModLoader;
using ProvidenceBoss = CalamityMod.NPCs.Providence.Providence;
namespace CalamityMod.CalPlayer
{
public class CalamityPlayerMiscEffects
@@ -140,48 +142,6 @@ namespace CalamityMod.CalPlayer
#region Revengeance Effects
private static void RevengeanceModeMiscEffects(Player player, CalamityPlayer modPlayer, Mod mod)
{
if (CalamityGlobalNPC.holyBoss != -1)
{
if (Main.npc[CalamityGlobalNPC.holyBoss].active)
{
if (Main.myPlayer == Main.npc[CalamityGlobalNPC.holyBoss].target)
{
float x = Vector2.Distance(Main.player[Main.npc[CalamityGlobalNPC.holyBoss].target].Center, Main.npc[CalamityGlobalNPC.holyBoss].Center);
float aiState = Main.npc[CalamityGlobalNPC.holyBoss].ai[0];
float aiTimer = Main.npc[CalamityGlobalNPC.holyBoss].ai[3];
float baseDistance = 2800f;
float shorterFlameCocoonDistance = (CalamityWorld.death || CalamityWorld.malice || !Main.dayTime) ? 600f : CalamityWorld.revenge ? 400f : Main.expertMode ? 200f : 0f;
float shorterSpearCocoonDistance = (CalamityWorld.death || CalamityWorld.malice || !Main.dayTime) ? 1000f : CalamityWorld.revenge ? 650f : Main.expertMode ? 300f : 0f;
float shorterDistance = aiState == 2f ? shorterFlameCocoonDistance : shorterSpearCocoonDistance;
bool guardianAlive = false;
if (CalamityGlobalNPC.holyBossAttacker != -1)
{
if (Main.npc[CalamityGlobalNPC.holyBossAttacker].active)
guardianAlive = true;
}
if (CalamityGlobalNPC.holyBossDefender != -1)
{
if (Main.npc[CalamityGlobalNPC.holyBossDefender].active)
guardianAlive = true;
}
if (CalamityGlobalNPC.holyBossHealer != -1)
{
if (Main.npc[CalamityGlobalNPC.holyBossHealer].active)
guardianAlive = true;
}
float maxDistance = guardianAlive ? baseDistance : (aiState == 2f || aiState == 5f) ? baseDistance - MathHelper.Lerp(0f, shorterDistance, MathHelper.Clamp(aiTimer / 120f, 0f, 1f)) : baseDistance;
float drawDarknessDistance = maxDistance - 400f;
float intensityScalar = MathHelper.Lerp(0f, 0.9f, MathHelper.Clamp((x - drawDarknessDistance) / 400f, 0f, 1f));
if (!Main.player[Main.npc[CalamityGlobalNPC.holyBoss].target].Calamity().ZoneAbyss && !Main.player[Main.npc[CalamityGlobalNPC.holyBoss].target].headcovered)
ScreenObstruction.screenObstruction = MathHelper.Lerp(ScreenObstruction.screenObstruction, 1f, intensityScalar);
}
}
}
if (CalamityWorld.revenge || CalamityWorld.malice)
{
// This effect is way too annoying during the fight so I disabled it - Fab
@@ -655,6 +615,35 @@ namespace CalamityMod.CalPlayer
}
}
// Update the Providence Burn effect drawer if applicable.
float providenceBurnIntensity = 0f;
if (Main.npc.IndexInRange(CalamityGlobalNPC.holyBoss) && Main.npc[CalamityGlobalNPC.holyBoss].active)
providenceBurnIntensity = (Main.npc[CalamityGlobalNPC.holyBoss].modNPC as ProvidenceBoss).CalculateBurnIntensity();
modPlayer.ProvidenceBurnEffectDrawer.ParticleSpawnRate = int.MaxValue;
// If the burn intensity is great enough, cause the player to ignite into flames.
if (providenceBurnIntensity > 0.45f)
modPlayer.ProvidenceBurnEffectDrawer.ParticleSpawnRate = 1;
// Otherwise, if the intensity is too weak, but still presernt, cause the player to release holy cinders.
else if (providenceBurnIntensity > 0f)
{
int cinderCount = (int)MathHelper.Lerp(1f, 4f, Utils.InverseLerp(0f, 0.45f, providenceBurnIntensity, true));
for (int i = 0; i < cinderCount; i++)
{
if (!Main.rand.NextBool(3))
continue;
Dust holyCinder = Dust.NewDustDirect(player.position, player.width, player.head, (int)CalamityDusts.ProfanedFire);
holyCinder.velocity = Main.rand.NextVector2Circular(3.5f, 3.5f);
holyCinder.velocity.Y -= Main.rand.NextFloat(1f, 3f);
holyCinder.scale = Main.rand.NextFloat(1.15f, 1.45f);
holyCinder.noGravity = true;
}
}
modPlayer.ProvidenceBurnEffectDrawer.Update();
// Immunity to most debuffs
if (modPlayer.invincible)
{
-43
View File
@@ -1402,49 +1402,6 @@ namespace CalamityMod
{
// Apply the calculated darkness value for the local player.
CalamityPlayer modPlayer = Main.LocalPlayer.Calamity();
if (CalamityGlobalNPC.holyBoss != -1)
{
if (Main.npc[CalamityGlobalNPC.holyBoss].active)
{
if (Main.myPlayer == Main.npc[CalamityGlobalNPC.holyBoss].target)
{
float x = Vector2.Distance(Main.player[Main.npc[CalamityGlobalNPC.holyBoss].target].Center, Main.npc[CalamityGlobalNPC.holyBoss].Center);
float aiState = Main.npc[CalamityGlobalNPC.holyBoss].ai[0];
float aiTimer = Main.npc[CalamityGlobalNPC.holyBoss].ai[3];
float baseDistance = 2800f;
float shorterFlameCocoonDistance = (CalamityWorld.death || CalamityWorld.malice || !Main.dayTime) ? 600f : CalamityWorld.revenge ? 400f : Main.expertMode ? 200f : 0f;
float shorterSpearCocoonDistance = (CalamityWorld.death || CalamityWorld.malice || !Main.dayTime) ? 1000f : CalamityWorld.revenge ? 650f : Main.expertMode ? 300f : 0f;
float shorterDistance = aiState == 2f ? shorterFlameCocoonDistance : shorterSpearCocoonDistance;
bool guardianAlive = false;
if (CalamityGlobalNPC.holyBossAttacker != -1)
{
if (Main.npc[CalamityGlobalNPC.holyBossAttacker].active)
guardianAlive = true;
}
if (CalamityGlobalNPC.holyBossDefender != -1)
{
if (Main.npc[CalamityGlobalNPC.holyBossDefender].active)
guardianAlive = true;
}
if (CalamityGlobalNPC.holyBossHealer != -1)
{
if (Main.npc[CalamityGlobalNPC.holyBossHealer].active)
guardianAlive = true;
}
float maxDistance = guardianAlive ? baseDistance : (aiState == 2f || aiState == 5f) ? baseDistance - MathHelper.Lerp(0f, shorterDistance, MathHelper.Clamp(aiTimer / 120f, 0f, 1f)) : baseDistance;
float drawDarknessDistance = maxDistance - 400f;
float intensityScalar = MathHelper.Lerp(0f, 0.9f, MathHelper.Clamp((x - drawDarknessDistance) / 400f, 0f, 1f));
scale -= intensityScalar;
// Return to prevent running other darkness code
return;
}
}
}
float darkRatio = MathHelper.Clamp(modPlayer.caveDarkness, 0f, 1f);
if (modPlayer.ZoneAbyss)
+40 -3
View File
@@ -277,10 +277,10 @@ namespace CalamityMod.NPCs.Providence
{
if (!player.dead && player.active)
player.AddBuff(ModContent.BuffType<HolyInferno>(), 2);
}
}
// Count the remaining Guardians, healer especially because it allows the boss to heal
int guardianAmt = 0;
// Count the remaining Guardians, healer especially because it allows the boss to heal
int guardianAmt = 0;
bool healerAlive = false;
if (CalamityGlobalNPC.holyBossAttacker != -1)
{
@@ -1276,6 +1276,43 @@ namespace CalamityMod.NPCs.Providence
}
}
public float CalculateBurnIntensity()
{
float distanceToTarget = Vector2.Distance(Main.player[npc.target].Center, npc.Center);
float aiTimer = npc.ai[3];
float baseDistance = 2800f;
float shorterFlameCocoonDistance = (CalamityWorld.death || CalamityWorld.malice || !Main.dayTime) ? 600f : CalamityWorld.revenge ? 400f : Main.expertMode ? 200f : 0f;
float shorterSpearCocoonDistance = (CalamityWorld.death || CalamityWorld.malice || !Main.dayTime) ? 1000f : CalamityWorld.revenge ? 650f : Main.expertMode ? 300f : 0f;
float shorterDistance = AIState == (int)Phase.FlameCocoon ? shorterFlameCocoonDistance : shorterSpearCocoonDistance;
bool guardianAlive = false;
if (CalamityGlobalNPC.holyBossAttacker != -1 && Main.npc[CalamityGlobalNPC.holyBossAttacker].active)
guardianAlive = true;
if (CalamityGlobalNPC.holyBossDefender != -1 && Main.npc[CalamityGlobalNPC.holyBossDefender].active)
guardianAlive = true;
if (CalamityGlobalNPC.holyBossHealer != -1 && Main.npc[CalamityGlobalNPC.holyBossHealer].active)
guardianAlive = true;
float maxDistance = baseDistance;
// A factor which measures how much of the distance shortening shave-off should be taken into account.
// It is determined based on how much time has elapsed during the attack thus far, specifically for the two cocoon attacks.
// This shave-off does not happen when guardians are present.
float shorterDistanceFade = Utils.InverseLerp(0f, 120f, aiTimer, true);
if (!guardianAlive)
{
maxDistance = baseDistance;
if (AIState == (int)Phase.FlameCocoon || AIState == (int)Phase.SpearCocoon)
maxDistance -= shorterDistance * shorterDistanceFade;
}
float drawFireDistanceStart = maxDistance - 800f;
return Utils.InverseLerp(drawFireDistanceStart, maxDistance, distanceToTarget, true);
}
private void DespawnSpecificProjectiles()
{
for (int x = 0; x < Main.maxProjectiles; x++)