From 7a7ac06853f7f5f57405ecc1f13c2aecadcdf59e Mon Sep 17 00:00:00 2001 From: Andrew Marheine Date: Sat, 6 Jun 2020 21:32:43 -0500 Subject: [PATCH] 1 - NPC Banner Buffs now reduce the damage of projectiles fired by those respective NPCs. 2 - Life Steal regen rate lowered. 3 - Spikecrag minions have a 2 second delay before firing. 4 - Buffed Plaguebringer Goliath HP again. 5 - Astrum Deus timed DR works properly now, 1 minute phase 1 and 2 minute phase 2. 6 - Astrum Deus shouldn't fly off screen a long way anymore. 7 - Destroyer aggression at low HP needs testing since it's been adjusted again. 8 - Added multiple Astrum Deus projectile resists. 9 - Astrum Deus lasers now go through tiles until they've reacher their target location. 10 - Astrum Deus mines now spread out for a short time after being fired. 11 - Removed the Spectre Heal and Vampire Knife Heal nerfs so they don't conflict with the new life steal change. 12 - Added ClampToWorld function from 1.4 to CalamityUtils. 13 - Added hornet variants that were missing to the hornetList. --- CalPlayer/CalamityPlayer.cs | 592 +++++++++++++++++- CalPlayer/CalamityPlayerMiscEffects.cs | 15 +- CalamityMod.cs | 20 +- Items/Weapons/Summon/SpikecragStaff.cs | 2 +- NPCs/CalamityAI.cs | 45 +- NPCs/CalamityGlobalAI.cs | 8 +- NPCs/CalamityGlobalNPC.cs | 25 +- NPCs/NormalNPCs/ArmoredDiggerBody.cs | 2 +- NPCs/NormalNPCs/IceClasper.cs | 2 +- .../PlaguebringerGoliath.cs | 2 +- Projectiles/Boss/AstralShot2.cs | 14 +- Projectiles/Boss/DeusMine.cs | 34 +- Projectiles/CalamityGlobalProjectile.cs | 3 + Projectiles/Enemy/AstralShot.cs | 102 --- Projectiles/Enemy/AstralShot.png | Bin 153 -> 0 bytes Projectiles/Summon/Spikecrag.cs | 21 +- Utilities/CalamityUtils.cs | 10 + 17 files changed, 715 insertions(+), 182 deletions(-) delete mode 100644 Projectiles/Enemy/AstralShot.cs delete mode 100644 Projectiles/Enemy/AstralShot.png diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 72962abe04..8c8a283332 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -17,16 +17,24 @@ using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Summon; using CalamityMod.NPCs; using CalamityMod.NPCs.Abyss; +using CalamityMod.NPCs.AcidRain; +using CalamityMod.NPCs.Astral; using CalamityMod.NPCs.Calamitas; +using CalamityMod.NPCs.Crags; using CalamityMod.NPCs.DevourerofGods; +using CalamityMod.NPCs.GreatSandShark; using CalamityMod.NPCs.Leviathan; using CalamityMod.NPCs.NormalNPCs; using CalamityMod.NPCs.PlaguebringerGoliath; +using CalamityMod.NPCs.Polterghast; using CalamityMod.NPCs.Providence; +using CalamityMod.NPCs.StormWeaver; +using CalamityMod.NPCs.SulphurousSea; using CalamityMod.NPCs.SunkenSea; using CalamityMod.NPCs.SupremeCalamitas; using CalamityMod.NPCs.Yharon; using CalamityMod.Projectiles.Boss; +using CalamityMod.Projectiles.Enemy; using CalamityMod.Projectiles.Environment; using CalamityMod.Projectiles.Melee; using CalamityMod.Projectiles.Ranged; @@ -5752,17 +5760,17 @@ namespace CalamityMod.CalPlayer } } } - #endregion + #endregion - #region Modify Hit By NPC - public override void ModifyHitByNPC(NPC npc, ref int damage, ref bool crit) - { - int bossRushDamage = (Main.expertMode ? 500 : 300) + (CalamityWorld.bossRushStage * 2); - if (CalamityWorld.bossRushActive) - { - if (damage < bossRushDamage) - damage = bossRushDamage; - } + #region Modify Hit By NPC + public override void ModifyHitByNPC(NPC npc, ref int damage, ref bool crit) + { + int bossRushDamage = (Main.expertMode ? 500 : 300) + (CalamityWorld.bossRushStage * 2); + if (CalamityWorld.bossRushActive) + { + if (damage < bossRushDamage) + damage = bossRushDamage; + } if (areThereAnyDamnBosses && CalamityMod.bossVelocityDamageScaleValues.ContainsKey(npc.type)) { @@ -5805,25 +5813,38 @@ namespace CalamityMod.CalPlayer player.AddBuff(ModContent.BuffType(), 1200, false); //20 seconds damage /= 2; } + if (tarragonCloak && !tarragonCloakCooldown && tarraMelee) { damage /= 2; } + if (bloodflareMelee && bloodflareFrenzy && !bloodFrenzyCooldown) { damage /= 2; } + if (silvaMelee && silvaCountdown <= 0 && hasSilvaEffect) { damage = (int)(damage * 0.8); } + if (aBulwarkRare) { aBulwarkRareMeleeBoostTimer += 3 * damage; if (aBulwarkRareMeleeBoostTimer > 900) aBulwarkRareMeleeBoostTimer = 900; } - if (player.whoAmI == Main.myPlayer && gainRageCooldown <= 0) + + if (Main.hardMode && Main.expertMode) + { + bool reduceChaosBallDamage = npc.type == NPCID.ChaosBall && !NPC.AnyNPCs(NPCID.GoblinSummoner); + + if (reduceChaosBallDamage || npc.type == NPCID.BurningSphere || npc.type == NPCID.WaterSphere) + damage = (int)(damage * 0.6); + } + + if (player.whoAmI == Main.myPlayer && gainRageCooldown <= 0) { if (CalamityWorld.revenge && CalamityConfig.Instance.Rippers && !npc.SpawnedFromStatue) { @@ -5873,37 +5894,90 @@ namespace CalamityMod.CalPlayer damage = 0; } } + + // Reduce projectile damage based on banner type + // IMPORTANT NOTE: Rework this in 1.4! + Point point = player.Center.ToTileCoordinates(); + int buffScanAreaWidth = (Main.maxScreenW + 800) / 16 - 1; + int buffScanAreaHeight = (Main.maxScreenH + 800) / 16 - 1; + Rectangle rectangle = CalamityUtils.ClampToWorld(tileRectangle: new Rectangle(point.X - buffScanAreaWidth / 2, point.Y - buffScanAreaHeight / 2, buffScanAreaWidth, buffScanAreaHeight)); + bool[] NPCBannerBuff = new bool[Main.MaxBannerTypes]; + bool hasBanner = false; + + // Scan area around the player for banners + for (int i = rectangle.Left; i < rectangle.Right; i++) + { + for (int j = rectangle.Top; j < rectangle.Bottom; j++) + { + if (!rectangle.Contains(i, j)) + continue; + + Tile tile = Main.tile[i, j]; + if (tile == null || !tile.active()) + continue; + + if (tile.type == TileID.Banners && (tile.frameX >= 396 || tile.frameY >= 54)) + { + int bannerType = tile.frameX / 18 - 21; + for (int k = tile.frameY; k >= 54; k -= 54) + { + bannerType += 90; + bannerType += 21; + } + + int bannerItemType = Item.BannerToItem(bannerType); + if (ItemID.Sets.BannerStrength[bannerItemType].Enabled) + { + NPCBannerBuff[bannerType] = true; + hasBanner = true; + } + } + } + } + + // Reduce damage + if (hasBanner) + { + BannerProjectileDamageReduction(proj, ref damage, NPCBannerBuff); + } + int bossRushDamage = (Main.expertMode ? 125 : 150) + (CalamityWorld.bossRushStage / 2); if (CalamityWorld.bossRushActive) { if (damage < bossRushDamage) damage = bossRushDamage; } + if (projRefRare) { if (proj.type == projTypeJustHitBy) damage = (int)(damage * 0.85); } + if (aSparkRare) { if (proj.type == ProjectileID.MartianTurretBolt || proj.type == ProjectileID.GigaZapperSpear || proj.type == ProjectileID.CultistBossLightningOrbArc || proj.type == ModContent.ProjectileType() || proj.type == ProjectileID.BulletSnowman || proj.type == ProjectileID.BulletDeadeye || proj.type == ProjectileID.SniperBullet) damage /= 2; } + if (proj.type == ProjectileID.Nail) { damage = (int)(damage * 0.75); } + if (beeResist) { if (CalamityMod.beeProjectileList.Contains(proj.type)) damage = (int)(damage * 0.75); } + if (Main.hardMode && Main.expertMode && !CalamityWorld.spawnedHardBoss && proj.active && !proj.friendly && proj.hostile && damage > 0) { if (CalamityMod.hardModeNerfList.Contains(proj.type)) damage = (int)(damage * 0.75); } + if (CalamityWorld.revenge) { double damageMultiplier = 1D; @@ -5971,10 +6045,500 @@ namespace CalamityMod.CalPlayer } } } - #endregion + #endregion - #region On Hit - public override void OnHitByNPC(NPC npc, int damage, bool crit) + #region Banner Projectile Damage Reduction + private void BannerProjectileDamageReduction(Projectile proj, ref int damage, bool[] NPCBannerBuffs) + { + bool? reduceDamage = null; + double bannerDamageMultiplier = Main.expertMode ? 0.5 : 0.75; + + for (int l = 0; l < Main.MaxBannerTypes; l++) + { + int bannerNPCType = Item.BannerToNPC(l); + if (bannerNPCType != 0 && NPCBannerBuffs[l]) + { + if (proj.type == ModContent.ProjectileType()) + { + if (bannerNPCType == ModContent.NPCType()) + reduceDamage = true; + } + else if (proj.type == ModContent.ProjectileType()) + { + if (bannerNPCType == ModContent.NPCType()) + reduceDamage = true; + } + else if (proj.type == ModContent.ProjectileType() || proj.type == ModContent.ProjectileType()) + { + if (bannerNPCType == ModContent.NPCType()) + reduceDamage = true; + } + else if (proj.type == ModContent.ProjectileType()) + { + if (bannerNPCType == ModContent.NPCType()) + reduceDamage = true; + } + else if (proj.type == ModContent.ProjectileType()) + { + if (bannerNPCType == ModContent.NPCType()) + reduceDamage = true; + } + else if (proj.type == ModContent.ProjectileType() || proj.type == ModContent.ProjectileType()) + { + if (bannerNPCType == ModContent.NPCType()) + reduceDamage = true; + } + else if (proj.type == ModContent.ProjectileType()) + { + if (bannerNPCType == ModContent.NPCType()) + reduceDamage = true; + } + else if (proj.type == ModContent.ProjectileType() || proj.type == ModContent.ProjectileType() || proj.type == ModContent.ProjectileType() || proj.type == ModContent.ProjectileType()) + { + if (bannerNPCType == ModContent.NPCType()) + reduceDamage = true; + } + else if (proj.type == ModContent.ProjectileType()) + { + if (bannerNPCType == ModContent.NPCType()) + reduceDamage = true; + } + else if (proj.type == ModContent.ProjectileType()) + { + if (bannerNPCType == ModContent.NPCType()) + reduceDamage = true; + } + else if (proj.type == ModContent.ProjectileType()) + { + if (bannerNPCType == ModContent.NPCType()) + reduceDamage = true; + } + else if (proj.type == ModContent.ProjectileType() || proj.type == ModContent.ProjectileType()) + { + if (bannerNPCType == ModContent.NPCType()) + reduceDamage = true; + } + else if (proj.type == ModContent.ProjectileType()) + { + if (bannerNPCType == ModContent.NPCType()) + reduceDamage = true; + } + else if (proj.type == ModContent.ProjectileType() || proj.type == ModContent.ProjectileType()) + { + if (bannerNPCType == ModContent.NPCType()) + reduceDamage = true; + } + else if (proj.type == ModContent.ProjectileType() || proj.type == ModContent.ProjectileType()) + { + if (bannerNPCType == ModContent.NPCType() || (bannerNPCType == ModContent.NPCType() && proj.type == ModContent.ProjectileType())) + reduceDamage = true; + } + else if (proj.type == ModContent.ProjectileType()) + { + if (bannerNPCType == ModContent.NPCType()) + reduceDamage = true; + } + else if (proj.type == ModContent.ProjectileType()) + { + if (bannerNPCType == ModContent.NPCType()) + reduceDamage = true; + } + else if (proj.type == ModContent.ProjectileType() || proj.type == ModContent.ProjectileType()) + { + if (bannerNPCType == ModContent.NPCType()) + reduceDamage = !NPC.AnyNPCs(ModContent.NPCType()) && !NPC.AnyNPCs(ModContent.NPCType()); + } + else if (proj.type == ModContent.ProjectileType()) + { + if (bannerNPCType == ModContent.NPCType()) + reduceDamage = true; + } + else if (proj.type == ModContent.ProjectileType()) + { + if (bannerNPCType == ModContent.NPCType()) + reduceDamage = !NPC.AnyNPCs(ModContent.NPCType()); + } + else if (proj.type == ModContent.ProjectileType()) + { + if (bannerNPCType == ModContent.NPCType() || bannerNPCType == ModContent.NPCType()) + reduceDamage = !NPC.AnyNPCs(ModContent.NPCType()); + } + else if (proj.type == ModContent.ProjectileType()) + { + if (bannerNPCType == ModContent.NPCType()) + reduceDamage = !NPC.AnyNPCs(ModContent.NPCType()); + } + else if (proj.type == ModContent.ProjectileType() || proj.type == ModContent.ProjectileType()) + { + if (bannerNPCType == ModContent.NPCType()) + reduceDamage = !NPC.AnyNPCs(ModContent.NPCType()); + } + else if (proj.type == ProjectileID.EyeBeam) + { + if (bannerNPCType == ModContent.NPCType()) + reduceDamage = !NPC.AnyNPCs(NPCID.Golem); + } + else if (proj.type == ProjectileID.CultistBossIceMist || proj.type == ProjectileID.CultistBossLightningOrbArc) + { + if (bannerNPCType == ModContent.NPCType() || bannerNPCType == ModContent.NPCType()) + reduceDamage = !NPC.AnyNPCs(ModContent.NPCType()) && !NPC.AnyNPCs(ModContent.NPCType()) && !NPC.AnyNPCs(NPCID.CultistBoss); + } + else if (proj.type == ProjectileID.SaucerScrap) + { + if (bannerNPCType == ModContent.NPCType()) + reduceDamage = Main.invasionType != InvasionID.MartianMadness; + } + else + { + switch (proj.type) + { + case ProjectileID.Stinger: + if (CalamityMod.hornetList.Contains(bannerNPCType) || CalamityMod.mossHornetList.Contains(bannerNPCType)) + { + reduceDamage = !NPC.AnyNPCs(NPCID.QueenBee); + } + break; + + case ProjectileID.PinkLaser: + if (bannerNPCType == NPCID.Gastropod || bannerNPCType == ModContent.NPCType()) + { + reduceDamage = !NPC.AnyNPCs(NPCID.TheDestroyer) && !NPC.AnyNPCs(ModContent.NPCType()) && !NPC.AnyNPCs(ModContent.NPCType()) && !NPC.AnyNPCs(ModContent.NPCType()); + } + break; + + case ProjectileID.SandBallFalling: + if (bannerNPCType == NPCID.Antlion) + { + reduceDamage = true; + } + break; + + case ProjectileID.DemonSickle: + if (bannerNPCType == NPCID.Demon || bannerNPCType == NPCID.VoodooDemon) + { + reduceDamage = true; + } + break; + + case ProjectileID.HarpyFeather: + if (bannerNPCType == NPCID.Harpy) + { + reduceDamage = true; + } + break; + + case ProjectileID.JavelinHostile: + if (bannerNPCType == NPCID.GreekSkeleton) + { + reduceDamage = true; + } + break; + + case ProjectileID.IceSpike: + if (bannerNPCType == NPCID.SpikedIceSlime) + { + reduceDamage = true; + } + break; + + case ProjectileID.JungleSpike: + if (bannerNPCType == NPCID.SpikedJungleSlime) + { + reduceDamage = true; + } + break; + + case ProjectileID.WebSpit: + if (bannerNPCType == NPCID.BlackRecluse || bannerNPCType == NPCID.BlackRecluseWall) + { + reduceDamage = true; + } + break; + + case ProjectileID.CursedFlameHostile: + if (bannerNPCType == NPCID.Clinger) + { + reduceDamage = !NPC.AnyNPCs(NPCID.Spazmatism); + } + break; + + case ProjectileID.DesertDjinnCurse: + if (bannerNPCType == NPCID.DesertDjinn) + { + reduceDamage = true; + } + break; + + case ProjectileID.InfernoHostileBlast: + case ProjectileID.InfernoHostileBolt: + if (bannerNPCType == NPCID.DiabolistRed || bannerNPCType == NPCID.DiabolistWhite) + { + reduceDamage = true; + } + break; + + case ProjectileID.Shadowflames: + if (bannerNPCType == NPCID.GiantCursedSkull) + { + reduceDamage = true; + } + break; + + case ProjectileID.FrostBlastHostile: + if (bannerNPCType == NPCID.IceElemental || bannerNPCType == ModContent.NPCType()) + { + reduceDamage = true; + } + break; + + case ProjectileID.IcewaterSpit: + if (bannerNPCType == NPCID.IcyMerman) + { + reduceDamage = true; + } + break; + + case ProjectileID.GoldenShowerHostile: + if (bannerNPCType == NPCID.IchorSticker) + { + reduceDamage = true; + } + break; + + case ProjectileID.ShadowBeamHostile: + if (bannerNPCType == NPCID.Necromancer || bannerNPCType == NPCID.NecromancerArmored) + { + reduceDamage = true; + } + break; + + case ProjectileID.PaladinsHammerHostile: + if (bannerNPCType == NPCID.Paladin) + { + reduceDamage = true; + } + break; + + case ProjectileID.LostSoulHostile: + if (bannerNPCType == NPCID.RaggedCaster || bannerNPCType == NPCID.RaggedCasterOpenCoat) + { + reduceDamage = true; + } + break; + + case ProjectileID.UnholyTridentHostile: + if (bannerNPCType == NPCID.RedDevil) + { + reduceDamage = true; + } + break; + + case ProjectileID.RuneBlast: + if (bannerNPCType == NPCID.RuneWizard) + { + reduceDamage = true; + } + break; + + case ProjectileID.FlamingArrow: + if (bannerNPCType == NPCID.SkeletonArcher || bannerNPCType == NPCID.PirateCrossbower || bannerNPCType == NPCID.GoblinArcher || bannerNPCType == NPCID.ElfArcher) + { + reduceDamage = true; + } + break; + + case ProjectileID.RocketSkeleton: + if (bannerNPCType == NPCID.SkeletonCommando) + { + reduceDamage = !NPC.AnyNPCs(NPCID.SkeletronPrime) || !CalamityWorld.revenge; + } + break; + + case ProjectileID.SniperBullet: + if (bannerNPCType == NPCID.SkeletonSniper) + { + reduceDamage = true; + } + break; + + case ProjectileID.BulletDeadeye: + if (bannerNPCType == NPCID.TacticalSkeleton || bannerNPCType == NPCID.SnowmanGangsta || bannerNPCType == NPCID.PirateCaptain || bannerNPCType == NPCID.PirateDeadeye || bannerNPCType == NPCID.ElfCopter) + { + reduceDamage = !NPC.AnyNPCs(NPCID.SantaNK1); + } + break; + + case ProjectileID.RainNimbus: + if (bannerNPCType == NPCID.AngryNimbus) + { + reduceDamage = true; + } + break; + + case ProjectileID.FrostBeam: + if (bannerNPCType == NPCID.IceGolem) + { + reduceDamage = true; + } + break; + + case ProjectileID.SandnadoHostile: + case ProjectileID.SandnadoHostileMark: + if (bannerNPCType == NPCID.SandElemental) + { + reduceDamage = true; + } + break; + + case ProjectileID.SnowBallHostile: + if (bannerNPCType == NPCID.SnowBalla) + { + reduceDamage = true; + } + break; + + case ProjectileID.CannonballHostile: + if (bannerNPCType == NPCID.PirateCaptain) + { + reduceDamage = !NPC.AnyNPCs(NPCID.PirateShip); + } + break; + + case ProjectileID.DrManFlyFlask: + if (bannerNPCType == NPCID.DrManFly) + { + reduceDamage = true; + } + break; + + case ProjectileID.EyeLaser: + if (bannerNPCType == NPCID.Eyezor) + { + reduceDamage = !NPC.AnyNPCs(NPCID.Retinazer); + } + break; + + case ProjectileID.Nail: + if (bannerNPCType == NPCID.Nailhead) + { + reduceDamage = true; + } + break; + + case ProjectileID.NebulaSphere: + if (bannerNPCType == NPCID.NebulaBeast) + { + reduceDamage = true; + } + break; + + case ProjectileID.NebulaLaser: + if (bannerNPCType == NPCID.NebulaBrain) + { + reduceDamage = true; + } + break; + + case ProjectileID.NebulaBolt: + if (bannerNPCType == NPCID.NebulaSoldier) + { + reduceDamage = true; + } + break; + + case ProjectileID.StardustJellyfishSmall: + if (bannerNPCType == NPCID.StardustJellyfishBig) + { + reduceDamage = true; + } + break; + + case ProjectileID.StardustSoldierLaser: + if (bannerNPCType == NPCID.StardustSoldier) + { + reduceDamage = true; + } + break; + + case ProjectileID.VortexAcid: + if (bannerNPCType == NPCID.VortexHornetQueen) + { + reduceDamage = true; + } + break; + + case ProjectileID.VortexLaser: + if (bannerNPCType == NPCID.VortexRifleman) + { + reduceDamage = true; + } + break; + + case ProjectileID.VortexLightning: + if (bannerNPCType == NPCID.VortexSoldier) + { + reduceDamage = true; + } + break; + + case ProjectileID.RayGunnerLaser: + if (bannerNPCType == NPCID.RayGunner) + { + reduceDamage = true; + } + break; + + case ProjectileID.BrainScramblerBolt: + if (bannerNPCType == NPCID.BrainScrambler) + { + reduceDamage = true; + } + break; + + case ProjectileID.MartianWalkerLaser: + if (bannerNPCType == NPCID.MartianWalker) + { + reduceDamage = true; + } + break; + + case ProjectileID.ScutlixLaser: + if (bannerNPCType == NPCID.Scutlix) + { + reduceDamage = true; + } + break; + + case ProjectileID.MartianTurretBolt: + if ((bannerNPCType == NPCID.MartianTurret && Main.invasionType == InvasionID.MartianMadness) || (bannerNPCType == ModContent.NPCType() && Main.invasionType != InvasionID.MartianMadness)) + { + reduceDamage = true; + } + break; + + case ProjectileID.SaucerLaser: + if (bannerNPCType == ModContent.NPCType() && Main.invasionType != InvasionID.MartianMadness) + { + reduceDamage = true; + } + break; + } + } + + if (reduceDamage.HasValue) + { + if (reduceDamage.Value) + damage = (int)(damage * bannerDamageMultiplier); + + break; + } + } + } + } + #endregion + + #region On Hit + public override void OnHitByNPC(NPC npc, int damage, bool crit) { if (sulfurSet) npc.AddBuff(BuffID.Poisoned, 120); diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index 393c2b1b26..a426dfed80 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -155,9 +155,10 @@ namespace CalamityMod.CalPlayer } } - // Life Steal nerf - if (player.lifeSteal > (CalamityWorld.death ? 50f : 60f)) - player.lifeSteal = CalamityWorld.death ? 50f : 60f; + // Adjusts the life steal cap in rev/death + float lifeStealCap = CalamityWorld.death ? 50f : 60f; + if (player.lifeSteal > lifeStealCap) + player.lifeSteal = lifeStealCap; if (player.whoAmI == Main.myPlayer) { @@ -367,6 +368,14 @@ namespace CalamityMod.CalPlayer (modPlayer.cShard ? 50 : 0) + (modPlayer.starBeamRye ? 50 : 0); + // Life Steal nerf + // Reduces normal mode life steal recovery rate from 0.6/s to 0.5/s + // Reduces expert mode life steal recovery rate from 0.5/s to 0.35/s + // Revengeance mode recovery rate is 0.3/s + // Death mode recovery rate is 0.25/s + float lifeStealCooldown = CalamityWorld.death ? 0.25f : CalamityWorld.revenge ? 0.2f : Main.expertMode ? 0.15f : 0.1f; + player.lifeSteal -= lifeStealCooldown; + // Nebula Armor nerf if (player.nebulaLevelMana > 0 && player.statMana < player.statManaMax2) { diff --git a/CalamityMod.cs b/CalamityMod.cs index 717d20194b..c4869db4a4 100644 --- a/CalamityMod.cs +++ b/CalamityMod.cs @@ -2423,7 +2423,19 @@ namespace CalamityMod hornetList = new List() { - NPCID.Hornet, + NPCID.BigHornetStingy, + NPCID.LittleHornetStingy, + NPCID.BigHornetSpikey, + NPCID.LittleHornetSpikey, + NPCID.BigHornetLeafy, + NPCID.LittleHornetLeafy, + NPCID.BigHornetHoney, + NPCID.LittleHornetHoney, + NPCID.BigHornetFatty, + NPCID.LittleHornetFatty, + NPCID.BigStinger, + NPCID.LittleStinger, + NPCID.Hornet, NPCID.HornetFatty, NPCID.HornetHoney, NPCID.HornetLeafy, @@ -2777,9 +2789,9 @@ namespace CalamityMod { ModContent.NPCType(), 10800 }, { ModContent.NPCType(), 10800 }, { ModContent.NPCType(), 10800 }, - { ModContent.NPCType(), 5400 }, - { ModContent.NPCType(), 5400 }, - { ModContent.NPCType(), 5400 }, + { ModContent.NPCType(), 7200 }, + { ModContent.NPCType(), 7200 }, + { ModContent.NPCType(), 7200 }, { ModContent.NPCType(), 10800 }, { ModContent.NPCType(), 10800 }, { ModContent.NPCType(), 5400 }, diff --git a/Items/Weapons/Summon/SpikecragStaff.cs b/Items/Weapons/Summon/SpikecragStaff.cs index 2c9a751206..4e076e9e8b 100644 --- a/Items/Weapons/Summon/SpikecragStaff.cs +++ b/Items/Weapons/Summon/SpikecragStaff.cs @@ -41,7 +41,7 @@ namespace CalamityMod.Items.Weapons.Summon position = Main.MouseWorld; speedX = 0; speedY = 0; - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 120f, 0f); player.UpdateMaxTurrets(); } return false; diff --git a/NPCs/CalamityAI.cs b/NPCs/CalamityAI.cs index 486dcb1d1e..b3e2d381a3 100644 --- a/NPCs/CalamityAI.cs +++ b/NPCs/CalamityAI.cs @@ -2734,6 +2734,12 @@ namespace CalamityMod.NPCs bool death = CalamityWorld.death || CalamityWorld.bossRushActive; bool enraged = calamityGlobalNPC.enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive); + // Deus cannot hit for 3 seconds + if (calamityGlobalNPC.newAI[1] < 180f) + npc.damage = 0; + else + npc.damage = npc.defDamage; + // 8 seconds of reistance to prevent spawn killing if (calamityGlobalNPC.newAI[1] < 480f) calamityGlobalNPC.newAI[1] += 1f; @@ -2756,6 +2762,13 @@ namespace CalamityMod.NPCs bool phase4 = lifeRatio < 0.5f && doubleWormPhase && expertMode; bool phase5 = lifeRatio < 0.2f && doubleWormPhase && expertMode; + // Set timed DR + if (!doubleWormPhase) + { + if (calamityGlobalNPC.AITimer < 3600) + calamityGlobalNPC.AITimer = 3600; + } + // Flight timer float aiSwitchTimer = doubleWormPhase ? 1200f : 1800f; calamityGlobalNPC.newAI[3] += 1f; @@ -3024,22 +3037,21 @@ namespace CalamityMod.NPCs fallSpeed += fallSpeedBoost; // Speed and movement - float speedBoost = death ? (targetFloatingUp ? 0.2f : 0.1f) : ((targetFloatingUp ? 0.2f : 0.1f) * (1f - lifeRatio)); - float turnSpeedBoost = death ? (targetFloatingUp ? 0.3f : 0.15f) : ((targetFloatingUp ? 0.3f : 0.15f) * (1f - lifeRatio)); - float speed = 0.1f + speedBoost; - float turnSpeed = 0.15f + turnSpeedBoost; + float speedBoost = death ? (targetFloatingUp ? 0.26f : 0.13f) : ((targetFloatingUp ? 0.26f : 0.13f) * (1f - lifeRatio)); + float turnSpeedBoost = death ? (targetFloatingUp ? 0.4f : 0.2f) : ((targetFloatingUp ? 0.4f : 0.2f) * (1f - lifeRatio)); + float speed = 0.13f + speedBoost; + float turnSpeed = 0.2f + turnSpeedBoost; if (flyAtTarget) { - float speedMultiplier = phase5 ? 1.3f : phase4 ? 1.15f : 1f; + float speedMultiplier = phase5 ? 2f : phase4 ? 1.75f : 1.5f; speed *= speedMultiplier; - turnSpeed *= speedMultiplier; } if (CalamityWorld.bossRushActive) { - speed *= 1.5f; - turnSpeed *= 1.5f; + speed *= 1.25f; + turnSpeed *= 1.25f; } Vector2 vector3 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); @@ -3085,18 +3097,6 @@ namespace CalamityMod.NPCs } else { - if (npc.soundDelay == 0) - { - float num24 = num22 / 40f; - if (num24 < 10f) - num24 = 10f; - if (num24 > 20f) - num24 = 20f; - - npc.soundDelay = (int)num24; - Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 1, 1f, 0f); - } - num22 = (float)Math.Sqrt(num20 * num20 + num21 * num21); float num25 = Math.Abs(num20); float num26 = Math.Abs(num21); @@ -3249,8 +3249,9 @@ namespace CalamityMod.NPCs if (npc.localAI[0] % divisor == 0f && npc.ai[0] % 2f == 0f) { npc.TargetClosest(true); - if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height) && Vector2.Distance(player.Center, npc.Center) > 80f) + if (Vector2.Distance(player.Center, npc.Center) > 80f) { + Main.PlaySound(SoundID.Item12, npc.Center); float num941 = revenge ? 14f : 13f; if (CalamityWorld.bossRushActive) { @@ -3275,7 +3276,7 @@ namespace CalamityMod.NPCs int num946 = ModContent.ProjectileType(); vector104.X += num942 * 5f; vector104.Y += num943 * 5f; - Projectile.NewProjectile(vector104.X, vector104.Y, num942, num943, num946, num945, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(vector104.X, vector104.Y, num942, num943, num946, num945, 0f, Main.myPlayer, player.Center.X, player.Center.Y); npc.netUpdate = true; } } diff --git a/NPCs/CalamityGlobalAI.cs b/NPCs/CalamityGlobalAI.cs index 2ccb630edd..646e343af5 100644 --- a/NPCs/CalamityGlobalAI.cs +++ b/NPCs/CalamityGlobalAI.cs @@ -4710,16 +4710,14 @@ namespace CalamityMod.NPCs if (flyAtTarget) { - float speedMultiplier = phase5 ? 1.3f : phase4 ? 1.15f : 1f; + float speedMultiplier = phase5 ? 2f : phase4 ? 1.75f : 1.5f; speed *= speedMultiplier; - turnSpeed *= speedMultiplier; - fallSpeed *= speedMultiplier; } if (CalamityWorld.bossRushActive) { - speed *= 1.5f; - turnSpeed *= 1.5f; + speed *= 1.25f; + turnSpeed *= 1.25f; } Vector2 vector3 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 563cf4e0fd..40758b20d3 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -3554,7 +3554,8 @@ namespace CalamityMod.NPCs GrenadeResist(projectile, ref damage); PierceResistGlobal(projectile, ref damage); - /*if (projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileType() || ProjectileID.Sets.StardustDragon[projectile.type]) + // Old resists + /*if (projectile.type == ProjectileType()) { damage = (int)(damage * 0.1); } @@ -3562,22 +3563,28 @@ namespace CalamityMod.NPCs { damage = (int)(damage * 0.2); } - else if (projectile.type == ProjectileID.Wasp || projectile.type == player.beeType() || projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileID.DD2BetsyArrow) + else if (projectile.type == player.beeType() || projectile.type == ProjectileType()) + { + damage = (int)(damage * 0.4); + }*/ + + // New resists + if (projectile.type == ProjectileType() || projectile.type == ProjectileType()) + { + damage = (int)(damage * 0.2); + } + else if (ProjectileID.Sets.StardustDragon[projectile.type] || projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileID.Electrosphere) { damage = (int)(damage * 0.4); } - else if (projectile.type == ProjectileType() || projectile.type == ProjectileType()) + else if (projectile.type == ProjectileType()) { damage = (int)(damage * 0.5); } - else if (projectile.type == ProjectileType() || projectile.type == ProjectileType()) + else if (projectile.type == ProjectileType() || projectile.type == ProjectileID.DD2BetsyArrow || projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileID.ChargedBlasterLaser) { - damage = (int)(damage * 0.6); + damage = (int)(damage * 0.75); } - else if (projectile.type == ProjectileType()) - { - damage = (int)(damage * 0.85); - }*/ } else if (StormWeaverIDs.Contains(npc.type)) { diff --git a/NPCs/NormalNPCs/ArmoredDiggerBody.cs b/NPCs/NormalNPCs/ArmoredDiggerBody.cs index 7fa78fa144..9b6eb621cc 100644 --- a/NPCs/NormalNPCs/ArmoredDiggerBody.cs +++ b/NPCs/NormalNPCs/ArmoredDiggerBody.cs @@ -90,7 +90,7 @@ namespace CalamityMod.NPCs.NormalNPCs num6 *= num8; num7 *= num8; int num9 = 30; - int num10 = 450; + int num10 = ProjectileID.SaucerScrap; vector.X += num6 * 5f; vector.Y += num7 * 5f; Projectile.NewProjectile(vector.X, vector.Y, num6, num7, num10, num9, 0f, Main.myPlayer, 0f, 0f); diff --git a/NPCs/NormalNPCs/IceClasper.cs b/NPCs/NormalNPCs/IceClasper.cs index 3f5a1133fe..5b7ea7a5e1 100644 --- a/NPCs/NormalNPCs/IceClasper.cs +++ b/NPCs/NormalNPCs/IceClasper.cs @@ -138,7 +138,7 @@ namespace CalamityMod.NPCs.NormalNPCs { num8 = 25; } - int num9 = 128; + int num9 = ProjectileID.FrostBlastHostile; int beam = Projectile.NewProjectile(vector.X, vector.Y, num4, num5, num9, num8, 0f, Main.myPlayer, 0f, 0f); Main.projectile[beam].timeLeft = 300; } diff --git a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs index 04ef50a30f..bbe25d94fc 100644 --- a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs +++ b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs @@ -53,7 +53,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath npc.height = 198; npc.defense = 40; npc.DR_NERD(0.4f); - npc.LifeMaxNERB(67500, 88800, 3700000); + npc.LifeMaxNERB(81000, 106500, 3700000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.knockBackResist = 0f; diff --git a/Projectiles/Boss/AstralShot2.cs b/Projectiles/Boss/AstralShot2.cs index bc1812f7ac..2317658c5b 100644 --- a/Projectiles/Boss/AstralShot2.cs +++ b/Projectiles/Boss/AstralShot2.cs @@ -23,6 +23,7 @@ namespace CalamityMod.Projectiles.Boss projectile.height = 10; projectile.hostile = true; projectile.ignoreWater = true; + projectile.tileCollide = false; projectile.alpha = 255; projectile.penetrate = -1; projectile.timeLeft = 600; @@ -30,6 +31,10 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { + Vector2 targetLocation = new Vector2(projectile.ai[0], projectile.ai[1]); + if (Vector2.Distance(targetLocation, projectile.Center) < 80f) + projectile.tileCollide = true; + projectile.frameCounter++; if (projectile.frameCounter > 4) { @@ -40,11 +45,7 @@ namespace CalamityMod.Projectiles.Boss { projectile.frame = 0; } - if (projectile.ai[0] == 0f) - { - projectile.ai[0] = 1f; - Main.PlaySound(SoundID.Item, (int)projectile.position.X, (int)projectile.position.Y, 12); - } + if (projectile.alpha > 0) { projectile.alpha -= 25; @@ -53,7 +54,8 @@ namespace CalamityMod.Projectiles.Boss { projectile.alpha = 0; } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + + projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + 1.57f; } public override void OnHitPlayer(Player target, int damage, bool crit) diff --git a/Projectiles/Boss/DeusMine.cs b/Projectiles/Boss/DeusMine.cs index cb8412d2b5..0a9f97b793 100644 --- a/Projectiles/Boss/DeusMine.cs +++ b/Projectiles/Boss/DeusMine.cs @@ -44,12 +44,38 @@ namespace CalamityMod.Projectiles.Boss projectile.ai[1] = 1f; Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 33); } - int num8 = Main.expertMode ? 45 : 60; - if (projectile.timeLeft == 935) - projectile.damage = num8; + if (projectile.timeLeft < 85) projectile.damage = 0; - } + + if (projectile.timeLeft < 930) + return; + + float velocity = 0.1f; + for (int i = 0; i < Main.maxProjectiles; i++) + { + if (Main.projectile[i].active) + { + if (i != projectile.whoAmI && Main.projectile[i].type == projectile.type) + { + if (Vector2.Distance(projectile.Center, Main.projectile[i].Center) < 48f) + { + if (projectile.position.X < Main.projectile[i].position.X) + projectile.velocity.X -= velocity; + else + projectile.velocity.X += velocity; + + if (projectile.position.Y < Main.projectile[i].position.Y) + projectile.velocity.Y -= velocity; + else + projectile.velocity.Y += velocity; + } + else + projectile.velocity = Vector2.Zero; + } + } + } + } public override bool CanHitPlayer(Player target) { diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index a664be8030..780d09bfca 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -1149,6 +1149,8 @@ namespace CalamityMod.Projectiles if (Main.player[Main.myPlayer].lifeSteal > 0f && target.canGhostHeal && target.type != NPCID.TargetDummy && target.type != NPCType() && !player.moonLeech) { + // Commented out for now to test the global life steal nerf + /* // Increases the degree to which Spectre Healing set contributes to the lifesteal cap if (player.ghostHeal) { @@ -1170,6 +1172,7 @@ namespace CalamityMod.Projectiles Main.player[Main.myPlayer].lifeSteal -= num; } + */ if (modPlayer.vampiricTalisman && rogue && crit) { diff --git a/Projectiles/Enemy/AstralShot.cs b/Projectiles/Enemy/AstralShot.cs deleted file mode 100644 index f120d45fad..0000000000 --- a/Projectiles/Enemy/AstralShot.cs +++ /dev/null @@ -1,102 +0,0 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; - -namespace CalamityMod.Projectiles.Enemy -{ - public class AstralShot : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Laser"); - } - - public override void SetDefaults() - { - projectile.width = 5; - projectile.height = 5; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.extraUpdates = 3; - projectile.timeLeft = 90; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.5f / 255f, (255 - projectile.alpha) * 0f / 255f, (255 - projectile.alpha) * 0.2f / 255f); - if (projectile.ai[0] == 0f) - { - projectile.ai[0] = 1f; - Main.PlaySound(SoundID.Item, (int)projectile.position.X, (int)projectile.position.Y, 12); - } - if (projectile.alpha > 0) - { - projectile.alpha -= 25; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - float num55 = 30f; - float num56 = 1f; - 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 Color? GetAlpha(Color lightColor) - { - return new Color(255, 100, 255, 0); - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); - int num147 = 0; - int num148 = 0; - float num149 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f; - SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Rectangle value6 = new Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000); - if (projectile.getRect().Intersects(value6)) - { - 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 = 30f; - float scaleFactor = 1f; - 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; - Color color29 = projectile.GetAlpha(color25); - color29 *= (num162 - (float)num163) / num162; - color29.A = 0; - Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], value7 - value8, null, color29, projectile.rotation, new Vector2(num149, (float)(projectile.height / 2 + num147)), projectile.scale, spriteEffects, 0f); - } - } - return false; - } - } -} diff --git a/Projectiles/Enemy/AstralShot.png b/Projectiles/Enemy/AstralShot.png deleted file mode 100644 index d2fb806a1ade54757c6afa64cf1177b47bca477c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 153 zcmeAS@N?(olHy`uVBq!ia0vp^Y(UJ#0V1dK=^Fzn#^NA%Cx&(BWL^R}Ea{HEjtmSN z`?>!lvI6;>0X`wFKw50=za!uON9>+556IE;ba4!k2v2Tc+_?4szh;9erw_0!HDpls vxoV~Fw!z_oS%=yjs~3ul>@L5W8yOjleh6H6lB4hpsFT6d)z4*}Q$iB}N4zb4 diff --git a/Projectiles/Summon/Spikecrag.cs b/Projectiles/Summon/Spikecrag.cs index 712871697f..c047fb1e4f 100644 --- a/Projectiles/Summon/Spikecrag.cs +++ b/Projectiles/Summon/Spikecrag.cs @@ -28,6 +28,7 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { Player player = Main.player[projectile.owner]; + if (projectile.localAI[0] == 0f) { projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); @@ -36,7 +37,7 @@ namespace CalamityMod.Projectiles.Summon } if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + int damage2 = (int)(projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); projectile.damage = damage2; @@ -52,13 +53,19 @@ namespace CalamityMod.Projectiles.Summon { projectile.frame = 0; } - projectile.velocity.Y += 0.5f; + projectile.velocity.Y += 0.5f; if (projectile.velocity.Y > 10f) { projectile.velocity.Y = 10f; } + if (projectile.ai[0] > 0f) + { + projectile.ai[0] -= 1f; + return; + } + float maxDistance = 1000f; bool homeIn = false; @@ -74,13 +81,9 @@ namespace CalamityMod.Projectiles.Summon } } } - if (projectile.owner == Main.myPlayer && homeIn) + + if (projectile.owner == Main.myPlayer && homeIn) { - if (projectile.ai[0] != 0f) - { - projectile.ai[0] -= 1f; - return; - } projectile.ai[1] += 1f; if ((projectile.ai[1] % 10f) == 0f) { @@ -89,7 +92,7 @@ namespace CalamityMod.Projectiles.Summon { float velocityX = Main.rand.NextFloat(-10f, 10f); float velocityY = Main.rand.NextFloat(-15f, -8f); - Projectile.NewProjectile(projectile.oldPosition.X + (float)(projectile.width / 2), projectile.oldPosition.Y + (float)(projectile.height / 2), velocityX, velocityY, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.oldPosition.X + (projectile.width / 2), projectile.oldPosition.Y + (projectile.height / 2), velocityX, velocityY, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); } } } diff --git a/Utilities/CalamityUtils.cs b/Utilities/CalamityUtils.cs index 0a4d0b339c..c45913f70b 100644 --- a/Utilities/CalamityUtils.cs +++ b/Utilities/CalamityUtils.cs @@ -3135,6 +3135,16 @@ namespace CalamityMod } return (t - from) / (to - from); } + + // REMOVE THIS IN CALAMITY 1.4, it's a 1.4 World.cs function + public static Rectangle ClampToWorld(Rectangle tileRectangle) + { + int num = Math.Max(0, Math.Min(tileRectangle.Left, Main.maxTilesX)); + int num2 = Math.Max(0, Math.Min(tileRectangle.Top, Main.maxTilesY)); + int num3 = Math.Max(0, Math.Min(tileRectangle.Right, Main.maxTilesX)); + int num4 = Math.Max(0, Math.Min(tileRectangle.Bottom, Main.maxTilesY)); + return new Rectangle(num, num2, num3 - num, num4 - num2); + } #endregion } }