Fixed various Boss Rush problems
This commit is contained in:
1 parent
ce4f889aca
commit
d72fce3b25
13 files changed
+67
-109
No files matched your search
@@ -3222,80 +3222,10 @@ namespace CalamityMod.CalPlayer
|
||||
|
||||
public static void UnderworldTeleport(Player player, bool syncData = false)
|
||||
{
|
||||
int teleportStartX = 100;
|
||||
int teleportRangeX = Main.maxTilesX - 200;
|
||||
int teleportStartY = Main.maxTilesY - 200;
|
||||
int teleportRangeY = 50;
|
||||
bool flag = false;
|
||||
int num = 0;
|
||||
int num2 = 0;
|
||||
int num3 = 0;
|
||||
int width = player.width;
|
||||
Vector2 vector = new Vector2((float)num2, (float)num3) * 16f + new Vector2((float)(-(float)width / 2 + 8), (float)-(float)player.height);
|
||||
while (!flag && num < 1000)
|
||||
{
|
||||
num++;
|
||||
num2 = teleportStartX + Main.rand.Next(teleportRangeX);
|
||||
num3 = teleportStartY + Main.rand.Next(teleportRangeY);
|
||||
vector = new Vector2((float)num2, (float)num3) * 16f + new Vector2((float)(-(float)width / 2 + 8), (float)-(float)player.height);
|
||||
if (!Collision.SolidCollision(vector, width, player.height))
|
||||
{
|
||||
int i = 0;
|
||||
while (i < 100)
|
||||
{
|
||||
Tile tile = Main.tile[num2, num3 + i];
|
||||
vector = new Vector2((float)num2, (float)(num3 + i)) * 16f + new Vector2((float)(-(float)width / 2 + 8), (float)-(float)player.height);
|
||||
Vector4 vector2 = Collision.SlopeCollision(vector, player.velocity, width, player.height, player.gravDir, false);
|
||||
bool arg_1FF_0 = !Collision.SolidCollision(vector, width, player.height);
|
||||
if (vector2.Z == player.velocity.X && vector2.Y == player.velocity.Y && vector2.X == vector.X)
|
||||
{
|
||||
bool arg_1FE_0 = vector2.Y == vector.Y;
|
||||
}
|
||||
if (arg_1FF_0)
|
||||
{
|
||||
i++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (tile.HasTile && !tile.HasUnactuatedTile && Main.tileSolid[(int)tile.TileType])
|
||||
{
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
if (!Collision.LavaCollision(vector, width, player.height) && Collision.HurtTiles(vector, player.velocity, width, player.height, false).Y <= 0f)
|
||||
{
|
||||
Collision.SlopeCollision(vector, player.velocity, width, player.height, player.gravDir, false);
|
||||
if (Collision.SolidCollision(vector, width, player.height) && i < 99)
|
||||
{
|
||||
Vector2 vector3 = Vector2.UnitX * 16f;
|
||||
if (!(Collision.TileCollision(vector - vector3, vector3, player.width, player.height, false, false, (int)player.gravDir) != vector3))
|
||||
{
|
||||
vector3 = -Vector2.UnitX * 16f;
|
||||
if (!(Collision.TileCollision(vector - vector3, vector3, player.width, player.height, false, false, (int)player.gravDir) != vector3))
|
||||
{
|
||||
vector3 = Vector2.UnitY * 16f;
|
||||
if (!(Collision.TileCollision(vector - vector3, vector3, player.width, player.height, false, false, (int)player.gravDir) != vector3))
|
||||
{
|
||||
vector3 = -Vector2.UnitY * 16f;
|
||||
if (!(Collision.TileCollision(vector - vector3, vector3, player.width, player.height, false, false, (int)player.gravDir) != vector3))
|
||||
{
|
||||
flag = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!flag)
|
||||
{
|
||||
return;
|
||||
}
|
||||
ModTeleport(player, vector, syncData, false);
|
||||
if (Main.netMode == NetmodeID.SinglePlayer)
|
||||
player.DemonConch();
|
||||
else if (Main.netMode == NetmodeID.MultiplayerClient && player.whoAmI == Main.myPlayer)
|
||||
NetMessage.SendData(MessageID.RequestTeleportationByServer, -1, -1, null, 2);
|
||||
}
|
||||
|
||||
public static void DungeonTeleport(Player player, bool syncData = false)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using CalamityMod.Events;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.Graphics.Effects;
|
||||
using Terraria.Graphics.Shaders;
|
||||
@@ -35,10 +36,10 @@ namespace CalamityMod.NPCs.Calamitas
|
||||
|
||||
public override void Update(GameTime gameTime)
|
||||
{
|
||||
if (CalIndex == -1)
|
||||
if (CalIndex == -1 || BossRushEvent.BossRushActive)
|
||||
{
|
||||
UpdateCalIndex();
|
||||
if (CalIndex == -1)
|
||||
if (CalIndex == -1 || BossRushEvent.BossRushActive)
|
||||
Filters.Scene["CalamityMod:CalamitasRun3"].Deactivate();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using CalamityMod.Events;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.GameContent;
|
||||
@@ -15,10 +16,10 @@ namespace CalamityMod.NPCs.Calamitas
|
||||
|
||||
public override void Update(GameTime gameTime)
|
||||
{
|
||||
if (CalIndex == -1)
|
||||
if (CalIndex == -1 || BossRushEvent.BossRushActive)
|
||||
{
|
||||
UpdateCalIndex();
|
||||
if (CalIndex == -1)
|
||||
if (CalIndex == -1 || BossRushEvent.BossRushActive)
|
||||
isActive = false;
|
||||
}
|
||||
|
||||
@@ -41,7 +42,7 @@ namespace CalamityMod.NPCs.Calamitas
|
||||
{
|
||||
x = Vector2.Distance(Main.player[Main.myPlayer].Center, Main.npc[this.CalIndex].Center);
|
||||
}
|
||||
return 1f - Utils.SmoothStep(3000f, 6000f, x);
|
||||
return (1f - Utils.SmoothStep(3000f, 6000f, x)) * intensity;
|
||||
}
|
||||
return 0f;
|
||||
}
|
||||
|
||||
@@ -151,7 +151,7 @@ namespace CalamityMod.NPCs.Cryogen
|
||||
for (int spike = 0; spike < 4; spike++)
|
||||
{
|
||||
randomSpread = Main.rand.Next(-200, 200) / 100;
|
||||
for (int x = 0; x < 4; x++)
|
||||
for (int x = 1; x <= 4; x++)
|
||||
Gore.NewGore(NPC.Center, NPC.velocity * randomSpread, Mod.Find<ModGore>("CryoShieldGore" + x).Type, 1f);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using CalamityMod.Events;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.Graphics.Effects;
|
||||
using Terraria.Graphics.Shaders;
|
||||
@@ -35,10 +36,10 @@ namespace CalamityMod.NPCs.Leviathan
|
||||
|
||||
public override void Update(GameTime gameTime)
|
||||
{
|
||||
if (LevIndex == -1)
|
||||
if (LevIndex == -1 || BossRushEvent.BossRushActive)
|
||||
{
|
||||
UpdateLIndex();
|
||||
if (LevIndex == -1)
|
||||
if (LevIndex == -1 || BossRushEvent.BossRushActive)
|
||||
Filters.Scene["CalamityMod:Leviathan"].Deactivate();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using CalamityMod.Events;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.GameContent;
|
||||
@@ -15,10 +16,10 @@ namespace CalamityMod.NPCs.Leviathan
|
||||
|
||||
public override void Update(GameTime gameTime)
|
||||
{
|
||||
if (LevIndex == -1)
|
||||
if (LevIndex == -1 || BossRushEvent.BossRushActive)
|
||||
{
|
||||
UpdateLIndex();
|
||||
if (LevIndex == -1)
|
||||
if (LevIndex == -1 || BossRushEvent.BossRushActive)
|
||||
isActive = false;
|
||||
}
|
||||
|
||||
@@ -47,7 +48,7 @@ namespace CalamityMod.NPCs.Leviathan
|
||||
if (Main.npc[LevIndex].Calamity().newAI[3] < spawnAnimationTimer)
|
||||
intensityScalar = MathHelper.Lerp(0f, intensityScalar, Main.npc[LevIndex].Calamity().newAI[3] / spawnAnimationTimer);
|
||||
|
||||
return (1f - Utils.SmoothStep(3000f, 6000f, x)) * intensityScalar;
|
||||
return (1f - Utils.SmoothStep(3000f, 6000f, x)) * intensityScalar * intensity;
|
||||
}
|
||||
return 0f;
|
||||
}
|
||||
@@ -82,7 +83,7 @@ namespace CalamityMod.NPCs.Leviathan
|
||||
if (maxDepth >= 0 && minDepth < 0)
|
||||
{
|
||||
float intensity = GetIntensity();
|
||||
spriteBatch.Draw(TextureAssets.BlackTile.Value, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), new Color(0, 0, 15) * intensity);
|
||||
spriteBatch.Draw(TextureAssets.BlackTile.Value, new Rectangle(0, 0, Main.screenWidth * 2, Main.screenHeight * 2), new Color(0, 0, 15) * intensity);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using CalamityMod.Events;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.GameContent;
|
||||
@@ -15,10 +16,10 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath
|
||||
|
||||
public override void Update(GameTime gameTime)
|
||||
{
|
||||
if (PbGIndex == -1)
|
||||
if (PbGIndex == -1 || BossRushEvent.BossRushActive)
|
||||
{
|
||||
UpdatePbGIndex();
|
||||
if (PbGIndex == -1)
|
||||
if (PbGIndex == -1 || BossRushEvent.BossRushActive)
|
||||
isActive = false;
|
||||
}
|
||||
|
||||
@@ -41,7 +42,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath
|
||||
{
|
||||
x = Vector2.Distance(Main.player[Main.myPlayer].Center, Main.npc[this.PbGIndex].Center);
|
||||
}
|
||||
return 1f - Utils.SmoothStep(3000f, 6000f, x);
|
||||
return (1f - Utils.SmoothStep(3000f, 6000f, x)) * intensity;
|
||||
}
|
||||
return 0f;
|
||||
}
|
||||
@@ -77,7 +78,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath
|
||||
if (maxDepth >= 0 && minDepth < 0)
|
||||
{
|
||||
float intensity = this.GetIntensity();
|
||||
spriteBatch.Draw(TextureAssets.BlackTile.Value, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), Color.Black * intensity);
|
||||
spriteBatch.Draw(TextureAssets.BlackTile.Value, new Rectangle(0, 0, Main.screenWidth * 2, Main.screenHeight * 2), Color.Black * intensity);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using CalamityMod.Events;
|
||||
using CalamityMod.Events;
|
||||
using CalamityMod.World;
|
||||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
@@ -38,6 +38,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses
|
||||
if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles && npc.type == NPCID.EaterofWorldsHead)
|
||||
npc.TargetClosest();
|
||||
|
||||
// Fade in.
|
||||
npc.Opacity = MathHelper.Clamp(npc.Opacity + 0.08f, 0f, 1f);
|
||||
|
||||
float enrageScale = BossRushEvent.BossRushActive ? 1f : 0f;
|
||||
if ((npc.position.Y / 16f) < Main.worldSurface || malice)
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using CalamityMod.Events;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.Graphics.Effects;
|
||||
using Terraria.Graphics.Shaders;
|
||||
@@ -35,10 +36,10 @@ namespace CalamityMod.NPCs.Yharon
|
||||
|
||||
public override void Update(GameTime gameTime)
|
||||
{
|
||||
if (YIndex == -1)
|
||||
if (YIndex == -1 || BossRushEvent.BossRushActive)
|
||||
{
|
||||
UpdateYIndex();
|
||||
if (YIndex == -1)
|
||||
if (YIndex == -1 || BossRushEvent.BossRushActive)
|
||||
Filters.Scene["CalamityMod:Yharon"].Deactivate();
|
||||
}
|
||||
}
|
||||
|
||||
+6
-5
@@ -1,4 +1,5 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using CalamityMod.Events;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.GameContent;
|
||||
@@ -15,10 +16,10 @@ namespace CalamityMod.NPCs.Yharon
|
||||
|
||||
public override void Update(GameTime gameTime)
|
||||
{
|
||||
if (YIndex == -1)
|
||||
if (YIndex == -1 || BossRushEvent.BossRushActive)
|
||||
{
|
||||
UpdateYIndex();
|
||||
if (YIndex == -1)
|
||||
if (YIndex == -1 || BossRushEvent.BossRushActive)
|
||||
isActive = false;
|
||||
}
|
||||
|
||||
@@ -41,7 +42,7 @@ namespace CalamityMod.NPCs.Yharon
|
||||
{
|
||||
x = Vector2.Distance(Main.player[Main.myPlayer].Center, Main.npc[this.YIndex].Center);
|
||||
}
|
||||
return (1f - Utils.SmoothStep(3000f, 6000f, x)) * 0.66f;
|
||||
return (1f - Utils.SmoothStep(3000f, 6000f, x)) * intensity * 0.66f;
|
||||
}
|
||||
return 0.66f;
|
||||
}
|
||||
@@ -77,7 +78,7 @@ namespace CalamityMod.NPCs.Yharon
|
||||
if (maxDepth >= 0 && minDepth < 0)
|
||||
{
|
||||
float intensity = this.GetIntensity();
|
||||
spriteBatch.Draw(TextureAssets.BlackTile.Value, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), new Color(77, 19, 0) * intensity);
|
||||
spriteBatch.Draw(TextureAssets.BlackTile.Value, new Rectangle(0, 0, Main.screenWidth * 2, Main.screenHeight * 2), new Color(77, 19, 0) * intensity);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using CalamityMod.NPCs.Cryogen;
|
||||
using CalamityMod.Skies;
|
||||
using Terraria;
|
||||
using Terraria.Graphics.Effects;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Systems
|
||||
@@ -19,7 +20,14 @@ namespace CalamityMod.Systems
|
||||
|
||||
public override void SpecialVisuals(Player player)
|
||||
{
|
||||
player.ManageSpecialBiomeVisuals("CalamityMod:Cryogen", IsSceneEffectActive(player));
|
||||
bool useCryogen = IsSceneEffectActive(player);
|
||||
if (SkyManager.Instance["CalamityMod:Cryogen"] != null && useCryogen != SkyManager.Instance["CalamityMod:Cryogen"].IsActive())
|
||||
{
|
||||
if (useCryogen)
|
||||
SkyManager.Instance.Activate("CalamityMod:Cryogen", player.Center);
|
||||
else
|
||||
SkyManager.Instance.Deactivate("CalamityMod:Cryogen");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using CalamityMod.Events;
|
||||
using CalamityMod.NPCs.SupremeCalamitas;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
|
||||
+13
-4
@@ -1,4 +1,5 @@
|
||||
using CalamityMod.NPCs;
|
||||
using CalamityMod.Events;
|
||||
using CalamityMod.NPCs;
|
||||
using CalamityMod.NPCs.SupremeCalamitas;
|
||||
using CalamityMod.Projectiles.Boss;
|
||||
using Microsoft.Xna.Framework;
|
||||
@@ -102,6 +103,13 @@ namespace CalamityMod.Skies
|
||||
|
||||
public override void Update(GameTime gameTime)
|
||||
{
|
||||
if (SCalIndex == -1)
|
||||
{
|
||||
UpdateSCalIndex();
|
||||
if (SCalIndex == -1)
|
||||
isActive = false;
|
||||
}
|
||||
|
||||
if (isActive && intensity < 1f)
|
||||
{
|
||||
intensity += 0.01f;
|
||||
@@ -171,13 +179,14 @@ namespace CalamityMod.Skies
|
||||
float x = 0f;
|
||||
if (SCalIndex != -1)
|
||||
x = Vector2.Distance(Main.player[Main.myPlayer].Center, Main.npc[this.SCalIndex].Center);
|
||||
float intensityFactor = BossRushEvent.BossRushActive ? -0.2f : intensity;
|
||||
|
||||
return 1f - Utils.SmoothStep(3000f, 6000f, x);
|
||||
return (1f - Utils.SmoothStep(3000f, 6000f, x)) * intensityFactor;
|
||||
}
|
||||
return 0f;
|
||||
}
|
||||
|
||||
public override Color OnTileColor(Color inColor) => new Color(Vector4.Lerp(new Vector4(0.5f, 0.8f, 1f, 1f), inColor.ToVector4(), 1f - GetIntensity()));
|
||||
public override Color OnTileColor(Color inColor) => new(Vector4.Lerp(new Vector4(0.5f, 0.8f, 1f, 1f), inColor.ToVector4(), 1f - GetIntensity()));
|
||||
|
||||
private bool UpdateSCalIndex()
|
||||
{
|
||||
@@ -203,7 +212,7 @@ namespace CalamityMod.Skies
|
||||
if (maxDepth >= 0 && minDepth < 0)
|
||||
{
|
||||
float intensity = GetIntensity();
|
||||
spriteBatch.Draw(TextureAssets.BlackTile.Value, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), Color.Black * intensity);
|
||||
spriteBatch.Draw(TextureAssets.BlackTile.Value, new Rectangle(0, 0, Main.screenWidth * 2, Main.screenHeight * 2), Color.Black * intensity);
|
||||
}
|
||||
|
||||
// Draw cinders.
|
||||
|
||||
Reference in new issue
Block a user