This commit is contained in:
mountaindrew10 committed 2024-05-13 20:59:25 -05:00
commit c1e7dd37de
460 files changed
+2631 -3397

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");
}
}
}
}
}
+112
View File
@@ -0,0 +1,112 @@
using CalamityMod.Items.Placeables.Furniture;
using CalamityMod.Systems;
using Terraria;
using Terraria.GameContent.Events;
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
{
get
{
if (Main.LocalPlayer.ZoneDesert && Sandstorm.Happening && !(Main.LocalPlayer.ZoneSnow || Main.slimeRain || Main.eclipse))
{
return SceneEffectPriority.Environment;
}
else
{
return 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;
}
}
+8 -12
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;
@@ -2978,10 +2975,9 @@ namespace CalamityMod.CalPlayer
}
if (Main.netMode != NetmodeID.MultiplayerClient)
{
for (int l = 0; l < Main.maxNPCs; l++)
foreach (NPC npc in Main.ActiveNPCs)
{
NPC npc = Main.npc[l];
if (npc.active && !npc.friendly && !npc.dontTakeDamage && Vector2.Distance(Player.Center, npc.Center) <= 3000f)
if (!npc.friendly && !npc.dontTakeDamage && Vector2.Distance(Player.Center, npc.Center) <= 3000f)
npc.AddBuff(ModContent.BuffType<Enraged>(), 600, false);
}
}
@@ -4768,22 +4764,22 @@ namespace CalamityMod.CalPlayer
{
int spearsFired = 0;
for (int i = 0; i < Main.projectile.Length; i++)
foreach (Projectile p in Main.ActiveProjectiles)
{
if (spearsFired == 2)
break;
if (Main.projectile[i].owner == Player.whoAmI && Main.projectile[i].friendly)
if (p.owner == Player.whoAmI && p.friendly)
{
bool attack = Main.projectile[i].owner == Player.whoAmI && Main.projectile[i].type == ModContent.ProjectileType<MiniGuardianAttack>();
bool attack = p.type == ModContent.ProjectileType<MiniGuardianAttack>();
if (attack)
{
int numSpears = profanedCrystalBuffs ? 12 : 6;
int dam = (int)(Main.projectile[i].originalDamage * (profanedCrystalBuffs ? 1f : 0.25f));
int dam = (int)(p.originalDamage * (profanedCrystalBuffs ? 1f : 0.25f));
for (int x = 0; x < numSpears; x++)
{
float angle = MathHelper.TwoPi / numSpears * x;
int proj = Projectile.NewProjectile(source, Main.projectile[i].Center, angle.ToRotationVector2().RotatedBy(Math.Atan(-45f)) * 8f, ModContent.ProjectileType<MiniGuardianSpear>(), dam, 0f, Player.whoAmI, pscState, 0f);
int proj = Projectile.NewProjectile(source, p.Center, angle.ToRotationVector2().RotatedBy(Math.Atan(-45f)) * 8f, ModContent.ProjectileType<MiniGuardianSpear>(), dam, 0f, Player.whoAmI, pscState, 0f);
Main.projectile[proj].originalDamage = dam;
}
spearsFired++;
+4 -8
View File
@@ -72,15 +72,13 @@ namespace CalamityMod.CalPlayer
if (HasCustomDash && Player.dashDelay < 0)
{
Rectangle hitArea = new Rectangle((int)(Player.position.X + Player.velocity.X * 0.5 - 4f), (int)(Player.position.Y + Player.velocity.Y * 0.5 - 4), Player.width + 8, Player.height + 8);
for (int i = 0; i < Main.maxNPCs; i++)
foreach (NPC n in Main.ActiveNPCs)
{
NPC n = Main.npc[i];
// Ignore critters with the Guide to Critter Companionship
if (Player.dontHurtCritters && NPCID.Sets.CountsAsCritter[n.type])
continue;
if (n.active && !n.dontTakeDamage && !n.friendly && n.Calamity().dashImmunityTime[Player.whoAmI] <= 0)
if (!n.dontTakeDamage && !n.friendly && n.Calamity().dashImmunityTime[Player.whoAmI] <= 0)
{
if (hitArea.Intersects(n.getRect()) && (n.noTileCollide || Player.CanHit(n)))
{
@@ -543,15 +541,13 @@ namespace CalamityMod.CalPlayer
public int DoMountDashDamage(Rectangle myRect, float Damage, float Knockback, int NPCImmuneTime, int PlayerImmuneTime)
{
int totalHurtNPCs = 0;
for (int i = 0; i < Main.maxNPCs; i++)
foreach (NPC n in Main.ActiveNPCs)
{
NPC n = Main.npc[i];
// Ignore critters with the Guide to Critter Companionship
if (Player.dontHurtCritters && NPCID.Sets.CountsAsCritter[n.type])
continue;
if (n.active && !n.dontTakeDamage && !n.friendly && n.Calamity().dashImmunityTime[Player.whoAmI] <= 0)
if (!n.dontTakeDamage && !n.friendly && n.Calamity().dashImmunityTime[Player.whoAmI] <= 0)
{
Rectangle npcHitbox = n.getRect();
if (myRect.Intersects(npcHitbox) && (n.noTileCollide || Collision.CanHit(Player.position, Player.width, Player.height, n.position, n.width, n.height)))
+12 -16
View File
@@ -250,10 +250,10 @@ namespace CalamityMod.CalPlayer
if (hInferno)
{
for (int x = 0; x < Main.maxNPCs; x++)
foreach (NPC n in Main.ActiveNPCs)
{
if (Main.npc[x].active && Main.npc[x].type == ModContent.NPCType<Providence>())
Main.npc[x].active = false;
if (n.type == ModContent.NPCType<Providence>())
n.active = false;
}
}
@@ -1473,15 +1473,13 @@ namespace CalamityMod.CalPlayer
// This also strikes the NPCs as a side effect
if (gSabatonFalling)
{
for (int i = 0; i < Main.maxNPCs; i++)
foreach (NPC n in Main.ActiveNPCs)
{
NPC n = Main.npc[i];
// Ignore critters with the Guide to Critter Companionship
if (Player.dontHurtCritters && NPCID.Sets.CountsAsCritter[n.type])
continue;
if (n.active && !n.dontTakeDamage && !n.friendly && n.Calamity().dashImmunityTime[Player.whoAmI] <= 0)
if (!n.dontTakeDamage && !n.friendly && n.Calamity().dashImmunityTime[Player.whoAmI] <= 0)
{
Rectangle npcHitbox = n.getRect();
if ((Player.getRect()).Intersects(npcHitbox) && (n.noTileCollide || Collision.CanHit(Player.position, Player.width, Player.height, n.position, n.width, n.height)))
@@ -2269,10 +2267,9 @@ namespace CalamityMod.CalPlayer
if (fBarrier || (aquaticHeart && NPC.downedBoss3))
{
SoundEngine.PlaySound(SoundID.Item27, Player.Center);
for (int m = 0; m < Main.maxNPCs; m++)
foreach (NPC npc in Main.ActiveNPCs)
{
NPC npc = Main.npc[m];
if (!npc.active || npc.friendly || npc.dontTakeDamage)
if (npc.friendly || npc.dontTakeDamage)
continue;
float npcDist = (npc.Center - Player.Center).Length();
@@ -2296,10 +2293,9 @@ namespace CalamityMod.CalPlayer
// and also doesn't have random chance (why does Brain of Confusion not guarantee confusion on hit)
if (aBrain || amalgam)
{
for (int m = 0; m < Main.maxNPCs; m++)
foreach (NPC npc in Main.ActiveNPCs)
{
NPC npc = Main.npc[m];
if (!npc.active || npc.friendly || npc.dontTakeDamage)
if (npc.friendly || npc.dontTakeDamage)
continue;
float npcDist = (npc.Center - Player.Center).Length();
@@ -2334,11 +2330,11 @@ namespace CalamityMod.CalPlayer
if (Player.ownedProjectileCounts[ModContent.ProjectileType<DrataliornusBow>()] != 0)
{
for (int i = 0; i < Main.maxProjectiles; i++)
foreach(Projectile p in Main.ActiveProjectiles)
{
if (Main.projectile[i].active && Main.projectile[i].type == ModContent.ProjectileType<DrataliornusBow>() && Main.projectile[i].owner == Player.whoAmI)
if (p.type == ModContent.ProjectileType<DrataliornusBow>() && p.owner == Player.whoAmI)
{
Main.projectile[i].Kill();
p.Kill();
break;
}
}
+43 -55
View File
@@ -452,10 +452,9 @@ namespace CalamityMod.CalPlayer
float enemyDistance = maxProxRageDistance + 1f;
float bossDistance = maxProxRageDistance + 1f;
for (int i = 0; i < Main.maxNPCs; ++i)
foreach (NPC npc in Main.ActiveNPCs)
{
NPC npc = Main.npc[i];
if (npc is null || npc.type == NPCID.None || !npc.IsAnEnemy() || !npc.Calamity().ProvidesProximityRage)
if (npc.type == NPCID.None || !npc.IsAnEnemy() || !npc.Calamity().ProvidesProximityRage)
continue;
// Take the longer of the two directions for the NPC's hitbox to be generous.
@@ -719,10 +718,9 @@ namespace CalamityMod.CalPlayer
sigilDamage = Player.ApplyArmorAccDamageBonusesTo(sigilDamage);
bool brightenedSigil = false;
for (int i = 0; i < Main.maxNPCs; i++)
foreach (NPC target in Main.ActiveNPCs)
{
NPC target = Main.npc[i];
if (!target.active || !target.Hitbox.Intersects(sigilHitbox) || target.immortal || target.dontTakeDamage || target.townNPC || NPCID.Sets.ActsLikeTownNPC[target.type] || NPCID.Sets.CountsAsCritter[target.type])
if (!target.Hitbox.Intersects(sigilHitbox) || target.immortal || target.dontTakeDamage || target.townNPC || NPCID.Sets.ActsLikeTownNPC[target.type] || NPCID.Sets.CountsAsCritter[target.type])
continue;
// Brighten the sigil because it is dealing damage. This can only happen once per hit event.
@@ -734,7 +732,7 @@ namespace CalamityMod.CalPlayer
// Create a direct strike to hit this specific NPC.
var source = Player.GetSource_Accessory(FindAccessory(ModContent.ItemType<Calamity>()));
Projectile sigilStrike = Projectile.NewProjectileDirect(source, target.Center, Vector2.Zero, ModContent.ProjectileType<DirectStrike>(), sigilDamage, 0f, Player.whoAmI, i);
Projectile sigilStrike = Projectile.NewProjectileDirect(source, target.Center, Vector2.Zero, ModContent.ProjectileType<DirectStrike>(), sigilDamage, 0f, Player.whoAmI, target.whoAmI);
// Enable crits by setting the sigil's damage class to be whatever the player's strongest damage class is.
sigilStrike.DamageType = Player.GetBestClass();
@@ -863,24 +861,23 @@ namespace CalamityMod.CalPlayer
{
int bullseyeType = ModContent.ProjectileType<SpiritOriginBullseye>();
List<int> alreadyTargetedNPCs = new List<int>();
for (int i = 0; i < Main.maxProjectiles; i++)
foreach (Projectile p in Main.ActiveProjectiles)
{
if (Main.projectile[i].type != bullseyeType || !Main.projectile[i].active || Main.projectile[i].owner != Player.whoAmI)
if (p.type != bullseyeType || p.owner != Player.whoAmI)
continue;
alreadyTargetedNPCs.Add((int)Main.projectile[i].ai[0]);
alreadyTargetedNPCs.Add((int)p.ai[0]);
}
for (int i = 0; i < Main.maxNPCs; i++)
foreach (NPC target in Main.ActiveNPCs)
{
NPC target = Main.npc[i];
if (!target.active || target.friendly || target.lifeMax < 5 || alreadyTargetedNPCs.Contains(i) || target.realLife >= 0 ||
if (target.friendly || target.lifeMax < 5 || alreadyTargetedNPCs.Contains(target.whoAmI) || target.realLife >= 0 ||
target.dontTakeDamage || target.immortal || target.townNPC || NPCID.Sets.ActsLikeTownNPC[target.type] || NPCID.Sets.CountsAsCritter[target.type])
continue;
var source = Player.GetSource_Accessory(FindAccessory(ModContent.ItemType<DaawnlightSpiritOrigin>()));
if (Main.myPlayer == Player.whoAmI && Main.npc[i].WithinRange(Player.Center, 2000f))
Projectile.NewProjectile(source, Main.npc[i].Center, Vector2.Zero, bullseyeType, 0, 0f, Player.whoAmI, i);
if (Main.myPlayer == Player.whoAmI && target.WithinRange(Player.Center, 2000f))
Projectile.NewProjectile(source, target.Center, Vector2.Zero, bullseyeType, 0, 0f, Player.whoAmI, target.whoAmI);
if (spiritOriginBullseyeShootCountdown <= 0)
spiritOriginBullseyeShootCountdown = 45;
}
@@ -1142,10 +1139,9 @@ namespace CalamityMod.CalPlayer
if (Player.ownedProjectileCounts[ModContent.ProjectileType<OmegaBlueTentacle>()] < 6 && Main.myPlayer == Player.whoAmI)
{
bool[] tentaclesPresent = new bool[6];
for (int i = 0; i < Main.maxProjectiles; i++)
foreach (Projectile projectile in Main.ActiveProjectiles)
{
Projectile projectile = Main.projectile[i];
if (projectile.active && projectile.type == ModContent.ProjectileType<OmegaBlueTentacle>() && projectile.owner == Main.myPlayer && projectile.ai[1] >= 0f && projectile.ai[1] < 6f)
if (projectile.type == ModContent.ProjectileType<OmegaBlueTentacle>() && projectile.owner == Main.myPlayer && projectile.ai[1] >= 0f && projectile.ai[1] < 6f)
tentaclesPresent[(int)projectile.ai[1]] = true;
}
@@ -1250,14 +1246,13 @@ namespace CalamityMod.CalPlayer
{
float maxDistance = 300f;
int target = -1;
for (int npcIndex = 0; npcIndex < Main.maxNPCs; npcIndex++)
foreach (NPC npc in Main.ActiveNPCs)
{
NPC npc = Main.npc[npcIndex];
float targetDist = Vector2.Distance(npc.Center, Player.Center);
if (targetDist < maxDistance && npc.Calamity().arcZapCooldown == 0 && npc.CanBeChasedBy())
{
maxDistance = targetDist;
target = npcIndex;
target = npc.whoAmI;
}
}
@@ -1853,10 +1848,9 @@ namespace CalamityMod.CalPlayer
{
if (Main.rand.NextBool(5))
{
for (int l = 0; l < Main.maxNPCs; l++)
foreach (NPC npc in Main.ActiveNPCs)
{
NPC npc = Main.npc[l];
if (!npc.active || npc.friendly || npc.damage <= 0 || npc.dontTakeDamage)
if (npc.friendly || npc.damage <= 0 || npc.dontTakeDamage)
continue;
if (!npc.buffImmune[buffType] && Vector2.Distance(Player.Center, npc.Center) <= freezeDist)
@@ -1902,10 +1896,9 @@ namespace CalamityMod.CalPlayer
// Ceaseless Hunger Potion buff
if (ceaselessHunger)
{
for (int j = 0; j < Main.maxItems; j++)
foreach (Item item in Main.ActiveItems)
{
Item item = Main.item[j];
if (item.active && item.noGrabDelay == 0 && item.playerIndexTheItemIsReservedFor == Player.whoAmI)
if (item.noGrabDelay == 0 && item.playerIndexTheItemIsReservedFor == Player.whoAmI)
{
item.beingGrabbed = true;
if (Player.Center.X > item.Center.X)
@@ -2783,10 +2776,9 @@ namespace CalamityMod.CalPlayer
{
if (Main.netMode != NetmodeID.MultiplayerClient && !areThereAnyDamnBosses)
{
for (int m = 0; m < Main.maxNPCs; m++)
foreach (NPC npc in Main.ActiveNPCs)
{
NPC npc = Main.npc[m];
if (!npc.active || npc.friendly || npc.dontTakeDamage)
if (npc.friendly || npc.dontTakeDamage)
continue;
float distance = (npc.Center - Player.Center).Length();
if (distance < 120f)
@@ -3140,14 +3132,13 @@ namespace CalamityMod.CalPlayer
var source = Player.GetSource_FromThis(TarragonHeadSummon.LifeAuraEntitySourceContext);
float range = 300f;
for (int i = 0; i < Main.maxNPCs; ++i)
foreach (NPC npc in Main.ActiveNPCs)
{
NPC npc = Main.npc[i];
if (!npc.active || npc.friendly || npc.dontTakeDamage)
if (npc.friendly || npc.dontTakeDamage)
continue;
if (Vector2.Distance(Player.Center, npc.Center) <= range)
Projectile.NewProjectileDirect(source, npc.Center, Vector2.Zero, ModContent.ProjectileType<TarragonAura>(), damage, 0f, Player.whoAmI, i);
Projectile.NewProjectileDirect(source, npc.Center, Vector2.Zero, ModContent.ProjectileType<TarragonAura>(), damage, 0f, Player.whoAmI, npc.whoAmI);
}
}
}
@@ -3168,14 +3159,13 @@ namespace CalamityMod.CalPlayer
var source = Player.GetSource_ItemUse(Player.ActiveItem());
float range = 200f;
for (int i = 0; i < Main.maxNPCs; ++i)
foreach (NPC npc in Main.ActiveNPCs)
{
NPC npc = Main.npc[i];
if (!npc.active || npc.friendly || npc.damage <= 0 || npc.dontTakeDamage)
if (npc.friendly || npc.damage <= 0 || npc.dontTakeDamage)
continue;
if (Vector2.Distance(Player.Center, npc.Center) <= range)
Projectile.NewProjectileDirect(source, npc.Center, Vector2.Zero, ModContent.ProjectileType<DirectStrike>(), damage, 0f, Player.whoAmI, i);
Projectile.NewProjectileDirect(source, npc.Center, Vector2.Zero, ModContent.ProjectileType<DirectStrike>(), damage, 0f, Player.whoAmI, npc.whoAmI);
// Occasionally spawn cute sparks so it looks like an electrical aura
if (Main.rand.NextBool(10))
@@ -3211,17 +3201,16 @@ namespace CalamityMod.CalPlayer
var source = Player.GetSource_FromThis(HydrothermicArmor.InfernoPotionEntitySourceContext);
float range = 300f;
for (int i = 0; i < Main.maxNPCs; ++i)
foreach (NPC npc in Main.ActiveNPCs)
{
NPC npc = Main.npc[i];
if (!npc.active || npc.friendly || npc.damage <= 0 || npc.dontTakeDamage)
if (npc.friendly || npc.damage <= 0 || npc.dontTakeDamage)
continue;
if (Vector2.Distance(Player.Center, npc.Center) <= range)
{
npc.AddBuff(ModContent.BuffType<BrimstoneFlames>(), 120);
if (brimLoreInfernoTimer == 0)
Projectile.NewProjectileDirect(source, npc.Center, Vector2.Zero, ModContent.ProjectileType<DirectStrike>(), damage, 0f, Player.whoAmI, i);
Projectile.NewProjectileDirect(source, npc.Center, Vector2.Zero, ModContent.ProjectileType<DirectStrike>(), damage, 0f, Player.whoAmI, npc.whoAmI);
}
}
}
@@ -3381,11 +3370,11 @@ namespace CalamityMod.CalPlayer
{
if (Player.whoAmI == Main.myPlayer)
{
for (int i = 0; i < Main.maxProjectiles; i++)
foreach (Projectile p in Main.ActiveProjectiles)
{
if (Main.projectile[i].active && Main.projectile[i].type == ModContent.ProjectileType<BlunderBoosterAura>() && Main.projectile[i].owner == Player.whoAmI)
if (p.type == ModContent.ProjectileType<BlunderBoosterAura>() && p.owner == Player.whoAmI)
{
Main.projectile[i].Kill();
p.Kill();
break;
}
}
@@ -3438,12 +3427,12 @@ namespace CalamityMod.CalPlayer
if (Player.whoAmI == Main.myPlayer)
{
int auraType = ModContent.ProjectileType<TeslaAura>();
for (int i = 0; i < Main.maxProjectiles; i++)
foreach (Projectile p in Main.ActiveProjectiles)
{
if (Main.projectile[i].type != auraType || !Main.projectile[i].active || Main.projectile[i].owner != Player.whoAmI)
if (p.type != auraType || p.owner != Player.whoAmI)
continue;
Main.projectile[i].Kill();
p.Kill();
break;
}
}
@@ -3461,12 +3450,12 @@ namespace CalamityMod.CalPlayer
else if (Player.whoAmI == Main.myPlayer)
{
int shieldType = ModContent.ProjectileType<CryonicShield>();
for (int i = 0; i < Main.maxProjectiles; i++)
foreach (Projectile p in Main.ActiveProjectiles)
{
if (Main.projectile[i].type != shieldType || !Main.projectile[i].active || Main.projectile[i].owner != Player.whoAmI)
if (p.type != shieldType || p.owner != Player.whoAmI)
continue;
Main.projectile[i].Kill();
p.Kill();
break;
}
}
@@ -4217,10 +4206,9 @@ namespace CalamityMod.CalPlayer
if (Main.myPlayer != Player.whoAmI)
return;
for (int i = 0; i < Main.maxNPCs; i++)
foreach (NPC npc in Main.ActiveNPCs)
{
NPC npc = Main.npc[i];
if (npc is null || !npc.active || npc.type != ModContent.NPCType<AndroombaFriendly>())
if (npc.type != ModContent.NPCType<AndroombaFriendly>())
continue;
bool holdingsol = ((Player.HeldItem.type >= ItemID.GreenSolution && Player.HeldItem.type <= ItemID.RedSolution) || (Player.HeldItem.type >= ItemID.SandSolution && Player.HeldItem.type <= ItemID.DirtSolution) || Player.HeldItem.type == ModContent.ItemType<AstralSolution>());
@@ -4316,7 +4304,7 @@ namespace CalamityMod.CalPlayer
}
}
if (Main.netMode == NetmodeID.Server)
NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, i);
NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, npc.whoAmI);
}
}
}
+3 -4
View File
@@ -1455,10 +1455,9 @@ namespace CalamityMod.CalPlayer
float lowestHealthCheck = 0f;
int healTarget = Player.whoAmI;
for (int i = 0; i < Main.maxPlayers; i++)
foreach (Player otherPlayer in Main.ActivePlayers)
{
Player otherPlayer = Main.player[i];
if (otherPlayer.active && !otherPlayer.dead && ((!Player.hostile && !otherPlayer.hostile) || Player.team == otherPlayer.team))
if (!otherPlayer.dead && ((!Player.hostile && !otherPlayer.hostile) || Player.team == otherPlayer.team))
{
float playerDist = Vector2.Distance(target.Center, otherPlayer.Center);
if (playerDist < BalancingConstants.LifeStealRange && (otherPlayer.statLifeMax2 - otherPlayer.statLife) > lowestHealthCheck)
@@ -1506,7 +1505,7 @@ namespace CalamityMod.CalPlayer
if (playerDist < BalancingConstants.LifeStealRange && (otherPlayer.statLifeMax2 - otherPlayer.statLife) > lowestHealthCheck)
{
lowestHealthCheck = otherPlayer.statLifeMax2 - otherPlayer.statLife;
healTarget = i;
healTarget = otherPlayer.whoAmI;
}
}
}
+2 -2
View File
@@ -34,9 +34,9 @@ namespace CalamityMod.CalPlayer.DrawLayers
int robot = -1;
int andromedaMechID = ModContent.ProjectileType<GiantIbanRobotOfDoom>();
for (int i = 0; i < Main.projectile.Length; i++)
foreach (Projectile p in Main.ActiveProjectiles)
{
if (Main.projectile[i].active && Main.projectile[i].type == andromedaMechID && Main.projectile[i].owner == drawPlayer.whoAmI)
if (p.type == andromedaMechID && p.owner == drawPlayer.whoAmI)
{
robot = i;
break;
+105
View File
@@ -0,0 +1,105 @@
using System;
using CalamityMod.World;
using Terraria;
using Terraria.Localization;
namespace CalamityMod
{
public static class CalamityConditions
{
private static Condition Create(string key, Func<bool> predicate)
{
return new Condition(
Language.GetText($"Mods.CalamityMod.Condition.{key}"),
predicate
);
}
//
// Config based conditions
//
public static readonly Condition PotionSellingConfig = Create("PotionConfig", () => CalamityConfig.Instance.PotionSelling);
//
// Player conditions
//
public static readonly Condition PlayerHasRogueArmor = Create("HasRogueArmor", () => Main.LocalPlayer.Calamity().rogueStealthMax > 0f && Main.LocalPlayer.Calamity().wearingRogueArmor);
public static readonly Condition PlayerHasWings = Create("HasWings", () => Main.LocalPlayer.wingTimeMax > 0);
public static readonly Condition PlayerAlcoholPoisoned = Create("AlcoholPoison", () => Main.LocalPlayer.Calamity().alcoholPoisoning);
//
// NPC conditions
//
/// <summary>Don't use this. It's always `true`.</summary>
public static readonly Condition TrasherTextCondition = Create("Drops.TrasherKill", () => true);
//
// Calamity Event Flag conditions
//
public static readonly Condition DownedAcidRainT1 = Create("Drops.DownedT1AR", () => DownedBossSystem.downedEoCAcidRain);
public static readonly Condition DownedAcidRainT2 = Create("Drops.DownedT2AR", () => DownedBossSystem.downedAquaticScourgeAcidRain);
//
// Calamity Boss Flag conditions
//
public static readonly Condition DownedDesertScourge = Create("Drops.DownedDS", () => DownedBossSystem.downedDesertScourge);
public static readonly Condition DownedCrabulon = Create("Drops.DownedCrabulon", () => DownedBossSystem.downedDesertScourge);
public static readonly Condition DownedHiveMind = Create("Drops.DownedHM", () => DownedBossSystem.downedHiveMind);
public static readonly Condition DownedPerforator = Create("Drops.DownedPerfs", () => DownedBossSystem.downedPerforator);
public static readonly Condition DownedSlimeGod = Create("Drops.DownedSG", () => DownedBossSystem.downedSlimeGod);
public static readonly Condition DownedCryogen = Create("Drops.DownedCryo", () => DownedBossSystem.downedCryogen);
public static readonly Condition DownedAquaticScourge = Create("Drops.DownedAS", () => DownedBossSystem.downedAquaticScourge);
public static readonly Condition DownedBrimstoneElemental = Create("Drops.DownedBrim", () => DownedBossSystem.downedBrimstoneElemental);
public static readonly Condition DownedCalamitasClone = Create("Drops.DownedCal", () => DownedBossSystem.downedCalamitasClone);
public static readonly Condition DownedLeviathan = Create("Drops.DownedLebi", () => DownedBossSystem.downedLeviathan);
public static readonly Condition DownedAstrumAureus = Create("Drops.DownedAureus", () => DownedBossSystem.downedAstrumAureus);
public static readonly Condition DownedPlaguebringer = Create("Drops.DownedPBG", () => DownedBossSystem.downedPlaguebringer);
public static readonly Condition DownedRavager = Create("Drops.DownedRav", () => DownedBossSystem.downedRavager);
public static readonly Condition DownedAstrumDeus = Create("Drops.DownedAD", () => DownedBossSystem.downedAstrumDeus);
public static readonly Condition DownedGuardians = Create("Drops.DownedGuard", () => DownedBossSystem.downedGuardians);
public static readonly Condition DownedBumblebird = Create("Drops.DownedBirb", () => DownedBossSystem.downedDragonfolly);
public static readonly Condition DownedProvidence = Create("Drops.DownedProv", () => DownedBossSystem.downedProvidence);
public static readonly Condition DownedSignus = Create("Drops.DownedSig", () => DownedBossSystem.downedSignus);
public static readonly Condition DownedStormWeaver = Create("Drops.DownedSW", () => DownedBossSystem.downedStormWeaver);
public static readonly Condition DownedCeaselessVoid = Create("Drops.DownedCV", () => DownedBossSystem.downedCeaselessVoid);
public static readonly Condition DownedPolterghast = Create("Drops.DownedPolter", () => DownedBossSystem.downedPolterghast);
public static readonly Condition DownedOldDuke = Create("Drops.DownedOD", () => DownedBossSystem.downedBoomerDuke);
public static readonly Condition DownedDevourerOfGods = Create("Drops.DownedDoG", () => DownedBossSystem.downedDoG);
public static readonly Condition DownedYharon = Create("Drops.DownedYharon", () => DownedBossSystem.downedYharon);
public static readonly Condition DownedExoMechs = Create("Drops.DownedExos", () => DownedBossSystem.downedExoMechs);
public static readonly Condition DownedSupremeCalamitas = Create("Drops.DownedSCal", () => DownedBossSystem.downedCalamitas);
public static readonly Condition DownedPrimordialWyrm = Create("Drops.DownedAEW", () => DownedBossSystem.downedPrimordialWyrm);
public static readonly Condition DownedClam = Create("Drops.DownedClam", () => DownedBossSystem.downedCLAM);
public static readonly Condition DownedBuffedClam = Create("Drops.DownedClamHM", () => DownedBossSystem.downedCLAMHardMode);
public static readonly Condition DownedGreatSandShark = Create("Drops.DownedGSS", () => DownedBossSystem.downedGSS);
// Mixed
public static readonly Condition DownedHiveMindOrPerforator = Create("Drops.DownedHMOrPerfs",() => DownedBossSystem.downedHiveMind || DownedBossSystem.downedPerforator);
public static readonly Condition DownedCalamitasCloneOrPlantera = Create("Drops.DownedCalPlant", () => DownedBossSystem.downedCalamitasClone || Condition.DownedPlantera.IsMet());
// Vanilla
public static readonly Condition DownedBetsy = Create("Drops.DownedBetsy", () => DownedBossSystem.downedBetsy);
//
// Calamity Biome conditions
//
public static readonly Condition InAstral = Create("InAstral", () => Main.LocalPlayer.Calamity().ZoneAstral);
public static readonly Condition InCrag = Create("InCrag", () => Main.LocalPlayer.Calamity().ZoneCalamity);
public static readonly Condition InSulph = Create("InSulph", () => Main.LocalPlayer.Calamity().ZoneSulphur);
public static readonly Condition InSunken = Create("InSunken", () => Main.LocalPlayer.Calamity().ZoneSunkenSea);
//
// World based conditions
//
public static readonly Condition InRevengeanceMode = Create("InRev", () => CalamityWorld.revenge);
public static readonly Condition InRevengeanceModeNotMasterMode = Create("InRev", () => !Main.masterMode && CalamityWorld.revenge);
public static readonly Condition InRevengeanceModeOrMasterMode = Create("InRevOrMM", () => Main.masterMode || CalamityWorld.revenge);
}
}
+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();
+11 -28
View File
@@ -65,10 +65,10 @@ namespace CalamityMod.Events
{
get
{
for (int i = 0; i < Main.npc.Length; i++)
foreach (NPC npc in Main.ActiveNPCs)
{
if (Main.npc[i].active && (PossibleMinibossesAS.Select(miniboss => miniboss.Key).Contains(Main.npc[i].type) ||
PossibleMinibossesPolter.Select(miniboss => miniboss.Key).Contains(Main.npc[i].type)))
if ((PossibleMinibossesAS.Select(miniboss => miniboss.Key).Contains(npc.type) ||
PossibleMinibossesPolter.Select(miniboss => miniboss.Key).Contains(npc.type)))
{
return true;
}
@@ -107,14 +107,8 @@ namespace CalamityMod.Events
{
get
{
int playerCount = 0;
for (int i = 0; i < Main.player.Length; i++)
{
if (Main.player[i].active)
{
playerCount++;
}
}
int playerCount = Main.CurrentFrameFlags.ActivePlayersCount;
if (DownedBossSystem.downedPolterghast)
return (int)(Math.Log(playerCount + Math.E - 1) * 170f);
else if (DownedBossSystem.downedAquaticScourge)
@@ -189,12 +183,7 @@ namespace CalamityMod.Events
if (AcidRainEventIsOngoing || (!NPC.downedBoss1 && !Main.hardMode && !DownedBossSystem.downedAquaticScourge) || BossRushEvent.BossRushActive)
return;
int playerCount = 0;
for (int i = 0; i < Main.player.Length; i++)
{
if (Main.player[i].active)
playerCount++;
}
int playerCount = Main.CurrentFrameFlags.ActivePlayersCount;
if (playerCount > 0)
{
@@ -243,12 +232,8 @@ namespace CalamityMod.Events
if (!HasStartedAcidicDownpour)
{
int sulphSeaWidth = SulphurousSea.BiomeWidth;
for (int playerIndex = 0; playerIndex < Main.maxPlayers; playerIndex++)
foreach (Player player in Main.ActivePlayers)
{
Player player = Main.player[playerIndex];
if (!player.active)
continue;
// An artificial biome can be made, and therefore, the event could be started by an artificial biome.
// While fighting the event in an artificial biome is not bad, having it be started by a patch of Sulphurous Sand
// would definitely be strange.
@@ -387,11 +372,9 @@ namespace CalamityMod.Events
if ((int)Main.time == (int)(Main.nightLength - 1f) && !Main.dayTime && Main.rand.NextBool(increasedEventChance ? 3 : 300))
{
bool shouldNotStartEvent = false;
for (int playerIndex = 0; playerIndex < Main.maxPlayers; playerIndex++)
foreach (Player player in Main.ActivePlayers)
{
if (!Main.player[playerIndex].active)
continue;
if (Main.player[playerIndex].Calamity().noStupidNaturalARSpawns)
if (player.Calamity().noStupidNaturalARSpawns)
{
shouldNotStartEvent = true;
break;
@@ -407,9 +390,9 @@ namespace CalamityMod.Events
// Attempt to force an Acid Rain immediately after the EoC is dead when someone wanders to the sea.
if (NPC.downedBoss1 && !DownedBossSystem.downedEoCAcidRain && !HasBeenForceStartedByEoCDefeat)
{
for (int playerIndex = 0; playerIndex < Main.maxPlayers; playerIndex++)
foreach (Player player in Main.ActivePlayers)
{
if (Main.player[playerIndex].active && Main.player[playerIndex].Calamity().ZoneSulphur)
if (player.Calamity().ZoneSulphur)
{
HasBeenForceStartedByEoCDefeat = true;
TryStartEvent();
+20 -36
View File
@@ -320,14 +320,10 @@ namespace CalamityMod.Events
new Boss(ModContent.NPCType<CeaselessVoid>(), spawnContext: type =>
{
for (int playerIndex = 0; playerIndex < Main.maxPlayers; playerIndex++)
foreach (Player p in Main.ActivePlayers)
{
Player p = Main.player[playerIndex];
if (p is not null && p.active)
{
if (p.FindBuffIndex(ModContent.BuffType<IcarusFolly>()) > -1)
p.ClearBuff(ModContent.BuffType<IcarusFolly>());
}
if (p.FindBuffIndex(ModContent.BuffType<IcarusFolly>()) > -1)
p.ClearBuff(ModContent.BuffType<IcarusFolly>());
}
Player player = Main.player[ClosestPlayerToWorldCenter];
@@ -415,19 +411,15 @@ namespace CalamityMod.Events
BossRushDialogueSystem.StartDialogue(BossRushDialoguePhase.TierOneComplete);
// Teleport players to where they came from
for (int playerIndex = 0; playerIndex < Main.maxPlayers; playerIndex++)
foreach (Player p in Main.ActivePlayers)
{
Player p = Main.player[playerIndex];
if (p is not null && p.active)
if (p.Calamity().BossRushReturnPosition.HasValue)
{
if (p.Calamity().BossRushReturnPosition.HasValue)
{
CalamityPlayer.ModTeleport(p, p.Calamity().BossRushReturnPosition.Value, false, TeleportationStyleID.TeleportationPotion);
p.Calamity().BossRushReturnPosition = null;
}
CalamityPlayer.ModTeleport(p, p.Calamity().BossRushReturnPosition.Value, false, TeleportationStyleID.TeleportationPotion);
p.Calamity().BossRushReturnPosition = null;
SoundEngine.PlaySound(TeleportSound with { Volume = 1.6f }, p.Center);
}
p.Calamity().BossRushReturnPosition = null;
SoundEngine.PlaySound(TeleportSound with { Volume = 1.6f }, p.Center);
}
},
// Plantera: End of Tier 2
@@ -628,13 +620,9 @@ namespace CalamityMod.Events
public static void End()
{
// Reset BossRushReturnPosition
for (int playerIndex = 0; playerIndex < Main.maxPlayers; playerIndex++)
foreach (Player p in Main.ActivePlayers)
{
Player p = Main.player[playerIndex];
if (p is not null && p.active)
{
p.Calamity().BossRushReturnPosition = null;
}
p.Calamity().BossRushReturnPosition = null;
}
if (Main.netMode == NetmodeID.SinglePlayer)
@@ -735,18 +723,14 @@ namespace CalamityMod.Events
CalamityUtils.KillAllHostileProjectiles();
HostileProjectileKillCounter = 3;
for (int playerIndex = 0; playerIndex < Main.maxPlayers; playerIndex++)
foreach (Player p in Main.ActivePlayers)
{
Player p = Main.player[playerIndex];
if (p is not null && p.active)
{
p.Calamity().BossRushReturnPosition = p.Center;
Vector2? underworld = CalamityPlayer.GetUnderworldPosition(p);
if (!underworld.HasValue)
break;
CalamityPlayer.ModTeleport(p, underworld.Value, false, TeleportationStyleID.TeleportationPotion);
SoundEngine.PlaySound(TeleportSound with { Volume = 1.6f }, p.Center);
}
p.Calamity().BossRushReturnPosition = p.Center;
Vector2? underworld = CalamityPlayer.GetUnderworldPosition(p);
if (!underworld.HasValue)
break;
CalamityPlayer.ModTeleport(p, underworld.Value, false, TeleportationStyleID.TeleportationPotion);
SoundEngine.PlaySound(TeleportSound with { Volume = 1.6f }, p.Center);
}
}
@@ -794,12 +778,12 @@ namespace CalamityMod.Events
{
if (Main.netMode != NetmodeID.MultiplayerClient)
{
for (int i = 0; i < Main.maxPlayers; i++)
foreach (Player p in Main.ActivePlayers)
{
if (!Main.player[i].active || Main.player[i].dead)
if (p.dead)
continue;
int animation = Projectile.NewProjectile(new EntitySource_WorldEvent(), Main.player[i].Center, Vector2.Zero, ModContent.ProjectileType<BossRushTierAnimation>(), 0, 0f, i);
int animation = Projectile.NewProjectile(new EntitySource_WorldEvent(), p.Center, Vector2.Zero, ModContent.ProjectileType<BossRushTierAnimation>(), 0, 0f, p.whoAmI);
if (Main.projectile.IndexInRange(animation))
Main.projectile[animation].ai[0] = tier;
}
@@ -65,12 +65,10 @@ namespace CalamityMod.Graphics.Primitives
var afterProjectiles = new List<IPixelatedPrimitiveRenderer>();
// Check every active projectile.
for (int i = 0; i < Main.maxProjectiles; i++)
foreach (Projectile projectile in Main.ActiveProjectiles)
{
var projectile = Main.projectile[i];
// If the projectile is active, a mod projectile, and uses the interface, add it to the list of primitives to draw this frame.
if (projectile.active && projectile.ModProjectile != null && projectile.ModProjectile is IPixelatedPrimitiveRenderer pixelPrimitiveProjectile)
if (projectile.ModProjectile != null && projectile.ModProjectile is IPixelatedPrimitiveRenderer pixelPrimitiveProjectile)
{
var listToUse = pixelPrimitiveProjectile.LayerToRenderTo switch
{
@@ -84,12 +82,10 @@ namespace CalamityMod.Graphics.Primitives
}
// Check every active NPC.
for (int i = 0; i < Main.maxNPCs; i++)
foreach (NPC npc in Main.ActiveNPCs)
{
var npc = Main.npc[i];
// If the NPC is active, a mod NPC, and uses the interface, add it to the list of primitives to draw this frame.
if (npc.active && npc.ModNPC != null && npc.ModNPC is IPixelatedPrimitiveRenderer pixelPrimitiveNPC)
if (npc.ModNPC != null && npc.ModNPC is IPixelatedPrimitiveRenderer pixelPrimitiveNPC)
{
var listToUse = pixelPrimitiveNPC.LayerToRenderTo switch
{
@@ -89,14 +89,12 @@ namespace CalamityMod.Graphics.Renderers.CalamityRenderers
ActuallyDoPreDraw = true;
// Draw every npc to a single target that should have the miracle blight visual.
for (int i = 0; i < Main.maxNPCs; i++)
foreach (NPC npc in Main.ActiveNPCs)
{
// Extra check to ensure that index errors will not occur. If not in range, something has gone wrong and the loop should terminate.
if (!Main.npc.IndexInRange(i))
if (!Main.npc.IndexInRange(npc.whoAmI))
break;
NPC npc = Main.npc[i];
if (ValidToDraw(npc))
Main.instance.DrawNPC(npc.whoAmI, npc.behindTiles);
}
+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.
+4 -10
View File
@@ -736,22 +736,16 @@ namespace CalamityMod.ILEditing
Main.spriteBatch.SetBlendState(BlendState.Additive);
// Draw Projectiles.
for (int i = 0; i < Main.maxProjectiles; i++)
foreach (Projectile p in Main.ActiveProjectiles)
{
if (!Main.projectile[i].active)
continue;
if (Main.projectile[i].ModProjectile is IAdditiveDrawer d)
if (p.ModProjectile is IAdditiveDrawer d)
d.AdditiveDraw(Main.spriteBatch);
}
// Draw NPCs.
for (int i = 0; i < Main.maxNPCs; i++)
foreach (NPC n in Main.ActiveNPCs)
{
if (!Main.npc[i].active)
continue;
if (Main.npc[i].ModNPC is IAdditiveDrawer d)
if (n.ModNPC is IAdditiveDrawer d)
d.AdditiveDraw(Main.spriteBatch);
}
+1 -1
View File
@@ -271,7 +271,7 @@ namespace CalamityMod.ILEditing
// Sync the color changes.
if (colorWasChanged)
NetMessage.SendData(MessageID.ItemTweaker, -1, -1, null, itemID, 1f);
NetMessage.SendData(MessageID.ItemTweaker, -1, -1, null, itemIndex, 1f);
}
#endregion Color Blighted Gel
+2 -2
View File
@@ -39,9 +39,9 @@ namespace CalamityMod.Items.Accessories
if (Main.rand.NextBool(15))
{
int numProj = 0;
for (int i = 0; i < Main.maxProjectiles; i++)
foreach (Projectile p in Main.ActiveProjectiles)
{
if (Main.projectile[i].active && Main.projectile[i].owner == player.whoAmI && Main.projectile[i].type == ModContent.ProjectileType<NebulaStar>())
if (p.owner == player.whoAmI && p.type == ModContent.ProjectileType<NebulaStar>())
{
numProj++;
}
+5 -6
View File
@@ -38,10 +38,9 @@ namespace CalamityMod.Items.Accessories
get
{
bool result = false;
for (int i = 0; i < Main.maxPlayers; i++)
foreach (Player player in Main.ActivePlayers)
{
Player player = Main.player[i];
if (player is null || !player.active || player.outOfRange || player.dead)
if (player.outOfRange || player.dead)
continue;
CalamityPlayer modPlayer = player.Calamity();
@@ -118,10 +117,9 @@ namespace CalamityMod.Items.Accessories
// Visibility is not net synced, for example.
bool alreadyDrawnShieldForPlayer = false;
for (int i = 0; i < Main.maxPlayers; i++)
foreach (Player player in Main.ActivePlayers)
{
Player player = Main.player[i];
if (player is null || !player.active || player.outOfRange || player.dead)
if (player.outOfRange || player.dead)
continue;
CalamityPlayer modPlayer = player.Calamity();
@@ -135,6 +133,7 @@ namespace CalamityMod.Items.Accessories
// Scale the shield is drawn at.
// The "i" parameter is to make different player's shields not be perfectly synced.
int i = player.whoAmI;
float scale = 0.15f + 0.03f * (0.5f + 0.5f * (float)Math.Sin(Main.GlobalTimeWrappedHourly * 0.5f + i * 0.2f));
if (!alreadyDrawnShieldForPlayer)
+2 -3
View File
@@ -42,10 +42,9 @@ namespace CalamityMod.Items.Accessories
get
{
bool result = false;
for (int i = 0; i < Main.maxPlayers; i++)
foreach (Player player in Main.ActivePlayers)
{
Player player = Main.player[i];
if (player is null || !player.active || player.outOfRange || player.dead)
if (player.outOfRange || player.dead)
continue;
CalamityPlayer modPlayer = player.Calamity();
+6 -8
View File
@@ -38,11 +38,10 @@ namespace CalamityMod.Items.Accessories
get
{
bool result = false;
for (int i = 0; i < Main.maxPlayers; i++)
foreach (Player player in Main.ActivePlayers)
{
Player player = Main.player[i];
if (player is null || !player.active || player.outOfRange || player.dead)
continue;
if (player.outOfRange || player.dead)
continue;
CalamityPlayer modPlayer = player.Calamity();
@@ -112,10 +111,9 @@ namespace CalamityMod.Items.Accessories
// Visibility is not net synced, for example.
bool alreadyDrawnShieldForPlayer = false;
for (int i = 0; i < Main.maxPlayers; i++)
foreach (Player player in Main.ActivePlayers)
{
Player player = Main.player[i];
if (player is null || !player.active || player.outOfRange || player.dead)
if (player.outOfRange || player.dead)
continue;
CalamityPlayer modPlayer = player.Calamity();
@@ -127,7 +125,7 @@ namespace CalamityMod.Items.Accessories
continue;
// The shield very gently grows and shrinks
float scale = 0.15f + 0.03f * (0.5f + 0.5f * (float)Math.Sin(Main.GlobalTimeWrappedHourly * 0.5f + i * 0.2f));
float scale = 0.15f + 0.03f * (0.5f + 0.5f * (float)Math.Sin(Main.GlobalTimeWrappedHourly * 0.5f + player.whoAmI * 0.2f));
if (!alreadyDrawnShieldForPlayer)
{
+2 -3
View File
@@ -58,13 +58,12 @@ namespace CalamityMod.Items.Accessories
if (auraCounter == 9)
{
auraCounter = 0;
for (int i = 0; i < Main.maxNPCs; i++)
foreach (NPC npc in Main.ActiveNPCs)
{
NPC npc = Main.npc[i];
if (npc.IsAnEnemy() && !npc.dontTakeDamage && Vector2.Distance(player.Center, npc.Center) <= range)
{
int campingFireDamage = (int)player.GetBestClassDamage().ApplyTo(Main.rand.Next(20, 41));
Projectile.NewProjectileDirect(source, npc.Center, Vector2.Zero, ModContent.ProjectileType<DirectStrike>(), campingFireDamage, 0f, player.whoAmI, i);
Projectile.NewProjectileDirect(source, npc.Center, Vector2.Zero, ModContent.ProjectileType<DirectStrike>(), campingFireDamage, 0f, player.whoAmI, npc.whoAmI);
}
}
}
+5 -6
View File
@@ -47,10 +47,9 @@ namespace CalamityMod.Items.Accessories
get
{
bool result = false;
for (int i = 0; i < Main.maxPlayers; i++)
foreach (Player player in Main.ActivePlayers)
{
Player player = Main.player[i];
if (player is null || !player.active || player.outOfRange || player.dead)
if (player.outOfRange || player.dead)
continue;
CalamityPlayer modPlayer = player.Calamity();
@@ -178,10 +177,9 @@ namespace CalamityMod.Items.Accessories
// Visibility is not net synced, for example.
bool alreadyDrawnShieldForPlayer = false;
for (int i = 0; i < Main.maxPlayers; i++)
foreach (Player player in Main.ActivePlayers)
{
Player player = Main.player[i];
if (player is null || !player.active || player.outOfRange || player.dead)
if (player.outOfRange || player.dead)
continue;
CalamityPlayer modPlayer = player.Calamity();
@@ -194,6 +192,7 @@ namespace CalamityMod.Items.Accessories
// Scale the shield is drawn at. The Sponge shield gently grows and shrinks; it should be largely imperceptible.
// The "i" parameter is to make different player's shields not be perfectly synced.
int i = player.whoAmI;
float baseScale = 0.155f;
float maxExtraScale = 0.025f;
float extraScalePulseInterpolant = MathF.Pow(4f, MathF.Sin(Main.GlobalTimeWrappedHourly * 0.791f + i) - 1);
+2 -3
View File
@@ -40,9 +40,8 @@ namespace CalamityMod.Items.Accessories
{
if (random == 0)
{
for (int l = 0; l < Main.maxNPCs; l++)
foreach (NPC nPC in Main.ActiveNPCs)
{
NPC nPC = Main.npc[l];
if (nPC.IsAnEnemy() && !nPC.dontTakeDamage && !nPC.buffImmune[plagueDebuff] && Vector2.Distance(player.Center, nPC.Center) <= 300f)
{
if (nPC.FindBuffIndex(plagueDebuff) == -1)
@@ -53,7 +52,7 @@ namespace CalamityMod.Items.Accessories
{
if (player.whoAmI == Main.myPlayer)
{
Projectile.NewProjectileDirect(source, nPC.Center, Vector2.Zero, ModContent.ProjectileType<DirectStrike>(), auraDamage, 0f, player.whoAmI, l);
Projectile.NewProjectileDirect(source, nPC.Center, Vector2.Zero, ModContent.ProjectileType<DirectStrike>(), auraDamage, 0f, player.whoAmI, nPC.whoAmI);
}
}
}
+4 -6
View File
@@ -49,26 +49,24 @@ namespace CalamityMod.Items.Accessories
float bonus = 0f;
int closestNPC = -1;
for (int i = 0; i < Main.maxNPCs; i++)
foreach (NPC nPC in Main.ActiveNPCs)
{
NPC nPC = Main.npc[i];
if (nPC.IsAnEnemy() && !nPC.dontTakeDamage)
{
closestNPC = i;
closestNPC = nPC.whoAmI;
break;
}
}
float distance = -1f;
for (int j = 0; j < Main.maxNPCs; j++)
foreach (NPC nPC in Main.ActiveNPCs)
{
NPC nPC = Main.npc[j];
if (nPC.IsAnEnemy() && !nPC.dontTakeDamage)
{
float distance2 = Math.Abs(nPC.position.X + (float)(nPC.width / 2) - (player.position.X + (float)(player.width / 2))) + Math.Abs(nPC.position.Y + (float)(nPC.height / 2) - (player.position.Y + (float)(player.height / 2)));
if (distance == -1f || distance2 < distance)
{
distance = distance2;
closestNPC = j;
closestNPC = nPC.whoAmI;
}
}
}
+6 -9
View File
@@ -361,10 +361,9 @@ namespace CalamityMod.Items.Accessories
if (bestGrapplePos != Point.Zero)
{
//Clear any hooks that might have been flying before then.
for (int i = 0; i < Main.maxProjectiles; ++i)
foreach (Projectile p in Main.ActiveProjectiles)
{
Projectile p = Main.projectile[i];
if (!p.active || p.owner != Player.whoAmI || p.type != ProjectileType<WulfrumHook>())
if (p.owner != Player.whoAmI || p.type != ProjectileType<WulfrumHook>())
continue;
if (p.ModProjectile is WulfrumHook)
@@ -412,10 +411,9 @@ namespace CalamityMod.Items.Accessories
if (triggersSet.Grapple && Player.releaseHook)
{
//Clear any previous non-wulfrum hooks / Any hooks that just got shot (should already be handled by the global proj
for (int i = 0; i < Main.maxProjectiles; ++i)
foreach (Projectile p in Main.ActiveProjectiles)
{
Projectile p = Main.projectile[i];
if (!p.active || p.owner != Player.whoAmI || p.aiStyle != 7 || p.type == ProjectileType<WulfrumHook>())
if (p.owner != Player.whoAmI || p.aiStyle != 7 || p.type == ProjectileType<WulfrumHook>())
continue;
p.Kill();
@@ -443,10 +441,9 @@ namespace CalamityMod.Items.Accessories
//Jumping out of the hook
if (triggersSet.Jump && Player.releaseJump)
{
for (int i = 0; i < Main.maxProjectiles; ++i)
foreach (Projectile p in Main.ActiveProjectiles)
{
Projectile p = Main.projectile[i];
if (!p.active || p.owner != Player.whoAmI || p.type != ProjectileType<WulfrumHook>())
if (p.owner != Player.whoAmI || p.type != ProjectileType<WulfrumHook>())
continue;
//Only clear hooks that are attached to stuff
+2 -2
View File
@@ -26,9 +26,9 @@ namespace CalamityMod.Items
{
int offset = player.direction == 1 ? 5 : -Item.width - 5;
Rectangle itemRect = new Rectangle((int)player.Center.X + offset, (int)player.position.Y - 10, Item.width, Item.height);
foreach (NPC npc in Main.npc)
foreach (NPC npc in Main.ActiveNPCs)
{
if (npc.active && npc != null && !npc.dontTakeDamage && npc.type != ModContent.NPCType<THELORDE>())
if (!npc.dontTakeDamage && npc.type != ModContent.NPCType<THELORDE>())
{
if (itemRect.Intersects(npc.getRect()))
{
+5 -6
View File
@@ -42,10 +42,9 @@ namespace CalamityMod.Items.Armor.LunicCorps
get
{
bool result = false;
for (int i = 0; i < Main.maxPlayers; i++)
foreach (Player player in Main.ActivePlayers)
{
Player player = Main.player[i];
if (player is null || !player.active || player.outOfRange || player.dead)
if (player.outOfRange || player.dead)
continue;
CalamityPlayer modPlayer = player.Calamity();
@@ -116,10 +115,9 @@ namespace CalamityMod.Items.Armor.LunicCorps
// Visibility is not net synced, for example.
bool alreadyDrawnShieldForPlayer = false;
for (int i = 0; i < Main.maxPlayers; i++)
foreach (Player player in Main.ActivePlayers)
{
Player player = Main.player[i];
if (player is null || !player.active || player.outOfRange || player.dead)
if (player.outOfRange || player.dead)
continue;
CalamityPlayer modPlayer = player.Calamity();
@@ -130,6 +128,7 @@ namespace CalamityMod.Items.Armor.LunicCorps
// Scale the shield is drawn at. The Lunic Corps shield sticks very close to the body to mimic Halo and occasionally pulses.
// The "i" parameter is to make different player's shields not be perfectly synced.
int i = player.whoAmI;
float baseScale = 0.11f;
float maxExtraScale = 0.013f;
float extraScalePulseInterpolant = MathF.Pow(12f, MathF.Sin(Main.GlobalTimeWrappedHourly * 1.6f + i) - 1);
+25 -25
View File
@@ -513,11 +513,11 @@ namespace CalamityMod.Items
}
if (item.type == ItemID.PearlwoodBow)
{
for (int i = 0; i < Main.maxProjectiles; i++)
foreach (Projectile p in Main.ActiveProjectiles)
{
if (Main.projectile[i].active && (Main.projectile[i].type == ModContent.ProjectileType<RainbowFront>() || Main.projectile[i].type == ModContent.ProjectileType<RainbowTrail>()) && Main.projectile[i].owner == player.whoAmI)
if ((p.type == ModContent.ProjectileType<RainbowFront>() || p.type == ModContent.ProjectileType<RainbowTrail>()) && p.owner == player.whoAmI)
{
Main.projectile[i].Kill();
p.Kill();
}
}
for (int i = -8; i <= 8; i += 8)
@@ -678,9 +678,9 @@ namespace CalamityMod.Items
if (player.ActiveItem().type == ModContent.ItemType<IgneousExaltation>())
{
bool hasBlades = false;
for (int i = 0; i < Main.maxProjectiles; i++)
foreach (Projectile p in Main.ActiveProjectiles)
{
if (Main.projectile[i].active && Main.projectile[i].type == ModContent.ProjectileType<IgneousBlade>() && Main.projectile[i].owner == player.whoAmI && Main.projectile[i].localAI[1] == 0f)
if (p.type == ModContent.ProjectileType<IgneousBlade>() && p.owner == player.whoAmI && p.localAI[1] == 0f)
{
hasBlades = true;
break;
@@ -688,22 +688,22 @@ namespace CalamityMod.Items
}
if (hasBlades)
{
for (int i = 0; i < Main.maxProjectiles; i++)
foreach (Projectile p in Main.ActiveProjectiles)
{
if (Main.projectile[i].ModProjectile is IgneousBlade)
if (p.ModProjectile is IgneousBlade)
{
if (Main.projectile[i].ModProjectile<IgneousBlade>().Firing)
if (p.ModProjectile<IgneousBlade>().Firing)
continue;
}
if (Main.projectile[i].active && Main.projectile[i].type == ModContent.ProjectileType<IgneousBlade>() && Main.projectile[i].owner == player.whoAmI && Main.projectile[i].localAI[1] == 0f)
if (p.type == ModContent.ProjectileType<IgneousBlade>() && p.owner == player.whoAmI && p.localAI[1] == 0f)
{
Main.projectile[i].rotation = MathHelper.PiOver2 + MathHelper.PiOver4;
Main.projectile[i].velocity = Main.projectile[i].SafeDirectionTo(Main.MouseWorld, Vector2.UnitY) * 22f;
Main.projectile[i].rotation += Main.projectile[i].velocity.ToRotation();
Main.projectile[i].ai[0] = 180f;
Main.projectile[i].ModProjectile<IgneousBlade>().Firing = true;
Main.projectile[i].tileCollide = true;
Main.projectile[i].netUpdate = true;
p.rotation = MathHelper.PiOver2 + MathHelper.PiOver4;
p.velocity = p.SafeDirectionTo(Main.MouseWorld, Vector2.UnitY) * 22f;
p.rotation += p.velocity.ToRotation();
p.ai[0] = 180f;
p.ModProjectile<IgneousBlade>().Firing = true;
p.tileCollide = true;
p.netUpdate = true;
}
}
}
@@ -711,13 +711,13 @@ namespace CalamityMod.Items
}
if (player.ActiveItem().type == ModContent.ItemType<VoidConcentrationStaff>() && player.ownedProjectileCounts[ModContent.ProjectileType<VoidConcentrationBlackhole>()] == 0)
{
for (int i = 0; i < Main.maxProjectiles; i++)
foreach (Projectile p in Main.ActiveProjectiles)
{
if (Main.projectile[i].ModProjectile is VoidConcentrationAura)
if (p.ModProjectile is VoidConcentrationAura)
{
if (Main.projectile[i].active && Main.projectile[i].owner == player.whoAmI)
if (p.owner == player.whoAmI)
{
Main.projectile[i].ModProjectile<VoidConcentrationAura>().HandleRightClick();
p.ModProjectile<VoidConcentrationAura>().HandleRightClick();
break;
}
}
@@ -728,18 +728,18 @@ namespace CalamityMod.Items
{
bool canContinue = true;
int count = 0;
for (int i = 0; i < Main.projectile.Length; i++)
foreach (Projectile p in Main.ActiveProjectiles)
{
if (Main.projectile[i].active && Main.projectile[i].type == ModContent.ProjectileType<GlacialEmbracePointyThing>() && Main.projectile[i].owner == player.whoAmI)
if (p.type == ModContent.ProjectileType<GlacialEmbracePointyThing>() && p.owner == player.whoAmI)
{
if (Main.projectile[i].ai[1] > 1f)
if (p.ai[1] > 1f)
{
canContinue = false;
break;
}
else if (Main.projectile[i].ai[1] == 0f)
else if (p.ai[1] == 0f)
{
if (((GlacialEmbracePointyThing)Main.projectile[i].ModProjectile).circlingPlayer)
if (((GlacialEmbracePointyThing)p.ModProjectile).circlingPlayer)
count++;
}
}
+1
View File
@@ -601,6 +601,7 @@ namespace CalamityMod.Items
{ ItemID.SpicyPepper, Do(Value(Item.sellPrice(copper: 40))) },
{ ItemID.Starfruit, Do(Value(Item.sellPrice(copper: 40))) },
{ ItemID.PortableStool, Do(Value(Item.sellPrice(copper: 20))) }, // Step Stool
{ ItemID.UncumberingStone, Do(Worthless) },
{ ItemID.ViciousMushroom, Do(Worthless) },
{ ItemID.VileMushroom, Do(Worthless) },
#endregion
+2 -2
View File
@@ -44,9 +44,9 @@ namespace CalamityMod.Items.Materials
bool closePlayer = false;
for (int i = 0; i < Main.maxPlayers; i++)
foreach (Player player in Main.ActivePlayers)
{
if ((Main.player[i].Center - Item.Center).Length() < 1200 && Main.player[i].GetModPlayer<WulfrumBatteryPlayer>().battery)
if ((player.Center - Item.Center).Length() < 1200 && player.GetModPlayer<WulfrumBatteryPlayer>().battery)
{
closePlayer = true;
break;
+5 -9
View File
@@ -71,12 +71,12 @@ namespace CalamityMod.Items.Mounts
public override void SetMount(Player player, ref bool skipDust)
{
for (int i = 0; i < Main.maxNPCs; i++)
foreach (NPC npc in Main.ActiveNPCs)
{
if (Main.npc[i].type == ModContent.NPCType<FAP>())
if (npc.type == ModContent.NPCType<FAP>())
{
Main.npc[i].active = false;
Main.npc[i].netUpdate = true;
npc.active = false;
npc.netUpdate = true;
break;
}
}
@@ -85,12 +85,8 @@ namespace CalamityMod.Items.Mounts
public override void Dismount(Player player, ref bool skipDust)
{
bool anyPlayerOnFabMount = false;
for (int i = 0; i < Main.maxPlayers; i++)
foreach (Player player2 in Main.ActivePlayers)
{
Player player2 = Main.player[i];
if (!player2.active)
continue;
// The player that is dismounting is technically not on the mount anymore.
if (player2.Calamity().fab && player2.whoAmI != player.whoAmI)
{
+7 -8
View File
@@ -50,14 +50,13 @@ namespace CalamityMod.Items.SummonItems
public override void AddRecipes()
{
Condition downedPerfs = new(CalamityUtils.GetText("Condition.DownedPerfs"), () => DownedBossSystem.downedPerforator);
CreateRecipe().
AddIngredient(ItemID.CrimtaneBar, 3).
AddIngredient<BloodSample>(7).
AddIngredient(ItemID.Vertebrae, 13).
AddTile(TileID.DemonAltar).
AddDecraftCondition(downedPerfs).
Register();
CreateRecipe()
.AddIngredient(ItemID.CrimtaneBar, 3)
.AddIngredient<BloodSample>(7)
.AddIngredient(ItemID.Vertebrae, 13)
.AddTile(TileID.DemonAltar)
.AddDecraftCondition(CalamityConditions.DownedPerforator)
.Register();
}
}
}
+1 -2
View File
@@ -50,13 +50,12 @@ namespace CalamityMod.Items.SummonItems
public override void AddRecipes()
{
Condition downedHM = new(CalamityUtils.GetText("Condition.DownedHM"), () => DownedBossSystem.downedHiveMind);
CreateRecipe().
AddIngredient(ItemID.DemoniteBar, 3).
AddIngredient<RottenMatter>(7).
AddIngredient(ItemID.RottenChunk, 13).
AddTile(TileID.DemonAltar).
AddDecraftCondition(downedHM).
AddDecraftCondition(CalamityConditions.DownedHiveMind).
Register();
}
}
+3 -4
View File
@@ -30,16 +30,15 @@ namespace CalamityMod.Items
public static void DeleteDummies()
{
for (int i = 0; i < Main.maxNPCs; i++)
foreach (NPC npc in Main.ActiveNPCs)
{
NPC npc = Main.npc[i];
if (npc.type == ModContent.NPCType<SuperDummyNPC>() && npc.active)
if (npc.type == ModContent.NPCType<SuperDummyNPC>())
{
npc.life = 0;
npc.active = false;
if (Main.netMode == NetmodeID.Server)
NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, i);
NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, npc.whoAmI);
}
}
}
+2 -3
View File
@@ -53,10 +53,9 @@ namespace CalamityMod.Items.Tools
{
bool explodedAny = false;
for (int i = 0; i < Main.maxProjectiles; ++i)
foreach (Projectile p in Main.ActiveProjectiles)
{
Projectile p = Main.projectile[i];
if (!p.active || p.owner != player.whoAmI || p.type != Item.shoot)
if (p.owner != player.whoAmI || p.type != Item.shoot)
continue;
p.ai[1] = 1f;
+6 -6
View File
@@ -56,9 +56,9 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal
float magnetCount = 0f;
for (int i = 0; i < Main.projectile.Length; i++)
foreach (Projectile p in Main.ActiveProjectiles)
{
if (Main.projectile[i].type == type && Main.projectile[i].active && Main.projectile[i].owner == player.whoAmI)
if (p.type == type && p.owner == player.whoAmI)
{
magnetCount++;
}
@@ -67,12 +67,12 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal
// Adjust the offset of all existing magnets such that they form a psuedo-circle.
// This offset is used when determining where a magnet should move to relative to its true destination (such as the player or an enemy).
int magnetIndex = 0;
for (int i = 0; i < Main.projectile.Length; i++)
foreach (Projectile p in Main.ActiveProjectiles)
{
if (Main.projectile[i].type == type && Main.projectile[i].active && Main.projectile[i].owner == player.whoAmI)
if (p.type == type && p.owner == player.whoAmI)
{
((PoleWarperSummon)Main.projectile[i].ModProjectile).Time = 0f;
((PoleWarperSummon)Main.projectile[i].ModProjectile).AngularOffset = MathHelper.TwoPi * magnetIndex / magnetCount;
((PoleWarperSummon)p.ModProjectile).Time = 0f;
((PoleWarperSummon)p.ModProjectile).AngularOffset = MathHelper.TwoPi * magnetIndex / magnetCount;
magnetIndex++;
}
}
+3 -3
View File
@@ -35,12 +35,12 @@ namespace CalamityMod.Items.Weapons.Melee
public override bool CanUseItem(Player player)
{
int bladeProjID = ModContent.ProjectileType<BladecrestOathswordProj>();
for (int i = 0; i < Main.maxProjectiles; i++)
foreach (Projectile p in Main.ActiveProjectiles)
{
if (Main.projectile[i].type != bladeProjID || !Main.projectile[i].active || Main.projectile[i].owner != player.whoAmI)
if (p.type != bladeProjID || p.owner != player.whoAmI)
continue;
return Main.projectile[i].ModProjectile<BladecrestOathswordProj>().PostSwingRepositionDelay <= 0f;
return p.ModProjectile<BladecrestOathswordProj>().PostSwingRepositionDelay <= 0f;
}
return base.CanUseItem(player);
+1 -1
View File
@@ -43,4 +43,4 @@ namespace CalamityMod.Items.Weapons.Melee
Register();
}
}
}
}
+13 -4
View File
@@ -100,15 +100,24 @@ namespace CalamityMod.Items.Weapons.Melee
float state = 0;
//If there are any exoblades in "stasis" after a bonk, the attack should be an empowered slash instead
if (Main.projectile.Any(n => n.active && n.owner == player.whoAmI && n.type == ProjectileType<ExobladeProj>() && n.ai[0] == 1 && n.ai[1] == 1 && n.timeLeft > LungeCooldown))
bool empoweredSlash = false;
foreach (Projectile p in Main.ActiveProjectiles)
{
if (p.owner == player.whoAmI && p.type == Item.shoot && p.ai[0] == 1 && p.ai[1] == 1 && p.timeLeft > LungeCooldown)
{
empoweredSlash = true;
break;
}
}
if (empoweredSlash)
{
state = 2;
//Put all the "post bonk" stasised exoblades into regular cooldown for the right click ljunge
for (int i = 0; i < Main.maxProjectiles; ++i)
foreach (Projectile p in Main.ActiveProjectiles)
{
Projectile p = Main.projectile[i];
if (!p.active || p.owner != player.whoAmI || p.type != Item.shoot || p.ai[0] != 1 || p.ai[1] != 1)
if (p.owner != player.whoAmI || p.type != Item.shoot || p.ai[0] != 1 || p.ai[1] != 1)
continue;
p.timeLeft = LungeCooldown;
+2 -3
View File
@@ -66,10 +66,9 @@ namespace CalamityMod.Items.Weapons.Ranged
private void DetonateRockets(Player player)
{
for (int i = 0; i < Main.maxProjectiles; ++i)
foreach (Projectile p in Main.ActiveProjectiles)
{
Projectile p = Main.projectile[i];
if (!p.active || p.owner != player.whoAmI || p.type != Item.shoot)
if (p.owner != player.whoAmI || p.type != Item.shoot)
continue;
// All rockets will instantly explode on the next frame and send packets to indicate as such.
+3 -4
View File
@@ -58,16 +58,15 @@ namespace CalamityMod.Items.Weapons.Ranged
int[] targets = new int[maxTargets];
int targetArrayIndex = 0;
Rectangle rectangle = new Rectangle((int)player.Center.X - 960, (int)player.Center.Y - 540, 1920, 1080);
for (int i = 0; i < Main.maxNPCs; i++)
foreach (NPC npc in Main.ActiveNPCs)
{
NPC npc = Main.npc[i];
if (npc.active && npc.chaseable && npc.lifeMax > 5 && !npc.dontTakeDamage && !npc.friendly && !npc.immortal)
if (npc.chaseable && npc.lifeMax > 5 && !npc.dontTakeDamage && !npc.friendly && !npc.immortal)
{
if (npc.Hitbox.Intersects(rectangle))
{
if (targetArrayIndex < maxTargets)
{
targets[targetArrayIndex] = i;
targets[targetArrayIndex] = npc.whoAmI;
targetArrayIndex++;
}
else
+3 -4
View File
@@ -58,16 +58,15 @@ namespace CalamityMod.Items.Weapons.Ranged
int[] targets = new int[maxTargets];
int targetArrayIndex = 0;
Rectangle rectangle = new Rectangle((int)player.Center.X - 960, (int)player.Center.Y - 540, 1920, 1080);
for (int i = 0; i < Main.maxNPCs; i++)
foreach (NPC npc in Main.ActiveNPCs)
{
NPC npc = Main.npc[i];
if (npc.active && npc.chaseable && npc.lifeMax > 5 && !npc.dontTakeDamage && !npc.friendly && !npc.immortal)
if (npc.chaseable && npc.lifeMax > 5 && !npc.dontTakeDamage && !npc.friendly && !npc.immortal)
{
if (npc.Hitbox.Intersects(rectangle))
{
if (targetArrayIndex < maxTargets)
{
targets[targetArrayIndex] = i;
targets[targetArrayIndex] = npc.whoAmI;
targetArrayIndex++;
}
else
+6 -6
View File
@@ -68,11 +68,11 @@ namespace CalamityMod.Items.Weapons.Ranged
}
else if (player.ActiveItem().type != Item.type || player.dead || !player.active)
{
for (int i = 0; i < Main.maxProjectiles; i++)
foreach (Projectile p in Main.ActiveProjectiles)
{
//Destroy all heads
if (Main.projectile[i].type == HeadID && Main.projectile[i].owner == player.whoAmI && Main.projectile[i].active)
Main.projectile[i].Kill();
if (p.type == HeadID && p.owner == player.whoAmI)
p.Kill();
}
HeadSpawnTimer = 0;
}
@@ -111,11 +111,11 @@ namespace CalamityMod.Items.Weapons.Ranged
Projectile.NewProjectile(source, newPos, spreadVelocity * spreadDirection, Item.shoot, damage, knockback, player.whoAmI);
}
for (int i = 0; i < Main.maxProjectiles; i++)
foreach (Projectile p in Main.ActiveProjectiles)
{
//Force all heads to shoot
if (Main.projectile[i].type == HeadID && Main.projectile[i].owner == player.whoAmI && Main.projectile[i].active)
Main.projectile[i].ai[1] = 1f;
if (p.type == HeadID && p.owner == player.whoAmI)
p.ai[1] = 1f;
}
return false;
}
+2 -2
View File
@@ -29,13 +29,13 @@ namespace CalamityMod.Items.Weapons.Ranged
Item.useStyle = ItemUseStyleID.Shoot;
Item.noMelee = true;
Item.knockBack = 7.5f;
Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice;
Item.value = CalamityGlobalItem.RarityLightRedBuyPrice;
Item.UseSound = FireSound;
Item.autoReuse = true;
Item.shoot = ModContent.ProjectileType<NitroShot>();
Item.shootSpeed = 12f;
Item.useAmmo = AmmoID.Bullet;
Item.rare = ModContent.RarityType<PureGreen>();
Item.rare = ItemRarityID.LightRed;
Item.Calamity().canFirePointBlankShots = true;
}
+3 -4
View File
@@ -43,12 +43,11 @@ namespace CalamityMod.Items.Weapons.Rogue
if (spore.WithinBounds(Main.maxProjectiles))
Main.projectile[spore].ai[1] = 1f;
}
for (int i = 0; i < Main.maxPlayers; i++)
foreach (Player other in Main.ActivePlayers)
{
Player other = Main.player[i];
if (other is null || !other.active || other.dead)
if (other.dead)
continue;
if ((other.team == player.team && player.team != 0) || player.whoAmI == i)
if ((other.team == player.team && player.team != 0) || player.whoAmI == other.whoAmI)
{
if (player.Distance(other.Center) <= 800f)
other.AddBuff(ModContent.BuffType<Mushy>(), 900);
+5 -7
View File
@@ -32,10 +32,9 @@ namespace CalamityMod.Items.Weapons.Rogue
public override bool AltFunctionUse(Player player)
{
for (int i = 0; i < Main.maxProjectiles; i++)
foreach (Projectile p in Main.ActiveProjectiles)
{
Projectile p = Main.projectile[i];
if (p.type == ModContent.ProjectileType<NychthemeronProjectile>() && p.owner == player.whoAmI)
if (p.type == Item.shoot && p.owner == player.whoAmI)
{
p.ai[0] = 1f;
}
@@ -93,12 +92,11 @@ namespace CalamityMod.Items.Weapons.Rogue
// Ideally new projectiles will fill in the most recently vacated spots in the pattern
int[] activeSlots = new int[10] { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 };
for (int i = 0; i < Main.maxProjectiles; i++)
foreach (Projectile proj in Main.ActiveProjectiles)
{
Projectile proj = Main.projectile[i];
if (proj.type == ModContent.ProjectileType<NychthemeronOrb>() && proj.owner == player.whoAmI && proj.active && proj.localAI[0] == 0f && activeSlots[(int)proj.localAI[1]] == -1)
if (proj.type == ModContent.ProjectileType<NychthemeronOrb>() && proj.owner == player.whoAmI && proj.localAI[0] == 0f && activeSlots[(int)proj.localAI[1]] == -1)
{
activeSlots[(int)proj.localAI[1]] = i;
activeSlots[(int)proj.localAI[1]] = proj.whoAmI;
}
}
+7 -7
View File
@@ -39,18 +39,18 @@ namespace CalamityMod.Items.Weapons.Rogue
{
if (player.altFunctionUse == 2)
{
for (int i = 0; i < Main.maxProjectiles; i++)
foreach (Projectile p in Main.ActiveProjectiles)
{
if (Main.projectile[i].type != type || !Main.projectile[i].active || Main.projectile[i].owner != player.whoAmI)
if (p.type != type || p.owner != player.whoAmI)
continue;
if (Main.projectile[i].ai[0] != 1f)
if (p.ai[0] != 1f)
continue;
NPC attachedNPC = Main.npc[(int)Main.projectile[i].ai[1]];
Main.projectile[i].ai[0] = 2f;
Main.projectile[i].ModProjectile<SacrificeProjectile>().AbleToHealOwner = attachedNPC.type != NPCID.TargetDummy && attachedNPC.type != ModContent.NPCType<SuperDummyNPC>();
Main.projectile[i].netUpdate = true;
NPC attachedNPC = Main.npc[(int)p.ai[1]];
p.ai[0] = 2f;
p.ModProjectile<SacrificeProjectile>().AbleToHealOwner = attachedNPC.type != NPCID.TargetDummy && attachedNPC.type != ModContent.NPCType<SuperDummyNPC>();
p.netUpdate = true;
}
//TODO: Add something here to avoid stealth being consumed
return false;
+7 -7
View File
@@ -19,14 +19,14 @@ namespace CalamityMod.Items.Weapons.Rogue
Item.channel = true;
Item.useAnimation = 26;
Item.useTime = 26;
Item.useStyle = ItemUseStyleID.Swing;
Item.knockBack = 5f;
Item.useStyle = ItemUseStyleID.Shoot;
Item.knockBack = 6f;
Item.UseSound = SoundID.DD2_GhastlyGlaivePierce;
Item.autoReuse = true;
Item.value = CalamityGlobalItem.RarityLightRedBuyPrice;
Item.rare = ItemRarityID.LightRed;
Item.value = CalamityGlobalItem.RarityOrangeBuyPrice;
Item.rare = ItemRarityID.Orange;
Item.shoot = ModContent.ProjectileType<SlickCaneProjectile>();
Item.shootSpeed = 22f;
Item.shootSpeed = 16f;
Item.DamageType = RogueDamageClass.Instance;
}
@@ -34,8 +34,8 @@ namespace CalamityMod.Items.Weapons.Rogue
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
{
float ai0 = Main.rand.NextFloat() * Item.shootSpeed * 0.75f * (float)player.direction;
int projectileIndex = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI, ai0, 0f);
float ai0 = Main.rand.NextFloat() * Item.shootSpeed * 1.5f * (float)player.direction;
int projectileIndex = Projectile.NewProjectile(source, position.X, position.Y+100, velocity.X*2f, velocity.Y*2f, type, damage, knockback, player.whoAmI, ai0, 0f);
if (projectileIndex.WithinBounds(Main.maxProjectiles))
Main.projectile[projectileIndex].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable();
return false;
+2 -3
View File
@@ -38,10 +38,9 @@ namespace CalamityMod.Items.Weapons.Summon
player.jumpSpeedBoost += 0.5f;
double minionCount = 0;
for (int j = 0; j < Main.projectile.Length; j++)
foreach (Projectile projectile in Main.ActiveProjectiles)
{
Projectile projectile = Main.projectile[j];
if (projectile.active && projectile.owner == player.whoAmI && projectile.minion && projectile.type != ModContent.ProjectileType<AstrageldonSummon>())
if (projectile.owner == player.whoAmI && projectile.minion && projectile.type != ModContent.ProjectileType<AstrageldonSummon>())
{
minionCount += projectile.minionSlots;
}
+4 -4
View File
@@ -113,13 +113,13 @@ namespace CalamityMod.Items.Weapons.Summon
// If the player owns a panel, make it fade away.
if (player.ownedProjectileCounts[panelID] >= 1)
{
for (int i = 0; i < Main.maxProjectiles; i++)
foreach (Projectile p in Main.ActiveProjectiles)
{
if (Main.projectile[i].type != panelID || Main.projectile[i].owner != player.whoAmI || !Main.projectile[i].active)
if (p.type != panelID || p.owner != player.whoAmI)
continue;
Main.projectile[i].ai[0] = 1f;
Main.projectile[i].netUpdate = true;
p.ai[0] = 1f;
p.netUpdate = true;
}
}
+5 -5
View File
@@ -53,13 +53,13 @@ namespace CalamityMod.Items.Weapons.Summon
Item.noUseGraphic = true;
}
int bladeIndex = 0;
for (int i = 0; i < Main.maxProjectiles; i++)
foreach (Projectile p in Main.ActiveProjectiles)
{
if (Main.projectile[i].type == type && Main.projectile[i].active && Main.projectile[i].owner == player.whoAmI)
if (p.type == type && p.owner == player.whoAmI)
{
Main.projectile[i].ModProjectile<BrittleStarMinion>().StarIndex = bladeIndex++;
Main.projectile[i].ModProjectile<BrittleStarMinion>().AITimer = 0f;
Main.projectile[i].netUpdate = true;
p.ModProjectile<BrittleStarMinion>().StarIndex = bladeIndex++;
p.ModProjectile<BrittleStarMinion>().AITimer = 0f;
p.netUpdate = true;
}
}
return false;
+4 -4
View File
@@ -45,12 +45,12 @@ namespace CalamityMod.Items.Weapons.Summon
if (player.altFunctionUse != 2)
{
// Reset the timer for all lamps, to re-align the formation.
for (int i = 0; i < Main.maxProjectiles; i++)
foreach (Projectile pro in Main.ActiveProjectiles)
{
if (Main.projectile[i].type == type && Main.projectile[i].owner == player.whoAmI && Main.projectile[i].active)
if (pro.type == type && pro.owner == player.whoAmI)
{
Main.projectile[i].ModProjectile<CosmilampMinion>().Timer = 0f;
Main.projectile[i].netUpdate = true;
pro.ModProjectile<CosmilampMinion>().Timer = 0f;
pro.netUpdate = true;
}
}
+4 -4
View File
@@ -48,12 +48,12 @@ namespace CalamityMod.Items.Weapons.Summon
angleMax += MathHelper.ToRadians((player.ownedProjectileCounts[Item.shoot] - 8) * 2.5f);
}
angleMax = angleMax > MathHelper.ToRadians(105f) ? MathHelper.ToRadians(105f) : angleMax; // More intuative than using a min function
for (int i = 0; i < Main.projectile.Length; i++)
foreach (Projectile p in Main.ActiveProjectiles)
{
if (Main.projectile[i].active && Main.projectile[i].type == type && Main.projectile[i].owner == player.whoAmI)
if (p.type == type && p.owner == player.whoAmI)
{
Main.projectile[i].ai[1] = (index / CalamityUtils.CountProjectiles(type)) * angleMax - angleMax / 2f;
Main.projectile[i].netUpdate = true;
p.ai[1] = (index / CalamityUtils.CountProjectiles(type)) * angleMax - angleMax / 2f;
p.netUpdate = true;
index++;
}
}
+3 -3
View File
@@ -32,11 +32,11 @@ namespace CalamityMod.Items.Weapons.Summon
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
{
float totalSlots = 0f;
for (int i = 0; i < Main.projectile.Length; i++)
foreach (Projectile p in Main.ActiveProjectiles)
{
if (Main.projectile[i].minion && Main.projectile[i].active && Main.projectile[i].owner == player.whoAmI)
if (p.minion && p.owner == player.whoAmI)
{
totalSlots += Main.projectile[i].minionSlots;
totalSlots += p.minionSlots;
}
}
if (totalSlots < player.maxMinions)
+3 -3
View File
@@ -39,11 +39,11 @@ namespace CalamityMod.Items.Weapons.Summon
{
bool bodyExists = false;
int bodyIndex = -1;
for (int i = 0; i < Main.projectile.Length; i++)
foreach (Projectile p in Main.ActiveProjectiles)
{
if (Main.projectile[i].active && Main.projectile[i].type == type && Main.projectile[i].owner == player.whoAmI)
if (p.type == type && p.owner == player.whoAmI)
{
bodyIndex = i;
bodyIndex = p.whoAmI;
bodyExists = true;
break;
}
+8 -10
View File
@@ -122,13 +122,12 @@ namespace CalamityMod.Items.Weapons.Summon
// If the player has any robots, kill them all.
if (player.ownedProjectileCounts[Item.shoot] > 0)
{
for (int i = 0; i < Main.projectile.Length; i++)
foreach (Projectile p in Main.ActiveProjectiles)
{
if (Main.projectile[i].active &&
Main.projectile[i].type == Item.shoot &&
Main.projectile[i].owner == player.whoAmI)
if (p.type == Item.shoot &&
p.owner == player.whoAmI)
{
Main.projectile[i].Kill();
p.Kill();
}
}
if (CalamityPlayer.areThereAnyDamnBosses)
@@ -151,13 +150,12 @@ namespace CalamityMod.Items.Weapons.Summon
int robotIndex = -1;
for (int i = 0; i < Main.projectile.Length; i++)
foreach (Projectile p in Main.ActiveProjectiles)
{
if (Main.projectile[i].active &&
Main.projectile[i].type == ModContent.ProjectileType<GiantIbanRobotOfDoom>() &&
Main.projectile[i].owner == player.whoAmI)
if (p.type == ModContent.ProjectileType<GiantIbanRobotOfDoom>() &&
p.owner == player.whoAmI)
{
robotIndex = i;
robotIndex = p.whoAmI;
break;
}
}
+12 -12
View File
@@ -35,11 +35,11 @@ namespace CalamityMod.Items.Weapons.Summon
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
{
float totalMinionSlots = 0f;
for (int i = 0; i < Main.projectile.Length; i++)
foreach (Projectile pro in Main.ActiveProjectiles)
{
if (Main.projectile[i].active && Main.projectile[i].minion && Main.projectile[i].owner == player.whoAmI)
if (pro.minion && pro.owner == player.whoAmI)
{
totalMinionSlots += Main.projectile[i].minionSlots;
totalMinionSlots += pro.minionSlots;
}
}
if (player.altFunctionUse != 2 && totalMinionSlots < player.maxMinions)
@@ -50,29 +50,29 @@ namespace CalamityMod.Items.Weapons.Summon
if (Main.projectile.IndexInRange(p))
Main.projectile[p].originalDamage = Item.damage;
int pointyThingCount = 0;
for (int i = 0; i < Main.projectile.Length; i++)
foreach (Projectile pro in Main.ActiveProjectiles)
{
if (Main.projectile[i].active && Main.projectile[i].type == type && Main.projectile[i].owner == player.whoAmI)
if (pro.type == type && pro.owner == player.whoAmI)
{
if (!(Main.projectile[i].ModProjectile as GlacialEmbracePointyThing).circlingPlayer)
if (!(pro.ModProjectile as GlacialEmbracePointyThing).circlingPlayer)
continue;
pointyThingCount++;
}
}
float angleVariance = MathHelper.TwoPi / pointyThingCount;
float angle = 0f;
for (int i = 0; i < Main.projectile.Length; i++)
foreach (Projectile pro in Main.ActiveProjectiles)
{
if (Main.projectile[i].active && Main.projectile[i].type == type && Main.projectile[i].owner == player.whoAmI && Main.projectile[i].ai[1] == 0f)
if (pro.type == type && pro.owner == player.whoAmI && pro.ai[1] == 0f)
{
if (!(Main.projectile[i].ModProjectile as GlacialEmbracePointyThing).circlingPlayer)
if (!(pro.ModProjectile as GlacialEmbracePointyThing).circlingPlayer)
continue;
Main.projectile[i].ai[0] = angle;
Main.projectile[i].netUpdate = true;
pro.ai[0] = angle;
pro.netUpdate = true;
angle += angleVariance;
for (int j = 0; j < 22; j++)
{
Dust dust = Dust.NewDustDirect(Main.projectile[i].position, Main.projectile[i].width, Main.projectile[i].height, DustID.Ice);
Dust dust = Dust.NewDustDirect(pro.position, pro.width, pro.height, DustID.Ice);
dust.velocity = Vector2.UnitY * Main.rand.NextFloat(3f, 5.5f) * Main.rand.NextBool().ToDirectionInt();
dust.noGravity = true;
}
+12 -12
View File
@@ -37,11 +37,11 @@ namespace CalamityMod.Items.Weapons.Summon
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
{
float totalMinionSlots = 0f;
for (int i = 0; i < Main.maxProjectiles; i++)
foreach (Projectile pro in Main.ActiveProjectiles)
{
if (Main.projectile[i].active && Main.projectile[i].minion && Main.projectile[i].owner == player.whoAmI)
if (pro.minion && pro.owner == player.whoAmI)
{
totalMinionSlots += Main.projectile[i].minionSlots;
totalMinionSlots += pro.minionSlots;
}
}
if (player.altFunctionUse != 2 && totalMinionSlots < player.maxMinions)
@@ -51,16 +51,16 @@ namespace CalamityMod.Items.Weapons.Summon
if (Main.projectile.IndexInRange(p))
Main.projectile[p].originalDamage = Item.damage;
int swordCount = 0;
for (int i = 0; i < Main.maxProjectiles; i++)
foreach (Projectile pro in Main.ActiveProjectiles)
{
if (Main.projectile[i].active && Main.projectile[i].type == type && Main.projectile[i].owner == player.whoAmI)
if (pro.type == type && pro.owner == player.whoAmI)
{
if ((Main.projectile[i].ModProjectile as IgneousBlade).Firing)
if ((pro.ModProjectile as IgneousBlade).Firing)
continue;
swordCount++;
for (int j = 0; j < 22; j++)
{
Dust dust = Dust.NewDustDirect(Main.projectile[i].position, Main.projectile[i].width, Main.projectile[i].height, DustID.Torch);
Dust dust = Dust.NewDustDirect(pro.position, pro.width, pro.height, DustID.Torch);
dust.velocity = Vector2.UnitY * Main.rand.NextFloat(3f, 5.5f) * Main.rand.NextBool().ToDirectionInt();
dust.noGravity = true;
}
@@ -68,17 +68,17 @@ namespace CalamityMod.Items.Weapons.Summon
}
float angleVariance = MathHelper.TwoPi / swordCount;
float angle = 0f;
for (int i = 0; i < Main.maxProjectiles; i++)
foreach (Projectile pro in Main.ActiveProjectiles)
{
if (Main.projectile[i].active && Main.projectile[i].type == type && Main.projectile[i].owner == player.whoAmI && Main.projectile[i].localAI[1] == 0f)
if (pro.type == type && pro.owner == player.whoAmI && pro.localAI[1] == 0f)
{
if ((Main.projectile[i].ModProjectile as IgneousBlade).Firing)
if ((pro.ModProjectile as IgneousBlade).Firing)
continue;
Main.projectile[i].ai[0] = angle;
pro.ai[0] = angle;
angle += angleVariance;
for (int j = 0; j < 22; j++)
{
Dust dust = Dust.NewDustDirect(Main.projectile[i].position, Main.projectile[i].width, Main.projectile[i].height, DustID.Torch);
Dust dust = Dust.NewDustDirect(pro.position, pro.width, pro.height, DustID.Torch);
dust.velocity = Vector2.UnitY * Main.rand.NextFloat(3f, 5.5f) * Main.rand.NextBool().ToDirectionInt();
dust.noGravity = true;
}
+8 -9
View File
@@ -35,10 +35,9 @@ namespace CalamityMod.Items.Weapons.Summon
{
float neededSlots = 1;
float foundSlotsCount = 0;
for (int i = 0; i < Main.maxProjectiles; i++)
foreach (Projectile p in Main.ActiveProjectiles)
{
Projectile p = Main.projectile[i];
if (p.active && p.minion && p.owner == player.whoAmI)
if (p.minion && p.owner == player.whoAmI)
{
foundSlotsCount += p.minionSlots;
if (foundSlotsCount + neededSlots > player.maxMinions)
@@ -100,17 +99,17 @@ namespace CalamityMod.Items.Weapons.Summon
{
int head = -1;
int tail = -1;
for (int i = 0; i < Main.maxProjectiles; i++)
foreach (Projectile p in Main.ActiveProjectiles)
{
if (Main.projectile[i].active && Main.projectile[i].owner == Main.myPlayer)
if (p.owner == Main.myPlayer)
{
if (head == -1 && Main.projectile[i].type == ModContent.ProjectileType<MechwormHead>())
if (head == -1 && p.type == ModContent.ProjectileType<MechwormHead>())
{
head = i;
head = p.whoAmI;
}
if (tail == -1 && Main.projectile[i].type == ModContent.ProjectileType<MechwormTail>())
if (tail == -1 && p.type == ModContent.ProjectileType<MechwormTail>())
{
tail = i;
tail = p.whoAmI;
}
if (head != -1 && tail != -1)
{
+5 -5
View File
@@ -42,13 +42,13 @@ namespace CalamityMod.Items.Weapons.Summon
}
int bladeIndex = 0;
for (int i = 0; i < Main.maxProjectiles; i++)
foreach (Projectile pro in Main.ActiveProjectiles)
{
if (Main.projectile[i].type == type && Main.projectile[i].active && Main.projectile[i].owner == player.whoAmI)
if (pro.type == type && pro.owner == player.whoAmI)
{
Main.projectile[i].ModProjectile<AstralProbeSummon>().ProbeIndex = bladeIndex++;
Main.projectile[i].ModProjectile<AstralProbeSummon>().AITimer = 0f;
Main.projectile[i].netUpdate = true;
pro.ModProjectile<AstralProbeSummon>().ProbeIndex = bladeIndex++;
pro.ModProjectile<AstralProbeSummon>().AITimer = 0f;
pro.netUpdate = true;
}
}
}
+4 -4
View File
@@ -39,13 +39,13 @@ namespace CalamityMod.Items.Weapons.Summon
Main.projectile[p].originalDamage = Item.damage;
int minionCount = 0;
for (int i = 0; i < Main.maxProjectiles; i++)
foreach (Projectile pro in Main.ActiveProjectiles)
{
if (Main.projectile[i].type != type || !Main.projectile[i].active || Main.projectile[i].owner != player.whoAmI)
if (pro.type != type || pro.owner != player.whoAmI)
continue;
Main.projectile[i].localAI[0] = minionCount;
Main.projectile[i].netUpdate = true;
pro.localAI[0] = minionCount;
pro.netUpdate = true;
minionCount++;
}
}
+5 -5
View File
@@ -63,13 +63,13 @@ namespace CalamityMod.Items.Weapons.Summon
}
int bladeIndex = 0;
for (int i = 0; i < Main.maxProjectiles; i++)
foreach (Projectile pro in Main.ActiveProjectiles)
{
if (Main.projectile[i].type == type && Main.projectile[i].active && Main.projectile[i].owner == player.whoAmI)
if (pro.type == type && pro.owner == player.whoAmI)
{
Main.projectile[i].ModProjectile<ViridVanguardBlade>().BladeIndex = bladeIndex++;
Main.projectile[i].ModProjectile<ViridVanguardBlade>().AITimer = 0f;
Main.projectile[i].netUpdate = true;
pro.ModProjectile<ViridVanguardBlade>().BladeIndex = bladeIndex++;
pro.ModProjectile<ViridVanguardBlade>().AITimer = 0f;
pro.netUpdate = true;
}
}
}
+4 -4
View File
@@ -56,12 +56,12 @@ namespace CalamityMod.Items.Weapons.Typeless
};
if (player.ownedProjectileCounts[Item.shoot] > 0)
{
for (int i = 0; i < Main.projectile.Length; i++)
foreach (Projectile p in Main.ActiveProjectiles)
{
if (Main.projectile[i].type == Item.shoot)
if (p.type == Item.shoot)
{
Main.projectile[i].Center = Main.MouseWorld;
Main.projectile[i].netUpdate = true;
p.Center = Main.MouseWorld;
p.netUpdate = true;
}
}
}
@@ -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,64 +1,43 @@
// Drop conditions
Drops: {
Cynosure: Drops once you have defeated both Draedon and Calamitas
DownedKS: Drops after defeating King Slime
DownedDS: Drops after defeating the Desert Scourge
DownedEoC: Drops after defeating the Eye of Cthulhu
DownedCrab: Drops after defeating Crabulon
DownedEoW: Drops after defeating the Eater of Worlds
DownedBoC: Drops after defeating the Brain of Cthulhu
DownedHM: Drops after defeating the Hive Mind
DownedPerfs: Drops after defeating the Perforators
DownedQB: Drops after defeating the Queen Bee
DownedDeer: Drops after defeating Deerclops
DownedSkele: Drops after defeating Skeletron
DownedSG: Drops after defeating the Slime God
Hardmode: Drops in Hardmode
DownedQS: Drops after defeating Queen Slime
DownedCryo: Drops after defeating Cryogen
DownedAS: Drops after defeating the Aquatic Scourge
DownedBrim: Drops after defeating the Brimstone Elemental
DownedDest: Drops after defeating the Destroyer
DownedTwins: Drops after defeating the Twins
DownedSP: Drops after defeating Skeletron Prime
Downed1Mech: Drops after defeating a Mechanical Boss
Downed3Mechs: Drops after defeating all three Mechanical Bosses
DownedCal: Drops after defeating Calamitas Clone
DownedPlant: Drops after defeating Plantera
DownedCalPlant: Drops after defeating Calamitas or Plantera
DownedLevi: Drops after defeating the Leviathan and Anahita
DownedAureus: Drops after defeating Astrum Aureus
DownedGolem: Drops after defeating Golem
DownedPBG: Drops after defeating the Plaguebringer Goliath
DownedEoL: Drops after defeating the Empress of Light
DownedFish: Drops after defeating Duke Fishron
DownedRav: Drops after defeating the Ravager
DownedLC: Drops after defeating the Lunatic Cultist
DownedAD: Drops after defeating Astrum Deus
DownedML: Drops after defeating the Moon Lord
DownedGuard: Drops after defeating the Profaned Guardians
DownedBirb: Drops after defeating the Dragonfolly
DownedProv: Drops after defeating Providence
DownedSig: Drops after defeating Signus
DownedSW: Drops after defeating the Storm Weaver
DownedCV: Drops after defeating the Ceaseless Void
DownedPolter: Drops after defeating the Polterghast
DownedOD: Drops after defeating the Old Duke
DownedDoG: Drops after defeating the Devourer of Gods
DownedYharon: Drops after defeating Yharon
DownedExos: Drops after defeating the Exo Mechs
DownedSCal: Drops after defeating Calamitas
DownedAEW: Drops after defeating the Primordial Wyrm
DownedClam: Drops after defeating the Giant Clam
DownedClamHM: Drops after defeating the Giant Clam in Hardmode
DownedGSS: Drops after defeating the Great Sand Shark
DownedBetsy: Drops after defeating Betsy
DownedT1AR: Drops after defeating the first tier of Acid Rain
DownedT2AR: Drops after defeating the second tier of Acid Rain
Cynosure: After defeating both Draedon and Calamitas
DownedDS: After defeating the Desert Scourge
DownedCrab: After defeating Crabulon
DownedHM: After defeating the Hive Mind
DownedPerfs: After defeating the Perforators
DownedHMOrPerfs: After defeating the Hive Mind or the Perforators
DownedSG: After defeating the Slime God
DownedCryo: After defeating Cryogen
DownedAS: After defeating the Aquatic Scourge
DownedBrim: After defeating the Brimstone Elemental
DownedDest: After defeating the Destroyer
DownedCal: After defeating Calamitas Clone
DownedCalPlant: After defeating Calamitas or Plantera
DownedLevi: After defeating the Leviathan and Anahita
DownedAureus: After defeating Astrum Aureus
DownedPBG: After defeating the Plaguebringer Goliath
DownedRav: After defeating the Ravager
DownedAD: After defeating Astrum Deus
DownedGuard: After defeating the Profaned Guardians
DownedBirb: After defeating the Dragonfolly
DownedProv: After defeating Providence
DownedSig: After defeating Signus
DownedSW: After defeating the Storm Weaver
DownedCV: After defeating the Ceaseless Void
DownedPolter: After defeating the Polterghast
DownedOD: After defeating the Old Duke
DownedDoG: After defeating the Devourer of Gods
DownedYharon: After defeating Yharon
DownedExos: After defeating the Exo Mechs
DownedSCal: After defeating Calamitas
DownedAEW: After defeating the Primordial Wyrm
DownedClam: After defeating the Giant Clam
DownedClamHM: After defeating the Giant Clam in Hardmode
DownedGSS: After defeating the Great Sand Shark
DownedBetsy: After defeating Betsy
DownedT1AR: After defeating the first tier of Acid Rain
DownedT2AR: After defeating the second tier of Acid Rain
FirstKill: Drops only on the first kill
IsGFB: This is an Everything Seed drop rate
IsRev: This is a Revengeance Mode drop rate
IsDeath: This is a Death Mode drop rate
MechBoss: Drops on the first kill of the final Mechanical Boss
ProvidenceHallow:
'''
@@ -84,18 +63,16 @@ PotionConfig: While the Town NPC Potion Selling configuration option is enabled
HasFlareGun: While holding a Flare Gun upgrade
HasRogueArmor: While wearing rogue armor
HasWings: While wearing wings
InAstral: While in the Astral Infection
InCrag: While in the Brimstone Crags
InSulph: While in the Sulphurous Sea
InSunken: While in the Sunken Sea
InAstral: In the Astral Infection
InCrag: In the Brimstone Crags
InSulph: In the Sulphurous Sea
InSunken: In the Sunken Sea
InRev: In Revengeance Mode
IsRevOrMM: In Revengeance Mode or in Master Mode
AlcoholPoison: While inflicted with Alcohol Poisoning
DownedHM: After the Hive Mind has been defeated
DownedPerfs: After the Perforator Hive has been defeated
DownedEvil2Boss: After the Hive Mind or the Perforators have been defeated
PostCal: After Calamitas Clone has been defeated
PostAureus: After Astrum Aureus has been defeated
PostPolter: After Polterghast has been defeated
PostOD: After the Old Duke has been defeated
PostDoG: After the Devourer of Gods has been defeated
PostYharon: After Yharon has been defeated
PostCal: After defeating Calamitas Clone
PostAureus: After defeating Astrum Aureus
PostPolter: After defeating Polterghast
PostOD: After defeating the Old Duke
PostDoG: After defeating the Devourer of Gods
PostYharon: After defeating Yharon
@@ -1084,7 +1084,8 @@ SlickCane: {
Tooltip:
'''
Swipes a cane that steals money from enemies
Stealth strikes gives a 1 in 15 chance for enemies to drop 1-3 gold coins when hit
Stealth strikes gives a 1 in 20 chance for enemies to drop 1-3 gold coins when hit
Stealth strikes' damage increases in proportion to money in the inventory (up to 2 platinum)
'Economy at its finest'
'''
}
+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;
+6 -1
View File
@@ -162,8 +162,13 @@ namespace CalamityMod.NPCs.Abyss
NPC.height = (int)(NPC.height * 3f);
NPC.position -= NPC.Size * 0.5f; //hitbox expansion + adjustments
SoundEngine.PlaySound(SoundID.Item14, NPC.Center); //bomb sound
foreach (Player player in Main.player.Where(player => player.active && !player.dead && NPC.Hitbox.Intersects(player.Hitbox)))
foreach (Player player in Main.ActivePlayers)
{
if (player.dead || !NPC.Hitbox.Intersects(player.Hitbox))
continue;
player.Hurt(PlayerDeathReason.ByNPC(NPC.whoAmI), explosionDamage, NPC.direction);
}
for (int k = 0; k < 8; k++)
{
int dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.MoonBoulder, 0f, -1f, 0, default, 1f);
+8 -2
View File
@@ -272,8 +272,14 @@ namespace CalamityMod.NPCs.Abyss
NPC.width = NPC.height;
NPC.position -= NPC.Size * 0.5f; //hitbox expansion + adjustments
SoundEngine.PlaySound(SoundID.Item14, NPC.Center); //bomb sound
foreach (Player player in Main.player.Where(player => player.active && !player.dead && NPC.Hitbox.Intersects(player.Hitbox)))
player.Hurt(PlayerDeathReason.ByNPC(NPC.whoAmI), NPC.damage * 3, NPC.direction); //Due to how slow the jelly is, this might catch you unaware, but then you'll never get hit by it again
foreach (Player player in Main.ActivePlayers)
{
if (player.dead || !NPC.Hitbox.Intersects(player.Hitbox))
continue;
//Due to how slow the jelly is, this might catch you unaware, but then you'll never get hit by it again
player.Hurt(PlayerDeathReason.ByNPC(NPC.whoAmI), NPC.damage * 3, NPC.direction);
}
for (int k = 0; k < 25; k++)
{
int dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.MoonBoulder, 0f, -1f, 0, default, 2f);
+11 -14
View File
@@ -540,24 +540,21 @@ namespace CalamityMod.NPCs.Abyss
}
float pushVelocity = 0.05f;
for (int i = 0; i < Main.maxNPCs; i++)
foreach (NPC otherNPC in Main.ActiveNPCs)
{
if (Main.npc[i].active)
if (otherNPC.whoAmI != NPC.whoAmI && otherNPC.type == NPC.type)
{
if (i != NPC.whoAmI && Main.npc[i].type == NPC.type)
if (Vector2.Distance(NPC.Center, otherNPC.Center) < 160f)
{
if (Vector2.Distance(NPC.Center, Main.npc[i].Center) < 160f)
{
if (NPC.position.X < Main.npc[i].position.X)
NPC.velocity.X -= pushVelocity;
else
NPC.velocity.X += pushVelocity;
if (NPC.position.X < otherNPC.position.X)
NPC.velocity.X -= pushVelocity;
else
NPC.velocity.X += pushVelocity;
if (NPC.position.Y < Main.npc[i].position.Y)
NPC.velocity.Y -= pushVelocity;
else
NPC.velocity.Y += pushVelocity;
}
if (NPC.position.Y < otherNPC.position.Y)
NPC.velocity.Y -= pushVelocity;
else
NPC.velocity.Y += pushVelocity;
}
}
}
+2 -2
View File
@@ -62,9 +62,9 @@ namespace CalamityMod.NPCs.Abyss
// Check if other segments are still alive, if not, die
bool shouldDespawn = true;
for (int i = 0; i < Main.maxNPCs; i++)
foreach (NPC n in Main.ActiveNPCs)
{
if (Main.npc[i].active && Main.npc[i].type == ModContent.NPCType<EidolonWyrmHead>())
if (n.type == ModContent.NPCType<EidolonWyrmHead>())
{
shouldDespawn = false;
break;
Loaded 100 of 460 files, more files were not shown because too many files have changed in this diff. Show more