From 750e0ef1f6b092870f2b1eb89124d6407338d7cc Mon Sep 17 00:00:00 2001 From: Andrew Marheine Date: Thu, 6 Aug 2020 00:40:21 -0500 Subject: [PATCH 1/2] 1 - DoG phase 1 lasers now go through tiles until they cross their target's original position. --- NPCs/DevourerofGods/DevourerofGodsBody.cs | 95 +++++++++++------------ Projectiles/Boss/DoGNebulaShot.cs | 92 ++++++++++++---------- 2 files changed, 99 insertions(+), 88 deletions(-) diff --git a/NPCs/DevourerofGods/DevourerofGodsBody.cs b/NPCs/DevourerofGods/DevourerofGodsBody.cs index 98b47a838e..415f5d2b7e 100644 --- a/NPCs/DevourerofGods/DevourerofGodsBody.cs +++ b/NPCs/DevourerofGods/DevourerofGodsBody.cs @@ -79,20 +79,19 @@ namespace CalamityMod.NPCs.DevourerofGods public override void AI() { bool expertMode = Main.expertMode; - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0f, 0.2f, 0.25f); + + Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 0f, 0.2f, 0.25f); + if (invinceTime > 0) { invinceTime--; npc.dontTakeDamage = true; } else - { npc.dontTakeDamage = false; - } + if (npc.ai[3] > 0f) - { npc.realLife = (int)npc.ai[3]; - } // Target if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) @@ -100,15 +99,11 @@ namespace CalamityMod.NPCs.DevourerofGods Player player = Main.player[npc.target]; - npc.velocity.Length(); if (npc.velocity.X < 0f) - { npc.spriteDirection = -1; - } else if (npc.velocity.X > 0f) - { npc.spriteDirection = 1; - } + bool flag = false; if (npc.ai[1] <= 0f) { @@ -124,6 +119,7 @@ namespace CalamityMod.NPCs.DevourerofGods npc.HitEffect(0, 10.0); npc.checkDead(); } + if (Main.npc[(int)npc.ai[1]].alpha < 128) { if (npc.alpha != 0) @@ -135,76 +131,77 @@ namespace CalamityMod.NPCs.DevourerofGods Main.dust[num935].noLight = true; } } + npc.alpha -= 42; if (npc.alpha < 0) - { npc.alpha = 0; - } } + if (Main.netMode != NetmodeID.MultiplayerClient) { - npc.localAI[0] += expertMode ? 2f : 1f; + npc.localAI[0] += expertMode ? 1.5f : 1f; int projectileType = ModContent.ProjectileType(); int damage = expertMode ? 58 : 70; float num941 = 5f; - if (npc.localAI[0] >= (float)Main.rand.Next(1400, 16000)) + if (npc.localAI[0] >= Main.rand.Next(1050, 12000)) { npc.localAI[0] = 0f; npc.TargetClosest(true); - Vector2 vector104 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)(npc.height / 2)); - float num942 = player.position.X + (float)player.width * 0.5f - vector104.X; - float num943 = player.position.Y + (float)player.height * 0.5f - vector104.Y; - float num944 = (float)Math.Sqrt((double)(num942 * num942 + num943 * num943)); + Vector2 vector104 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + (npc.height / 2)); + float num942 = player.position.X + player.width * 0.5f - vector104.X; + float num943 = player.position.Y + player.height * 0.5f - vector104.Y; + float num944 = (float)Math.Sqrt(num942 * num942 + num943 * num943); num944 = num941 / num944; num942 *= num944; num943 *= num944; vector104.X += num942 * 5f; vector104.Y += num943 * 5f; - Projectile.NewProjectile(vector104.X, vector104.Y, num942, num943, projectileType, damage, 0f, Main.myPlayer, 0f, 0f); - npc.netUpdate = true; + int proj = Projectile.NewProjectile(vector104.X, vector104.Y, num942, num943, projectileType, damage, 0f, Main.myPlayer, 0f, 0f); + Main.projectile[proj].ai[0] = Main.player[npc.target].Center.X; + Main.projectile[proj].ai[1] = Main.player[npc.target].Center.Y; + Main.projectile[proj].netUpdate = true; + npc.netUpdate = true; } } + if (player.dead) - { npc.TargetClosest(false); - } - Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num191 = player.position.X + (float)(player.width / 2); - float num192 = player.position.Y + (float)(player.height / 2); - num191 = (float)((int)(num191 / 16f) * 16); - num192 = (float)((int)(num192 / 16f) * 16); - vector18.X = (float)((int)(vector18.X / 16f) * 16); - vector18.Y = (float)((int)(vector18.Y / 16f) * 16); + + Vector2 vector18 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num191 = player.position.X + (player.width / 2); + float num192 = player.position.Y + (player.height / 2); + num191 = (int)(num191 / 16f) * 16; + num192 = (int)(num192 / 16f) * 16; + vector18.X = (int)(vector18.X / 16f) * 16; + vector18.Y = (int)(vector18.Y / 16f) * 16; num191 -= vector18.X; num192 -= vector18.Y; - float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - if (npc.ai[1] > 0f && npc.ai[1] < (float)Main.npc.Length) + float num193 = (float)Math.Sqrt(num191 * num191 + num192 * num192); + if (npc.ai[1] > 0f && npc.ai[1] < Main.npc.Length) { try { - vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num191 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; - num192 = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; + vector18 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + num191 = Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; + num192 = Main.npc[(int)npc.ai[1]].position.Y + (Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; } catch { } - npc.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; - num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); + + npc.rotation = (float)Math.Atan2(num192, num191) + MathHelper.PiOver2; + num193 = (float)Math.Sqrt(num191 * num191 + num192 * num192); int num194 = npc.width; - num193 = (num193 - (float)num194) / num193; + num193 = (num193 - num194) / num193; num191 *= num193; num192 *= num193; npc.velocity = Vector2.Zero; npc.position.X = npc.position.X + num191; npc.position.Y = npc.position.Y + num192; + if (num191 < 0f) - { npc.spriteDirection = -1; - } else if (num191 > 0f) - { npc.spriteDirection = 1; - } } } @@ -215,10 +212,10 @@ namespace CalamityMod.NPCs.DevourerofGods spriteEffects = SpriteEffects.FlipHorizontally; Texture2D texture2D15 = Main.npcTexture[npc.type]; - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / 2)); + Vector2 vector11 = new Vector2(Main.npcTexture[npc.type].Width / 2, Main.npcTexture[npc.type].Height / 2); Vector2 vector43 = npc.Center - Main.screenPosition; - vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * npc.scale / 2f; + vector43 -= new Vector2(texture2D15.Width, texture2D15.Height) * npc.scale / 2f; vector43 += vector11 * npc.scale + new Vector2(0f, 4f + npc.gfxOffY); spriteBatch.Draw(texture2D15, vector43, npc.frame, npc.GetAlpha(lightColor), npc.rotation, vector11, npc.scale, spriteEffects, 0f); @@ -255,16 +252,16 @@ namespace CalamityMod.NPCs.DevourerofGods { if (npc.life <= 0) { - float randomSpread = (float)(Main.rand.Next(-100, 100) / 100); + float randomSpread = Main.rand.Next(-100, 100) / 100; Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/DoGBody"), 1f); Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/DoGBody2"), 1f); Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/DoGBody3"), 1f); - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.position.X = npc.position.X + (npc.width / 2); + npc.position.Y = npc.position.Y + (npc.height / 2); npc.width = 50; npc.height = 50; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); + npc.position.X = npc.position.X - (npc.width / 2); + npc.position.Y = npc.position.Y - (npc.height / 2); for (int num621 = 0; num621 < 10; num621++) { int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 2f); @@ -272,7 +269,7 @@ namespace CalamityMod.NPCs.DevourerofGods if (Main.rand.NextBool(2)) { Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } for (int num623 = 0; num623 < 20; num623++) diff --git a/Projectiles/Boss/DoGNebulaShot.cs b/Projectiles/Boss/DoGNebulaShot.cs index 5c1e55803b..561983f54e 100644 --- a/Projectiles/Boss/DoGNebulaShot.cs +++ b/Projectiles/Boss/DoGNebulaShot.cs @@ -1,3 +1,4 @@ +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System.IO; @@ -19,6 +20,7 @@ namespace CalamityMod.Projectiles.Boss projectile.height = 5; projectile.hostile = true; projectile.ignoreWater = true; + projectile.tileCollide = false; projectile.alpha = 255; projectile.penetrate = 1; projectile.extraUpdates = 4; @@ -36,40 +38,51 @@ namespace CalamityMod.Projectiles.Boss projectile.localAI[0] = reader.ReadSingle(); } - public override void AI() - { - if (projectile.ai[0] == 0f) - { - projectile.ai[0] = 1f; - Main.PlaySound(SoundID.Item12, (int)projectile.Center.X, (int)projectile.Center.Y); - } - if (projectile.alpha > 0) - { - projectile.alpha -= 25; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - float num55 = 50f; - float num56 = 1.5f; - if (projectile.ai[1] == 0f) - { - projectile.localAI[0] += num56; - if (projectile.localAI[0] > num55) - { - projectile.localAI[0] = num55; - } - } - else - { - projectile.localAI[0] -= num56; - if (projectile.localAI[0] <= 0f) - { - projectile.Kill(); - } - } - } + public override void AI() + { + if (projectile.localAI[1] == 0f) + { + projectile.localAI[1] = 1f; + Main.PlaySound(SoundID.Item12, (int)projectile.Center.X, (int)projectile.Center.Y); + } + bool xIntersects = false; + bool yIntersects = false; + if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) + { + xIntersects = true; + } + if (projectile.velocity.X > 0f && projectile.position.X > projectile.ai[0]) + { + xIntersects = true; + } + if (projectile.velocity.Y < 0f && projectile.position.Y < projectile.ai[1]) + { + yIntersects = true; + } + if (projectile.velocity.Y > 0f && projectile.position.Y > projectile.ai[1]) + { + yIntersects = true; + } + if (xIntersects && yIntersects) + { + projectile.tileCollide = true; + } + if (projectile.alpha > 0) + { + projectile.alpha -= 25; + } + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + float num55 = 50f; + float num56 = 1.5f; + projectile.localAI[0] += num56; + if (projectile.localAI[0] > num55) + { + projectile.localAI[0] = num55; + } + } public override Color? GetAlpha(Color lightColor) { @@ -93,10 +106,6 @@ namespace CalamityMod.Projectiles.Boss Vector2 value7 = new Vector2(projectile.position.X - Main.screenPosition.X + num149 + (float)num148, projectile.position.Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY); float num162 = 50f; float scaleFactor = 1.5f; - if (projectile.ai[1] == 1f) - { - num162 = (float)(int)projectile.localAI[0]; - } for (int num163 = 1; num163 <= (int)projectile.localAI[0]; num163++) { Vector2 value8 = Vector2.Normalize(projectile.velocity) * (float)num163 * scaleFactor; @@ -109,7 +118,12 @@ namespace CalamityMod.Projectiles.Boss return false; } - public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 120); + } + + public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) { target.Calamity().lastProjectileHit = projectile; } From b9b572d9729ad2e22098b01f5e5fcf42d9a944ee Mon Sep 17 00:00:00 2001 From: Andrew Marheine Date: Thu, 6 Aug 2020 05:02:25 -0500 Subject: [PATCH 2/2] 1 - Increased Giant Clam spawn rate. 2 - Increased the chance for biome shrines to spawn. --- NPCs/SunkenSea/GiantClam.cs | 2 +- World/SmallBiomes.cs | 37 +++++++++++++++++++------------------ 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/NPCs/SunkenSea/GiantClam.cs b/NPCs/SunkenSea/GiantClam.cs index ae08fbb541..eeada006ed 100644 --- a/NPCs/SunkenSea/GiantClam.cs +++ b/NPCs/SunkenSea/GiantClam.cs @@ -354,7 +354,7 @@ namespace CalamityMod.NPCs.SunkenSea { if (spawnInfo.player.Calamity().ZoneSunkenSea && spawnInfo.water && CalamityWorld.downedDesertScourge && !NPC.AnyNPCs(ModContent.NPCType())) { - return SpawnCondition.CaveJellyfish.Chance * 0.12f; + return SpawnCondition.CaveJellyfish.Chance * 0.24f; } return 0f; } diff --git a/World/SmallBiomes.cs b/World/SmallBiomes.cs index 9cd1e09822..8ca6397570 100644 --- a/World/SmallBiomes.cs +++ b/World/SmallBiomes.cs @@ -42,12 +42,13 @@ namespace CalamityMod.World int genLimit = x / 2; int generateBack = genLimit - 80; //Small = 2020 int generateForward = genLimit + 80; //Small = 2180 + double shrineChance = 100E-05; - for (int k = 0; k < (int)(x * y * 50E-05); k++) //Surface Shrine + for (int k = 0; k < (int)(x * y * shrineChance); k++) //Surface Shrine { - int tilesX = WorldGen.genRand.Next((int)(x * 0.3), generateBack); - int tilesX2 = WorldGen.genRand.Next(generateForward, (int)(x * 0.7)); - int tilesY = WorldGen.genRand.Next((int)(y * .3f), (int)(y * .35f)); + int tilesX = WorldGen.genRand.Next((int)(x * 0.35), generateBack); + int tilesX2 = WorldGen.genRand.Next(generateForward, (int)(x * 0.65)); + int tilesY = WorldGen.genRand.Next((int)(y * 0.3f), (int)(y * 0.35f)); if (Main.tile[tilesX, tilesY].type == TileID.Dirt || Main.tile[tilesX, tilesY].type == TileID.Stone) { @@ -61,10 +62,10 @@ namespace CalamityMod.World } } - for (int k = 0; k < (int)(x * y * 50E-05); k++) //Evil Shrine + for (int k = 0; k < (int)(x * y * shrineChance); k++) //Evil Shrine { int tilesX = WorldGen.genRand.Next(0, x); - int tilesY = WorldGen.genRand.Next((int)(y * .3f), (int)(y * .35f)); + int tilesY = WorldGen.genRand.Next((int)(y * 0.3f), (int)(y * 0.35f)); if (Main.tile[tilesX, tilesY].type == (WorldGen.crimson ? TileID.Crimstone : TileID.Ebonstone)) { @@ -75,11 +76,11 @@ namespace CalamityMod.World } } - for (int k = 0; k < (int)(x * y * 50E-05); k++) //Cavern Shrine + for (int k = 0; k < (int)(x * y * shrineChance); k++) //Cavern Shrine { int tilesX = WorldGen.genRand.Next((int)(x * 0.3), generateBack); int tilesX2 = WorldGen.genRand.Next(generateForward, (int)(x * 0.7)); - int tilesY = WorldGen.genRand.Next((int)(y * .55f), (int)(y * .8f)); + int tilesY = WorldGen.genRand.Next((int)(y * 0.55f), (int)(y * 0.8f)); if (Main.tile[tilesX, tilesY].type == TileID.Stone) { @@ -93,10 +94,10 @@ namespace CalamityMod.World } } - for (int k = 0; k < (int)(x * y * 50E-05); k++) //Ice Shrine + for (int k = 0; k < (int)(x * y * shrineChance); k++) //Ice Shrine { int tilesX = WorldGen.genRand.Next(0, x); - int tilesY = WorldGen.genRand.Next((int)(y * .35f), (int)(y * .5f)); + int tilesY = WorldGen.genRand.Next((int)(y * 0.35f), (int)(y * 0.5f)); if (Main.tile[tilesX, tilesY].type == TileID.IceBlock) { @@ -105,10 +106,10 @@ namespace CalamityMod.World } } - for (int k = 0; k < (int)(x * y * 50E-05); k++) //Desert Shrine + for (int k = 0; k < (int)(x * y * shrineChance); k++) //Desert Shrine { int tilesX = WorldGen.genRand.Next(0, x); - int tilesY = WorldGen.genRand.Next((int)(y * .35f), (int)(y * .5f)); + int tilesY = WorldGen.genRand.Next((int)(y * 0.3f), (int)(y * 0.5f)); if (Main.tile[tilesX, tilesY].type == TileID.DesertFossil) { @@ -117,10 +118,10 @@ namespace CalamityMod.World } } - for (int k = 0; k < (int)(x * y * 50E-05); k++) //Mushroom Shrine + for (int k = 0; k < (int)(x * y * shrineChance); k++) //Mushroom Shrine { int tilesX = WorldGen.genRand.Next(0, x); - int tilesY = WorldGen.genRand.Next((int)(y * .35f), (int)(y * .5f)); + int tilesY = WorldGen.genRand.Next((int)(y * 0.35f), (int)(y * 0.5f)); if (Main.tile[tilesX, tilesY].type == TileID.MushroomGrass) { @@ -129,10 +130,10 @@ namespace CalamityMod.World } } - for (int k = 0; k < (int)(x * y * 50E-05); k++) //Granite Shrine + for (int k = 0; k < (int)(x * y * shrineChance); k++) //Granite Shrine { int tilesX = WorldGen.genRand.Next(0, x); - int tilesY = WorldGen.genRand.Next((int)(y * .35f), (int)(y * .5f)); + int tilesY = WorldGen.genRand.Next((int)(y * 0.35f), (int)(y * 0.5f)); if (Main.tile[tilesX, tilesY].type == TileID.Granite) { @@ -141,10 +142,10 @@ namespace CalamityMod.World } } - for (int k = 0; k < (int)(x * y * 50E-05); k++) //Marble Shrine + for (int k = 0; k < (int)(x * y * shrineChance); k++) //Marble Shrine { int tilesX = WorldGen.genRand.Next(0, x); - int tilesY = WorldGen.genRand.Next((int)(y * .35f), (int)(y * .5f)); + int tilesY = WorldGen.genRand.Next((int)(y * 0.35f), (int)(y * 0.5f)); if (Main.tile[tilesX, tilesY].type == TileID.Marble) {