A few random edits, not much to say really. I'll optimize more problematic code later.
This commit is contained in:
1 parent
b5833525d6
commit
840b13f692
7 files changed
+43
-34
No files matched your search
@@ -5681,17 +5681,20 @@ namespace CalamityMod.CalPlayer
|
||||
if (Player.whoAmI == Main.myPlayer)
|
||||
{
|
||||
// Summon a portal if needed.
|
||||
if (Player.Calamity().persecutedEnchant && NPC.CountNPCS(ModContent.NPCType<DemonPortal>()) < 2)
|
||||
if (Player.Calamity().persecutedEnchant)
|
||||
{
|
||||
int tries = 0;
|
||||
Vector2 spawnPosition;
|
||||
do
|
||||
if (NPC.CountNPCS(ModContent.NPCType<DemonPortal>()) < 2)
|
||||
{
|
||||
spawnPosition = Player.Center + Main.rand.NextVector2Unit() * Main.rand.NextFloat(270f, 420f);
|
||||
tries++;
|
||||
int tries = 0;
|
||||
Vector2 spawnPosition;
|
||||
do
|
||||
{
|
||||
spawnPosition = Player.Center + Main.rand.NextVector2Unit() * Main.rand.NextFloat(270f, 420f);
|
||||
tries++;
|
||||
}
|
||||
while (Collision.SolidCollision(spawnPosition - Vector2.One * 24f, 48, 24) && tries < 100);
|
||||
CalamityNetcode.NewNPC_ClientSide(spawnPosition, ModContent.NPCType<DemonPortal>(), Player);
|
||||
}
|
||||
while (Collision.SolidCollision(spawnPosition - Vector2.One * 24f, 48, 24) && tries < 100);
|
||||
CalamityNetcode.NewNPC_ClientSide(spawnPosition, ModContent.NPCType<DemonPortal>(), Player);
|
||||
}
|
||||
|
||||
if (daedalusAbsorb && Main.rand.NextBool(10))
|
||||
|
||||
@@ -1259,17 +1259,20 @@ namespace CalamityMod.CalPlayer
|
||||
else
|
||||
{
|
||||
persecutedEnchantSummonTimer = 0;
|
||||
if (Main.myPlayer == Player.whoAmI && persecutedEnchant && NPC.CountNPCS(ModContent.NPCType<DemonPortal>()) < 2)
|
||||
if (Main.myPlayer == Player.whoAmI && persecutedEnchant)
|
||||
{
|
||||
int tries = 0;
|
||||
Vector2 spawnPosition;
|
||||
do
|
||||
if (NPC.CountNPCS(ModContent.NPCType<DemonPortal>()) < 2)
|
||||
{
|
||||
spawnPosition = Player.Center + Main.rand.NextVector2Unit() * Main.rand.NextFloat(270f, 420f);
|
||||
tries++;
|
||||
int tries = 0;
|
||||
Vector2 spawnPosition;
|
||||
do
|
||||
{
|
||||
spawnPosition = Player.Center + Main.rand.NextVector2Unit() * Main.rand.NextFloat(270f, 420f);
|
||||
tries++;
|
||||
}
|
||||
while (Collision.SolidCollision(spawnPosition - Vector2.One * 24f, 48, 24) && tries < 100);
|
||||
CalamityNetcode.NewNPC_ClientSide(spawnPosition, ModContent.NPCType<DemonPortal>(), Player);
|
||||
}
|
||||
while (Collision.SolidCollision(spawnPosition - Vector2.One * 24f, 48, 24) && tries < 100);
|
||||
CalamityNetcode.NewNPC_ClientSide(spawnPosition, ModContent.NPCType<DemonPortal>(), Player);
|
||||
}
|
||||
}
|
||||
if (Player.miscCounter % 20 == 0)
|
||||
|
||||
@@ -240,10 +240,13 @@ namespace CalamityMod.Items
|
||||
public override bool Shoot(Item item, Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockBack)
|
||||
{
|
||||
CalamityPlayer modPlayer = player.Calamity();
|
||||
if (Main.myPlayer == player.whoAmI && player.Calamity().cursedSummonsEnchant && NPC.CountNPCS(ModContent.NPCType<CalamitasEnchantDemon>()) < 2)
|
||||
if (Main.myPlayer == player.whoAmI && player.Calamity().cursedSummonsEnchant)
|
||||
{
|
||||
CalamityNetcode.NewNPC_ClientSide(Main.MouseWorld, ModContent.NPCType<CalamitasEnchantDemon>(), player);
|
||||
SoundEngine.PlaySound(SoundID.DD2_DarkMageSummonSkeleton, Main.MouseWorld);
|
||||
if (NPC.CountNPCS(ModContent.NPCType<CalamitasEnchantDemon>()) < 2)
|
||||
{
|
||||
CalamityNetcode.NewNPC_ClientSide(Main.MouseWorld, ModContent.NPCType<CalamitasEnchantDemon>(), player);
|
||||
SoundEngine.PlaySound(SoundID.DD2_DarkMageSummonSkeleton, Main.MouseWorld);
|
||||
}
|
||||
}
|
||||
|
||||
// Traitorous enchantment implementation
|
||||
|
||||
@@ -183,9 +183,8 @@ namespace CalamityMod.NPCs.Abyss
|
||||
public override float SpawnChance(NPCSpawnInfo spawnInfo)
|
||||
{
|
||||
if (spawnInfo.Player.Calamity().ZoneAbyssLayer4 && spawnInfo.Water && NPC.CountNPCS(ModContent.NPCType<Bloatfish>()) < 3)
|
||||
{
|
||||
return Main.remixWorld ? 4.5f : SpawnCondition.CaveJellyfish.Chance * 0.5f;
|
||||
}
|
||||
|
||||
return 0f;
|
||||
}
|
||||
|
||||
|
||||
@@ -70,14 +70,17 @@ namespace CalamityMod.NPCs.Astral
|
||||
NPC.ai[0]++;
|
||||
if (NPC.ai[0] > (CalamityWorld.death ? 60f : CalamityWorld.revenge ? 120f : 180f))
|
||||
{
|
||||
if (Main.rand.NextBool(100) && NPC.CountNPCS(ModContent.NPCType<Hiveling>()) < 10)
|
||||
if (Main.rand.NextBool(100))
|
||||
{
|
||||
NPC.ai[0] = 0;
|
||||
if (NPC.CountNPCS(ModContent.NPCType<Hiveling>()) < 10)
|
||||
{
|
||||
NPC.ai[0] = 0;
|
||||
|
||||
//spawn hiveling, it's ai[0] is the hive npc index.
|
||||
int n = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, ModContent.NPCType<Hiveling>(), 0, NPC.whoAmI);
|
||||
Main.npc[n].velocity.X = Main.rand.NextFloat(-0.4f, 0.4f);
|
||||
Main.npc[n].velocity.Y = Main.rand.NextFloat(-0.5f, -0.05f);
|
||||
// Spawn hiveling, it's ai[0] is the hive npc index.
|
||||
int n = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, ModContent.NPCType<Hiveling>(), 0, NPC.whoAmI);
|
||||
Main.npc[n].velocity.X = Main.rand.NextFloat(-0.4f, 0.4f);
|
||||
Main.npc[n].velocity.Y = Main.rand.NextFloat(-0.5f, -0.05f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -98,7 +101,7 @@ namespace CalamityMod.NPCs.Astral
|
||||
|
||||
public override void PostDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor)
|
||||
{
|
||||
//draw glowmask
|
||||
// Draw glowmask.
|
||||
spriteBatch.Draw(glowmask, NPC.Center - screenPos, NPC.frame, Color.White * 0.6f, NPC.rotation, new Vector2(19, 30), 1f, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -136,14 +136,11 @@ namespace CalamityMod.NPCs.SulphurousSea
|
||||
public override float SpawnChance(NPCSpawnInfo spawnInfo)
|
||||
{
|
||||
if (spawnInfo.PlayerSafe)
|
||||
{
|
||||
return 0f;
|
||||
}
|
||||
if ((spawnInfo.Player.Calamity().ZoneSulphur || spawnInfo.Player.Calamity().ZoneAbyssLayer1) &&
|
||||
spawnInfo.Water && NPC.CountNPCS(ModContent.NPCType<AquaticUrchin>()) < 12)
|
||||
{
|
||||
|
||||
if ((spawnInfo.Player.Calamity().ZoneSulphur || spawnInfo.Player.Calamity().ZoneAbyssLayer1) && spawnInfo.Water && NPC.CountNPCS(ModContent.NPCType<AquaticUrchin>()) < 12)
|
||||
return 2.2f;
|
||||
}
|
||||
|
||||
return 0f;
|
||||
}
|
||||
|
||||
|
||||
@@ -55,6 +55,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses
|
||||
float totalSegments = GetEaterOfWorldsSegmentsCountRevDeath();
|
||||
|
||||
// Count segments remaining
|
||||
// TODO - This runs for every EoW segment, this is bad because there are three separate loops here running every frame.
|
||||
float segmentCount = NPC.CountNPCS(NPCID.EaterofWorldsHead) + NPC.CountNPCS(NPCID.EaterofWorldsBody) + NPC.CountNPCS(NPCID.EaterofWorldsTail);
|
||||
|
||||
// Percent segments remaining, add two to total for head and tail
|
||||
|
||||
Reference in new issue
Block a user