Replaced IL Editing for generating AR icon
This commit is contained in:
1 parent
a6fc7a45d9
commit
db1e047d1f
10 files changed
+97
-286
No files matched your search
@@ -3015,6 +3015,19 @@ namespace CalamityMod
|
||||
AstralArcanumUI.UpdateAndDraw(Main.spriteBatch);
|
||||
return true;
|
||||
}, InterfaceScaleType.None));
|
||||
|
||||
int invasionIndex = layers.FindIndex(layer => layer.Name == "Vanilla: Diagnose Net");
|
||||
if (invasionIndex != -1)
|
||||
{
|
||||
layers.Insert(invasionIndex, new LegacyGameInterfaceLayer("Acid Rain Invasion UI", () =>
|
||||
{
|
||||
if (CalamityWorld.rainingAcid)
|
||||
{
|
||||
AcidRainUI.Draw(Main.spriteBatch);
|
||||
}
|
||||
return true;
|
||||
}, InterfaceScaleType.None));
|
||||
}
|
||||
}
|
||||
|
||||
public static Color GetNPCColor(NPC npc, Vector2? position = null, bool effects = true, float shadowOverride = 0f)
|
||||
|
||||
@@ -127,7 +127,6 @@ namespace CalamityMod.Events
|
||||
rectangleCheckSize, rectangleCheckSize);
|
||||
if (screen.Intersects(invasionCheckArea))
|
||||
{
|
||||
Main.invasionProgressDisplayLeft = 480;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -152,23 +151,13 @@ namespace CalamityMod.Events
|
||||
}
|
||||
if (playerCount > 0)
|
||||
{
|
||||
// So that vanilla doesn't shit itself
|
||||
Main.invasionType = -1;
|
||||
|
||||
CalamityWorld.rainingAcid = true;
|
||||
// The E - 1 part is to ensure that we start at 1 as a multiple instead of 0
|
||||
// At a maximum of 255 players, the max multiplier is 9.98, or 998 enemies that need to be killed.
|
||||
CalamityWorld.acidRainPoints = (int)(180 * Math.Log(playerCount + Math.E - 1));
|
||||
Main.invasionProgress = 0;
|
||||
Main.invasionProgressIcon = -1;
|
||||
Main.invasionProgressWave = 0;
|
||||
|
||||
// Make it rain normally
|
||||
Main.raining = true;
|
||||
|
||||
// If abyssSide is true, then the abyss was generated on the left side of the world.
|
||||
// If false, the right.
|
||||
Main.invasionX = CalamityWorld.abyssSide ? 0 : Main.maxTilesX;
|
||||
CalamityWorld.triedToSummonOldDuke = false;
|
||||
}
|
||||
UpdateInvasion();
|
||||
@@ -187,9 +176,6 @@ namespace CalamityMod.Events
|
||||
{
|
||||
CalamityWorld.rainingAcid = false;
|
||||
BroadcastEventText("Mods.CalamityMod.AcidRainEnd"); // The sulphuric skies begin to clear...
|
||||
Main.invasionType = 0;
|
||||
Main.invasionDelay = 0;
|
||||
Main.invasionProgressNearInvasion = false;
|
||||
CalamityWorld.acidRainExtraDrawTime = 40;
|
||||
|
||||
// Turn off the rain from the event
|
||||
|
||||
@@ -19,232 +19,6 @@ namespace CalamityMod.ILEditing
|
||||
/// </summary>
|
||||
public static void Initialize()
|
||||
{
|
||||
IL.Terraria.Main.DrawInvasionProgress += (il) =>
|
||||
{
|
||||
var cursor = new ILCursor(il)
|
||||
{
|
||||
Index = 1
|
||||
};
|
||||
cursor.EmitDelegate<Action>(() =>
|
||||
{
|
||||
if (Main.invasionProgressMode == 2 && (Main.invasionProgressNearInvasion || AcidRainEvent.NearInvasionCheck(7500)) && Main.invasionProgressDisplayLeft < 160)
|
||||
{
|
||||
Main.invasionProgressDisplayLeft = 160;
|
||||
}
|
||||
if (!Main.gamePaused && Main.invasionProgressDisplayLeft > 0)
|
||||
{
|
||||
Main.invasionProgressDisplayLeft--;
|
||||
}
|
||||
if (Main.invasionProgressDisplayLeft > 0)
|
||||
{
|
||||
Main.invasionProgressAlpha += 0.05f;
|
||||
}
|
||||
else
|
||||
{
|
||||
Main.invasionProgressAlpha -= 0.05f;
|
||||
}
|
||||
if (Main.invasionProgressAlpha < 0f)
|
||||
{
|
||||
Main.invasionProgressAlpha = 0f;
|
||||
}
|
||||
if (Main.invasionProgressAlpha > 1f)
|
||||
{
|
||||
Main.invasionProgressAlpha = 1f;
|
||||
}
|
||||
if (CalamityWorld.rainingAcid)
|
||||
{
|
||||
Main.invasionProgressAlpha = 1f;
|
||||
}
|
||||
if (Main.invasionProgressAlpha <= 0f)
|
||||
{
|
||||
return;
|
||||
}
|
||||
bool draw = CalamityWorld.rainingAcid || CalamityWorld.acidRainExtraDrawTime > 0;
|
||||
if ((draw && !Main.LocalPlayer.Calamity().ZoneSulphur) ||
|
||||
(!draw && Main.LocalPlayer.Calamity().ZoneSulphur))
|
||||
return;
|
||||
|
||||
float progressAlpha = 0.5f + Main.invasionProgressAlpha * 0.5f;
|
||||
if (CalamityWorld.acidRainExtraDrawTime > 0)
|
||||
{
|
||||
progressAlpha = 0.5f + CalamityWorld.acidRainExtraDrawTime / 40f * 0.5f;
|
||||
CalamityWorld.acidRainExtraDrawTime--;
|
||||
}
|
||||
Vector2 screenCoords = new Vector2(Main.screenWidth - 120, Main.screenHeight - 40);
|
||||
int sizeX = (int)(200f * progressAlpha);
|
||||
int sizeY = (int)(45f * progressAlpha);
|
||||
Rectangle screenCoordsRectangle =
|
||||
new Rectangle((int)screenCoords.X - sizeX / 2,
|
||||
(int)screenCoords.Y - sizeY / 2, sizeX, sizeY);
|
||||
Texture2D barTexture = Main.colorBarTexture;
|
||||
|
||||
// If you touch the netcode behind this without a good reason your life will come to an abrupt end -Dominic
|
||||
if (CalamityWorld.rainingAcid || CalamityWorld.acidRainExtraDrawTime > 0)
|
||||
{
|
||||
Utils.DrawInvBG(Main.spriteBatch, screenCoordsRectangle, new Color(63, 65, 151, 255) * 0.785f);
|
||||
|
||||
float progressRatio = 1f - CalamityWorld.AcidRainCompletionRatio;
|
||||
string progressText = $"{((int)(100 * progressRatio)).ToString()}%";
|
||||
progressText = Language.GetTextValue("Game.WaveCleared", progressText);
|
||||
Main.spriteBatch.Draw(barTexture, screenCoords, null, Color.White * Main.invasionProgressAlpha, 0f, new Vector2(barTexture.Width / 2, 0f), progressAlpha, SpriteEffects.None, 0f);
|
||||
Vector2 textMeasurement = Main.fontMouseText.MeasureString(progressText);
|
||||
float adjustedAlpha = progressAlpha;
|
||||
if (textMeasurement.Y > 22f)
|
||||
{
|
||||
adjustedAlpha *= 22f / textMeasurement.Y;
|
||||
}
|
||||
float barDrawOffsetX = 169f * progressAlpha;
|
||||
float scaleY = 8f * progressAlpha;
|
||||
Vector2 barDrawPosition = screenCoords + Vector2.UnitY * scaleY + Vector2.UnitX * 1f;
|
||||
Utils.DrawBorderString(Main.spriteBatch, progressText, barDrawPosition + new Vector2(0f, -4f), Color.White * Main.invasionProgressAlpha, adjustedAlpha, 0.5f, 1f, -1);
|
||||
barDrawPosition += Vector2.UnitX * (progressRatio - 0.5f) * barDrawOffsetX;
|
||||
Main.spriteBatch.Draw(Main.magicPixel, barDrawPosition, new Rectangle?(new Rectangle(0, 0, 1, 1)), new Color(255, 241, 51) * Main.invasionProgressAlpha, 0f, new Vector2(1f, 0.5f), new Vector2(barDrawOffsetX * progressRatio, scaleY), SpriteEffects.None, 0f);
|
||||
Main.spriteBatch.Draw(Main.magicPixel, barDrawPosition, new Rectangle?(new Rectangle(0, 0, 1, 1)), new Color(255, 165, 0, 127) * Main.invasionProgressAlpha, 0f, new Vector2(1f, 0.5f), new Vector2(2f, scaleY), SpriteEffects.None, 0f);
|
||||
Main.spriteBatch.Draw(Main.magicPixel, barDrawPosition, new Rectangle?(new Rectangle(0, 0, 1, 1)), Color.Black * Main.invasionProgressAlpha, 0f, new Vector2(0f, 0.5f), new Vector2(barDrawOffsetX * (1f - progressRatio), scaleY), SpriteEffects.None, 0f);
|
||||
|
||||
string invasionNameText = "Acid Rain";
|
||||
Vector2 textMeasurement2 = Main.fontMouseText.MeasureString(invasionNameText);
|
||||
float x = 120f;
|
||||
if (textMeasurement2.X > 200f)
|
||||
{
|
||||
x += textMeasurement2.X - 200f;
|
||||
}
|
||||
Texture2D iconTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/AcidRainIcon");
|
||||
Rectangle iconRectangle = Utils.CenteredRectangle(new Vector2(Main.screenWidth - x, Main.screenHeight - 80), (textMeasurement2 + new Vector2(iconTexture.Width + 12, 6f)) * progressAlpha);
|
||||
Utils.DrawInvBG(Main.spriteBatch, iconRectangle, AcidRainEvent.TextColor * 0.5f);
|
||||
Main.spriteBatch.Draw(iconTexture, iconRectangle.Left() + Vector2.UnitX * progressAlpha * 8f, null, Color.White * Main.invasionProgressAlpha, 0f, new Vector2(0f, iconTexture.Height / 2), progressAlpha * 0.8f, SpriteEffects.None, 0f);
|
||||
Utils.DrawBorderString(Main.spriteBatch, invasionNameText, iconRectangle.Right() + Vector2.UnitX * progressAlpha * -22f, Color.White * Main.invasionProgressAlpha, progressAlpha * 0.9f, 1f, 0.4f, -1);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Main.invasionProgress == -1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Texture2D iconTexture = Main.extraTexture[9];
|
||||
string invasionNameText = "";
|
||||
Color drawColor = Color.White;
|
||||
if (Main.invasionProgressIcon == 1)
|
||||
{
|
||||
iconTexture = Main.extraTexture[8];
|
||||
invasionNameText = Language.GetTextValue("LegacyInterface.83");
|
||||
drawColor = new Color(64, 109, 164) * 0.5f;
|
||||
}
|
||||
else if (Main.invasionProgressIcon == 2)
|
||||
{
|
||||
iconTexture = Main.extraTexture[12];
|
||||
invasionNameText = Language.GetTextValue("LegacyInterface.84");
|
||||
drawColor = new Color(112, 86, 114) * 0.5f;
|
||||
}
|
||||
else if (Main.invasionProgressIcon == 3)
|
||||
{
|
||||
iconTexture = Main.extraTexture[79];
|
||||
invasionNameText = Language.GetTextValue("DungeonDefenders2.InvasionProgressTitle");
|
||||
drawColor = new Color(88, 0, 160) * 0.5f;
|
||||
}
|
||||
else if (Main.invasionProgressIcon == 7)
|
||||
{
|
||||
iconTexture = Main.extraTexture[10];
|
||||
invasionNameText = Language.GetTextValue("LegacyInterface.85");
|
||||
drawColor = new Color(165, 160, 155) * 0.5f;
|
||||
}
|
||||
else if (Main.invasionProgressIcon == 6)
|
||||
{
|
||||
iconTexture = Main.extraTexture[11];
|
||||
invasionNameText = Language.GetTextValue("LegacyInterface.86");
|
||||
drawColor = new Color(148, 122, 72) * 0.5f;
|
||||
}
|
||||
else if (Main.invasionProgressIcon == 5)
|
||||
{
|
||||
iconTexture = Main.extraTexture[7];
|
||||
invasionNameText = Language.GetTextValue("LegacyInterface.87");
|
||||
drawColor = new Color(173, 135, 140) * 0.5f;
|
||||
}
|
||||
else if (Main.invasionProgressIcon == 4)
|
||||
{
|
||||
iconTexture = Main.extraTexture[9];
|
||||
invasionNameText = Language.GetTextValue("LegacyInterface.88");
|
||||
drawColor = new Color(94, 72, 131) * 0.5f;
|
||||
}
|
||||
else return;
|
||||
if (Main.invasionProgressWave > 0)
|
||||
{
|
||||
Utils.DrawInvBG(Main.spriteBatch, screenCoordsRectangle, new Color(63, 65, 151, 255) * 0.785f);
|
||||
string pointsText;
|
||||
if (Main.invasionProgressMax == 0)
|
||||
{
|
||||
pointsText = Language.GetTextValue("Game.InvasionPoints", Main.invasionProgress);
|
||||
}
|
||||
else
|
||||
{
|
||||
pointsText = ((int)((float)Main.invasionProgress * 100f / (float)Main.invasionProgressMax)).ToString() + "%";
|
||||
}
|
||||
pointsText = Language.GetTextValue("Game.WaveMessage", Main.invasionProgressWave, pointsText);
|
||||
float progressRatio = MathHelper.Clamp(Main.invasionProgress / (float)Main.invasionProgressMax, 0f, 1f);
|
||||
if (Main.invasionProgressMax == 0)
|
||||
{
|
||||
progressRatio = 1f;
|
||||
}
|
||||
float barDrawOffsetX = 169f * progressAlpha;
|
||||
float scaleY = 8f * progressAlpha;
|
||||
Vector2 barDrawPosition = screenCoords + Vector2.UnitY * scaleY + Vector2.UnitX * 1f;
|
||||
Utils.DrawBorderString(Main.spriteBatch, pointsText, barDrawPosition, Color.White * Main.invasionProgressAlpha, progressAlpha, 0.5f, 1f, -1);
|
||||
Main.spriteBatch.Draw(barTexture, screenCoords, null, Color.White * Main.invasionProgressAlpha, 0f, new Vector2(barTexture.Width / 2, 0f), progressAlpha, SpriteEffects.None, 0f);
|
||||
barDrawPosition += Vector2.UnitX * (progressRatio - 0.5f) * barDrawOffsetX;
|
||||
Main.spriteBatch.Draw(Main.magicPixel, barDrawPosition, new Rectangle?(new Rectangle(0, 0, 1, 1)), new Color(255, 241, 51) * Main.invasionProgressAlpha, 0f, new Vector2(1f, 0.5f), new Vector2(barDrawOffsetX * progressRatio, scaleY), SpriteEffects.None, 0f);
|
||||
Main.spriteBatch.Draw(Main.magicPixel, barDrawPosition, new Rectangle?(new Rectangle(0, 0, 1, 1)), new Color(255, 165, 0, 127) * Main.invasionProgressAlpha, 0f, new Vector2(1f, 0.5f), new Vector2(2f, scaleY), SpriteEffects.None, 0f);
|
||||
Main.spriteBatch.Draw(Main.magicPixel, barDrawPosition, new Rectangle?(new Rectangle(0, 0, 1, 1)), Color.Black * Main.invasionProgressAlpha, 0f, new Vector2(0f, 0.5f), new Vector2(barDrawOffsetX * (1f - progressRatio), scaleY), SpriteEffects.None, 0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
Vector2 vectorIconRectangle = new Vector2(Main.screenWidth - 120, Main.screenHeight - 40);
|
||||
Utils.DrawInvBG(Main.spriteBatch, screenCoordsRectangle, new Color(63, 65, 151, 255) * 0.785f);
|
||||
string progressText;
|
||||
if (Main.invasionProgressMax == 0)
|
||||
{
|
||||
progressText = Main.invasionProgress.ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
progressText = ((int)(Main.invasionProgress * 100f / Main.invasionProgressMax)).ToString() + "%";
|
||||
}
|
||||
progressText = Language.GetTextValue("Game.WaveCleared", progressText);
|
||||
if (Main.invasionProgressMax != 0)
|
||||
{
|
||||
Main.spriteBatch.Draw(barTexture, vectorIconRectangle, null, Color.White * Main.invasionProgressAlpha, 0f, new Vector2((float)(barTexture.Width / 2), 0f), progressAlpha, SpriteEffects.None, 0f);
|
||||
float progressRatio = MathHelper.Clamp(Main.invasionProgress / (float)Main.invasionProgressMax, 0f, 1f);
|
||||
Vector2 textMeasurement = Main.fontMouseText.MeasureString(progressText);
|
||||
float adjustedAlpha = progressAlpha;
|
||||
if (textMeasurement.Y > 22f)
|
||||
{
|
||||
adjustedAlpha *= 22f / textMeasurement.Y;
|
||||
}
|
||||
float barDrawOffsetX = 169f * progressAlpha;
|
||||
float scaleY = 8f * progressAlpha;
|
||||
Vector2 barDrawPosition = vectorIconRectangle + Vector2.UnitY * scaleY + Vector2.UnitX * 1f;
|
||||
Utils.DrawBorderString(Main.spriteBatch, progressText, barDrawPosition + new Vector2(0f, -4f), Color.White * Main.invasionProgressAlpha, adjustedAlpha, 0.5f, 1f, -1);
|
||||
barDrawPosition += Vector2.UnitX * (progressRatio - 0.5f) * barDrawOffsetX;
|
||||
Main.spriteBatch.Draw(Main.magicPixel, barDrawPosition, new Rectangle?(new Rectangle(0, 0, 1, 1)), new Color(255, 241, 51) * Main.invasionProgressAlpha, 0f, new Vector2(1f, 0.5f), new Vector2(barDrawOffsetX * progressRatio, scaleY), SpriteEffects.None, 0f);
|
||||
Main.spriteBatch.Draw(Main.magicPixel, barDrawPosition, new Rectangle?(new Rectangle(0, 0, 1, 1)), new Color(255, 165, 0, 127) * Main.invasionProgressAlpha, 0f, new Vector2(1f, 0.5f), new Vector2(2f, scaleY), SpriteEffects.None, 0f);
|
||||
Main.spriteBatch.Draw(Main.magicPixel, barDrawPosition, new Rectangle?(new Rectangle(0, 0, 1, 1)), Color.Black * Main.invasionProgressAlpha, 0f, new Vector2(0f, 0.5f), new Vector2(barDrawOffsetX * (1f - progressRatio), scaleY), SpriteEffects.None, 0f);
|
||||
}
|
||||
}
|
||||
Vector2 textMeasurement2 = Main.fontMouseText.MeasureString(invasionNameText);
|
||||
float x = 120f;
|
||||
if (textMeasurement2.X > 200f)
|
||||
{
|
||||
x += textMeasurement2.X - 200f;
|
||||
}
|
||||
Rectangle iconRectangle = Utils.CenteredRectangle(new Vector2(Main.screenWidth - x, Main.screenHeight - 80), (textMeasurement2 + new Vector2(iconTexture.Width + 12, 6f)) * progressAlpha);
|
||||
Utils.DrawInvBG(Main.spriteBatch, iconRectangle, drawColor);
|
||||
Main.spriteBatch.Draw(iconTexture, iconRectangle.Left() + Vector2.UnitX * progressAlpha * 8f, null, Color.White * Main.invasionProgressAlpha, 0f, new Vector2(0f, iconTexture.Height / 2), progressAlpha * 0.8f, SpriteEffects.None, 0f);
|
||||
Utils.DrawBorderString(Main.spriteBatch, invasionNameText, iconRectangle.Right() + Vector2.UnitX * progressAlpha * -22f, Color.White * Main.invasionProgressAlpha, progressAlpha * 0.9f, 1f, 0.4f, -1);
|
||||
}
|
||||
});
|
||||
cursor.Emit(Pop);
|
||||
cursor.Emit(Ret);
|
||||
};
|
||||
|
||||
IL.Terraria.WorldGen.MakeDungeon += (il) =>
|
||||
{
|
||||
var cursor = new ILCursor(il)
|
||||
|
||||
@@ -22,8 +22,8 @@ namespace CalamityMod.NPCs.AcidRain
|
||||
npc.width = 72;
|
||||
npc.height = 18;
|
||||
|
||||
npc.damage = 40;
|
||||
npc.lifeMax = 260;
|
||||
npc.damage = 30;
|
||||
npc.lifeMax = 140;
|
||||
npc.defense = 4;
|
||||
|
||||
if (CalamityWorld.downedPolterghast)
|
||||
|
||||
@@ -28,13 +28,13 @@ namespace CalamityMod.NPCs.AcidRain
|
||||
npc.aiStyle = aiType = -1;
|
||||
|
||||
npc.damage = 66;
|
||||
npc.lifeMax = 11000;
|
||||
npc.lifeMax = 6000;
|
||||
npc.defense = 25;
|
||||
|
||||
if (CalamityWorld.downedPolterghast)
|
||||
{
|
||||
npc.damage = 160;
|
||||
npc.lifeMax = 216600;
|
||||
npc.lifeMax = 146600;
|
||||
npc.defense = 80;
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ namespace CalamityMod.NPCs.AcidRain
|
||||
|
||||
npc.ai[0]++;
|
||||
|
||||
// Summons a spinning diamond of dust and a dust telegraph
|
||||
// Summons a spinning spiral of dust and a dust telegraph
|
||||
if (npc.ai[0] % 420f > 240f && npc.ai[0] % 420f < 300f)
|
||||
{
|
||||
float vectorRotationAngle = (npc.ai[0] % 420f - 240f) / 60f * MathHelper.Pi * 4f;
|
||||
@@ -121,7 +121,7 @@ namespace CalamityMod.NPCs.AcidRain
|
||||
for (float k = 0f; k < 20f; ++k)
|
||||
{
|
||||
Vector2 randomCirclePointLerped = Vector2.Lerp(circlePointVector, randomCirclePointRotated, k / 20f);
|
||||
float lerpMultiplier = MathHelper.Lerp(lerpStart, lerpEnd, k / 20f) * 1.4f;
|
||||
float lerpMultiplier = MathHelper.Lerp(lerpStart, lerpEnd, k / 20f) * 0.9f;
|
||||
int dustIndex = Dust.NewDust(npc.Top + 6f * Vector2.UnitY, 0, 0,
|
||||
(int)CalamityDusts.SulfurousSeaAcid,
|
||||
0f, 0f, 100, default, 1.3f);
|
||||
@@ -135,41 +135,6 @@ namespace CalamityMod.NPCs.AcidRain
|
||||
}
|
||||
}
|
||||
}
|
||||
// Near copy-pasta of the Gamma slime's hyper-complex dust code
|
||||
if (npc.ai[0] % 420f > 300f)
|
||||
{
|
||||
float angle = npc.ai[0] / 20f;
|
||||
float x = (float)Math.Sin(angle * npc.ai[1]) * (float)Math.Cos(angle);
|
||||
float y = (float)Math.Cos(angle * npc.ai[2]) * (float)Math.Sin(angle);
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
Vector2 velocity = new Vector2(x * 7f, y * 4f).RotatedBy(MathHelper.TwoPi / 3f * i);
|
||||
Dust dust = Dust.NewDustPerfect(npc.Top + 6f * Vector2.UnitY + angle.ToRotationVector2() * 8f, (int)CalamityDusts.SulfurousSeaAcid);
|
||||
dust.velocity = velocity;
|
||||
dust.scale = (float)Math.Cos(angle) + 2.5f;
|
||||
dust.noGravity = true;
|
||||
|
||||
dust = Dust.NewDustPerfect(npc.Top + 6f * Vector2.UnitY + angle.ToRotationVector2() * 8f, (int)CalamityDusts.SulfurousSeaAcid);
|
||||
dust.velocity = -velocity;
|
||||
dust.scale = (float)Math.Cos(angle) + 2.5f;
|
||||
dust.noGravity = true;
|
||||
}
|
||||
if (npc.ai[0] % 420f < 360f)
|
||||
{
|
||||
float length = 1100f - 1100f * (npc.ai[0] % 420f - 300f) / 60f;
|
||||
float outwardness = 1f - (npc.ai[0] % 420f - 300f) / 60f;
|
||||
for (float i = npc.Top.Y + 4f; i >= npc.Top.Y + 4f - length; i -= 6f)
|
||||
{
|
||||
angle = i / 32f;
|
||||
float vectorRotationAngle = -(i / 20f) % 0.4f - 0.2f;
|
||||
Vector2 spawnPosition = new Vector2(npc.Center.X, i);
|
||||
Dust dust = Dust.NewDustPerfect(spawnPosition, (int)CalamityDusts.SulfurousSeaAcid);
|
||||
dust.scale = 1.5f;
|
||||
dust.velocity = (Vector2.UnitX * (float)Math.Cos(angle) * 4f * outwardness).RotatedBy(vectorRotationAngle);
|
||||
dust.noGravity = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!Phase2)
|
||||
{
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace CalamityMod.NPCs.AcidRain
|
||||
npc.aiStyle = aiType = -1;
|
||||
|
||||
npc.damage = 20;
|
||||
npc.lifeMax = 250;
|
||||
npc.lifeMax = 150;
|
||||
npc.defense = 3;
|
||||
|
||||
if (CalamityWorld.downedPolterghast)
|
||||
|
||||
@@ -27,8 +27,8 @@ namespace CalamityMod.NPCs.AcidRain
|
||||
npc.height = 22;
|
||||
npc.aiStyle = aiType = -1;
|
||||
|
||||
npc.damage = 40;
|
||||
npc.lifeMax = 360;
|
||||
npc.damage = 28;
|
||||
npc.lifeMax = 210;
|
||||
npc.defense = 6;
|
||||
|
||||
if (CalamityWorld.downedPolterghast)
|
||||
|
||||
@@ -22,8 +22,8 @@ namespace CalamityMod.NPCs.AcidRain
|
||||
npc.width = 26;
|
||||
npc.height = 14;
|
||||
|
||||
npc.damage = 56;
|
||||
npc.lifeMax = 130;
|
||||
npc.damage = 44;
|
||||
npc.lifeMax = 90;
|
||||
npc.defense = 0;
|
||||
|
||||
if (CalamityWorld.downedPolterghast)
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
using CalamityMod.Events;
|
||||
using CalamityMod.World;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.Localization;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.UI
|
||||
{
|
||||
public static class AcidRainUI
|
||||
{
|
||||
public static void Draw(SpriteBatch spriteBatch)
|
||||
{
|
||||
bool draw = CalamityWorld.rainingAcid || CalamityWorld.acidRainExtraDrawTime > 0;
|
||||
if ((draw && !Main.LocalPlayer.Calamity().ZoneSulphur) ||
|
||||
(!draw && Main.LocalPlayer.Calamity().ZoneSulphur))
|
||||
return;
|
||||
|
||||
float progressAlpha = 1f;
|
||||
Vector2 screenCoords = new Vector2(Main.screenWidth - 120, Main.screenHeight - 40);
|
||||
int sizeX = (int)(200f * progressAlpha);
|
||||
int sizeY = (int)(45f * progressAlpha);
|
||||
Rectangle screenCoordsRectangle =
|
||||
new Rectangle((int)screenCoords.X - sizeX / 2,
|
||||
(int)screenCoords.Y - sizeY / 2, sizeX, sizeY);
|
||||
Texture2D barTexture = Main.colorBarTexture;
|
||||
|
||||
// If you touch the netcode behind this without a good reason your life will come to an abrupt end -Dominic
|
||||
if (CalamityWorld.rainingAcid || CalamityWorld.acidRainExtraDrawTime > 0)
|
||||
{
|
||||
Utils.DrawInvBG(spriteBatch, screenCoordsRectangle, new Color(63, 65, 151, 255) * 0.785f);
|
||||
|
||||
float progressRatio = 1f - CalamityWorld.AcidRainCompletionRatio;
|
||||
string progressText = $"{((int)(100 * progressRatio)).ToString()}%";
|
||||
progressText = Language.GetTextValue("Game.WaveCleared", progressText);
|
||||
spriteBatch.Draw(barTexture, screenCoords, null, Color.White, 0f, new Vector2(barTexture.Width / 2, 0f), progressAlpha, SpriteEffects.None, 0f);
|
||||
Vector2 textMeasurement = Main.fontMouseText.MeasureString(progressText);
|
||||
float adjustedAlpha = progressAlpha;
|
||||
if (textMeasurement.Y > 22f)
|
||||
{
|
||||
adjustedAlpha *= 22f / textMeasurement.Y;
|
||||
}
|
||||
float barDrawOffsetX = 169f * progressAlpha;
|
||||
float scaleY = 8f * progressAlpha;
|
||||
Vector2 barDrawPosition = screenCoords + Vector2.UnitY * scaleY + Vector2.UnitX * 1f;
|
||||
Utils.DrawBorderString(spriteBatch, progressText, barDrawPosition + new Vector2(0f, -4f), Color.White, adjustedAlpha, 0.5f, 1f, -1);
|
||||
barDrawPosition += Vector2.UnitX * (progressRatio - 0.5f) * barDrawOffsetX;
|
||||
spriteBatch.Draw(Main.magicPixel, barDrawPosition, new Rectangle?(new Rectangle(0, 0, 1, 1)), new Color(255, 241, 51), 0f, new Vector2(1f, 0.5f), new Vector2(barDrawOffsetX * progressRatio, scaleY), SpriteEffects.None, 0f);
|
||||
spriteBatch.Draw(Main.magicPixel, barDrawPosition, new Rectangle?(new Rectangle(0, 0, 1, 1)), new Color(255, 165, 0, 127), 0f, new Vector2(1f, 0.5f), new Vector2(2f, scaleY), SpriteEffects.None, 0f);
|
||||
spriteBatch.Draw(Main.magicPixel, barDrawPosition, new Rectangle?(new Rectangle(0, 0, 1, 1)), Color.Black, 0f, new Vector2(0f, 0.5f), new Vector2(barDrawOffsetX * (1f - progressRatio), scaleY), SpriteEffects.None, 0f);
|
||||
|
||||
string invasionNameText = "Acid Rain";
|
||||
Vector2 textMeasurement2 = Main.fontMouseText.MeasureString(invasionNameText);
|
||||
float x = 120f;
|
||||
if (textMeasurement2.X > 200f)
|
||||
{
|
||||
x += textMeasurement2.X - 200f;
|
||||
}
|
||||
Texture2D iconTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/AcidRainIcon");
|
||||
Rectangle iconRectangle = Utils.CenteredRectangle(new Vector2(Main.screenWidth - x, Main.screenHeight - 80), (textMeasurement2 + new Vector2(iconTexture.Width + 12, 6f)) * progressAlpha);
|
||||
Utils.DrawInvBG(spriteBatch, iconRectangle, AcidRainEvent.TextColor * 0.5f);
|
||||
spriteBatch.Draw(iconTexture, iconRectangle.Left() + Vector2.UnitX * progressAlpha * 8f, null, Color.White, 0f, new Vector2(0f, iconTexture.Height / 2), progressAlpha * 0.8f, SpriteEffects.None, 0f);
|
||||
Utils.DrawBorderString(spriteBatch, invasionNameText, iconRectangle.Right() + Vector2.UnitX * progressAlpha * -22f, Color.White, progressAlpha * 0.9f, 1f, 0.4f, -1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -973,6 +973,11 @@ namespace CalamityMod.World
|
||||
}
|
||||
}
|
||||
}
|
||||
if (Main.invasionProgress != -1)
|
||||
{
|
||||
Main.invasionType = 0;
|
||||
Main.invasionProgress = -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user