Astral infection biome code overhaul (#28)

Omitting gigantic messy co-authoring list due to the 1.4.4 force push.
This commit is contained in:
Lion8cake authored and Ozzatron committed 2024-05-13 18:06:17 -04:00
1 parent de2bb4a483
commit 1bb44ca194
75 files changed
+631 -823

No files matched your search

+97 -11
View File
@@ -1,22 +1,23 @@
using Terraria.ModLoader;
using Microsoft.Xna.Framework.Graphics;
using System.Reflection;
using System;
using Terraria.Graphics.Effects;
using Terraria;
using Terraria.ModLoader;
using Microsoft.Xna.Framework;
namespace CalamityMod.Backgrounds
{
public class AstralDesertSurfaceBGStyle : ModSurfaceBackgroundStyle
{
public override int ChooseFarTexture() => BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/BlankPixel");
public override int ChooseMiddleTexture() => BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/BlankPixel");
public override int ChooseCloseTexture(ref float scale, ref double parallax, ref float a, ref float b)
{
b -= 75f;
return BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/BlankPixel");
}
internal static readonly FieldInfo screenOffField = typeof(Main).GetField("screenOff", BindingFlags.Instance | BindingFlags.NonPublic);
internal static readonly FieldInfo scAdjField = typeof(Main).GetField("scAdj", BindingFlags.Instance | BindingFlags.NonPublic);
internal static readonly FieldInfo COSBMAplhaField = typeof(Main).GetField("ColorOfSurfaceBackgroundsModified", BindingFlags.Static | BindingFlags.NonPublic);
readonly int CloseBGYOffset = 475;
readonly int MiddleBGYOffset = 475;
public override void ModifyFarFades(float[] fades, float transitionSpeed)
{
// This just fades in the background and fades out other backgrounds.
for (int i = 0; i < fades.Length; i++)
{
if (i == Slot)
@@ -33,5 +34,90 @@ namespace CalamityMod.Backgrounds
}
}
}
public override int ChooseFarTexture() => BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/AstralSurfaceHorizon");
public override int ChooseMiddleTexture() => BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/AstralDesertSurfaceFar");
public override int ChooseCloseTexture(ref float scale, ref double parallax, ref float a, ref float b) => BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Skies/AstralDesertSurfaceMiddle");
public override bool PreDrawCloseBackground(SpriteBatch spriteBatch)
{
//Please see AstralSurfaceBGStyle for comments, code is pretty much identical here
float screenOff = (float)screenOffField.GetValue(Main.instance);
float scAdj = (float)scAdjField.GetValue(Main.instance);
Color COSBMAplha = (Color)COSBMAplhaField.GetValue(null);
Color ColorOfSurfaceBackgroundsModified = new Color(63, 51, 90, COSBMAplha.A);
bool canBGDraw = false;
if ((!Main.remixWorld || (Main.gameMenu && !WorldGen.remixWorldGen)) && (!WorldGen.remixWorldGen || !WorldGen.drunkWorldGen))
canBGDraw = true;
if (Main.mapFullscreen)
canBGDraw = false;
int offset = 30;
if (Main.gameMenu)
offset = 0;
if (WorldGen.drunkWorldGen)
offset = -180;
float surfacePosition = (float)Main.worldSurface;
if (surfacePosition == 0f)
surfacePosition = 1f;
float screenPosition = Main.screenPosition.Y + (float)(Main.screenHeight / 2) - 600f;
double backgroundTopMagicNumber = (0f - screenPosition + screenOff / 2f) / (surfacePosition * 16f);
float bgGlobalScaleMultiplier = 2f;
int pushBGTopHack;
int offset2 = -180;
int menuOffset = 0;
if (Main.gameMenu)
{
menuOffset -= offset2;
}
pushBGTopHack = menuOffset;
pushBGTopHack += offset;
pushBGTopHack += offset2;
if (canBGDraw)
{
var bgScale = 1.25f;
var bgParallax = 0.4;
var bgTopY = (int)(backgroundTopMagicNumber * 1800.0 + 1500.0) + (int)scAdj + pushBGTopHack;
bgScale *= bgGlobalScaleMultiplier;
var bgWidthScaled = (int)((float)CalamityMod.AstralDesertSurfaceMiddle.Width * bgScale);
SkyManager.Instance.DrawToDepth(Main.spriteBatch, 1.2f / (float)bgParallax);
var bgStartX = (int)(0.0 - Math.IEEERemainder((double)Main.screenPosition.X * bgParallax, bgWidthScaled) - (double)(bgWidthScaled / 2));
if (Main.gameMenu)
bgTopY = 320 + pushBGTopHack;
var bgLoops = Main.screenWidth / bgWidthScaled + 2;
if ((double)Main.screenPosition.Y < Main.worldSurface * 16.0 + 16.0)
{
for (int i = 0; i < bgLoops; i++)
{
Main.spriteBatch.Draw(CalamityMod.AstralDesertSurfaceMiddle, new Vector2(bgStartX + bgWidthScaled * i, bgTopY + MiddleBGYOffset), new Rectangle(0, 0, CalamityMod.AstralDesertSurfaceMiddle.Width, CalamityMod.AstralDesertSurfaceMiddle.Height), ColorOfSurfaceBackgroundsModified, 0f, default(Vector2), bgScale, SpriteEffects.None, 0f);
}
}
bgScale = 1.31f;
bgParallax = 0.43;
bgTopY = (int)(backgroundTopMagicNumber * 1950.0 + 1750.0) + (int)scAdj + pushBGTopHack;
bgScale *= bgGlobalScaleMultiplier;
bgWidthScaled = (int)((float)CalamityMod.AstralDesertSurfaceClose.Width * bgScale);
SkyManager.Instance.DrawToDepth(Main.spriteBatch, 1f / (float)bgParallax);
bgStartX = (int)(0.0 - Math.IEEERemainder((double)Main.screenPosition.X * bgParallax, bgWidthScaled) - (double)(bgWidthScaled / 2));
if (Main.gameMenu)
{
bgTopY = 400 + pushBGTopHack;
bgStartX -= 80;
}
bgLoops = Main.screenWidth / bgWidthScaled + 2;
if ((double)Main.screenPosition.Y < Main.worldSurface * 16.0 + 16.0)
{
for (int i = 0; i < bgLoops; i++)
{
Main.spriteBatch.Draw(CalamityMod.AstralDesertSurfaceClose, new Vector2(bgStartX + bgWidthScaled * i, bgTopY + CloseBGYOffset), new Rectangle(0, 0, CalamityMod.AstralDesertSurfaceClose.Width, CalamityMod.AstralDesertSurfaceClose.Height), ColorOfSurfaceBackgroundsModified, 0f, default(Vector2), bgScale, SpriteEffects.None, 0f);
}
}
}
return false;
}
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 23 KiB

+122 -7
View File
@@ -1,18 +1,25 @@
using Terraria.ModLoader;
using Microsoft.Xna.Framework.Graphics;
using System.Reflection;
using System;
using Terraria.Graphics.Effects;
using Terraria;
using Terraria.ModLoader;
using Microsoft.Xna.Framework;
using Terraria.GameContent.UI.States;
namespace CalamityMod.Backgrounds
{
public class AstralSnowSurfaceBGStyle : ModSurfaceBackgroundStyle
{
public override int ChooseFarTexture() => BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/BlankPixel");
public override int ChooseMiddleTexture() => BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/BlankPixel");
public override int ChooseCloseTexture(ref float scale, ref double parallax, ref float a, ref float b) => BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/BlankPixel");
internal static readonly FieldInfo screenOffField = typeof(Main).GetField("screenOff", BindingFlags.Instance | BindingFlags.NonPublic);
internal static readonly FieldInfo scAdjField = typeof(Main).GetField("scAdj", BindingFlags.Instance | BindingFlags.NonPublic);
internal static readonly FieldInfo COSBMAplhaField = typeof(Main).GetField("ColorOfSurfaceBackgroundsModified", BindingFlags.Static | BindingFlags.NonPublic);
readonly int FrontBGYOffset = 275;
readonly int CloseBGYOffset = 175;
readonly int MiddleBGYOffset = 475;
public override void ModifyFarFades(float[] fades, float transitionSpeed)
{
// This just fades in the background and fades out other backgrounds.
for (int i = 0; i < fades.Length; i++)
{
if (i == Slot)
@@ -29,5 +36,113 @@ namespace CalamityMod.Backgrounds
}
}
}
public override int ChooseFarTexture() => BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/AstralSurfaceHorizon");
public override int ChooseMiddleTexture() => BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/AstralSurfaceFar");
public override int ChooseCloseTexture(ref float scale, ref double parallax, ref float a, ref float b) => BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Skies/AstralSnowSurfaceMiddle");
public override bool PreDrawCloseBackground(SpriteBatch spriteBatch)
{
//Please see AstralSurfaceBGStyle for comments, code is pretty much identical here
float screenOff = (float)screenOffField.GetValue(Main.instance);
float scAdj = (float)scAdjField.GetValue(Main.instance);
Color COSBMAplha = (Color)COSBMAplhaField.GetValue(null);
Color ColorOfSurfaceBackgroundsModified = new Color(63, 51, 90, COSBMAplha.A);
bool canBGDraw = false;
if ((!Main.remixWorld || (Main.gameMenu && !WorldGen.remixWorldGen)) && (!WorldGen.remixWorldGen || !WorldGen.drunkWorldGen))
canBGDraw = true;
if (Main.mapFullscreen)
canBGDraw = false;
int offset = 30;
if (Main.gameMenu)
offset = 0;
if (WorldGen.drunkWorldGen)
offset = -180;
float surfacePosition = (float)Main.worldSurface;
if (surfacePosition == 0f)
surfacePosition = 1f;
float screenPosition = Main.screenPosition.Y + (float)(Main.screenHeight / 2) - 600f;
double backgroundTopMagicNumber = (0f - screenPosition + screenOff / 2f) / (surfacePosition * 16f);
float bgGlobalScaleMultiplier = 2f;
int pushBGTopHack;
int offset2 = -180;
int menuOffset = 0;
if (Main.gameMenu)
{
menuOffset -= offset2;
}
pushBGTopHack = menuOffset;
pushBGTopHack += offset;
pushBGTopHack += offset2;
if (canBGDraw)
{
var bgScale = 1.25f;
var bgParallax = 0.4;
var bgTopY = (int)(backgroundTopMagicNumber * 1800.0 + 1500.0) + (int)scAdj + pushBGTopHack;
bgScale *= bgGlobalScaleMultiplier;
var bgWidthScaled = (int)((float)CalamityMod.AstralSnowSurfaceMiddle.Width * bgScale);
SkyManager.Instance.DrawToDepth(Main.spriteBatch, 1.2f / (float)bgParallax);
var bgStartX = (int)(0.0 - Math.IEEERemainder((double)Main.screenPosition.X * bgParallax, bgWidthScaled) - (double)(bgWidthScaled / 2));
if (Main.gameMenu)
bgTopY = 320 + pushBGTopHack;
var bgLoops = Main.screenWidth / bgWidthScaled + 2;
if ((double)Main.screenPosition.Y < Main.worldSurface * 16.0 + 16.0)
{
for (int i = 0; i < bgLoops; i++)
{
Main.spriteBatch.Draw(CalamityMod.AstralSnowSurfaceMiddle, new Vector2(bgStartX + bgWidthScaled * i, bgTopY + MiddleBGYOffset), new Rectangle(0, 0, CalamityMod.AstralSnowSurfaceMiddle.Width, CalamityMod.AstralSnowSurfaceMiddle.Height), ColorOfSurfaceBackgroundsModified, 0f, default(Vector2), bgScale, SpriteEffects.None, 0f);
}
}
bgScale = 1.31f;
bgParallax = 0.43;
bgTopY = (int)(backgroundTopMagicNumber * 1950.0 + 1750.0) + (int)scAdj + pushBGTopHack;
bgScale *= bgGlobalScaleMultiplier;
bgWidthScaled = (int)((float)CalamityMod.AstralSurfaceClose.Width * bgScale);
SkyManager.Instance.DrawToDepth(Main.spriteBatch, 1f / (float)bgParallax);
bgStartX = (int)(0.0 - Math.IEEERemainder((double)Main.screenPosition.X * bgParallax, bgWidthScaled) - (double)(bgWidthScaled / 2));
if (Main.gameMenu)
{
bgTopY = 400 + pushBGTopHack;
bgStartX -= 80;
}
bgLoops = Main.screenWidth / bgWidthScaled + 2;
if ((double)Main.screenPosition.Y < Main.worldSurface * 16.0 + 16.0)
{
for (int i = 0; i < bgLoops; i++)
{
Main.spriteBatch.Draw(CalamityMod.AstralSurfaceClose, new Vector2(bgStartX + bgWidthScaled * i, bgTopY + CloseBGYOffset), new Rectangle(0, 0, CalamityMod.AstralSurfaceClose.Width, CalamityMod.AstralSurfaceClose.Height), ColorOfSurfaceBackgroundsModified, 0f, default(Vector2), bgScale, SpriteEffects.None, 0f);
Main.spriteBatch.Draw(CalamityMod.AstralSurfaceCloseGlow, new Vector2(bgStartX + bgWidthScaled * i, bgTopY + CloseBGYOffset), new Rectangle(0, 0, CalamityMod.AstralSurfaceCloseGlow.Width, CalamityMod.AstralSurfaceCloseGlow.Height), new Color(Color.White.R * 0.7f, Color.White.G * 0.7f, Color.White.B * 0.7f, COSBMAplha.A), 0f, default(Vector2), bgScale, SpriteEffects.None, 0f);
}
}
bgScale = 1.34f;
bgParallax = 0.49;
bgTopY = (int)(backgroundTopMagicNumber * 2100.0 + 2000.0) + (int)scAdj + pushBGTopHack;
bgScale *= bgGlobalScaleMultiplier;
bgWidthScaled = (int)(CalamityMod.AstralSurfaceFront.Width * bgScale);
SkyManager.Instance.DrawToDepth(Main.spriteBatch, 1f / (float)bgParallax);
bgStartX = (int)(0.0 - Math.IEEERemainder((double)Main.screenPosition.X * bgParallax, bgWidthScaled) - (double)(bgWidthScaled / 2));
if (Main.gameMenu)
{
bgTopY = 480 + pushBGTopHack;
bgStartX -= 120;
}
bgLoops = Main.screenWidth / bgWidthScaled + 2;
if ((double)Main.screenPosition.Y < Main.worldSurface * 16.0 + 16.0)
{
for (int i = 0; i < bgLoops; i++)
{
Main.spriteBatch.Draw(CalamityMod.AstralSurfaceFront, new Vector2(bgStartX + bgWidthScaled * i, bgTopY + FrontBGYOffset), new Rectangle(0, 0, CalamityMod.AstralSurfaceFront.Width, CalamityMod.AstralSurfaceFront.Height), ColorOfSurfaceBackgroundsModified, 0f, default(Vector2), bgScale, SpriteEffects.None, 0f);
Main.spriteBatch.Draw(CalamityMod.AstralSurfaceFrontGlow, new Vector2(bgStartX + bgWidthScaled * i, bgTopY + FrontBGYOffset), new Rectangle(0, 0, CalamityMod.AstralSurfaceFrontGlow.Width, CalamityMod.AstralSurfaceFrontGlow.Height), new Color(Color.White.R * 0.9f, Color.White.G * 0.9f, Color.White.B * 0.9f, COSBMAplha.A), 0f, default(Vector2), bgScale, SpriteEffects.None, 0f);
}
}
}
return false;
}
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 8.5 KiB

+128 -11
View File
@@ -1,22 +1,24 @@
using Terraria.ModLoader;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;
using System.Reflection;
using System;
using Terraria.Graphics.Effects;
using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.Backgrounds
{
public class AstralSurfaceBGStyle : ModSurfaceBackgroundStyle
{
public override int ChooseFarTexture() => BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/BlankPixel");
public override int ChooseMiddleTexture() => BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/BlankPixel");
public override int ChooseCloseTexture(ref float scale, ref double parallax, ref float a, ref float b)
{
scale *= 0.75f;
return BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/BlankPixel");
}
internal static readonly FieldInfo screenOffField = typeof(Main).GetField("screenOff", BindingFlags.Instance | BindingFlags.NonPublic);
internal static readonly FieldInfo scAdjField = typeof(Main).GetField("scAdj", BindingFlags.Instance | BindingFlags.NonPublic);
internal static readonly FieldInfo COSBMAplhaField = typeof(Main).GetField("ColorOfSurfaceBackgroundsModified", BindingFlags.Static | BindingFlags.NonPublic);
readonly int FrontBGYOffset = 275; //Offsets for the height positioning. Make these 0 for backgrounds that want to be the same as treeline backgrounds (backgrounds that have the front 3 layers as trees)
readonly int CloseBGYOffset = 175;
readonly int MiddleBGYOffset = 475;
public override void ModifyFarFades(float[] fades, float transitionSpeed)
{
// This just fades in the background and fades out other backgrounds.
for (int i = 0; i < fades.Length; i++)
{
if (i == Slot)
@@ -33,5 +35,120 @@ namespace CalamityMod.Backgrounds
}
}
}
public override int ChooseFarTexture() => BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/AstralSurfaceHorizon"); //5th layer (Horizon)
public override int ChooseMiddleTexture() => BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/AstralSurfaceFar"); //4th layer (Far)
public override int ChooseCloseTexture(ref float scale, ref double parallax, ref float a, ref float b) => BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Skies/AstralSurfaceMiddle"); //Fallback texture, not nessesarily needed since predraw returns false
public override bool PreDrawCloseBackground(SpriteBatch spriteBatch) //Taken from vanilla to draw the front 3 layers, edited to fit tmod and astral background needs
{
float screenOff = (float)screenOffField.GetValue(Main.instance);
float scAdj = (float)scAdjField.GetValue(Main.instance);
Color COSBMAplha = (Color)COSBMAplhaField.GetValue(null);
Color ColorOfSurfaceBackgroundsModified = new Color(63, 51, 90, COSBMAplha.A); //Astral Biome Coloration with the alpha as the background fade
bool canBGDraw = false;
if ((!Main.remixWorld || (Main.gameMenu && !WorldGen.remixWorldGen)) && (!WorldGen.remixWorldGen || !WorldGen.drunkWorldGen))
canBGDraw = true;
if (Main.mapFullscreen)
canBGDraw = false;
int offset = 30;
if (Main.gameMenu)
offset = 0;
if (WorldGen.drunkWorldGen)
offset = -180;
float surfacePosition = (float)Main.worldSurface;
if (surfacePosition == 0f)
surfacePosition = 1f;
float screenPosition = Main.screenPosition.Y + (float)(Main.screenHeight / 2) - 600f;
double backgroundTopMagicNumber = (0f - screenPosition + screenOff / 2f) / (surfacePosition * 16f);
float bgGlobalScaleMultiplier = 2f;
int pushBGTopHack;
int offset2 = -180;
int menuOffset = 0;
if (Main.gameMenu)
{
menuOffset -= offset2;
}
pushBGTopHack = menuOffset;
pushBGTopHack += offset;
pushBGTopHack += offset2; //Offsets to the background placement
if (canBGDraw) //If the background can draw (player is not in a remix world or is not in a map). This can probably be removed since backgrounds already go through these checks
{
//3rd layer (Middle)
var bgScale = 1.25f; //Scale of the furthest of the closest background layers (3rd layer)
var bgParallax = 0.4; //The parallax of the background layer
var bgTopY = (int)(backgroundTopMagicNumber * 1800.0 + 1500.0) + (int)scAdj + pushBGTopHack; //the Y position of the background
bgScale *= bgGlobalScaleMultiplier; //Scale of the background
var bgWidthScaled = (int)((float)CalamityMod.AstralSurfaceMiddle.Width * bgScale); //The Width of the bg texture scaled to the correct size
SkyManager.Instance.DrawToDepth(Main.spriteBatch, 1.2f / (float)bgParallax);
var bgStartX = (int)(0.0 - Math.IEEERemainder((double)Main.screenPosition.X * bgParallax, bgWidthScaled) - (double)(bgWidthScaled / 2)); //The starting position of the background layer
if (Main.gameMenu)
bgTopY = 320 + pushBGTopHack; //increases the height in the main menu
var bgLoops = Main.screenWidth / bgWidthScaled + 2;
if ((double)Main.screenPosition.Y < Main.worldSurface * 16.0 + 16.0)
{
for (int i = 0; i < bgLoops; i++)
{
//Draw the texture and its glowmask to each loop of the texture
Main.spriteBatch.Draw(CalamityMod.AstralSurfaceMiddle, new Vector2(bgStartX + bgWidthScaled * i, bgTopY + MiddleBGYOffset), new Rectangle(0, 0, CalamityMod.AstralSurfaceMiddle.Width, CalamityMod.AstralSurfaceMiddle.Height), ColorOfSurfaceBackgroundsModified, 0f, default(Vector2), bgScale, SpriteEffects.None, 0f);
Main.spriteBatch.Draw(CalamityMod.AstralSurfaceMiddleGlow, new Vector2(bgStartX + bgWidthScaled * i, bgTopY + MiddleBGYOffset), new Rectangle(0, 0, CalamityMod.AstralSurfaceMiddleGlow.Width, CalamityMod.AstralSurfaceMiddleGlow.Height), new Color(Color.White.R * 0.5f, Color.White.G * 0.5f, Color.White.B * 0.5f, COSBMAplha.A), 0f, default(Vector2), bgScale, SpriteEffects.None, 0f);
}
}
//2nd layer (Close)
//Repeat of above with slight changes to variables
bgScale = 1.31f;
bgParallax = 0.43;
bgTopY = (int)(backgroundTopMagicNumber * 1950.0 + 1750.0) + (int)scAdj + pushBGTopHack;
bgScale *= bgGlobalScaleMultiplier;
bgWidthScaled = (int)((float)CalamityMod.AstralSurfaceClose.Width * bgScale);
SkyManager.Instance.DrawToDepth(Main.spriteBatch, 1f / (float)bgParallax);
bgStartX = (int)(0.0 - Math.IEEERemainder((double)Main.screenPosition.X * bgParallax, bgWidthScaled) - (double)(bgWidthScaled / 2));
if (Main.gameMenu)
{
bgTopY = 400 + pushBGTopHack;
bgStartX -= 80; //the initial postion of where the background starts in the main menu is pushed back to not be directly ontop, mostly for tree bgs that use the same treeline texture but faded
}
bgLoops = Main.screenWidth / bgWidthScaled + 2;
if ((double)Main.screenPosition.Y < Main.worldSurface * 16.0 + 16.0)
{
for (int i = 0; i < bgLoops; i++)
{
Main.spriteBatch.Draw(CalamityMod.AstralSurfaceClose, new Vector2(bgStartX + bgWidthScaled * i, bgTopY + CloseBGYOffset), new Rectangle(0, 0, CalamityMod.AstralSurfaceClose.Width, CalamityMod.AstralSurfaceClose.Height), ColorOfSurfaceBackgroundsModified, 0f, default(Vector2), bgScale, SpriteEffects.None, 0f);
Main.spriteBatch.Draw(CalamityMod.AstralSurfaceCloseGlow, new Vector2(bgStartX + bgWidthScaled * i, bgTopY + CloseBGYOffset), new Rectangle(0, 0, CalamityMod.AstralSurfaceCloseGlow.Width, CalamityMod.AstralSurfaceCloseGlow.Height), new Color(Color.White.R * 0.7f, Color.White.G * 0.7f, Color.White.B * 0.7f, COSBMAplha.A), 0f, default(Vector2), bgScale, SpriteEffects.None, 0f);
}
}
//1st layer (Front)
//Repeat of above with slight changes to variables
bgScale = 1.34f;
bgParallax = 0.49;
bgTopY = (int)(backgroundTopMagicNumber * 2100.0 + 2000.0) + (int)scAdj + pushBGTopHack;
bgScale *= bgGlobalScaleMultiplier;
bgWidthScaled = (int)(CalamityMod.AstralSurfaceFront.Width * bgScale);
SkyManager.Instance.DrawToDepth(Main.spriteBatch, 1f / (float)bgParallax);
bgStartX = (int)(0.0 - Math.IEEERemainder((double)Main.screenPosition.X * bgParallax, bgWidthScaled) - (double)(bgWidthScaled / 2));
if (Main.gameMenu)
{
bgTopY = 480 + pushBGTopHack;
bgStartX -= 120;
}
bgLoops = Main.screenWidth / bgWidthScaled + 2;
if ((double)Main.screenPosition.Y < Main.worldSurface * 16.0 + 16.0)
{
for (int i = 0; i < bgLoops; i++)
{
Main.spriteBatch.Draw(CalamityMod.AstralSurfaceFront, new Vector2(bgStartX + bgWidthScaled * i, bgTopY + FrontBGYOffset), new Rectangle(0, 0, CalamityMod.AstralSurfaceFront.Width, CalamityMod.AstralSurfaceFront.Height), ColorOfSurfaceBackgroundsModified, 0f, default(Vector2), bgScale, SpriteEffects.None, 0f);
Main.spriteBatch.Draw(CalamityMod.AstralSurfaceFrontGlow, new Vector2(bgStartX + bgWidthScaled * i, bgTopY + FrontBGYOffset), new Rectangle(0, 0, CalamityMod.AstralSurfaceFrontGlow.Width, CalamityMod.AstralSurfaceFrontGlow.Height), new Color(Color.White.R * 0.9f, Color.White.G * 0.9f, Color.White.B * 0.9f, COSBMAplha.A), 0f, default(Vector2), bgScale, SpriteEffects.None, 0f);
}
}
}
return false; //Stop the drawing of the base close background texture (note: does NOT stop the drawing of the Middle and Far textures because tmodloader is slight stupid :blushing:)
}
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 63 KiB

After

Width:  |  Height:  |  Size: 27 KiB

File renamed without changes.

Before

Width:  |  Height:  |  Size: 35 KiB

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 23 KiB

-37
View File
@@ -1,37 +0,0 @@
using Terraria.ModLoader;
namespace CalamityMod.Backgrounds
{
public class AstralSurfaceFogBGStyle : ModSurfaceBackgroundStyle
{
public override int ChooseFarTexture() => BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/BlankPixel");
public override int ChooseMiddleTexture() => BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/BlankPixel");
public override int ChooseCloseTexture(ref float scale, ref double parallax, ref float a, ref float b)
{
scale *= 0.75f;
return BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/BlankPixel");
}
public override void ModifyFarFades(float[] fades, float transitionSpeed)
{
// This just fades in the background and fades out other backgrounds.
for (int i = 0; i < fades.Length; i++)
{
if (i == Slot)
{
fades[i] += transitionSpeed;
if (fades[i] > 1f)
fades[i] = 1f;
}
else
{
fades[i] -= transitionSpeed;
if (fades[i] < 0f)
fades[i] = 0f;
}
}
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

File renamed without changes.

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 20 KiB

File renamed without changes.

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

+4 -3
View File
@@ -1,4 +1,5 @@
using Terraria.ModLoader;
using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.Backgrounds
{
@@ -6,8 +7,8 @@ namespace CalamityMod.Backgrounds
{
public override void FillTextureArray(int[] textureSlots)
{
for (int i = 0; i <= 3; i++)
textureSlots[i] = BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/AstralUG" + i.ToString());
for (int i = 0; i <= 4; i++)
textureSlots[i] = BackgroundTextureLoader.GetBackgroundSlot(i == 4 ? "CalamityMod/Backgrounds/AstralUG" + i.ToString() + "_" + Main.hellBackStyle : "CalamityMod/Backgrounds/AstralUG" + i.ToString());
}
}
}
-34
View File
@@ -1,34 +0,0 @@
using CalamityMod.Items.Placeables.Furniture;
using CalamityMod.Systems;
using Terraria;
using Terraria.Graphics.Effects;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.BiomeManagers
{
public class AbovegroundAstralBiome : ModBiome
{
public override ModWaterStyle WaterStyle => ModContent.Find<ModWaterStyle>("CalamityMod/AstralWater");
public override ModSurfaceBackgroundStyle SurfaceBackgroundStyle => ModContent.Find<ModSurfaceBackgroundStyle>("CalamityMod/AstralSurfaceFogBGStyle");
public override ModUndergroundBackgroundStyle UndergroundBackgroundStyle => ModContent.Find<ModUndergroundBackgroundStyle>("CalamityMod/AstralUndergroundBGStyle");
public override int BiomeTorchItemType => ModContent.ItemType<AstralTorch>();
public override SceneEffectPriority Priority => SceneEffectPriority.BiomeHigh;
public override string BestiaryIcon => "CalamityMod/BiomeManagers/AbovegroundAstralBiomeIcon";
public override string BackgroundPath => "CalamityMod/Backgrounds/MapBackgrounds/AstralBG";
public override string MapBackground => "CalamityMod/Backgrounds/MapBackgrounds/AstralBG";
public override int Music => CalamityMod.Instance.GetMusicFromMusicMod("AstralInfection") ?? MusicID.Space;
public override bool IsBiomeActive(Player player)
{
return !player.ZoneDungeon && BiomeTileCounterSystem.AstralTiles > 950;
}
public override void SpecialVisuals(Player player, bool isActive)
{
player.ManageSpecialBiomeVisuals("CalamityMod:Astral", isActive);
}
}
}
@@ -1,41 +0,0 @@
using CalamityMod.Items.Placeables.Furniture;
using CalamityMod.Systems;
using Terraria;
using Terraria.Graphics.Effects;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.BiomeManagers
{
public class AbovegroundAstralBiomeSurface : ModBiome
{
public override ModWaterStyle WaterStyle => ModContent.Find<ModWaterStyle>("CalamityMod/AstralWater");
public override ModSurfaceBackgroundStyle SurfaceBackgroundStyle => ModContent.Find<ModSurfaceBackgroundStyle>("CalamityMod/AstralSurfaceBGStyle");
public override int BiomeTorchItemType => ModContent.ItemType<AstralTorch>();
public override SceneEffectPriority Priority => SceneEffectPriority.BiomeHigh;
public override string MapBackground => "CalamityMod/Backgrounds/MapBackgrounds/AstralBG";
public override int Music => CalamityMod.Instance.GetMusicFromMusicMod("AstralInfection") ?? MusicID.Space;
public override bool IsBiomeActive(Player player)
{
return !player.ZoneDungeon && BiomeTileCounterSystem.AstralTiles > 950 && !player.ZoneSnow && !player.ZoneDesert;
}
public override void SpecialVisuals(Player player, bool isActive)
{
if (SkyManager.Instance["CalamityMod:AstralSurface"] != null && isActive != SkyManager.Instance["CalamityMod:AstralSurface"].IsActive())
{
if (isActive)
{
SkyManager.Instance.Activate("CalamityMod:AstralSurface");
}
else
{
SkyManager.Instance.Deactivate("CalamityMod:AstralSurface");
}
}
}
}
}
@@ -1,43 +0,0 @@
using CalamityMod.Items.Placeables.Furniture;
using CalamityMod.Systems;
using Terraria;
using Terraria.GameContent.Events;
using Terraria.Graphics.Effects;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.BiomeManagers
{
public class AbovegroundAstralDesertBiome : ModBiome
{
public override ModWaterStyle WaterStyle => ModContent.Find<ModWaterStyle>("CalamityMod/AstralWater");
public override ModSurfaceBackgroundStyle SurfaceBackgroundStyle => ModContent.Find<ModSurfaceBackgroundStyle>("CalamityMod/AstralDesertSurfaceBGStyle");
public override int BiomeTorchItemType => ModContent.ItemType<AstralTorch>();
public override SceneEffectPriority Priority => Sandstorm.Happening && !(Main.slimeRain || Main.eclipse) ? SceneEffectPriority.Environment : SceneEffectPriority.BiomeHigh;
public override string BestiaryIcon => "CalamityMod/BiomeManagers/AstralDesertIcon";
// Could use its own unique background
public override string BackgroundPath => "CalamityMod/Backgrounds/MapBackgrounds/AstralBG";
public override string MapBackground => "CalamityMod/Backgrounds/MapBackgrounds/AstralBG";
public override int Music => CalamityMod.Instance.GetMusicFromMusicMod("AstralInfection") ?? MusicID.Space;
public override bool IsBiomeActive(Player player)
{
return !player.ZoneDungeon && BiomeTileCounterSystem.AstralTiles > 950 && player.ZoneDesert && !player.ZoneSnow;
}
public override void SpecialVisuals(Player player, bool isActive)
{
if (SkyManager.Instance["CalamityMod:AstralDesert"] != null && isActive != SkyManager.Instance["CalamityMod:AstralDesert"].IsActive())
{
if (isActive)
{
SkyManager.Instance.Activate("CalamityMod:AstralDesert");
}
else
{
SkyManager.Instance.Deactivate("CalamityMod:AstralDesert");
}
}
}
}
}
@@ -1,41 +0,0 @@
using CalamityMod.Items.Placeables.Furniture;
using CalamityMod.Systems;
using Terraria;
using Terraria.Graphics.Effects;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.BiomeManagers
{
public class AbovegroundAstralSnowBiome : ModBiome
{
public override ModWaterStyle WaterStyle => ModContent.Find<ModWaterStyle>("CalamityMod/AstralWater");
public override ModSurfaceBackgroundStyle SurfaceBackgroundStyle => ModContent.Find<ModSurfaceBackgroundStyle>("CalamityMod/AstralSnowSurfaceBGStyle");
public override int BiomeTorchItemType => ModContent.ItemType<AstralTorch>();
public override SceneEffectPriority Priority => SceneEffectPriority.BiomeHigh;
public override string MapBackground => "CalamityMod/Backgrounds/MapBackgrounds/AstralBG";
public override int Music => CalamityMod.Instance.GetMusicFromMusicMod("AstralInfection") ?? MusicID.Space;
public override bool IsBiomeActive(Player player)
{
return !player.ZoneDungeon && BiomeTileCounterSystem.AstralTiles > 950 && player.ZoneSnow;
}
public override void SpecialVisuals(Player player, bool isActive)
{
if (SkyManager.Instance["CalamityMod:AstralSnow"] != null && isActive != SkyManager.Instance["CalamityMod:AstralSnow"].IsActive())
{
if (isActive)
{
SkyManager.Instance.Activate("CalamityMod:AstralSnow");
}
else
{
SkyManager.Instance.Deactivate("CalamityMod:AstralSnow");
}
}
}
}
}
+94
View File
@@ -0,0 +1,94 @@
using CalamityMod.Items.Placeables.Furniture;
using CalamityMod.Systems;
using Terraria;
using Terraria.Graphics.Effects;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.BiomeManagers
{
public class AstralInfectionBiome : ModBiome
{
public override ModWaterStyle WaterStyle => ModContent.Find<ModWaterStyle>("CalamityMod/AstralWater");
public override ModSurfaceBackgroundStyle SurfaceBackgroundStyle
{
get
{
if (Main.LocalPlayer.ZoneSnow) //Snow
{
return ModContent.Find<ModSurfaceBackgroundStyle>("CalamityMod/AstralSnowSurfaceBGStyle");
}
else if (Main.LocalPlayer.ZoneDesert && !Main.LocalPlayer.ZoneSnow) //Desert
{
return ModContent.Find<ModSurfaceBackgroundStyle>("CalamityMod/AstralDesertSurfaceBGStyle");
}
else //surface
{
return ModContent.Find<ModSurfaceBackgroundStyle>("CalamityMod/AstralSurfaceBGStyle");
}
}
}
public override ModUndergroundBackgroundStyle UndergroundBackgroundStyle
{
get
{
if (Main.LocalPlayer.ZoneSnow)
{
return ModContent.Find<ModUndergroundBackgroundStyle>("CalamityMod/AstralUndergroundBGStyle"); // Could use its own unique background
}
return ModContent.Find<ModUndergroundBackgroundStyle>("CalamityMod/AstralUndergroundBGStyle");
}
}
public override int BiomeTorchItemType => ModContent.ItemType<AstralTorch>();
public override SceneEffectPriority Priority => SceneEffectPriority.BiomeHigh;
public override string BestiaryIcon => "CalamityMod/BiomeManagers/AbovegroundAstralBiomeIcon";
public override string BackgroundPath
{
get {
if (Main.LocalPlayer.ZoneDesert && !Main.LocalPlayer.ZoneSnow)
{
//desert
return "CalamityMod/Backgrounds/MapBackgrounds/AstralBG"; // Could use its own unique background
}
else if (Main.LocalPlayer.ZoneDirtLayerHeight || Main.LocalPlayer.ZoneRockLayerHeight || Main.LocalPlayer.ZoneUnderworldHeight)
{
//underground
return "CalamityMod/Backgrounds/MapBackgrounds/AstralBG"; // Could use its own unique background
}
else
{
return "CalamityMod/Backgrounds/MapBackgrounds/AstralBG";
}
}
}
public override string MapBackground => "CalamityMod/Backgrounds/MapBackgrounds/AstralBG";
public override int Music
{
get
{
if (Main.LocalPlayer.ZoneDirtLayerHeight || Main.LocalPlayer.ZoneRockLayerHeight || Main.LocalPlayer.ZoneUnderworldHeight)
{
return CalamityMod.Instance.GetMusicFromMusicMod("AstralInfectionUnderground") ?? MusicID.Space;
}
return CalamityMod.Instance.GetMusicFromMusicMod("AstralInfection") ?? MusicID.Space;
}
}
public override bool IsBiomeActive(Player player)
{
return !player.ZoneDungeon && BiomeTileCounterSystem.AstralTiles > 950;
}
public override void SpecialVisuals(Player player, bool isActive)
{
player.ManageSpecialBiomeVisuals("CalamityMod:Astral", isActive);
if (Main.LocalPlayer.ZoneDirtLayerHeight || Main.LocalPlayer.ZoneRockLayerHeight || Main.LocalPlayer.ZoneUnderworldHeight)
{
player.ManageSpecialBiomeVisuals("CalamityMod:Astral", isActive); //underground
}
}
}
}
@@ -0,0 +1,11 @@
using Terraria.ModLoader;
namespace CalamityMod.BiomeManagers.BestiaryCategories
{
public class AstralCaveDesert : ModBiome //Unused, currently
{
public override string BestiaryIcon => "CalamityMod/BiomeManagers/AstralCaveDesertIcon";
public override string MapBackground => "CalamityMod/Backgrounds/MapBackgrounds/AstralBG";
}
}
@@ -0,0 +1,11 @@
using Terraria.ModLoader;
namespace CalamityMod.BiomeManagers.BestiaryCategories
{
public class AstralDesert : ModBiome
{
public override string BestiaryIcon => "CalamityMod/BiomeManagers/AstralDesertIcon";
public override string MapBackground => "CalamityMod/Backgrounds/MapBackgrounds/AstralBG";
}
}
@@ -0,0 +1,11 @@
using Terraria.ModLoader;
namespace CalamityMod.BiomeManagers.BestiaryCategories
{
public class AstralIce : ModBiome //Unused, currently
{
public override string BestiaryIcon => "CalamityMod/BiomeManagers/AstralIceIcon";
public override string MapBackground => "CalamityMod/Backgrounds/MapBackgrounds/AstralBG";
}
}
@@ -0,0 +1,11 @@
using Terraria.ModLoader;
namespace CalamityMod.BiomeManagers.BestiaryCategories
{
public class AstralUnderground : ModBiome
{
public override string BestiaryIcon => "CalamityMod/BiomeManagers/UndergroundAstralIcon";
public override string MapBackground => "CalamityMod/Backgrounds/MapBackgrounds/AstralBG";
}
}
-33
View File
@@ -1,33 +0,0 @@
using CalamityMod.Systems;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.BiomeManagers
{
public class UndergroundAstralBiome : ModBiome
{
public override ModWaterStyle WaterStyle => ModContent.Find<ModWaterStyle>("CalamityMod/AstralWater");
public override ModUndergroundBackgroundStyle UndergroundBackgroundStyle => ModContent.Find<ModUndergroundBackgroundStyle>("CalamityMod/AstralUndergroundBGStyle");
public override SceneEffectPriority Priority => SceneEffectPriority.BiomeHigh;
public override string BestiaryIcon => "CalamityMod/BiomeManagers/UndergroundAstralIcon";
// Could use its own unique background
public override string BackgroundPath => "CalamityMod/Backgrounds/MapBackgrounds/AstralBG";
public override string MapBackground => "CalamityMod/Backgrounds/MapBackgrounds/AstralBG";
public override int Music => CalamityMod.Instance.GetMusicFromMusicMod("AstralInfectionUnderground") ?? MusicID.Space;
public override bool IsBiomeActive(Player player)
{
return !player.ZoneDungeon && BiomeTileCounterSystem.AstralTiles > 950 && (player.ZoneDirtLayerHeight || player.ZoneRockLayerHeight || player.ZoneUnderworldHeight);
}
public override void SpecialVisuals(Player player, bool isActive)
{
player.ManageSpecialBiomeVisuals("CalamityMod:Astral", isActive);
}
// Just slightly above the above-ground astral biomes.
public override float GetWeight(Player player) => 0.51f;
}
}
+1 -4
View File
@@ -1089,10 +1089,7 @@ namespace CalamityMod.CalPlayer
#region Biome
public bool ZoneCalamity => Player.InModBiome(ModContent.GetInstance<BrimstoneCragsBiome>());
public bool ZoneAstral => (Player.InModBiome(ModContent.GetInstance<AbovegroundAstralBiome>()) ||
Player.InModBiome(ModContent.GetInstance<AbovegroundAstralSnowBiome>()) ||
Player.InModBiome(ModContent.GetInstance<AbovegroundAstralDesertBiome>()) ||
Player.InModBiome(ModContent.GetInstance<UndergroundAstralBiome>())) && !ZoneAbyss;
public bool ZoneAstral => Player.InModBiome(ModContent.GetInstance<BiomeManagers.AstralInfectionBiome>()) && !ZoneAbyss;
public bool ZoneSunkenSea => Player.InModBiome(ModContent.GetInstance<SunkenSeaBiome>());
public bool ZoneSulphur => Player.InModBiome(ModContent.GetInstance<SulphurousSeaBiome>());
public bool ZoneAbyss => ZoneAbyssLayer1 || ZoneAbyssLayer2 || ZoneAbyssLayer3 || ZoneAbyssLayer4;
+11 -21
View File
@@ -92,13 +92,10 @@ namespace CalamityMod
public static Texture2D AstralSurfaceCloseGlow;
public static Texture2D AstralSurfaceMiddle;
public static Texture2D AstralSurfaceMiddleGlow;
public static Texture2D AstralSurfaceFar;
public static Texture2D AstralSurfaceHorizon;
// Astral Desert Sky/BG
public static Texture2D AstralDesertSurfaceClose;
public static Texture2D AstralDesertSurfaceMiddle;
public static Texture2D AstralDesertSurfaceFar;
// Astral Snow Sky/BG
public static Texture2D AstralSnowSurfaceMiddle;
@@ -278,22 +275,19 @@ namespace CalamityMod
{
// Astral Sky/BG
AstralSky = ModContent.Request<Texture2D>("CalamityMod/Skies/AstralSky", AssetRequestMode.ImmediateLoad).Value;
AstralSurfaceFront = ModContent.Request<Texture2D>("CalamityMod/Skies/AstralSurfaceFront", AssetRequestMode.ImmediateLoad).Value;
AstralSurfaceFrontGlow = ModContent.Request<Texture2D>("CalamityMod/Skies/AstralSurfaceFrontGlow", AssetRequestMode.ImmediateLoad).Value;
AstralSurfaceClose = ModContent.Request<Texture2D>("CalamityMod/Skies/AstralSurfaceClose", AssetRequestMode.ImmediateLoad).Value;
AstralSurfaceCloseGlow = ModContent.Request<Texture2D>("CalamityMod/Skies/AstralSurfaceCloseGlow", AssetRequestMode.ImmediateLoad).Value;
AstralSurfaceMiddle = ModContent.Request<Texture2D>("CalamityMod/Skies/AstralSurfaceMiddle", AssetRequestMode.ImmediateLoad).Value;
AstralSurfaceMiddleGlow = ModContent.Request<Texture2D>("CalamityMod/Skies/AstralSurfaceMiddleGlow", AssetRequestMode.ImmediateLoad).Value;
AstralSurfaceFar = ModContent.Request<Texture2D>("CalamityMod/Skies/AstralSurfaceFar", AssetRequestMode.ImmediateLoad).Value;
AstralSurfaceHorizon = ModContent.Request<Texture2D>("CalamityMod/Skies/AstralSurfaceHorizon", AssetRequestMode.ImmediateLoad).Value;
AstralSurfaceFront = ModContent.Request<Texture2D>("CalamityMod/Backgrounds/AstralSurfaceFront", AssetRequestMode.ImmediateLoad).Value;
AstralSurfaceFrontGlow = ModContent.Request<Texture2D>("CalamityMod/Backgrounds/AstralSurfaceFrontGlow", AssetRequestMode.ImmediateLoad).Value;
AstralSurfaceClose = ModContent.Request<Texture2D>("CalamityMod/Backgrounds/AstralSurfaceClose", AssetRequestMode.ImmediateLoad).Value;
AstralSurfaceCloseGlow = ModContent.Request<Texture2D>("CalamityMod/Backgrounds/AstralSurfaceCloseGlow", AssetRequestMode.ImmediateLoad).Value;
AstralSurfaceMiddle = ModContent.Request<Texture2D>("CalamityMod/Backgrounds/AstralSurfaceMiddle", AssetRequestMode.ImmediateLoad).Value;
AstralSurfaceMiddleGlow = ModContent.Request<Texture2D>("CalamityMod/Backgrounds/AstralSurfaceMiddleGlow", AssetRequestMode.ImmediateLoad).Value;
// Astral Desert Sky/BG
AstralDesertSurfaceClose = ModContent.Request<Texture2D>("CalamityMod/Skies/AstralDesertSurfaceClose", AssetRequestMode.ImmediateLoad).Value;
AstralDesertSurfaceMiddle = ModContent.Request<Texture2D>("CalamityMod/Skies/AstralDesertSurfaceMiddle", AssetRequestMode.ImmediateLoad).Value;
AstralDesertSurfaceFar = ModContent.Request<Texture2D>("CalamityMod/Skies/AstralDesertSurfaceFar", AssetRequestMode.ImmediateLoad).Value;
//Astral Desert Sky/BG
AstralDesertSurfaceClose = ModContent.Request<Texture2D>("CalamityMod/Backgrounds/AstralDesertSurfaceClose", AssetRequestMode.ImmediateLoad).Value;
AstralDesertSurfaceMiddle = ModContent.Request<Texture2D>("CalamityMod/Backgrounds/AstralDesertSurfaceMiddle", AssetRequestMode.ImmediateLoad).Value;
// Astral Snow Sky/BG
AstralSnowSurfaceMiddle = ModContent.Request<Texture2D>("CalamityMod/Skies/AstralSnowSurfaceMiddle", AssetRequestMode.ImmediateLoad).Value;
//Astral Snow Sky/BG
AstralSnowSurfaceMiddle = ModContent.Request<Texture2D>("CalamityMod/Backgrounds/AstralSnowSurfaceMiddle", AssetRequestMode.ImmediateLoad).Value;
// Sulpher Sea Sky/BG
SulphurSeaSky = ModContent.Request<Texture2D>("CalamityMod/Skies/SulphurSeaSky", AssetRequestMode.ImmediateLoad).Value;
@@ -352,10 +346,6 @@ namespace CalamityMod
SkyManager.Instance["CalamityMod:BrimstoneCrag"] = new BrimstoneCragSky();
SkyManager.Instance["CalamityMod:Astral"] = new AstralSky();
SkyManager.Instance["CalamityMod:AstralSurface"] = new AstralSkySurface();
SkyManager.Instance["CalamityMod:AstralDesert"] = new AstralSkyDesert();
SkyManager.Instance["CalamityMod:AstralSnow"] = new AstralSkySnow();
SkyManager.Instance["CalamityMod:MonolithAstral"] = new AstralMonolithSky();
SkyManager.Instance["CalamityMod:SulphurSea"] = new SulphurSeaSky();
SkyManager.Instance["CalamityMod:Cryogen"] = new CryogenSky();
SkyManager.Instance["CalamityMod:StormWeaverFlash"] = new StormWeaverFlashSky();
+1 -1
View File
@@ -64,7 +64,7 @@ namespace CalamityMod.ILEditing
SoundEngine.PlaySound(SoundID.DoorClosed, new Vector2(doorX * 16, doorY * 16));
return true;
}
private static Texture2D SelectLavaTexture(Texture2D initialTexture, LiquidTileType type)
{
// Use the initial texture if it isn't lava.
+1 -1
View File
@@ -43,4 +43,4 @@ namespace CalamityMod.Items.Weapons.Melee
Register();
}
}
}
}
@@ -1,29 +1,28 @@
// For general uses
Abyss: Abyss
AstralInfection: Astral Infection
AstralDesert: Astral Desert
AstralSnow: Astral Snow
BrimstoneCrags: Brimstone Crags
SulphurousSea: Sulphurous Sea
SunkenSea: Sunken Sea
AbovegroundAstralBiome: {
DisplayName: Astral Infection
TownNPCDialogueName: Astral Infection
}
AbovegroundAstralBiomeSurface: {
DisplayName: Astral Surface
TownNPCDialogueName: Astral Infection
}
AbovegroundAstralDesertBiome: {
AstralDesert: {
DisplayName: Astral Desert Surface
TownNPCDialogueName: Astral Desert
}
AbovegroundAstralSnowBiome: {
DisplayName: Astral Snow Surface
AstralBiome: {
DisplayName: Astral Infection
TownNPCDialogueName: Astral Infection
}
AstralInfectionBiome: {
DisplayName: Astral Infection
TownNPCDialogueName: Astral Infection
}
AstralIce: {
DisplayName: Astral Ice
TownNPCDialogueName: Astral Snow
}
@@ -72,7 +71,12 @@ SunkenSeaBiome: {
TownNPCDialogueName: Sunken Sea
}
UndergroundAstralBiome: {
AstralUnderground: {
DisplayName: Astral Underground
TownNPCDialogueName: Underground Astral Infection
}
AstralCaveDesert: {
DisplayName: Astral Cave Desert
TownNPCDialogueName: the Astral Cave Desert
}
+1
View File
@@ -21,6 +21,7 @@ using CalamityMod.Items.Weapons.Magic;
using CalamityMod.Items.Weapons.Ranged;
using CalamityMod.Items.Weapons.Rogue;
using CalamityMod.Items.Weapons.Summon;
using CalamityMod.Items.Weapons.Rogue;
using CalamityMod.NPCs.AcidRain;
using CalamityMod.NPCs.AquaticScourge;
using CalamityMod.NPCs.Astral;
+1 -1
View File
@@ -50,7 +50,7 @@ namespace CalamityMod.NPCs.Astral
}
NPC.Calamity().VulnerableToHeat = true;
NPC.Calamity().VulnerableToSickness = false;
SpawnModBiomes = new int[1] { ModContent.GetInstance<AbovegroundAstralBiome>().Type };
SpawnModBiomes = new int[1] { ModContent.GetInstance<AstralInfectionBiome>().Type };
// Scale stats in Expert and Master
CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC);
+1 -1
View File
@@ -56,7 +56,7 @@ namespace CalamityMod.NPCs.Astral
}
NPC.Calamity().VulnerableToHeat = true;
NPC.Calamity().VulnerableToSickness = false;
SpawnModBiomes = new int[1] { ModContent.GetInstance<AbovegroundAstralBiome>().Type };
SpawnModBiomes = new int[1] { ModContent.GetInstance<BiomeManagers.AstralInfectionBiome>().Type };
// Scale stats in Expert and Master
CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC);
+1 -1
View File
@@ -44,7 +44,7 @@ namespace CalamityMod.NPCs.Astral
}
NPC.Calamity().VulnerableToHeat = true;
NPC.Calamity().VulnerableToSickness = false;
SpawnModBiomes = new int[1] { ModContent.GetInstance<AbovegroundAstralBiome>().Type };
SpawnModBiomes = new int[1] { ModContent.GetInstance<AstralInfectionBiome>().Type };
// Scale stats in Expert and Master
CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC);
+2 -1
View File
@@ -7,6 +7,7 @@ using CalamityMod.Items.Placeables.Banners;
using CalamityMod.Items.Weapons.Magic;
using CalamityMod.Sounds;
using CalamityMod.World;
using CalamityMod.BiomeManagers.BestiaryCategories;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using ReLogic.Content;
@@ -58,7 +59,7 @@ namespace CalamityMod.NPCs.Astral
}
NPC.Calamity().VulnerableToHeat = true;
NPC.Calamity().VulnerableToSickness = false;
SpawnModBiomes = new int[1] { ModContent.GetInstance<UndergroundAstralBiome>().Type };
SpawnModBiomes = new int[1] { ModContent.GetInstance<AstralUnderground>().Type };
// Scale stats in Expert and Master
CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC);
+1 -1
View File
@@ -153,7 +153,7 @@ namespace CalamityMod.NPCs.Astral
}
NPC.Calamity().VulnerableToHeat = true;
NPC.Calamity().VulnerableToSickness = false;
SpawnModBiomes = new int[1] { ModContent.GetInstance<AbovegroundAstralBiome>().Type };
SpawnModBiomes = new int[1] { ModContent.GetInstance<BiomeManagers.AstralInfectionBiome>().Type };
// Scale stats in Expert and Master
CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC);
+2 -1
View File
@@ -4,6 +4,7 @@ using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Dusts;
using CalamityMod.Items.Materials;
using CalamityMod.Items.Placeables.Banners;
using CalamityMod.BiomeManagers.BestiaryCategories;
using CalamityMod.Projectiles.Enemy;
using CalamityMod.Sounds;
using Microsoft.Xna.Framework;
@@ -75,7 +76,7 @@ namespace CalamityMod.NPCs.Astral
}
NPC.Calamity().VulnerableToHeat = true;
NPC.Calamity().VulnerableToSickness = false;
SpawnModBiomes = new int[1] { ModContent.GetInstance<AbovegroundAstralDesertBiome>().Type };
SpawnModBiomes = new int[1] { ModContent.GetInstance<AstralDesert>().Type };
// Scale stats in Expert and Master
CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC);
+2 -1
View File
@@ -8,6 +8,7 @@ using CalamityMod.Items.Placeables.Banners;
using CalamityMod.Sounds;
using CalamityMod.Tiles.AstralDesert;
using CalamityMod.World;
using CalamityMod.BiomeManagers.BestiaryCategories;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using ReLogic.Content;
@@ -58,7 +59,7 @@ namespace CalamityMod.NPCs.Astral
}
NPC.Calamity().VulnerableToHeat = true;
NPC.Calamity().VulnerableToSickness = false;
SpawnModBiomes = new int[1] { ModContent.GetInstance<AbovegroundAstralDesertBiome>().Type };
SpawnModBiomes = new int[1] { ModContent.GetInstance<AstralDesert>().Type };
// Scale stats in Expert and Master
CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC);
+2 -1
View File
@@ -7,6 +7,7 @@ using CalamityMod.Items.Placeables.Banners;
using CalamityMod.Items.Weapons.Summon;
using CalamityMod.Sounds;
using CalamityMod.World;
using CalamityMod.BiomeManagers.BestiaryCategories;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using ReLogic.Content;
@@ -50,7 +51,7 @@ namespace CalamityMod.NPCs.Astral
}
NPC.Calamity().VulnerableToHeat = true;
NPC.Calamity().VulnerableToSickness = false;
SpawnModBiomes = new int[1] { ModContent.GetInstance<UndergroundAstralBiome>().Type };
SpawnModBiomes = new int[1] { ModContent.GetInstance<AstralUnderground>().Type };
if (Main.zenithWorld)
{
NPC.scale = 3f;
+2 -1
View File
@@ -4,6 +4,7 @@ using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Dusts;
using CalamityMod.Sounds;
using CalamityMod.World;
using CalamityMod.BiomeManagers.BestiaryCategories;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using ReLogic.Content;
@@ -50,7 +51,7 @@ namespace CalamityMod.NPCs.Astral
}
NPC.Calamity().VulnerableToHeat = true;
NPC.Calamity().VulnerableToSickness = false;
SpawnModBiomes = new int[1] { ModContent.GetInstance<UndergroundAstralBiome>().Type };
SpawnModBiomes = new int[1] { ModContent.GetInstance<AstralUnderground>().Type };
// Scale stats in Expert and Master
CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC);
+1 -1
View File
@@ -60,7 +60,7 @@ namespace CalamityMod.NPCs.Astral
}
NPC.Calamity().VulnerableToHeat = true;
NPC.Calamity().VulnerableToSickness = false;
SpawnModBiomes = new int[1] { ModContent.GetInstance<AbovegroundAstralBiome>().Type };
SpawnModBiomes = new int[1] { ModContent.GetInstance<BiomeManagers.AstralInfectionBiome>().Type };
// Scale stats in Expert and Master
CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC);
+1 -1
View File
@@ -81,7 +81,7 @@ namespace CalamityMod.NPCs.Astral
}
NPC.Calamity().VulnerableToHeat = true;
NPC.Calamity().VulnerableToSickness = false;
SpawnModBiomes = new int[1] { ModContent.GetInstance<AbovegroundAstralBiome>().Type };
SpawnModBiomes = new int[1] { ModContent.GetInstance<BiomeManagers.AstralInfectionBiome>().Type };
// Scale stats in Expert and Master
CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC);
+1 -1
View File
@@ -59,7 +59,7 @@ namespace CalamityMod.NPCs.Astral
}
NPC.Calamity().VulnerableToHeat = true;
NPC.Calamity().VulnerableToSickness = false;
SpawnModBiomes = new int[1] { ModContent.GetInstance<AbovegroundAstralBiome>().Type };
SpawnModBiomes = new int[1] { ModContent.GetInstance<BiomeManagers.AstralInfectionBiome>().Type };
// Scale stats in Expert and Master
CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC);
+1 -1
View File
@@ -61,7 +61,7 @@ namespace CalamityMod.NPCs.Astral
}
NPC.Calamity().VulnerableToHeat = true;
NPC.Calamity().VulnerableToSickness = false;
SpawnModBiomes = new int[1] { ModContent.GetInstance<AbovegroundAstralBiome>().Type };
SpawnModBiomes = new int[1] { ModContent.GetInstance<BiomeManagers.AstralInfectionBiome>().Type };
// Scale stats in Expert and Master
CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC);
+2 -1
View File
@@ -5,6 +5,7 @@ using CalamityMod.Dusts;
using CalamityMod.Items.Accessories;
using CalamityMod.Items.Materials;
using CalamityMod.Items.Placeables.Banners;
using CalamityMod.BiomeManagers.BestiaryCategories;
using CalamityMod.Sounds;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
@@ -59,7 +60,7 @@ namespace CalamityMod.NPCs.Astral
}
NPC.Calamity().VulnerableToHeat = true;
NPC.Calamity().VulnerableToSickness = false;
SpawnModBiomes = new int[1] { ModContent.GetInstance<UndergroundAstralBiome>().Type };
SpawnModBiomes = new int[1] { ModContent.GetInstance<AstralUnderground>().Type };
// Scale stats in Expert and Master
CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC);
+1 -1
View File
@@ -26,7 +26,7 @@ namespace CalamityMod.NPCs.Astral
AIType = NPCID.LightningBug;
AnimationType = NPCID.LightningBug;
NPC.catchItem = (short)ModContent.ItemType<TwinklerItem>();
SpawnModBiomes = new int[1] { ModContent.GetInstance<AbovegroundAstralBiome>().Type };
SpawnModBiomes = new int[1] { ModContent.GetInstance<BiomeManagers.AstralInfectionBiome>().Type };
}
public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry)
+2 -2
View File
@@ -106,7 +106,7 @@ namespace CalamityMod.NPCs.AstrumAureus
NPC.lifeMax += (int)(NPC.lifeMax * HPBoost);
NPC.Calamity().VulnerableToHeat = true;
NPC.Calamity().VulnerableToSickness = false;
SpawnModBiomes = new int[1] { ModContent.GetInstance<AbovegroundAstralBiome>().Type };
SpawnModBiomes = new int[1] { ModContent.GetInstance<BiomeManagers.AstralInfectionBiome>().Type };
if (Main.getGoodWorld)
NPC.scale *= 0.8f;
@@ -439,7 +439,7 @@ namespace CalamityMod.NPCs.AstrumAureus
}
// Drop an Astral Meteor if applicable
ThreadPool.QueueUserWorkItem(_ => AstralBiome.PlaceAstralMeteor());
ThreadPool.QueueUserWorkItem(_ => World.AstralBiome.PlaceAstralMeteor());
// Mark Astrum Aureus as dead
DownedBossSystem.downedAstrumAureus = true;
+1 -1
View File
@@ -108,7 +108,7 @@ namespace CalamityMod.NPCs.AstrumDeus
NPC.netAlways = true;
NPC.Calamity().VulnerableToHeat = true;
NPC.Calamity().VulnerableToSickness = false;
SpawnModBiomes = new int[1] { ModContent.GetInstance<AbovegroundAstralBiome>().Type };
SpawnModBiomes = new int[1] { ModContent.GetInstance<BiomeManagers.AstralInfectionBiome>().Type };
if (Main.zenithWorld)
{
+2 -2
View File
@@ -147,13 +147,13 @@ namespace CalamityMod.NPCs.TownNPCs
type = ConvertType.Crimson;
break;
}
AstralBiome.ConvertFromAstral(x - 2, x + 2, y - 2, y + 2, type);
World.AstralBiome.ConvertFromAstral(x - 2, x + 2, y - 2, y + 2, type);
WorldGen.Convert(x, y, conversionType, 2);
}
// Calamity solution(s)
else if (conversionType == 8)
{
AstralBiome.ConvertToAstral(x - 2, x + 2, y - 2, y + 2);
World.AstralBiome.ConvertToAstral(x - 2, x + 2, y - 2, y + 2);
}
// Solutions registered by other mods
else
+1
View File
@@ -8,6 +8,7 @@ using Terraria;
using Terraria.Graphics.Shaders;
using Terraria.ID;
using Terraria.ModLoader;
using CalamityMod.Graphics.Primitives;
namespace CalamityMod.Projectiles.Magic
{
+1
View File
@@ -8,6 +8,7 @@ using Terraria;
using Terraria.Graphics.Shaders;
using Terraria.ID;
using Terraria.ModLoader;
using CalamityMod.Graphics.Primitives;
namespace CalamityMod.Projectiles.Magic
{
+13 -6
View File
@@ -1,4 +1,4 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.DataStructures;
using Terraria.ModLoader;
@@ -28,7 +28,7 @@ namespace CalamityMod.Projectiles.Melee
public override void OnSpawn(IEntitySource source)
{
if (Main.npc[(int)Projectile.ai[0]] is not null || Main.npc[(int)Projectile.ai[0]].active)
target = Main.npc[(int)Projectile.ai[0]]; // Convert target.whoAmI to object
target = Main.npc[(int)Projectile.ai[0]]; // Convert target.whoAmI to object
}
// ai[0] for ID of target to follow until the end of projectile's lifespan or the target cannot be found
@@ -41,7 +41,8 @@ namespace CalamityMod.Projectiles.Melee
Projectile.Kill();
}
Projectile.Center = Main.npc[(int)Projectile.ai[0]].Center; // Stay with target
// Stay with target
Projectile.Center = Main.npc[(int)Projectile.ai[0]].Center;
if (Projectile.ai[1] == CurrentSwordTimer)
{
@@ -49,10 +50,16 @@ namespace CalamityMod.Projectiles.Melee
randomDirection.Normalize();
int randomDistance = Main.rand.Next(200, 426);
Vector2 spawnPos = Projectile.Center + (randomDirection * randomDistance);
Vector2 velocity = Vector2.Normalize(Projectile.Center - spawnPos) * Utils.GetLerpValue(-100, 426, randomDistance, clamped: true) * 20f; // Sword moves a bit slower if spawned closer, moves faster if spawned further
// Sword moves a bit slower if spawned closer, moves faster if spawned further
Vector2 velocity = Vector2.Normalize(Projectile.Center - spawnPos) * Utils.GetLerpValue(-100, 426, randomDistance, clamped: true) * 20f;
Projectile.NewProjectile(Projectile.GetSource_FromThis(), spawnPos.X, spawnPos.Y, velocity.X, velocity.Y, ModContent.ProjectileType<CosmicShivBlade>(), Projectile.damage, Projectile.knockBack * 0.8f, Projectile.owner, randomDistance);
Projectile.ai[1] = 0; // Reset timer
CurrentSwordTimer = Main.rand.Next(SwordsAverageDelay - SwordsRandomOffset, SwordsAverageDelay + SwordsRandomOffset); // Determine when next sword will spawn
// Reset timer
Projectile.ai[1] = 0;
// Determine when next sword will spawn
CurrentSwordTimer = Main.rand.Next(SwordsAverageDelay - SwordsRandomOffset, SwordsAverageDelay + SwordsRandomOffset);
}
Projectile.ai[1]++;
+12 -5
View File
@@ -66,13 +66,18 @@ namespace CalamityMod.Projectiles.Melee
float rotation = Projectile.rotation;
Color randomColor = Projectile.GetAlpha(lightColor);
// Afterimages to make the blade look longer
float scaleMult = 1.2f;
for (int i = 0; i < Projectile.oldPos.Length; i++) // Afterimages to make the blade look longer
for (int i = 0; i < Projectile.oldPos.Length; i++)
{
Vector2 drawPos = Projectile.oldPos[i] + (Projectile.Size / 2f) - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY);
Color color = randomColor * ((float)(Projectile.oldPos.Length - i) / (float)Projectile.oldPos.Length);
Main.spriteBatch.Draw(texture, drawPos, new Rectangle?(sourceRectangle), color, rotation, origin, Projectile.scale * scaleMult, SpriteEffects.None, 0f); // Smaller, more visible layer
Main.spriteBatch.Draw(texture, drawPos, new Rectangle?(sourceRectangle), color * 0.5f, rotation, origin, Projectile.scale * 1.6f * scaleMult, SpriteEffects.None, 0f); // Bigger, less visible layer
// Smaller, more visible layer
Main.spriteBatch.Draw(texture, drawPos, new Rectangle?(sourceRectangle), color, rotation, origin, Projectile.scale * scaleMult, SpriteEffects.None, 0f);
// Bigger, less visible layer
Main.spriteBatch.Draw(texture, drawPos, new Rectangle?(sourceRectangle), color * 0.5f, rotation, origin, Projectile.scale * 1.6f * scaleMult, SpriteEffects.None, 0f);
scaleMult *= 0.95f;
}
@@ -88,12 +93,14 @@ namespace CalamityMod.Projectiles.Melee
}
}
public override Color? GetAlpha(Color lightColor) // Probably not the right way to use this function, but it works (hopefully)
// Probably not the right way to use this function, but it works (hopefully)
public override Color? GetAlpha(Color lightColor)
{
// Take random color from a list and make it more white
Color color = CosmicShivTrail.DustColors[ColorIndex] * Projectile.Opacity;
color = Color.Lerp(color, Color.White, 0.6f);
color.A = 0;
return color; // Take random color from a list and make it more white
return color;
}
}
}
+44
View File
@@ -7,6 +7,14 @@ using Terraria;
using Terraria.GameContent;
using Terraria.ID;
using Terraria.ModLoader;
using CalamityMod.Buffs.DamageOverTime;
using System.Collections.Generic;
using System.Security.Cryptography.X509Certificates;
using System.Reflection.Metadata;
using Microsoft.Xna.Framework.Graphics;
using System.Diagnostics.Contracts;
using Terraria.GameContent;
using Terraria.Audio;
namespace CalamityMod.Projectiles.Melee
{
@@ -104,6 +112,40 @@ namespace CalamityMod.Projectiles.Melee
target.AddBuff(ModContent.BuffType<GodSlayerInferno>(), 60);
}
// pretty much entirely from the Oracle circular damage code
private void CircularDamage(float radius)
{
if (Projectile.owner != Main.myPlayer)
return;
Player owner = Main.player[Projectile.owner];
for (int i = 0; i < Main.npc.Length; ++i)
{
NPC target = Main.npc[i];
if (!target.active || target.dontTakeDamage || target.friendly)
continue;
// Shock any valid target within range. Check all four corners of their hitbox.
float d1 = Vector2.Distance(Projectile.Center, target.Hitbox.TopLeft());
float d2 = Vector2.Distance(Projectile.Center, target.Hitbox.TopRight());
float d3 = Vector2.Distance(Projectile.Center, target.Hitbox.BottomLeft());
float d4 = Vector2.Distance(Projectile.Center, target.Hitbox.BottomRight());
float dist = MathHelper.Min(d1, d2);
dist = MathHelper.Min(dist, d3);
dist = MathHelper.Min(dist, d4);
if (dist <= radius)
{
int damage = (int)(Projectile.damage * ExplosionDamageMultiplier);
bool crit = Main.rand.Next(100) <= owner.GetCritChance<MeleeDamageClass>() + 4;
target.StrikeNPC(target.CalculateHitInfo(damage, 0, crit, 0));
if (Main.netMode != NetmodeID.SinglePlayer)
NetMessage.SendData(MessageID.DamageNPC, -1, -1, null, i, damage, 0f, 0f, crit ? 1 : 0, 0, 0);
}
}
}
// Very similar to CosmicShivBlade PreDraw
public override bool PreDraw(ref Color lightColor)
{
@@ -187,6 +229,8 @@ namespace CalamityMod.Projectiles.Melee
dust.fadeIn = -1f;
}
}
CircularDamage(80f);
}
public override Color? GetAlpha(Color lightColor)
+1
View File
@@ -8,6 +8,7 @@ using Terraria.Graphics.Shaders;
using Terraria.ID;
using Terraria.ModLoader;
using static Terraria.ModLoader.ModContent;
using CalamityMod.Graphics.Primitives;
namespace CalamityMod.Projectiles.Melee
{
@@ -1,9 +1,14 @@
using System;
using System;
using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Buffs.StatDebuffs;
using CalamityMod.Items.Weapons.Melee;
using CalamityMod.Projectiles.BaseProjectiles;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.GameContent;
using Terraria.Graphics;
using Terraria.Graphics.Shaders;
using Terraria.ID;
using Terraria.Localization;
using Terraria.ModLoader;
@@ -57,7 +62,8 @@ namespace CalamityMod.Projectiles.Melee.Shortswords
OnHitEffect();
if (NumHits < 3)
{ // Just to avoid insanity from stacking so many super dummies or hitting many worm segments at once
{
// Just to avoid insanity from stacking so many super dummies or hitting many worm segments at once
// 2x bonus for true melee hits (spawns an additional aura plus the one aura from the cosmic shiv ball)
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.position, Vector2.Zero, ModContent.ProjectileType<CosmicShivAura>(), Projectile.damage, Projectile.knockBack, Projectile.owner, target.whoAmI);
NumHits++;
Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

+1
View File
@@ -6,6 +6,7 @@ using Terraria.GameContent;
using Terraria.Graphics.Effects;
using Terraria.ID;
using Terraria.ModLoader;
using System.Reflection;
namespace CalamityMod.Skies
{
-137
View File
@@ -1,137 +0,0 @@
using CalamityMod.Systems;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.GameContent;
using Terraria.Graphics.Effects;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Skies
{
public class AstralSkyDesert : CustomSky
{
private bool skyActive;
private float opacity;
private const float Scale = 2f;
public override void Deactivate(params object[] args)
{
skyActive = Main.LocalPlayer.Calamity().ZoneAstral && !Main.LocalPlayer.ZoneDungeon && BiomeTileCounterSystem.AstralTiles > 950 && Main.LocalPlayer.ZoneDesert && !Main.LocalPlayer.ZoneSnow;
}
public override void Reset()
{
skyActive = false;
}
public override bool IsActive()
{
return skyActive || opacity > 0f;
}
public override void Activate(Vector2 position, params object[] args)
{
skyActive = true;
}
public override Color OnTileColor(Color inColor)
{
return Color.Lerp(inColor, new Color(63, 51, 90, inColor.A), opacity);
}
public override void Draw(SpriteBatch spriteBatch, float minDepth, float maxDepth)
{
// Small worlds, default draw height.
int AstralBiomeHeight = (World.AstralBiome.YStart + (int)Main.worldSurface) / 2;
// Medium worlds.
if (Main.maxTilesX >= 6400 && Main.maxTilesX < 8400)
AstralBiomeHeight = (World.AstralBiome.YStart + (int)Main.worldSurface) / 4;
// Large worlds (and anything bigger).
if (Main.maxTilesX >= 8400)
AstralBiomeHeight = (World.AstralBiome.YStart + (int)Main.worldSurface) / 140;
// Background from here starting from the back layer to the front layer.
float width = Main.screenWidth / 2f;
float height = Main.screenHeight / 2f;
Color color = new Color(63, 51, 90, 255) * opacity;
if (maxDepth >= 9f && minDepth < 9f)
{
float screenParralaxMultiplier = 0.16f;
Texture2D texture = CalamityMod.AstralSurfaceHorizon;
int x = (int)(Main.screenPosition.X * screenParralaxMultiplier);
x %= (int)(texture.Width * Scale);
int y = (int)(Main.screenPosition.Y * screenParralaxMultiplier);
y -= 1380; // 1000
for (int k = -1; k <= 1; k++)
{
var pos = new Vector2(width - x + texture.Width * k * Scale, height - y);
spriteBatch.Draw(texture, pos - texture.Size() / 2f * Scale, null, color, 0f, new Vector2(0f, (float)AstralBiomeHeight), Scale, SpriteEffects.None, 0f);
}
}
if (maxDepth >= 8f && minDepth < 8f)
{
float screenParralaxMultiplier = 0.4f;
Texture2D texture = CalamityMod.AstralDesertSurfaceFar;
int x = (int)(Main.screenPosition.X * 0.5f * screenParralaxMultiplier);
x %= (int)(texture.Width * Scale);
int y = (int)(Main.screenPosition.Y * 0.45f * screenParralaxMultiplier);
y -= 1520; // 1000
for (int k = -1; k <= 1; k++)
{
var pos = new Vector2(width - x + texture.Width * k * Scale, height - y);
spriteBatch.Draw(texture, pos - texture.Size() / 2f * Scale, null, color, 0f, new Vector2(0f, (float)AstralBiomeHeight), Scale, SpriteEffects.None, 0f);
}
}
if (maxDepth >= 7f && minDepth < 7f)
{
float screenParralaxMultiplier = 0.4f;
Texture2D texture = CalamityMod.AstralDesertSurfaceMiddle;
int x = (int)(Main.screenPosition.X * 0.8f * screenParralaxMultiplier);
x %= (int)(texture.Width * Scale);
int y = (int)(Main.screenPosition.Y * 0.5f * screenParralaxMultiplier);
y -= 1900; // 1000
for (int k = -1; k <= 1; k++)
{
var pos = new Vector2(width - x + texture.Width * k * Scale, height - y);
spriteBatch.Draw(texture, pos - texture.Size() / 2f * Scale, null, color, 0f, new Vector2(0f, (float)AstralBiomeHeight), Scale, SpriteEffects.None, 0f);
}
}
if (maxDepth >= 6f && minDepth < 6f)
{
float screenParralaxMultiplier = 0.4f;
Texture2D texture = CalamityMod.AstralDesertSurfaceClose;
int x = (int)(Main.screenPosition.X * 1f * screenParralaxMultiplier);
x %= (int)(texture.Width * Scale);
int y = (int)(Main.screenPosition.Y * 0.55f * screenParralaxMultiplier);
y -= 2050; // 1000
for (int k = -1; k <= 1; k++)
{
var pos = new Vector2(width - x + texture.Width * k * Scale, height - y);
spriteBatch.Draw(texture, pos - texture.Size() / 2f * Scale, null, color, 0f, new Vector2(0f, (float)AstralBiomeHeight), Scale, SpriteEffects.None, 0f);
}
}
}
public override void Update(GameTime gameTime)
{
if (!Main.LocalPlayer.Calamity().ZoneAstral || Main.gameMenu)
skyActive = false;
if (skyActive && opacity < 1f)
opacity += 0.02f;
else if (!skyActive && opacity > 0f)
opacity -= 0.02f;
}
public override float GetCloudAlpha()
{
return (1f - opacity) * 0.97f + 0.03f;
}
}
}
-171
View File
@@ -1,171 +0,0 @@
using CalamityMod.Systems;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.GameContent;
using Terraria.Graphics.Effects;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Skies
{
public class AstralSkySnow : CustomSky
{
private bool skyActive;
private float opacity;
private const float Scale = 2.0f;
private const float ScreenParralaxMultiplier = 0.4f;
public override void Deactivate(params object[] args)
{
skyActive = Main.LocalPlayer.Calamity().ZoneAstral && !Main.LocalPlayer.ZoneDungeon && BiomeTileCounterSystem.AstralTiles > 950 && Main.LocalPlayer.ZoneSnow && !Main.LocalPlayer.ZoneDesert;
}
public override void Reset()
{
skyActive = false;
}
public override bool IsActive()
{
return skyActive || opacity > 0f;
}
public override void Activate(Vector2 position, params object[] args)
{
skyActive = true;
}
public override Color OnTileColor(Color inColor)
{
return Color.Lerp(inColor, new Color(63, 51, 90, inColor.A), opacity);
}
public override void Draw(SpriteBatch spriteBatch, float minDepth, float maxDepth)
{
// Small worlds, default draw height.
int AstralBiomeHeight = (World.AstralBiome.YStart + (int)Main.worldSurface) / 2;
// Medium worlds.
if (Main.maxTilesX >= 6400 && Main.maxTilesX < 8400)
AstralBiomeHeight = (World.AstralBiome.YStart + (int)Main.worldSurface) / 4;
// Large worlds (and anything bigger).
if (Main.maxTilesX >= 8400)
AstralBiomeHeight = (World.AstralBiome.YStart + (int)Main.worldSurface) / 140;
// Background from here starting from the back layer to the front layer.
float width = Main.screenWidth / 2f;
float height = Main.screenHeight / 2f;
Color textureColor = new Color(116, 96, 164, 255) * opacity;
Vector2 origin = new Vector2(0f, AstralBiomeHeight);
if (maxDepth >= 9f && minDepth < 9f)
{
Texture2D texture = CalamityMod.AstralSurfaceHorizon;
int x = (int)(Main.screenPosition.X * 0.4f * ScreenParralaxMultiplier);
x %= (int)(texture.Width * Scale);
int y = (int)(Main.screenPosition.Y * 0.4f * ScreenParralaxMultiplier);
y -= 1380; // 1000
Vector2 position = texture.Size() / 2f * Scale;
for (int k = -1; k <= 1; k++)
{
var pos = new Vector2(width - x + texture.Width * k * Scale, height - y);
spriteBatch.Draw(texture, pos - position, null, textureColor, 0f, origin, Scale, SpriteEffects.None, 0f);
}
}
if (maxDepth >= 8f && minDepth < 8f)
{
Texture2D texture = CalamityMod.AstralSurfaceFar;
int x = (int)(Main.screenPosition.X * 0.5f * ScreenParralaxMultiplier);
x %= (int)(texture.Width * Scale);
int y = (int)(Main.screenPosition.Y * 0.45f * ScreenParralaxMultiplier);
y -= 1520; // 1000
Vector2 position = texture.Size() / 2f * Scale;
for (int k = -1; k <= 1; k++)
{
var pos = new Vector2(width - x + texture.Width * k * Scale, height - y);
spriteBatch.Draw(texture, pos - position, null, textureColor, 0f, origin, Scale, SpriteEffects.None, 0f);
}
}
if (maxDepth >= 7f && minDepth < 7f)
{
Texture2D texture = CalamityMod.AstralSnowSurfaceMiddle;
int x = (int)(Main.screenPosition.X * 0.8f * ScreenParralaxMultiplier);
x %= (int)(texture.Width * Scale);
int y = (int)(Main.screenPosition.Y * 0.5f * ScreenParralaxMultiplier);
y -= 1900; // 1000
Vector2 position = texture.Size() / 2f * Scale;
for (int k = -1; k <= 1; k++)
{
var pos = new Vector2(width - x + texture.Width * k * Scale, height - y);
spriteBatch.Draw(texture, pos - position, null, textureColor, 0f, origin, Scale, SpriteEffects.None, 0f);
}
}
if (maxDepth >= 6f && minDepth < 6f)
{
Texture2D texture = CalamityMod.AstralSurfaceClose;
int x = (int)(Main.screenPosition.X * 0.9f * ScreenParralaxMultiplier);
x %= (int)(texture.Width * Scale);
int y = (int)(Main.screenPosition.Y * 0.55f * ScreenParralaxMultiplier);
y -= 1880; // 1000
Vector2 position = texture.Size() / 2f * Scale;
for (int k = -1; k <= 1; k++)
{
var pos = new Vector2(width - x + texture.Width * k * Scale, height - y);
spriteBatch.Draw(texture, pos - position, null, textureColor, 0f, origin, Scale, SpriteEffects.None, 0f);
}
Texture2D textureglow = CalamityMod.AstralSurfaceCloseGlow;
Color textureGlowColor = Color.White * 0.7f * opacity;
for (int k = -1; k <= 1; k++)
{
var pos = new Vector2(width - x + texture.Width * k * Scale, height - y);
spriteBatch.Draw(textureglow, pos - position, null, textureGlowColor, 0f, origin, Scale, SpriteEffects.None, 0f);
}
}
if (maxDepth >= 5f && minDepth < 5f)
{
Texture2D texture = CalamityMod.AstralSurfaceFront;
int x = (int)(Main.screenPosition.X * 1.1f * ScreenParralaxMultiplier);
x %= (int)(texture.Width * Scale);
int y = (int)(Main.screenPosition.Y * 0.6f * ScreenParralaxMultiplier);
y -= 2100; // 1000
Vector2 position = texture.Size() / 2f * Scale;
for (int k = -1; k <= 1; k++)
{
var pos = new Vector2(width - x + texture.Width * k * Scale, height - y);
spriteBatch.Draw(texture, pos - position, null, textureColor, 0f, origin, Scale, SpriteEffects.None, 0f);
}
Texture2D textureglow = CalamityMod.AstralSurfaceFrontGlow;
Color textureGlowColor = Color.White * 0.9f * opacity;
for (int k = -1; k <= 1; k++)
{
var pos = new Vector2(width - x + texture.Width * k * Scale, height - y);
spriteBatch.Draw(textureglow, pos - position, null, textureGlowColor, 0f, origin, Scale, SpriteEffects.None, 0f);
}
}
}
public override void Update(GameTime gameTime)
{
if (!Main.LocalPlayer.Calamity().ZoneAstral || Main.gameMenu)
skyActive = false;
if (skyActive && opacity < 1f)
opacity += 0.02f;
else if (!skyActive && opacity > 0f)
opacity -= 0.02f;
}
public override float GetCloudAlpha()
{
return (1f - opacity) * 0.97f + 0.03f;
}
}
}
-179
View File
@@ -1,179 +0,0 @@
using CalamityMod.Systems;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.GameContent;
using Terraria.Graphics.Effects;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Skies
{
public class AstralSkySurface : CustomSky
{
private bool skyActive;
private float opacity;
private const float Scale = 2f;
private const float ScreenParralaxMultiplier = 0.4f;
public override void Deactivate(params object[] args)
{
skyActive = Main.LocalPlayer.Calamity().ZoneAstral && !Main.LocalPlayer.ZoneDungeon && BiomeTileCounterSystem.AstralTiles > 950 && !Main.LocalPlayer.ZoneDesert && !Main.LocalPlayer.ZoneSnow;
}
public override void Reset()
{
skyActive = false;
}
public override bool IsActive()
{
return skyActive || opacity > 0f;
}
public override void Activate(Vector2 position, params object[] args)
{
skyActive = true;
}
public override Color OnTileColor(Color inColor)
{
return Color.Lerp(inColor, new Color(63, 51, 90, inColor.A), opacity);
}
public override void Draw(SpriteBatch spriteBatch, float minDepth, float maxDepth)
{
// Small worlds, default draw height.
int AstralBiomeHeight = (World.AstralBiome.YStart + (int)Main.worldSurface) / 2;
// Medium worlds.
if (Main.maxTilesX >= 6400 && Main.maxTilesX < 8400)
AstralBiomeHeight = (World.AstralBiome.YStart + (int)Main.worldSurface) / 4;
// Large worlds (and anything bigger).
if (Main.maxTilesX >= 8400)
AstralBiomeHeight = (World.AstralBiome.YStart + (int)Main.worldSurface) / 140;
// Background from here starting from the back layer to the front layer.
float width = Main.screenWidth / 2f;
float height = Main.screenHeight / 2f;
Color textureColor = new Color(63, 51, 90, 255) * opacity;
Vector2 origin = new Vector2(0f, AstralBiomeHeight);
if (maxDepth >= 9f && minDepth < 9f)
{
Texture2D texture = CalamityMod.AstralSurfaceHorizon;
int x = (int)(Main.screenPosition.X * 0.4f * ScreenParralaxMultiplier);
x %= (int)(texture.Width * Scale);
int y = (int)(Main.screenPosition.Y * 0.4f * ScreenParralaxMultiplier);
y -= 1380; // 1000
Vector2 position = texture.Size() / 2f * Scale;
for (int k = -1; k <= 1; k++)
{
var pos = new Vector2(width - x + texture.Width * k * Scale, height - y);
spriteBatch.Draw(texture, pos - position, null, textureColor, 0f, origin, Scale, SpriteEffects.None, 0f);
}
}
if (maxDepth >= 8f && minDepth < 8f)
{
Texture2D texture = CalamityMod.AstralSurfaceFar;
int x = (int)(Main.screenPosition.X * 0.5f * ScreenParralaxMultiplier);
x %= (int)(texture.Width * Scale);
int y = (int)(Main.screenPosition.Y * 0.45f * ScreenParralaxMultiplier);
y -= 1520; // 1000
Vector2 position = texture.Size() / 2f * Scale;
for (int k = -1; k <= 1; k++)
{
var pos = new Vector2(width - x + texture.Width * k * Scale, height - y);
spriteBatch.Draw(texture, pos - position, null, textureColor, 0f, origin, Scale, SpriteEffects.None, 0f);
}
}
if (maxDepth >= 7f && minDepth < 7f)
{
Texture2D texture = CalamityMod.AstralSurfaceMiddle;
int x = (int)(Main.screenPosition.X * 0.8f * ScreenParralaxMultiplier);
x %= (int)(texture.Width * Scale);
int y = (int)(Main.screenPosition.Y * 0.5f * ScreenParralaxMultiplier);
y -= 1900; // 1000
Vector2 position = texture.Size() / 2f * Scale;
for (int k = -1; k <= 1; k++)
{
var pos = new Vector2(width - x + texture.Width * k * Scale, height - y);
spriteBatch.Draw(texture, pos - position, null, textureColor, 0f, origin, Scale, SpriteEffects.None, 0f);
}
Texture2D textureglow = CalamityMod.AstralSurfaceMiddleGlow;
Color textureGlowColor = Color.White * 0.5f * opacity;
for (int k = -1; k <= 1; k++)
{
var pos = new Vector2(width - x + texture.Width * k * Scale, height - y);
spriteBatch.Draw(textureglow, pos - position, null, textureGlowColor, 0f, origin, Scale, SpriteEffects.None, 0f);
}
}
if (maxDepth >= 6f && minDepth < 6f)
{
Texture2D texture = CalamityMod.AstralSurfaceClose;
int x = (int)(Main.screenPosition.X * 0.9f * ScreenParralaxMultiplier);
x %= (int)(texture.Width * Scale);
int y = (int)(Main.screenPosition.Y * 0.55f * ScreenParralaxMultiplier);
y -= 1880; // 1000
Vector2 position = texture.Size() / 2f * Scale;
for (int k = -1; k <= 1; k++)
{
var pos = new Vector2(width - x + texture.Width * k * Scale, height - y);
spriteBatch.Draw(texture, pos - position, null, textureColor, 0f, origin, Scale, SpriteEffects.None, 0f);
}
Texture2D textureglow = CalamityMod.AstralSurfaceCloseGlow;
Color textureGlowColor = Color.White * 0.7f * opacity;
for (int k = -1; k <= 1; k++)
{
var pos = new Vector2(width - x + texture.Width * k * Scale, height - y);
spriteBatch.Draw(textureglow, pos - position, null, textureGlowColor, 0f, origin, Scale, SpriteEffects.None, 0f);
}
}
if (maxDepth >= 5f && minDepth < 5f)
{
Texture2D texture = CalamityMod.AstralSurfaceFront;
int x = (int)(Main.screenPosition.X * 1.1f * ScreenParralaxMultiplier);
x %= (int)(texture.Width * Scale);
int y = (int)(Main.screenPosition.Y * 0.6f * ScreenParralaxMultiplier);
y -= 2100; // 1000
Vector2 position = texture.Size() / 2f * Scale;
for (int k = -1; k <= 1; k++)
{
var pos = new Vector2(width - x + texture.Width * k * Scale, height - y);
spriteBatch.Draw(texture, pos - position, null, textureColor, 0f, origin, Scale, SpriteEffects.None, 0f);
}
Texture2D textureglow = CalamityMod.AstralSurfaceFrontGlow;
Color textureGlowColor = Color.White * 0.9f * opacity;
for (int k = -1; k <= 1; k++)
{
var pos = new Vector2(width - x + texture.Width * k * Scale, height - y);
spriteBatch.Draw(textureglow, pos - position, null, textureGlowColor, 0f, origin, Scale, SpriteEffects.None, 0f);
}
}
}
public override void Update(GameTime gameTime)
{
if (!Main.LocalPlayer.Calamity().ZoneAstral || Main.gameMenu)
skyActive = false;
if (skyActive && opacity < 1f)
opacity += 0.02f;
else if (!skyActive && opacity > 0f)
opacity -= 0.02f;
}
public override float GetCloudAlpha()
{
return (1f - opacity) * 0.97f + 0.03f;
}
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

@@ -111,6 +111,7 @@ namespace CalamityMod.UI.DraedonSummoning
get;
set;
}
public static float DialogOffYCache = 0;
/// <summary>