Merge branch 'master' of https://github.com/UncleDanny/CalamityMod
This commit is contained in:
commit
48ce9893cd
16 files changed
+105
-55
No files matched your search
+7
-2
@@ -3651,11 +3651,15 @@ namespace CalamityMod
|
||||
case CalamityModMessageType.AcidRainUIDrawFadeSync:
|
||||
CalamityWorld.acidRainExtraDrawTime = reader.ReadInt32();
|
||||
break;
|
||||
case CalamityModMessageType.AcidRainOldDukeSummonSync:
|
||||
CalamityWorld.triedToSummonOldDuke = reader.ReadBoolean();
|
||||
break;
|
||||
default:
|
||||
Logger.Error($"Failed to parse Calamity packet: No Calamity packet exists with ID {msgType}.");
|
||||
break;
|
||||
}
|
||||
} catch(Exception e)
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
if (e is EndOfStreamException eose)
|
||||
Logger.Error("Failed to parse Calamity packet: Packet was too short, missing data, or otherwise corrupt.", eose);
|
||||
@@ -3729,6 +3733,7 @@ namespace CalamityMod
|
||||
DeathModeBlizzardTimeSync,
|
||||
DeathBossSpawnCountdownSync,
|
||||
AcidRainSync,
|
||||
AcidRainUIDrawFadeSync
|
||||
AcidRainUIDrawFadeSync,
|
||||
AcidRainOldDukeSummonSync
|
||||
}
|
||||
}
|
||||
+14
-1
@@ -112,7 +112,7 @@ namespace CalamityMod.Events
|
||||
/// </summary>
|
||||
public static void TryStartEvent()
|
||||
{
|
||||
if (CalamityWorld.rainingAcid || (!NPC.downedBoss1 && !Main.hardMode))
|
||||
if (CalamityWorld.rainingAcid || (!NPC.downedBoss1 && !Main.hardMode) || CalamityWorld.bossRushActive)
|
||||
return;
|
||||
int playerCount = 0;
|
||||
for (int i = 0; i < Main.player.Length; i++)
|
||||
@@ -141,6 +141,7 @@ namespace CalamityMod.Events
|
||||
// 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();
|
||||
BroadcastEventText("Mods.CalamityMod.AcidRainStart"); // A toxic downpour falls over the wasteland seas!
|
||||
@@ -174,10 +175,15 @@ namespace CalamityMod.Events
|
||||
CalamityWorld.downedEoCAcidRain = true;
|
||||
CalamityWorld.downedAquaticScourgeAcidRain = CalamityWorld.downedAquaticScourge;
|
||||
}
|
||||
CalamityWorld.triedToSummonOldDuke = false;
|
||||
CalamityMod.StopRain();
|
||||
}
|
||||
CalamityMod.UpdateServerBoolean();
|
||||
|
||||
// You will be tempted to turn this into a single if conditional.
|
||||
// Don't do this. Doing so has caused so much misery, with various things being read instead
|
||||
// of the correct thing, look booleans being mixed up in the sending and receiving process.
|
||||
// In short, leave this alone.
|
||||
if (Main.netMode == NetmodeID.Server)
|
||||
{
|
||||
var netMessage = CalamityMod.instance.GetPacket();
|
||||
@@ -193,6 +199,13 @@ namespace CalamityMod.Events
|
||||
netMessage.Write(CalamityWorld.acidRainExtraDrawTime);
|
||||
netMessage.Send();
|
||||
}
|
||||
if (Main.netMode == NetmodeID.Server)
|
||||
{
|
||||
var netMessage = CalamityMod.instance.GetPacket();
|
||||
netMessage.Write((byte)CalamityModMessageType.AcidRainOldDukeSummonSync);
|
||||
netMessage.Write(CalamityWorld.triedToSummonOldDuke);
|
||||
netMessage.Send();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@ namespace CalamityMod.Items.SummonItems.Invasion
|
||||
else
|
||||
{
|
||||
CalamityWorld.acidRainPoints = 0;
|
||||
CalamityWorld.triedToSummonOldDuke = false;
|
||||
AcidRainEvent.UpdateInvasion(false);
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace CalamityMod.NPCs.AcidRain
|
||||
|
||||
if (CalamityWorld.downedPolterghast)
|
||||
{
|
||||
npc.damage = 260;
|
||||
npc.damage = 160;
|
||||
npc.lifeMax = 6650;
|
||||
npc.defense = 45;
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ using CalamityMod.Projectiles.Enemy;
|
||||
using CalamityMod.World;
|
||||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
using System.IO;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
@@ -46,6 +47,16 @@ namespace CalamityMod.NPCs.AcidRain
|
||||
banner = npc.type;
|
||||
bannerItem = ModContent.ItemType<FlakCrabBanner>();
|
||||
}
|
||||
public override void SendExtraAI(BinaryWriter writer)
|
||||
{
|
||||
writer.Write(npc.localAI[0]);
|
||||
writer.Write(npc.localAI[1]);
|
||||
}
|
||||
public override void ReceiveExtraAI(BinaryReader reader)
|
||||
{
|
||||
npc.localAI[0] = reader.ReadSingle();
|
||||
npc.localAI[1] = reader.ReadSingle();
|
||||
}
|
||||
public override void ScaleExpertStats(int numPlayers, float bossLifeScale)
|
||||
{
|
||||
npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale);
|
||||
@@ -58,7 +69,10 @@ namespace CalamityMod.NPCs.AcidRain
|
||||
npc.defense = npc.localAI[1] < 10f ? 999999 : 20;
|
||||
|
||||
if (npc.justHit)
|
||||
{
|
||||
npc.localAI[0] = 240;
|
||||
npc.netUpdate = true;
|
||||
}
|
||||
if (npc.localAI[0] == 0f || npc.localAI[1] < 10f)
|
||||
{
|
||||
npc.chaseable = false;
|
||||
@@ -104,6 +118,7 @@ namespace CalamityMod.NPCs.AcidRain
|
||||
npc.ai[2] = 0f;
|
||||
npc.velocity.Y -= jumpSpeed;
|
||||
npc.velocity.X = lungeForwardSpeed * -npc.direction;
|
||||
npc.netUpdate = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace CalamityMod.NPCs.AcidRain
|
||||
npc.width = 40;
|
||||
npc.height = 30;
|
||||
|
||||
npc.damage = 205;
|
||||
npc.damage = 145;
|
||||
npc.lifeMax = 6410;
|
||||
npc.defense = 50;
|
||||
|
||||
@@ -82,9 +82,10 @@ namespace CalamityMod.NPCs.AcidRain
|
||||
{
|
||||
float angle = MathHelper.TwoPi / 5f * i + (npc.ai[1] % 2) * MathHelper.PiOver2;
|
||||
Projectile.NewProjectile(npc.Center, angle.ToRotationVector2() * 7f, ModContent.ProjectileType<GammaAcid>(),
|
||||
40, 3f);
|
||||
45, 3f);
|
||||
}
|
||||
}
|
||||
npc.netUpdate = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -113,12 +114,12 @@ namespace CalamityMod.NPCs.AcidRain
|
||||
{
|
||||
angularMultiplier1 = Main.rand.NextFloat(3f);
|
||||
angularMultiplier2 = Main.rand.NextFloat(4f);
|
||||
npc.netUpdate = true;
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
{
|
||||
Main.PlaySound(SoundID.Zombie, (int)npc.position.X, (int)npc.position.Y, 104); // Moon lord beam sound
|
||||
Projectile.NewProjectile(npc.Center, -Vector2.UnitY, ModContent.ProjectileType<GammaBeam>(), 105, 4f, 0, 0f, npc.whoAmI);
|
||||
Projectile.NewProjectile(npc.Center, -Vector2.UnitY, ModContent.ProjectileType<GammaBeam>(), 120, 4f, Main.myPlayer, 0f, npc.whoAmI);
|
||||
}
|
||||
npc.netUpdate = true;
|
||||
}
|
||||
// Very complex particle effects while releasing the beam
|
||||
else if (npc.ai[3] >= 300f)
|
||||
@@ -143,6 +144,7 @@ namespace CalamityMod.NPCs.AcidRain
|
||||
Main.rand.NextBool(110))
|
||||
{
|
||||
npc.ai[3] = 600f;
|
||||
npc.netUpdate = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace CalamityMod.NPCs.AcidRain
|
||||
|
||||
if (CalamityWorld.downedPolterghast)
|
||||
{
|
||||
npc.damage = 300;
|
||||
npc.damage = 180;
|
||||
npc.lifeMax = 5700;
|
||||
npc.defense = 65;
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace CalamityMod.NPCs.AcidRain
|
||||
|
||||
if (CalamityWorld.downedPolterghast)
|
||||
{
|
||||
npc.damage = 285;
|
||||
npc.damage = 175;
|
||||
npc.lifeMax = 6300;
|
||||
npc.defense = 58;
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace CalamityMod.NPCs.AcidRain
|
||||
|
||||
if (CalamityWorld.downedPolterghast)
|
||||
{
|
||||
npc.damage = 210;
|
||||
npc.damage = 140;
|
||||
npc.lifeMax = 6600;
|
||||
npc.defense = 33;
|
||||
}
|
||||
@@ -89,7 +89,10 @@ namespace CalamityMod.NPCs.AcidRain
|
||||
if (npc.wet)
|
||||
{
|
||||
if (npc.velocity.Y >= 0f)
|
||||
{
|
||||
npc.velocity.Y = -3f;
|
||||
npc.netUpdate = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (closestBubble != null && minimumDistance < 200f)
|
||||
@@ -99,8 +102,8 @@ namespace CalamityMod.NPCs.AcidRain
|
||||
if (closestBubble.Hitbox.Intersects(npc.Hitbox))
|
||||
{
|
||||
npc.ai[0] = 1f;
|
||||
npc.netUpdate = true;
|
||||
closestBubble.Kill();
|
||||
npc.netUpdate = true;
|
||||
}
|
||||
}
|
||||
if (npc.velocity.Y == 0f || npc.wet)
|
||||
@@ -108,18 +111,19 @@ namespace CalamityMod.NPCs.AcidRain
|
||||
npc.TargetClosest(false);
|
||||
npc.velocity.X *= 0.85f;
|
||||
npc.ai[1]++;
|
||||
float lungeForwardSpeed = 13f;
|
||||
float jumpSpeed = 3f;
|
||||
float lungeForwardSpeed = 15f;
|
||||
float jumpSpeed = 4f;
|
||||
if (Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1))
|
||||
{
|
||||
lungeForwardSpeed *= 1.2f;
|
||||
}
|
||||
if (npc.ai[1] >= 10)
|
||||
if (npc.ai[1] >= 17)
|
||||
{
|
||||
npc.ai[1] = 0f;
|
||||
npc.velocity.Y -= jumpSpeed;
|
||||
npc.velocity.X = lungeForwardSpeed * (npc.Center.X - destination.X < 0).ToDirectionInt();
|
||||
npc.spriteDirection = (npc.Center.X - destination.X < 0).ToDirectionInt();
|
||||
npc.netUpdate = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -135,40 +139,21 @@ namespace CalamityMod.NPCs.AcidRain
|
||||
if (npc.Distance(player.Center) < 200f)
|
||||
inertia *= 0.667f;
|
||||
npc.velocity = (npc.velocity * inertia + npc.DirectionTo(player.Center) * speed) / (inertia + 1f);
|
||||
|
||||
float SAImovement = 0.5f;
|
||||
for (int index = 0; index < Main.npc.Length; index++)
|
||||
{
|
||||
NPC other = Main.npc[index];
|
||||
if (index != npc.whoAmI &&
|
||||
other.active &&
|
||||
other.type == npc.type && Math.Abs(npc.position.X - other.position.X) + Math.Abs(npc.position.Y - other.position.Y) < npc.width)
|
||||
{
|
||||
if (npc.position.X < other.position.X)
|
||||
{
|
||||
npc.velocity.X -= SAImovement;
|
||||
}
|
||||
else
|
||||
{
|
||||
npc.velocity.X += SAImovement;
|
||||
}
|
||||
if (npc.position.Y < other.position.Y)
|
||||
{
|
||||
npc.velocity.Y -= SAImovement;
|
||||
}
|
||||
else
|
||||
{
|
||||
npc.velocity.Y += SAImovement;
|
||||
}
|
||||
}
|
||||
}
|
||||
npc.spriteDirection = (npc.velocity.X > 0).ToDirectionInt();
|
||||
if (player.dead && npc.Distance(player.Center) < 20f)
|
||||
{
|
||||
npc.ai[0] = 0f;
|
||||
npc.netUpdate = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit)
|
||||
{
|
||||
if (npc.ai[0] != 0f)
|
||||
{
|
||||
npc.ai[0] = 0f;
|
||||
npc.netUpdate = true;
|
||||
}
|
||||
}
|
||||
public override void FindFrame(int frameHeight)
|
||||
{
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace CalamityMod.NPCs.AcidRain
|
||||
|
||||
if (CalamityWorld.downedPolterghast)
|
||||
{
|
||||
npc.damage = 233;
|
||||
npc.damage = 160;
|
||||
npc.lifeMax = 7200;
|
||||
npc.defense = 78;
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace CalamityMod.NPCs.AcidRain
|
||||
|
||||
if (CalamityWorld.downedPolterghast)
|
||||
{
|
||||
npc.damage = 315;
|
||||
npc.damage = 172;
|
||||
npc.lifeMax = 4000;
|
||||
npc.defense = 30;
|
||||
}
|
||||
@@ -72,6 +72,7 @@ namespace CalamityMod.NPCs.AcidRain
|
||||
{
|
||||
// Revert back to swimming around after successfully devouring the player
|
||||
npc.ai[0] = 0f;
|
||||
npc.netUpdate = true;
|
||||
return;
|
||||
}
|
||||
// Stick to player and make them bleed
|
||||
@@ -122,6 +123,7 @@ namespace CalamityMod.NPCs.AcidRain
|
||||
{
|
||||
npc.ai[0] = 1f;
|
||||
npc.ai[1] = 300f;
|
||||
npc.netUpdate = true;
|
||||
}
|
||||
npc.velocity = (npc.velocity * (swimIntertia - 1f) + npc.DirectionTo(player.Center) * speed) / swimIntertia;
|
||||
}
|
||||
|
||||
@@ -4301,6 +4301,7 @@ namespace CalamityMod.NPCs
|
||||
if (npc.timeLeft == 1)
|
||||
{
|
||||
CalamityWorld.acidRainPoints = 0;
|
||||
CalamityWorld.triedToSummonOldDuke = false;
|
||||
AcidRainEvent.UpdateInvasion(false);
|
||||
npc.timeLeft = 0;
|
||||
}
|
||||
|
||||
@@ -1612,6 +1612,7 @@ namespace CalamityMod.NPCs
|
||||
npc.type == ModContent.NPCType<OldDuke.OldDuke>() &&
|
||||
CalamityWorld.acidRainPoints <= 2f)
|
||||
{
|
||||
CalamityWorld.triedToSummonOldDuke = false;
|
||||
CalamityWorld.acidRainPoints = 0;
|
||||
}
|
||||
AcidRainEvent.UpdateInvasion();
|
||||
|
||||
@@ -127,7 +127,6 @@ namespace CalamityMod.Projectiles.Boss
|
||||
}
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
{
|
||||
Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/OldDukeRoar").SoundId, (int)projectile.Top.X, (int)projectile.Top.Y, volumeScale: 1.45f);
|
||||
int boomer = NPC.NewNPC((int)projectile.Top.X, (int)projectile.Top.Y + 100, ModContent.NPCType<OldDuke>());
|
||||
string boomerName = Main.npc[boomer].TypeName;
|
||||
|
||||
@@ -149,11 +148,14 @@ namespace CalamityMod.Projectiles.Boss
|
||||
Main.npc[boomer].alpha = 255;
|
||||
Main.npc[boomer].Calamity().newAI[3] = 1f; // To signal that Old Duke should not deccelerate as it normally would
|
||||
Main.npc[boomer].netUpdate = true;
|
||||
CalamityWorld.triedToSummonOldDuke = true;
|
||||
AcidRainEvent.UpdateInvasion(false);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
CalamityWorld.acidRainPoints = 0;
|
||||
CalamityWorld.triedToSummonOldDuke = false;
|
||||
AcidRainEvent.UpdateInvasion(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using CalamityMod.World;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
@@ -8,7 +9,13 @@ namespace CalamityMod.Waters
|
||||
{
|
||||
public override bool ChooseWaterStyle()
|
||||
{
|
||||
return Main.LocalPlayer.Calamity().ZoneSulphur;
|
||||
bool inXZone = Main.LocalPlayer.Center.X < 10400f;
|
||||
if (!CalamityWorld.abyssSide)
|
||||
inXZone = Main.LocalPlayer.Center.X > Main.maxTilesX * 16f - 10400f;
|
||||
|
||||
bool inYZone = Main.LocalPlayer.Center.Y < Main.rockLayer * 16f - 320 && Main.LocalPlayer.Center.Y >= 5800f;
|
||||
|
||||
return (inXZone && inYZone) || Main.LocalPlayer.Calamity().ZoneSulphur;
|
||||
}
|
||||
|
||||
public override int ChooseWaterfallStyle()
|
||||
|
||||
+25
-9
@@ -107,6 +107,7 @@ namespace CalamityMod.World
|
||||
public static bool rainingAcid;
|
||||
public static int acidRainPoints = 0;
|
||||
public static int acidRainExtraDrawTime = 0;
|
||||
public static bool triedToSummonOldDuke = false;
|
||||
public static float AcidRainCompletionRatio
|
||||
{
|
||||
get
|
||||
@@ -364,6 +365,8 @@ namespace CalamityMod.World
|
||||
downed.Add("eocRain");
|
||||
if (downedAquaticScourgeAcidRain)
|
||||
downed.Add("hmRain");
|
||||
if (triedToSummonOldDuke)
|
||||
downed.Add("spawnedBoomer");
|
||||
|
||||
return new TagCompound
|
||||
{
|
||||
@@ -431,6 +434,7 @@ namespace CalamityMod.World
|
||||
spawnedCirrus = downed.Contains("drunkPrincess");
|
||||
downedEoCAcidRain = downed.Contains("eocRain");
|
||||
downedAquaticScourgeAcidRain = downed.Contains("hmRain");
|
||||
triedToSummonOldDuke = downed.Contains("spawnedBoomer");
|
||||
|
||||
abyssChasmBottom = tag.GetInt("abyssChasmBottom");
|
||||
acidRainPoints = tag.GetInt("acidRainPoints");
|
||||
@@ -514,8 +518,9 @@ namespace CalamityMod.World
|
||||
downedCLAM = flags7[2];
|
||||
dragonScalesBought = flags7[3];
|
||||
rainingAcid = flags7[4];
|
||||
downedEoCAcidRain = flags[5];
|
||||
downedAquaticScourgeAcidRain = flags[6];
|
||||
downedEoCAcidRain = flags7[5];
|
||||
downedAquaticScourgeAcidRain = flags7[6];
|
||||
triedToSummonOldDuke = flags7[7];
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -597,6 +602,7 @@ namespace CalamityMod.World
|
||||
flags7[4] = rainingAcid;
|
||||
flags7[5] = downedEoCAcidRain;
|
||||
flags7[6] = downedAquaticScourgeAcidRain;
|
||||
flags7[7] = triedToSummonOldDuke;
|
||||
|
||||
writer.Write(flags);
|
||||
writer.Write(flags2);
|
||||
@@ -681,8 +687,9 @@ namespace CalamityMod.World
|
||||
downedCLAM = flags7[2];
|
||||
dragonScalesBought = flags7[3];
|
||||
rainingAcid = flags7[4];
|
||||
downedEoCAcidRain = flags[5];
|
||||
downedAquaticScourgeAcidRain = flags[6];
|
||||
downedEoCAcidRain = flags7[5];
|
||||
downedAquaticScourgeAcidRain = flags7[6];
|
||||
triedToSummonOldDuke = flags7[7];
|
||||
|
||||
abyssChasmBottom = reader.ReadInt32();
|
||||
acidRainPoints = reader.ReadInt32();
|
||||
@@ -919,12 +926,21 @@ namespace CalamityMod.World
|
||||
!NPC.AnyNPCs(ModContent.NPCType<OldDuke>()) &&
|
||||
CalamityUtils.CountProjectiles(ModContent.ProjectileType<OverlyDramaticDukeSummoner>()) <= 0)
|
||||
{
|
||||
int playerClosestToAbyss = Player.FindClosest(new Vector2(abyssSide ? 0 : Main.maxTilesX * 16, (int)Main.worldSurface), 0, 0);
|
||||
Player closestToAbyss = Main.player[playerClosestToAbyss];
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient && Math.Abs(closestToAbyss.Center.X - (abyssSide ? 0 : Main.maxTilesX * 16)) <= 12000f)
|
||||
if (triedToSummonOldDuke)
|
||||
{
|
||||
Projectile.NewProjectile(closestToAbyss.Center + Vector2.UnitY * 160f, Vector2.Zero,
|
||||
ModContent.ProjectileType<OverlyDramaticDukeSummoner>(), 120, 8f);
|
||||
acidRainPoints = 0;
|
||||
triedToSummonOldDuke = false;
|
||||
AcidRainEvent.UpdateInvasion(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
int playerClosestToAbyss = Player.FindClosest(new Vector2(abyssSide ? 0 : Main.maxTilesX * 16, (int)Main.worldSurface), 0, 0);
|
||||
Player closestToAbyss = Main.player[playerClosestToAbyss];
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient && Math.Abs(closestToAbyss.Center.X - (abyssSide ? 0 : Main.maxTilesX * 16)) <= 12000f)
|
||||
{
|
||||
Projectile.NewProjectile(closestToAbyss.Center + Vector2.UnitY * 160f, Vector2.Zero,
|
||||
ModContent.ProjectileType<OverlyDramaticDukeSummoner>(), 120, 8f, Main.myPlayer);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user