diff --git a/Buffs/Potions/PenumbraBuff.cs b/Buffs/Potions/PenumbraBuff.cs index 9aa3385d32..371d848858 100644 --- a/Buffs/Potions/PenumbraBuff.cs +++ b/Buffs/Potions/PenumbraBuff.cs @@ -8,8 +8,9 @@ namespace CalamityMod.Buffs.Potions public override void SetDefaults() { DisplayName.SetDefault("Penumbra"); - Description.SetDefault("Stealth regenerates at 10% speed while moving\n" + - "The boost increases to 20% at night and to 30% during an eclipse"); + Description.SetDefault("Stealth regenerates 15% faster while moving\n" + + "At night, stealth additionally regenerates 15% faster while standing still\n" + + "Both boosts increase to 20% during a solar eclipse"); Main.debuff[Type] = false; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = false; diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 50eb60c1c1..e07673a761 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -115,6 +115,7 @@ namespace CalamityMod.CalPlayer public double trueMeleeDamage = 0D; public double contactDamageReduction = 0D; public double projectileDamageReduction = 0D; + public bool brimlashBusterBoost = false; #endregion #region External variables -- Only set by Mod.Call @@ -164,7 +165,8 @@ namespace CalamityMod.CalPlayer public int ammoReductionRanged = 0; public int ammoReductionRogue = 0; public int armorPenetrationStat = 0; - public int wingFlightTimeStat = 0; + public float wingFlightTimeStat = 0f; + public float jumpSpeedStat = 0f; public int adrenalineChargeStat = 0; public int rageDamageStat = 0; public int moveSpeedStat = 0; @@ -195,9 +197,7 @@ namespace CalamityMod.CalPlayer public int tarraLifeAuraTimer = 0; public int bloodflareHeartTimer = 180; public int bloodflareManaTimer = 180; - public int moneyStolenByBandit = 0; public int polarisBoostCounter = 0; - public int reforges = 0; public int gaelSwipes = 0; public float modStealth = 1f; public float aquaticBoost = 1f; @@ -211,6 +211,7 @@ namespace CalamityMod.CalPlayer public int hurtSoundTimer = 0; public int danceOfLightCharge = 0; public int shadowPotCooldown = 0; + public int dogTextCooldown = 0; #endregion #region Sound @@ -464,6 +465,7 @@ namespace CalamityMod.CalPlayer public bool shadowMinions = false; public bool tearMinions = false; public bool alchFlask = false; + public bool reducedPlagueDmg = false; public bool abaddon = false; public bool community = false; public bool fleshTotem = false; @@ -488,6 +490,7 @@ namespace CalamityMod.CalPlayer public bool aquaticEmblem = false; public bool darkSunRing = false; public bool calamityRing = false; + public bool voidOfExtinction = false; public bool eArtifact = false; public bool dArtifact = false; public bool gArtifact = false; @@ -1073,8 +1076,6 @@ namespace CalamityMod.CalPlayer { "rogueLevel", rogueLevel }, { "exactRogueLevel", exactRogueLevel }, { "deathCount", deathCount }, - { "moneyStolenByBandit", moneyStolenByBandit }, - { "reforges", reforges }, { "deathModeUnderworldTime", deathModeUnderworldTime }, { "deathModeBlizzardTime", deathModeBlizzardTime } }; @@ -1131,8 +1132,13 @@ namespace CalamityMod.CalPlayer sCalDeathCount = tag.GetInt("sCalDeathCount"); sCalKillCount = tag.GetInt("sCalKillCount"); deathCount = tag.GetInt("deathCount"); - moneyStolenByBandit = tag.GetInt("moneyStolenByBandit"); - reforges = tag.GetInt("reforges"); + + // These two variables are no longer used, as the code was moved into CalamityWorld.cs to support multiplayer. + // As a result, their values are simply fed into a discard. + + _ = tag.GetInt("moneyStolenByBandit"); + _ = tag.GetInt("reforges"); + deathModeUnderworldTime = tag.GetInt("deathModeUnderworldTime"); deathModeBlizzardTime = tag.GetInt("deathModeBlizzardTime"); @@ -1156,8 +1162,13 @@ namespace CalamityMod.CalPlayer sCalDeathCount = reader.ReadInt32(); sCalKillCount = reader.ReadInt32(); deathCount = reader.ReadInt32(); - moneyStolenByBandit = reader.ReadInt32(); - reforges = reader.ReadInt32(); + + // These two variables are no longer used, as the code was moved into CalamityWorld.cs to support multiplayer. + // As a result, their values are simply fed into a discard. + + _ = reader.ReadInt32(); // moneyStolenByBandit + _ = reader.ReadInt32(); // reforges + deathModeUnderworldTime = reader.ReadInt32(); deathModeBlizzardTime = reader.ReadInt32(); @@ -1519,6 +1530,7 @@ namespace CalamityMod.CalPlayer shadowMinions = false; tearMinions = false; alchFlask = false; + reducedPlagueDmg = false; abaddon = false; community = false; stressPills = false; @@ -1536,6 +1548,7 @@ namespace CalamityMod.CalPlayer harpyWingBoost = false; //harpy wings + harpy ring darkSunRing = false; calamityRing = false; + voidOfExtinction = false; eArtifact = false; dArtifact = false; gArtifact = false; @@ -1954,6 +1967,7 @@ namespace CalamityMod.CalPlayer galileoCooldown = 0; soundCooldown = 0; shadowPotCooldown = 0; + dogTextCooldown = 0; rage = 0; adrenaline = 0; raiderStack = 0; @@ -1968,7 +1982,6 @@ namespace CalamityMod.CalPlayer acidRoundMultiplier = 1D; externalAbyssLight = 0; externalColdImmunity = externalHeatImmunity = false; - reforges = 0; polarisBoostCounter = 0; spectralVeilImmunity = 0; jetPackCooldown = 0; @@ -2283,6 +2296,7 @@ namespace CalamityMod.CalPlayer KameiBladeUseDelay = 0; lastProjectileHit = null; + brimlashBusterBoost = false; if (CalamityWorld.bossRushActive) { @@ -5194,26 +5208,19 @@ namespace CalamityMod.CalPlayer float num13 = target.position.X + (float)(target.width / 2) - vector.X; float num14 = target.position.Y + (float)(target.height / 2) - vector.Y; num13 += (float)Main.rand.Next(-100, 101); - float num15 = 25f; - int projectileType = Main.rand.Next(3); - if (projectileType == 0) - { - projectileType = ModContent.ProjectileType(); - } - else if (projectileType == 1) - { - projectileType = ProjectileID.HallowStar; - } - else - { - projectileType = ModContent.ProjectileType(); - } + float speed = 25f; + int projectileType = Utils.SelectRandom(Main.rand, new int[] + { + ModContent.ProjectileType(), + ProjectileID.HallowStar, + ModContent.ProjectileType() + }); float num16 = (float)Math.Sqrt((double)(num13 * num13 + num14 * num14)); - num16 = num15 / num16; + num16 = speed / num16; num13 *= num16; num14 *= num16; int num17 = Projectile.NewProjectile(x, y, num13, num14, projectileType, 120, 5f, player.whoAmI, 0f, 0f); - Main.projectile[num17].ranged = false; + Main.projectile[num17].Calamity().forceTypeless = true; } } if (bloodflareMelee && item.melee) @@ -5285,7 +5292,7 @@ namespace CalamityMod.CalPlayer return; bool isTrueMelee = proj.Calamity().trueMelee; - bool isSummon = proj.minion || proj.sentry || CalamityMod.projectileMinionList.Contains(proj.type) || ProjectileID.Sets.MinionShot[proj.type] || ProjectileID.Sets.SentryShot[proj.type]; + bool isSummon = proj.IsSummon(); bool hasClassType = proj.melee || proj.ranged || proj.magic || isSummon || proj.Calamity().rogue; Item heldItem = player.ActiveItem(); @@ -5538,20 +5545,24 @@ namespace CalamityMod.CalPlayer #endregion #region MultiplicativeReductions - // Fearmonger armor makes you immune to the summoner cross-class nerf - // Forbidden armor makes you immune when holding the respective helmet's preferred weapon type + // Fearmonger armor reduces the summoner cross-class nerf + // Forbidden armor reduces said nerf when holding the respective helmet's preferred weapon type // Profaned Soul Crystal encourages use of other weapons, nerfing the damage would not make sense. bool forbidden = player.head == ArmorIDs.Head.AncientBattleArmor && player.body == ArmorIDs.Body.AncientBattleArmor && player.legs == ArmorIDs.Legs.AncientBattleArmor; - if (isSummon && !fearmongerSet && !profanedCrystalBuffs && - (!forbidden || !heldItem.magic) && (!forbiddenCirclet || !heldItem.Calamity().rogue)) + bool reducedNerf = fearmongerSet || (forbidden && heldItem.magic) || (forbiddenCirclet && heldItem.Calamity().rogue); + double summonNerfMult = 0.5; + if (reducedNerf) + summonNerfMult = 0.75; + if (isSummon && !profanedCrystalBuffs) { if (heldItem.type > ItemID.None) { if (!heldItem.summon && (heldItem.melee || heldItem.ranged || heldItem.magic || heldItem.Calamity().rogue) && - heldItem.hammer == 0 && heldItem.pick == 0 && heldItem.axe == 0 && heldItem.useStyle != 0) + heldItem.hammer == 0 && heldItem.pick == 0 && heldItem.axe == 0 && heldItem.useStyle != 0 && + !heldItem.accessory && heldItem.ammo == AmmoID.None) { - damage = (int)(damage * 0.75); + damage = (int)(damage * summonNerfMult); } } } @@ -5569,9 +5580,7 @@ namespace CalamityMod.CalPlayer damage = (int)(damage * 0.7); break; } - if (proj.type == ModContent.ProjectileType()) - damage = (int)(damage * 0.8); - else if (proj.type == ModContent.ProjectileType() && heldItem.type == ModContent.ItemType()) + if (proj.type == ModContent.ProjectileType() && heldItem.type == ModContent.ItemType()) damage = (int)(damage * 0.75); } if (proj.type == ProjectileID.SpectreWrath && player.ghostHurt) @@ -5636,22 +5645,15 @@ namespace CalamityMod.CalPlayer float num13 = target.position.X + (float)(target.width / 2) - vector.X; float num14 = target.position.Y + (float)(target.height / 2) - vector.Y; num13 += (float)Main.rand.Next(-100, 101); - float num15 = 25f; - int projectileType = Main.rand.Next(3); - if (projectileType == 0) - { - projectileType = ModContent.ProjectileType(); - } - else if (projectileType == 1) - { - projectileType = ProjectileID.HallowStar; - } - else - { - projectileType = ProjectileID.FallingStar; - } + float speed = 25f; + int projectileType = Utils.SelectRandom(Main.rand, new int[] + { + ModContent.ProjectileType(), + ProjectileID.HallowStar, + ModContent.ProjectileType() + }); float num16 = (float)Math.Sqrt((double)(num13 * num13 + num14 * num14)); - num16 = num15 / num16; + num16 = speed / num16; num13 *= num16; num14 *= num16; int num17 = Projectile.NewProjectile(x, y, num13, num14, projectileType, 120, 5f, player.whoAmI, 0f, 0f); @@ -5717,7 +5719,7 @@ namespace CalamityMod.CalPlayer Main.projectile[fire].netUpdate = true; } } - if (umbraphileSet && proj.Calamity().rogue && (Main.rand.NextBool(4) || proj.Calamity().stealthStrike)) + if (umbraphileSet && proj.Calamity().rogue && (Main.rand.NextBool(4) || proj.Calamity().stealthStrike) && proj.type != ModContent.ProjectileType()) { Projectile.NewProjectile(proj.Center.X, proj.Center.Y, 0f, 0f, ModContent.ProjectileType(), CalamityUtils.DamageSoftCap(proj.damage * 0.25, 50), 0f, player.whoAmI, 0f, 0f); } @@ -5967,7 +5969,7 @@ namespace CalamityMod.CalPlayer if (corrEffigy) contactDamageReduction -= 0.2; - if (calamityRing) + if (calamityRing && !voidOfExtinction) contactDamageReduction -= 0.15; // 10% is converted to 9%, 25% is converted to 20%, 50% is converted to 33%, 75% is converted to 43%, 100% is converted to 50% @@ -6196,7 +6198,7 @@ namespace CalamityMod.CalPlayer if (corrEffigy) projectileDamageReduction -= 0.2; - if (calamityRing) + if (calamityRing && !voidOfExtinction) projectileDamageReduction -= 0.15; // 10% is converted to 9%, 25% is converted to 20%, 50% is converted to 33%, 75% is converted to 43%, 100% is converted to 50% @@ -7761,8 +7763,8 @@ namespace CalamityMod.CalPlayer float xPos = Main.rand.NextBool(2) ? player.Center.X + 100 : player.Center.X - 100; Vector2 vector2 = new Vector2(xPos, player.Center.Y + Main.rand.Next(-100, 101)); offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - int spore1 = Projectile.NewProjectile(vector2.X, vector2.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), 590, fDamage, 1.25f, player.whoAmI, 0f, 0f); - int spore2 = Projectile.NewProjectile(vector2.X, vector2.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), 590, fDamage, 1.25f, player.whoAmI, 0f, 0f); + int spore1 = Projectile.NewProjectile(vector2.X, vector2.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ProjectileID.TruffleSpore, fDamage, 1.25f, player.whoAmI, 0f, 0f); + int spore2 = Projectile.NewProjectile(vector2.X, vector2.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ProjectileID.TruffleSpore, fDamage, 1.25f, player.whoAmI, 0f, 0f); Main.projectile[spore1].timeLeft = 120; Main.projectile[spore2].timeLeft = 120; } @@ -8156,11 +8158,11 @@ namespace CalamityMod.CalPlayer Rectangle rectangle = new Rectangle((int)((double)player.position.X + (double)player.velocity.X * 0.5 - 4.0), (int)((double)player.position.Y + (double)player.velocity.Y * 0.5 - 4.0), player.width + 8, player.height + 8); for (int i = 0; i < Main.maxNPCs; i++) { - if (Main.npc[i].active && !Main.npc[i].dontTakeDamage && !Main.npc[i].friendly && Main.npc[i].immune[player.whoAmI] <= 0) + NPC npc = Main.npc[i]; + if (npc.active && !npc.dontTakeDamage && !npc.friendly && npc.immune[player.whoAmI] <= 0) { - NPC nPC = Main.npc[i]; - Rectangle rect = nPC.getRect(); - if (rectangle.Intersects(rect) && (nPC.noTileCollide || player.CanHit(nPC))) + Rectangle rect = npc.getRect(); + if (rectangle.Intersects(rect) && (npc.noTileCollide || player.CanHit(npc))) { float num = 50f * player.AverageDamage(); float num2 = 3f; @@ -8188,11 +8190,11 @@ namespace CalamityMod.CalPlayer } if (player.whoAmI == Main.myPlayer) { - player.ApplyDamageToNPC(nPC, (int)num, num2, direction, crit); + player.ApplyDamageToNPC(npc, (int)num, num2, direction, crit); } - if (nPC.immune[player.whoAmI] < 6) - nPC.immune[player.whoAmI] = 6; - nPC.AddBuff(ModContent.BuffType(), 300); + if (npc.immune[player.whoAmI] < 6) + npc.immune[player.whoAmI] = 6; + npc.AddBuff(ModContent.BuffType(), 300); player.immune = true; player.immuneNoBlink = true; if (player.immuneTime < 4) @@ -8210,11 +8212,11 @@ namespace CalamityMod.CalPlayer Rectangle rectangle = new Rectangle((int)((double)player.position.X + (double)player.velocity.X * 0.5 - 4.0), (int)((double)player.position.Y + (double)player.velocity.Y * 0.5 - 4.0), player.width + 8, player.height + 8); for (int i = 0; i < Main.maxNPCs; i++) { - if (Main.npc[i].active && !Main.npc[i].dontTakeDamage && !Main.npc[i].friendly && Main.npc[i].immune[player.whoAmI] <= 0) + NPC npc = Main.npc[i]; + if (npc.active && !npc.dontTakeDamage && !npc.friendly && npc.immune[player.whoAmI] <= 0) { - NPC nPC = Main.npc[i]; - Rectangle rect = nPC.getRect(); - if (rectangle.Intersects(rect) && (nPC.noTileCollide || player.CanHit(nPC))) + Rectangle rect = npc.getRect(); + if (rectangle.Intersects(rect) && (npc.noTileCollide || player.CanHit(npc))) { float num = 1500f * player.AverageDamage(); float num2 = 15f; @@ -8242,13 +8244,13 @@ namespace CalamityMod.CalPlayer } if (player.whoAmI == Main.myPlayer) { - player.ApplyDamageToNPC(nPC, (int)num, num2, direction, crit); + player.ApplyDamageToNPC(npc, (int)num, num2, direction, crit); Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(1000 * player.AverageDamage()), 20f, Main.myPlayer, 0f, 0f); Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(780 * player.AverageDamage()), 5f, Main.myPlayer, 0f, 0f); } - if (nPC.immune[player.whoAmI] < 6) - nPC.immune[player.whoAmI] = 6; - nPC.AddBuff(ModContent.BuffType(), 300); + if (npc.immune[player.whoAmI] < 6) + npc.immune[player.whoAmI] = 6; + npc.AddBuff(ModContent.BuffType(), 300); player.immune = true; player.immuneNoBlink = true; if (player.immuneTime < 4) @@ -8266,11 +8268,11 @@ namespace CalamityMod.CalPlayer Rectangle rectangle = new Rectangle((int)((double)player.position.X + (double)player.velocity.X * 0.5 - 4.0), (int)((double)player.position.Y + (double)player.velocity.Y * 0.5 - 4.0), player.width + 8, player.height + 8); for (int i = 0; i < Main.maxNPCs; i++) { - if (Main.npc[i].active && !Main.npc[i].dontTakeDamage && !Main.npc[i].friendly && Main.npc[i].immune[player.whoAmI] <= 0) + NPC npc = Main.npc[i]; + if (npc.active && !npc.dontTakeDamage && !npc.friendly && npc.immune[player.whoAmI] <= 0) { - NPC nPC = Main.npc[i]; - Rectangle rect = nPC.getRect(); - if (rectangle.Intersects(rect) && (nPC.noTileCollide || player.CanHit(nPC))) + Rectangle rect = npc.getRect(); + if (rectangle.Intersects(rect) && (npc.noTileCollide || player.CanHit(npc))) { float num = 500f * player.AverageDamage(); float num2 = 12f; @@ -8298,12 +8300,12 @@ namespace CalamityMod.CalPlayer } if (player.whoAmI == Main.myPlayer) { - player.ApplyDamageToNPC(nPC, (int)num, num2, direction, crit); + player.ApplyDamageToNPC(npc, (int)num, num2, direction, crit); Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(500 * player.AverageDamage()), 15f, Main.myPlayer, 0f, 0f); Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(380 * player.AverageDamage()), 5f, Main.myPlayer, 0f, 0f); } - if (nPC.immune[player.whoAmI] < 6) - nPC.immune[player.whoAmI] = 6; + if (npc.immune[player.whoAmI] < 6) + npc.immune[player.whoAmI] = 6; player.immune = true; player.immuneNoBlink = true; if (player.immuneTime < 4) @@ -8321,11 +8323,11 @@ namespace CalamityMod.CalPlayer Rectangle rectangle = new Rectangle((int)((double)player.position.X + (double)player.velocity.X * 0.5 - 4.0), (int)((double)player.position.Y + (double)player.velocity.Y * 0.5 - 4.0), player.width + 8, player.height + 8); for (int i = 0; i < Main.maxNPCs; i++) { - if (Main.npc[i].active && !Main.npc[i].dontTakeDamage && !Main.npc[i].friendly && Main.npc[i].immune[player.whoAmI] <= 0) + NPC npc = Main.npc[i]; + if (npc.active && !npc.dontTakeDamage && !npc.friendly && npc.immune[player.whoAmI] <= 0) { - NPC nPC = Main.npc[i]; - Rectangle rect = nPC.getRect(); - if (rectangle.Intersects(rect) && (nPC.noTileCollide || player.CanHit(nPC))) + Rectangle rect = npc.getRect(); + if (rectangle.Intersects(rect) && (npc.noTileCollide || player.CanHit(npc))) { float num = 100f * player.AverageDamage(); float num2 = 9f; @@ -8353,11 +8355,11 @@ namespace CalamityMod.CalPlayer } if (player.whoAmI == Main.myPlayer) { - player.ApplyDamageToNPC(nPC, (int)num, num2, direction, crit); + player.ApplyDamageToNPC(npc, (int)num, num2, direction, crit); Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(100 * player.AverageDamage()), 15f, Main.myPlayer, 0f, 0f); } - if (nPC.immune[player.whoAmI] < 6) - nPC.immune[player.whoAmI] = 6; + if (npc.immune[player.whoAmI] < 6) + npc.immune[player.whoAmI] = 6; player.immune = true; player.immuneNoBlink = true; if (player.immuneTime < 4) @@ -8375,11 +8377,11 @@ namespace CalamityMod.CalPlayer Rectangle rectangle = new Rectangle((int)(player.position.X + player.velocity.X * 0.5f - 4f), (int)(player.position.Y + player.velocity.Y * 0.5f - 4f), player.width + 8, player.height + 8); for (int i = 0; i < Main.maxNPCs; i++) { - if (Main.npc[i].active && !Main.npc[i].dontTakeDamage && !Main.npc[i].friendly && Main.npc[i].immune[player.whoAmI] <= 0) + NPC npc = Main.npc[i]; + if (npc.active && !npc.dontTakeDamage && !npc.friendly && npc.immune[player.whoAmI] <= 0) { - NPC nPC = Main.npc[i]; - Rectangle rect = nPC.getRect(); - if (rectangle.Intersects(rect) && (nPC.noTileCollide || player.CanHit(nPC))) + Rectangle rect = npc.getRect(); + if (rectangle.Intersects(rect) && (npc.noTileCollide || player.CanHit(npc))) { float num = 50f * player.MinionDamage(); float num2 = 3f; @@ -8395,11 +8397,11 @@ namespace CalamityMod.CalPlayer } if (player.whoAmI == Main.myPlayer) { - player.ApplyDamageToNPC(nPC, (int)num, num2, direction, crit); + player.ApplyDamageToNPC(npc, (int)num, num2, direction, crit); } - if (nPC.immune[player.whoAmI] < 6) - nPC.immune[player.whoAmI] = 6; - nPC.AddBuff(ModContent.BuffType(), 300); + if (npc.immune[player.whoAmI] < 6) + npc.immune[player.whoAmI] = 6; + npc.AddBuff(ModContent.BuffType(), 300); player.immune = true; player.immuneNoBlink = true; if (player.immuneTime < 4) @@ -9619,6 +9621,23 @@ namespace CalamityMod.CalPlayer } }); + public static readonly PlayerLayer DyeInvisibilityFix = new PlayerLayer("CalamityMod", "DyeInvisibilityFix", PlayerLayer.Arms, (PlayerDrawInfo drawInfo) => + { + Player drawPlayer = drawInfo.drawPlayer; + CalamityPlayer modPlayer = drawPlayer.Calamity(); + if (!drawPlayer.invis || + drawPlayer.itemAnimation > 0) + { + return; + } + for (int i = 0; i < Main.playerDrawData.Count; i++) + { + var copy = Main.playerDrawData[i]; + copy.shader = 0; // There's no other easy solution here to my knowledge since DrawData is a value type. + Main.playerDrawData[i] = copy; + } + }); + public override void ModifyDrawInfo(ref PlayerDrawInfo drawInfo) { if (drawInfo.shadow != 0f) @@ -9945,7 +9964,7 @@ namespace CalamityMod.CalPlayer Texture2D robotTexture = ModContent.GetTexture("CalamityMod/Projectiles/Summon/AndromedaSmall"); Rectangle frame = new Rectangle(0, robotEntityInstance.CurrentFrame * 54, robotTexture.Width, robotTexture.Height / 21); DrawData drawData = new DrawData(robotTexture, - drawPlayer.Center + new Vector2(0f, -8f) - Main.screenPosition, + drawPlayer.Center + new Vector2(drawPlayer.direction == 1 ? -24 : -10, -8f) - Main.screenPosition, frame, Color.White, 0f, @@ -9988,6 +10007,7 @@ namespace CalamityMod.CalPlayer list.Add(ColdDivinityOverlay); list.Add(StratusSphereDrawing); list.Add(IbanDevRobot); + list.Add(DyeInvisibilityFix); } public PlayerLayer clAfterAll = new PlayerLayer("Calamity", "clAfterAll", PlayerLayer.MiscEffectsFront, delegate (PlayerDrawInfo drawInfo) diff --git a/CalPlayer/CalamityPlayerFishing.cs b/CalPlayer/CalamityPlayerFishing.cs index 01064f7d9d..d42c7755f3 100644 --- a/CalPlayer/CalamityPlayerFishing.cs +++ b/CalPlayer/CalamityPlayerFishing.cs @@ -97,6 +97,8 @@ namespace CalamityMod.CalPlayer CalamityUtils.AddWithCondition(fishList, ItemID.FlarefinKoi, !modPlayer.ZoneCalamity); CalamityUtils.AddWithCondition(fishList, ItemID.Obsidifish, !modPlayer.ZoneCalamity); CalamityUtils.AddWithCondition(fishList, ModContent.ItemType(), modPlayer.ZoneCalamity); + CalamityUtils.AddWithCondition(fishList, ModContent.ItemType(), modPlayer.ZoneCalamity); + CalamityUtils.AddWithCondition(fishList, ModContent.ItemType(), modPlayer.ZoneCalamity); } else if (water) { diff --git a/CalPlayer/CalamityPlayerLifeRegen.cs b/CalPlayer/CalamityPlayerLifeRegen.cs index 5899716584..5899ddd699 100644 --- a/CalPlayer/CalamityPlayerLifeRegen.cs +++ b/CalPlayer/CalamityPlayerLifeRegen.cs @@ -205,7 +205,7 @@ namespace CalamityMod.CalPlayer player.lifeRegen = 0; player.lifeRegenTime = 0; - lifeRegenLost += modPlayer.alchFlask ? 10 : 20; + lifeRegenLost += modPlayer.reducedPlagueDmg ? 10 : 20; } if (modPlayer.bBlood) @@ -391,7 +391,7 @@ namespace CalamityMod.CalPlayer if (player.whoAmI == Main.myPlayer && modPlayer.bloodfinTimer <= 0) { modPlayer.bloodfinTimer = 30; - if (player.statLife <= (int)(player.statLifeMax2 * 0.75)) + if (player.statLife <= (int)(player.statLifeMax2 * 0.75) && !CalamityWorld.ironHeart) player.statLife += 1; } } @@ -713,188 +713,152 @@ namespace CalamityMod.CalPlayer player.lifeRegen += 1; // Standing still healing bonuses (all exclusive with vanilla Shiny Stone) - if (!player.shinyStone) - { - int lifeRegenTimeMaxBoost = CalamityPlayer.areThereAnyDamnBosses ? 450 : 1800; - int lifeRegenMaxBoost = CalamityPlayer.areThereAnyDamnBosses ? 1 : 4; - float lifeRegenLifeRegenTimeMaxBoost = CalamityPlayer.areThereAnyDamnBosses ? 8f : 30f; + if (!player.shinyStone) + { + int lifeRegenTimeMaxBoost = CalamityPlayer.areThereAnyDamnBosses ? 450 : 1800; + int lifeRegenMaxBoost = CalamityPlayer.areThereAnyDamnBosses ? 1 : 4; + float lifeRegenLifeRegenTimeMaxBoost = CalamityPlayer.areThereAnyDamnBosses ? 8f : 30f; - if (Math.Abs(player.velocity.X) < 0.05f && Math.Abs(player.velocity.Y) < 0.05f && player.itemAnimation == 0) - { - if (modPlayer.shadeRegen) - { - if (player.lifeRegenTime > 90 && player.lifeRegenTime < lifeRegenTimeMaxBoost) - player.lifeRegenTime = lifeRegenTimeMaxBoost; + if (Math.Abs(player.velocity.X) < 0.05f && Math.Abs(player.velocity.Y) < 0.05f && player.itemAnimation == 0) + { + bool boostedRegen = false; + bool noSunlight = false; + if (modPlayer.shadeRegen) + { + boostedRegen = true; + if (player.lifeRegen > 0 && player.statLife < modPlayer.actualMaxLife) + { + if (Main.rand.Next(30000) < player.lifeRegenTime || Main.rand.NextBool(30)) + { + int num5 = Dust.NewDust(player.position, player.width, player.height, 173, 0f, 0f, 200, default, 1f); + Main.dust[num5].noGravity = true; + Main.dust[num5].velocity *= 0.75f; + Main.dust[num5].fadeIn = 1.3f; + Vector2 vector = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + vector.Normalize(); + vector *= (float)Main.rand.Next(50, 100) * 0.04f; + Main.dust[num5].velocity = vector; + vector.Normalize(); + vector *= 34f; + Main.dust[num5].position = player.Center - vector; + } + } + } + else if (modPlayer.cFreeze) + { + boostedRegen = true; + if (player.lifeRegen > 0 && player.statLife < modPlayer.actualMaxLife) + { + if (Main.rand.Next(30000) < player.lifeRegenTime || Main.rand.NextBool(30)) + { + int num5 = Dust.NewDust(player.position, player.width, player.height, 67, 0f, 0f, 200, new Color(150, Main.DiscoG, 255), 0.75f); + Main.dust[num5].noGravity = true; + Main.dust[num5].velocity *= 0.75f; + Main.dust[num5].fadeIn = 1.3f; + Vector2 vector = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + vector.Normalize(); + vector *= (float)Main.rand.Next(50, 100) * 0.04f; + Main.dust[num5].velocity = vector; + vector.Normalize(); + vector *= 34f; + Main.dust[num5].position = player.Center - vector; + } + } + } + else if (modPlayer.draedonsHeart) + { + boostedRegen = true; + if (player.lifeRegen > 0 && player.statLife < modPlayer.actualMaxLife) + { + if (Main.rand.Next(30000) < player.lifeRegenTime || Main.rand.NextBool(2)) + { + int num5 = Dust.NewDust(player.position, player.width, player.height, 107, 0f, 0f, 200, default, 1f); + Main.dust[num5].noGravity = true; + Main.dust[num5].velocity *= 0.75f; + Main.dust[num5].fadeIn = 1.3f; + Vector2 vector = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + vector.Normalize(); + vector *= (float)Main.rand.Next(50, 100) * 0.04f; + Main.dust[num5].velocity = vector; + vector.Normalize(); + vector *= 34f; + Main.dust[num5].position = player.Center - vector; + } + } + } + else if (modPlayer.photosynthesis) + { + boostedRegen = true; + if (!Main.dayTime) + noSunlight = true; + if (player.lifeRegen > 0 && player.statLife < modPlayer.actualMaxLife) + { + if (Main.rand.Next(30000) < player.lifeRegenTime || Main.rand.NextBool(2)) + { + int num5 = Dust.NewDust(player.position, player.width, player.height, 244, 0f, 0f, 200, default, 1f); + Main.dust[num5].noGravity = true; + Main.dust[num5].velocity *= 0.75f; + Main.dust[num5].fadeIn = 1.3f; + Vector2 vector = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + vector.Normalize(); + vector *= (float)Main.rand.Next(50, 100) * 0.04f; + Main.dust[num5].velocity = vector; + vector.Normalize(); + vector *= 34f; + Main.dust[num5].position = player.Center - vector; + } + } + } + if (boostedRegen) + { + int lifeRegenTimeMaxBoost2 = !noSunlight ? lifeRegenTimeMaxBoost : (lifeRegenTimeMaxBoost / 5); + int lifeRegenMaxBoost2 = !noSunlight ? lifeRegenMaxBoost : (lifeRegenMaxBoost / 5); + float lifeRegenLifeRegenTimeMaxBoost2 = !noSunlight ? lifeRegenLifeRegenTimeMaxBoost : (lifeRegenLifeRegenTimeMaxBoost / 5); - player.lifeRegenTime += lifeRegenMaxBoost; - player.lifeRegen += lifeRegenMaxBoost; + if (player.lifeRegenTime > 90 && player.lifeRegenTime < lifeRegenTimeMaxBoost2) + player.lifeRegenTime = lifeRegenTimeMaxBoost2; - float num3 = player.lifeRegenTime * 2.5f; // lifeRegenTime max is 3600 - num3 /= 300f; - if (num3 > 0f) - { - if (num3 > lifeRegenLifeRegenTimeMaxBoost) - num3 = lifeRegenLifeRegenTimeMaxBoost; + player.lifeRegenTime += lifeRegenMaxBoost2; + player.lifeRegen += lifeRegenMaxBoost2; - player.lifeRegen += (int)num3; - } + float num3 = player.lifeRegenTime * 2.5f; // lifeRegenTime max is 3600 + num3 /= 300f; + if (num3 > 0f) + { + if (num3 > lifeRegenLifeRegenTimeMaxBoost2) + num3 = lifeRegenLifeRegenTimeMaxBoost2; - if (player.lifeRegen > 0 && player.statLife < modPlayer.actualMaxLife) - { - player.lifeRegenCount++; - if (Main.rand.Next(30000) < player.lifeRegenTime || Main.rand.NextBool(30)) - { - int num5 = Dust.NewDust(player.position, player.width, player.height, 173, 0f, 0f, 200, default, 1f); - Main.dust[num5].noGravity = true; - Main.dust[num5].velocity *= 0.75f; - Main.dust[num5].fadeIn = 1.3f; - Vector2 vector = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - vector.Normalize(); - vector *= (float)Main.rand.Next(50, 100) * 0.04f; - Main.dust[num5].velocity = vector; - vector.Normalize(); - vector *= 34f; - Main.dust[num5].position = player.Center - vector; - } - } - } - else if (modPlayer.cFreeze) - { - if (player.lifeRegenTime > 90 && player.lifeRegenTime < lifeRegenTimeMaxBoost) - player.lifeRegenTime = lifeRegenTimeMaxBoost; - - player.lifeRegenTime += lifeRegenMaxBoost; - player.lifeRegen += lifeRegenMaxBoost; - - float num3 = (player.lifeRegenTime * 2.5f); // lifeRegenTime max is 3600 - num3 /= 300f; - if (num3 > 0f) - { - if (num3 > lifeRegenLifeRegenTimeMaxBoost) - num3 = lifeRegenLifeRegenTimeMaxBoost; - - player.lifeRegen += (int)num3; - } - - if (player.lifeRegen > 0 && player.statLife < modPlayer.actualMaxLife) - { - player.lifeRegenCount++; - if (Main.rand.Next(30000) < player.lifeRegenTime || Main.rand.NextBool(30)) - { - int num5 = Dust.NewDust(player.position, player.width, player.height, 67, 0f, 0f, 200, new Color(150, Main.DiscoG, 255), 0.75f); - Main.dust[num5].noGravity = true; - Main.dust[num5].velocity *= 0.75f; - Main.dust[num5].fadeIn = 1.3f; - Vector2 vector = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - vector.Normalize(); - vector *= (float)Main.rand.Next(50, 100) * 0.04f; - Main.dust[num5].velocity = vector; - vector.Normalize(); - vector *= 34f; - Main.dust[num5].position = player.Center - vector; - } - } - } - else if (modPlayer.draedonsHeart) - { - if (player.lifeRegenTime > 90 && player.lifeRegenTime < lifeRegenTimeMaxBoost) - player.lifeRegenTime = lifeRegenTimeMaxBoost; - - player.lifeRegenTime += lifeRegenMaxBoost; - player.lifeRegen += lifeRegenMaxBoost; - - float num3 = player.lifeRegenTime * 2.5f; // lifeRegenTime max is 3600 - num3 /= 300f; - if (num3 > 0f) - { - if (num3 > lifeRegenLifeRegenTimeMaxBoost) - num3 = lifeRegenLifeRegenTimeMaxBoost; - - player.lifeRegen += (int)num3; - } - - if (player.lifeRegen > 0 && player.statLife < modPlayer.actualMaxLife) - { - player.lifeRegenCount++; - if (Main.rand.Next(30000) < player.lifeRegenTime || Main.rand.NextBool(2)) - { - int num5 = Dust.NewDust(player.position, player.width, player.height, 107, 0f, 0f, 200, default, 1f); - Main.dust[num5].noGravity = true; - Main.dust[num5].velocity *= 0.75f; - Main.dust[num5].fadeIn = 1.3f; - Vector2 vector = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - vector.Normalize(); - vector *= (float)Main.rand.Next(50, 100) * 0.04f; - Main.dust[num5].velocity = vector; - vector.Normalize(); - vector *= 34f; - Main.dust[num5].position = player.Center - vector; - } - } - } - else if (modPlayer.photosynthesis) - { - int lifeRegenTimeMaxBoost2 = Main.dayTime ? lifeRegenTimeMaxBoost : (lifeRegenTimeMaxBoost / 5); - int lifeRegenMaxBoost2 = Main.dayTime ? lifeRegenMaxBoost : (lifeRegenMaxBoost / 5); - float lifeRegenLifeRegenTimeMaxBoost2 = Main.dayTime ? lifeRegenLifeRegenTimeMaxBoost : (lifeRegenLifeRegenTimeMaxBoost / 5); - - if (player.lifeRegenTime > 90 && player.lifeRegenTime < lifeRegenTimeMaxBoost2) - player.lifeRegenTime = lifeRegenTimeMaxBoost2; - - player.lifeRegenTime += lifeRegenMaxBoost2; - player.lifeRegen += lifeRegenMaxBoost2; - - float num3 = player.lifeRegenTime * 2.5f; // lifeRegenTime max is 3600 - num3 /= 300f; - if (num3 > 0f) - { - if (num3 > lifeRegenLifeRegenTimeMaxBoost2) - num3 = lifeRegenLifeRegenTimeMaxBoost2; - - player.lifeRegen += (int)num3; - } - - if (player.lifeRegen > 0 && player.statLife < modPlayer.actualMaxLife) - { - player.lifeRegenCount++; - if (Main.rand.Next(30000) < player.lifeRegenTime || Main.rand.NextBool(2)) - { - int num5 = Dust.NewDust(player.position, player.width, player.height, 244, 0f, 0f, 200, default, 1f); - Main.dust[num5].noGravity = true; - Main.dust[num5].velocity *= 0.75f; - Main.dust[num5].fadeIn = 1.3f; - Vector2 vector = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - vector.Normalize(); - vector *= (float)Main.rand.Next(50, 100) * 0.04f; - Main.dust[num5].velocity = vector; - vector.Normalize(); - vector *= 34f; - Main.dust[num5].position = player.Center - vector; - } - } - } - } - else if (modPlayer.camper && player.statLife < modPlayer.actualMaxLife) - { - player.lifeRegen = (int)((player.lifeRegen * 2) * 1.75f); - player.lifeRegenCount = player.lifeRegenCount > 30 ? player.lifeRegenCount : 30; - player.lifeRegenCount++; - if (Main.rand.Next(30000) < player.lifeRegenTime || Main.rand.NextBool(2)) - { - int num5 = Dust.NewDust(player.position, player.width, player.height, 12, 0f, 0f, 200, Color.OrangeRed, 1f); - Main.dust[num5].noGravity = true; - Main.dust[num5].velocity *= 0.75f; - Main.dust[num5].fadeIn = 1.3f; - Vector2 vector = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - vector.Normalize(); - vector *= (float)Main.rand.Next(50, 100) * 0.04f; - Main.dust[num5].velocity = vector; - vector.Normalize(); - vector *= 34f; - Main.dust[num5].position = player.Center - vector; - } - } - } + player.lifeRegen += (int)num3; + } + if (player.lifeRegen > 0 && player.statLife < modPlayer.actualMaxLife) + { + player.lifeRegenCount++; + } + } + else if (modPlayer.camper && player.statLife < modPlayer.actualMaxLife) + { + float camperRegenMult = CalamityPlayer.areThereAnyDamnBosses ? 1.3f : 1.75f; + int camperCap = CalamityPlayer.areThereAnyDamnBosses ? 20 : 30; + player.lifeRegen = (int)((player.lifeRegen * 2) * camperRegenMult); + player.lifeRegenCount = player.lifeRegenCount > camperCap ? player.lifeRegenCount : camperCap; + player.lifeRegenCount++; + if (Main.rand.Next(30000) < player.lifeRegenTime || Main.rand.NextBool(2)) + { + int num5 = Dust.NewDust(player.position, player.width, player.height, 12, 0f, 0f, 200, Color.OrangeRed, 1f); + Main.dust[num5].noGravity = true; + Main.dust[num5].velocity *= 0.75f; + Main.dust[num5].fadeIn = 1.3f; + Vector2 vector = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + vector.Normalize(); + vector *= (float)Main.rand.Next(50, 100) * 0.04f; + Main.dust[num5].velocity = vector; + vector.Normalize(); + vector *= 34f; + Main.dust[num5].position = player.Center - vector; + } + } + } + } if (CalamityWorld.revenge) { diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index 1b4d16c477..b142dd257b 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -8,6 +8,7 @@ using CalamityMod.Dusts; using CalamityMod.Items.Armor; using CalamityMod.Items.Fishing.AstralCatches; using CalamityMod.Items.Fishing.FishingRods; +using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.NPCs; using CalamityMod.NPCs.AcidRain; @@ -342,7 +343,7 @@ namespace CalamityMod.CalPlayer if(player.Calamity().andromedaState == AndromedaPlayerState.LargeRobot) { - player.width = 152; + player.width = 80; player.height = 212; player.position.Y -= 170; } @@ -983,6 +984,8 @@ namespace CalamityMod.CalPlayer modPlayer.titanBoost--; if (modPlayer.prismaticLasers > 0) modPlayer.prismaticLasers--; + if (modPlayer.dogTextCooldown > 0) + modPlayer.dogTextCooldown--; if (modPlayer.titanCooldown > 0) modPlayer.titanCooldown--; @@ -1813,7 +1816,7 @@ namespace CalamityMod.CalPlayer modPlayer.gSabatonFall = 300; modPlayer.gSabatonCooldown = 480; //8 second cooldown player.gravity *= 2f; - Projectile.NewProjectile(player.Center.X, player.Center.Y, player.velocity.X, player.velocity.Y, ModContent.ProjectileType(), 0, 0, player.whoAmI); + Projectile.NewProjectile(player.Center.X, player.Center.Y + (player.height / 5f), player.velocity.X, player.velocity.Y, ModContent.ProjectileType(), 0, 0, player.whoAmI); } } if (modPlayer.gSabatonCooldown == 1) //dust when ready to use again @@ -2668,6 +2671,12 @@ namespace CalamityMod.CalPlayer modPlayer.planarSpeedBoost = 0; } + if (modPlayer.brimlashBusterBoost) + { + if (player.ActiveItem().type != ModContent.ItemType()) + modPlayer.brimlashBusterBoost = false; + } + if (modPlayer.etherealExtorter) { bool ZoneForest = !modPlayer.ZoneAbyss && !modPlayer.ZoneSulphur && !modPlayer.ZoneAstral && !modPlayer.ZoneCalamity && @@ -3359,6 +3368,7 @@ namespace CalamityMod.CalPlayer player.npcTypeNoAggro[ModContent.NPCType()] = true; player.npcTypeNoAggro[ModContent.NPCType()] = true; player.npcTypeNoAggro[ModContent.NPCType()] = true; + player.npcTypeNoAggro[ModContent.NPCType()] = true; // LATER -- When Wulfrum Slimes start being definitely robots, remove this immunity. player.npcTypeNoAggro[ModContent.NPCType()] = true; } @@ -3761,6 +3771,10 @@ namespace CalamityMod.CalPlayer if (player.endurance > 0f) player.endurance = 1f - (1f / (1f + player.endurance)); + // Very similar scaling to damage reduction. Ex. Frog Leg goes from 48% jump speed to 38% + //if (player.jumpSpeedBoost > 0f) + // player.jumpSpeedBoost = (1f - 1f / (1f + (player.jumpSpeedBoost / 10f))) * 10f + if (modPlayer.yharonLore && !CalamityWorld.defiled) { if (player.wingTimeMax < 50000) @@ -3837,7 +3851,11 @@ namespace CalamityMod.CalPlayer modPlayer.manaRegenStat = player.manaRegen; modPlayer.armorPenetrationStat = player.armorPenetration; modPlayer.moveSpeedStat = (int)((player.moveSpeed - 1f) * 100f); - modPlayer.wingFlightTimeStat = player.wingTimeMax; + modPlayer.wingFlightTimeStat = player.wingTimeMax / 60f; + float trueJumpSpeedBoost = player.jumpSpeedBoost + + (player.wereWolf ? 0.2f : 0f) + + (player.jumpBoost ? 1.5f : 0f); + modPlayer.jumpSpeedStat = trueJumpSpeedBoost * 20f; modPlayer.adrenalineChargeStat = 45 - (modPlayer.adrenalineBoostOne ? 10 : 0) - (modPlayer.adrenalineBoostTwo ? 10 : 0) - diff --git a/CalamityConfig.cs b/CalamityConfig.cs index a4686a4d84..ba3be07e85 100644 --- a/CalamityConfig.cs +++ b/CalamityConfig.cs @@ -64,7 +64,7 @@ namespace CalamityMod [BackgroundColor(192, 54, 64, 192)] [Label("Lock Meter Positions")] - [DefaultValue(false)] + [DefaultValue(true)] [Tooltip("Prevents clicking on the Stealth, Rage and Adrenaline Meters.\nThis stops them from being dragged around with the mouse.")] public bool MeterPosLock { get; set; } @@ -116,6 +116,12 @@ namespace CalamityMod [Tooltip("Increases the player's mining speed by 75%.\nThis does not affect drills.")] public bool MiningSpeedBoost { get; set; } + [Label("Boss Zen")] + [BackgroundColor(192, 54, 64, 192)] + [DefaultValue(true)] + [Tooltip("While a boss is alive, all players receive the Boss Zen buff which drastically reduces enemy spawn rates.")] + public bool BossZen { get; set; } + [Label("Never Weaken Reactive Boss DR")] [BackgroundColor(192, 54, 64, 192)] [DefaultValue(false)] diff --git a/CalamityMod.cs b/CalamityMod.cs index 53a32446b8..e81ce5773c 100644 --- a/CalamityMod.cs +++ b/CalamityMod.cs @@ -181,6 +181,7 @@ namespace CalamityMod public static List revengeanceProjectileBuffList5Percent; public static List revengeanceLifeStealExceptionList; public static List movementImpairImmuneList; + public static List needsDebuffIconDisplayList; public static List trapProjectileList; public static List scopedWeaponList; public static List boomerangList; @@ -414,6 +415,7 @@ namespace CalamityMod revengeanceProjectileBuffList5Percent = null; revengeanceLifeStealExceptionList = null; movementImpairImmuneList = null; + needsDebuffIconDisplayList = null; trapProjectileList = null; scopedWeaponList = null; boomerangList = null; @@ -704,6 +706,7 @@ namespace CalamityMod ModContent.ProjectileType(), ModContent.ProjectileType(), ModContent.ProjectileType(), + ModContent.ProjectileType(), ModContent.ProjectileType(), ModContent.ProjectileType() }; @@ -1977,6 +1980,11 @@ namespace CalamityMod NPCID.QueenBee, }; + needsDebuffIconDisplayList = new List() + { + NPCID.WallofFleshEye + }; + trapProjectileList = new List() { ProjectileID.PoisonDartTrap, diff --git a/Items/Accessories/AeroStone.cs b/Items/Accessories/AeroStone.cs index 6028a09bcf..67c5d1d5ca 100644 --- a/Items/Accessories/AeroStone.cs +++ b/Items/Accessories/AeroStone.cs @@ -1,3 +1,4 @@ +using System.Collections.Generic; using Terraria; using Terraria.DataStructures; using Terraria.ModLoader; @@ -10,7 +11,7 @@ namespace CalamityMod.Items.Accessories { DisplayName.SetDefault("Aero Stone"); Tooltip.SetDefault("One of the ancient relics\n" + - "Increases movement speed by 10%, jump speed by 100%, and all damage by 3%"); + "Increases movement speed by 10%, jump speed by 20%, and all damage by 3%"); Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(4, 8)); } @@ -23,6 +24,19 @@ namespace CalamityMod.Items.Accessories item.accessory = true; } + public override void ModifyTooltips(List list) + { + bool autoJump = Main.player[Main.myPlayer].autoJump; + string jumpAmt = autoJump ? "5" : "20"; + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip1") + { + line2.text = "Increases movement speed by 10%, jump speed by " + jumpAmt + "%, and all damage by 3%"; + } + } + } + public override void UpdateAccessory(Player player, bool hideVisual) { Lighting.AddLight((int)player.Center.X / 16, (int)player.Center.Y / 16, 0f, 0.425f, 0.425f); diff --git a/Items/Accessories/AlchemicalFlask.cs b/Items/Accessories/AlchemicalFlask.cs index 135985faea..465e3709fa 100644 --- a/Items/Accessories/AlchemicalFlask.cs +++ b/Items/Accessories/AlchemicalFlask.cs @@ -30,6 +30,7 @@ namespace CalamityMod.Items.Accessories { CalamityPlayer modPlayer = player.Calamity(); modPlayer.alchFlask = true; + modPlayer.reducedPlagueDmg = true; } public override void AddRecipes() diff --git a/Items/Accessories/CounterScarf.cs b/Items/Accessories/CounterScarf.cs index cf54dca9f1..cc2a7e8674 100644 --- a/Items/Accessories/CounterScarf.cs +++ b/Items/Accessories/CounterScarf.cs @@ -14,6 +14,8 @@ namespace CalamityMod.Items.Accessories "Grants the ability to dash; dashing into an attack will cause you to dodge it\n" + "After a dodge you will be granted a buff to all damage, melee speed, and all crit chance for a short time\n" + "After a successful dodge you must wait 15 seconds before you can dodge again\n" + + "This cooldown will be twice as long if you have Chaos State\n" + + "While on cooldown, Chaos State will last twice as long\n" + "Revengeance drop"); } diff --git a/Items/Accessories/DragonScales.cs b/Items/Accessories/DragonScales.cs index 234dc0c6ca..7fa2875f7d 100644 --- a/Items/Accessories/DragonScales.cs +++ b/Items/Accessories/DragonScales.cs @@ -9,10 +9,10 @@ namespace CalamityMod.Items.Accessories public override void SetStaticDefaults() { DisplayName.SetDefault("Dragon Scales"); - Tooltip.SetDefault("Causes all rogue projectiles to emit a slow fireball as it travels\n" + + Tooltip.SetDefault("Only a living dragon holds true treasure\n" + + "Rogue projectiles create slow fireballs as they travel\n" + "Stealth strikes create infernados on death\n" + - "After Yharon is dead, you are granted 10% movement speed and acceleration\n" + - "'Only a living dragon holds true treasure'"); + "After Yharon is dead, you gain 10% movement speed and acceleration"); } public override void SetDefaults() diff --git a/Items/Accessories/EvasionScarf.cs b/Items/Accessories/EvasionScarf.cs index da59176343..7c7b45012c 100644 --- a/Items/Accessories/EvasionScarf.cs +++ b/Items/Accessories/EvasionScarf.cs @@ -14,7 +14,9 @@ namespace CalamityMod.Items.Accessories Tooltip.SetDefault("True melee strikes deal 30% more damage\n" + "Grants the ability to dash; dashing into an attack will cause you to dodge it\n" + "After a dodge you will be granted a buff to all damage, melee speed, and all crit chance for a short time\n" + - "After a successful dodge you must wait 13 seconds before you can dodge again"); + "After a successful dodge you must wait 13 seconds before you can dodge again\n" + + "This cooldown will be 50 percent longer if you have Chaos State\n" + + "While on cooldown, Chaos State will be 50 percent longer"); } public override void SetDefaults() diff --git a/Items/Accessories/GrandGelatin.cs b/Items/Accessories/GrandGelatin.cs index a34f996431..e28518e65d 100644 --- a/Items/Accessories/GrandGelatin.cs +++ b/Items/Accessories/GrandGelatin.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -11,7 +12,7 @@ namespace CalamityMod.Items.Accessories { DisplayName.SetDefault("Grand Gelatin"); Tooltip.SetDefault("10% increased movement speed\n" + - "200% increased jump speed\n" + + "40% increased jump speed\n" + "+20 max life and mana\n" + "Standing still boosts life and mana regen"); } @@ -25,13 +26,26 @@ namespace CalamityMod.Items.Accessories item.accessory = true; } + public override void ModifyTooltips(List list) + { + bool autoJump = Main.player[Main.myPlayer].autoJump; + string jumpAmt = autoJump ? "10" : "40"; + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip1") + { + line2.text = jumpAmt + "% increased jump speed"; + } + } + } + public override void UpdateAccessory(Player player, bool hideVisual) { player.moveSpeed += 0.1f; - player.jumpSpeedBoost += player.autoJump ? 0.5f : 2.0f; + player.jumpSpeedBoost += player.autoJump ? 0.5f : 2f; player.statLifeMax2 += 20; player.statManaMax2 += 20; - if ((double)Math.Abs(player.velocity.X) < 0.05 && (double)Math.Abs(player.velocity.Y) < 0.05 && player.itemAnimation == 0) + if (Math.Abs(player.velocity.X) < 0.05f && Math.Abs(player.velocity.Y) < 0.05f && player.itemAnimation == 0) { player.lifeRegen += 2; player.manaRegenBonus += 2; diff --git a/Items/Accessories/HeartoftheElements.cs b/Items/Accessories/HeartoftheElements.cs index 8c91663429..0fb723f893 100644 --- a/Items/Accessories/HeartoftheElements.cs +++ b/Items/Accessories/HeartoftheElements.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Accessories DisplayName.SetDefault("Heart of the Elements"); Tooltip.SetDefault("The heart of the world\n" + "Increases max life by 20, life regen by 1, and all damage by 8%\n" + - "Increases movement speed by 10% and jump speed by 100%\n" + + "Increases movement speed by 10% and jump speed by 20%\n" + "Increases damage reduction by 5%\n" + "Increases max mana by 50 and reduces mana usage by 5%\n" + "You grow flowers on the grass beneath you, chance to grow very random dye plants on grassless dirt\n" + diff --git a/Items/Accessories/PlagueHive.cs b/Items/Accessories/PlagueHive.cs index 839cc07166..5509810c03 100644 --- a/Items/Accessories/PlagueHive.cs +++ b/Items/Accessories/PlagueHive.cs @@ -51,6 +51,7 @@ namespace CalamityMod.Items.Accessories modPlayer.uberBees = true; player.strongBees = true; modPlayer.alchFlask = true; + modPlayer.reducedPlagueDmg = true; int plagueCounter = 0; Lighting.AddLight((int)(player.Center.X / 16f), (int)(player.Center.Y / 16f), 0.1f, 2f, 0.2f); int num = ModContent.BuffType(); diff --git a/Items/Accessories/Sponge.cs b/Items/Accessories/Sponge.cs index f5faacd468..00b9534f64 100644 --- a/Items/Accessories/Sponge.cs +++ b/Items/Accessories/Sponge.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Accessories "Poison, Freeze, Chill, Frostburn, and Venom immunity\n" + "Honey-like life regen with no speed penalty, +20 max life and mana\n" + "Most bee/hornet enemies and projectiles do 75% damage to you\n" + - "120% increased jump speed and 12% increased movement speed\n" + + "24% increased jump speed and 12% increased movement speed\n" + "Standing still boosts life and mana regen\n" + "Increased defense and damage reduction when submerged in liquid\n" + "Increased movement speed when submerged in liquid\n" + diff --git a/Items/Accessories/StatMeter.cs b/Items/Accessories/StatMeter.cs index 11954e4a3f..72bf551374 100644 --- a/Items/Accessories/StatMeter.cs +++ b/Items/Accessories/StatMeter.cs @@ -62,7 +62,8 @@ namespace CalamityMod.Items.Accessories int lifeRegen = modPlayer.lifeRegenStat; int manaRegen = modPlayer.manaRegenStat; int armorPenetration = modPlayer.armorPenetrationStat; - int wingFlightTime = modPlayer.wingFlightTimeStat; + string wingFlightTime = modPlayer.wingFlightTimeStat.ToString("n2"); + string jumpSpeed = modPlayer.jumpSpeedStat.ToString("n2"); int moveSpeed = modPlayer.moveSpeedStat; int lightLevel = modPlayer.abyssLightLevelStat; int breathLoss = modPlayer.abyssBreathLossStat; @@ -124,10 +125,11 @@ namespace CalamityMod.Items.Accessories // Generic stats always render. sb.Append("Defense: ").Append(defense); - sb.Append(" | DR: ").Append(DR).Append("%\n"); - sb.Append("Life Regen: ").Append(lifeRegen); - sb.Append(" | Armor Penetration: ").Append(armorPenetration).Append("\n"); - sb.Append("Wing Flight Time: ").Append(wingFlightTime); + sb.Append(" | DR: ").Append(DR).Append("%"); + sb.Append(" | Life Regen: ").Append(lifeRegen).Append("\n"); + sb.Append("Armor Penetration: ").Append(armorPenetration); + sb.Append(" | Wing Flight Time: ").Append(wingFlightTime).Append(" seconds\n"); + sb.Append("Jump Speed Boost: ").Append(jumpSpeed).Append("%"); sb.Append(" | Movement Speed Boost: ").Append(moveSpeed).Append("%\n\n"); sb.Append(CalamityWorld.death ? "Abyss/Cave Light Strength: " : "Abyss Light Strength: ").Append(lightLevel).Append("\n\n"); diff --git a/Items/Accessories/StatisBeltOfCurses.cs b/Items/Accessories/StatisBeltOfCurses.cs index bf47a82aa2..4fa75465a5 100644 --- a/Items/Accessories/StatisBeltOfCurses.cs +++ b/Items/Accessories/StatisBeltOfCurses.cs @@ -12,7 +12,8 @@ namespace CalamityMod.Items.Accessories public override void SetStaticDefaults() { DisplayName.SetDefault("Statis' Void Sash"); - Tooltip.SetDefault("Increases jump speed and allows constant jumping\n" + + Tooltip.SetDefault("24% increased jump speed and allows constant jumping\n" + + "Increases fall damage resistance by 50 blocks\n" + "Can climb walls, dash, and dodge attacks\n" + "Dashes leave homing scythes in your wake\n" + "Toggle visibility of this accessory to enable/disable the dash"); diff --git a/Items/Accessories/StatisNinjaBelt.cs b/Items/Accessories/StatisNinjaBelt.cs index ea42449d67..dd713bf077 100644 --- a/Items/Accessories/StatisNinjaBelt.cs +++ b/Items/Accessories/StatisNinjaBelt.cs @@ -11,7 +11,8 @@ namespace CalamityMod.Items.Accessories public override void SetStaticDefaults() { DisplayName.SetDefault("Statis' Ninja Belt"); - Tooltip.SetDefault("Increases jump speed and allows constant jumping\n" + + Tooltip.SetDefault("8% increased jump speed and allows constant jumping\n" + + "Increased fall damage resistance by 35 blocks\n" + "Can climb walls, dash, and dodge attacks\n" + "Toggle visibility of this accessory to enable/disable the dash"); } diff --git a/Items/Accessories/TheAbsorber.cs b/Items/Accessories/TheAbsorber.cs index 0d620fda79..e4132ff431 100644 --- a/Items/Accessories/TheAbsorber.cs +++ b/Items/Accessories/TheAbsorber.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Accessories { DisplayName.SetDefault("The Absorber"); Tooltip.SetDefault("12% increased movement speed\n" + - "120% increased jump speed\n" + + "24% increased jump speed\n" + "+20 max life and mana\n" + "Standing still boosts life and mana regen\n" + "Increased defense and damage reduction when submerged in liquid\n" + diff --git a/Items/Accessories/VitalJelly.cs b/Items/Accessories/VitalJelly.cs index 5b3b9986f8..785dd687f1 100644 --- a/Items/Accessories/VitalJelly.cs +++ b/Items/Accessories/VitalJelly.cs @@ -1,3 +1,4 @@ +using System.Collections.Generic; using Terraria; using Terraria.ModLoader; @@ -8,23 +9,36 @@ namespace CalamityMod.Items.Accessories public override void SetStaticDefaults() { DisplayName.SetDefault("Vital Jelly"); - Tooltip.SetDefault("10% increased movement speed\n" + - "200% increased jump speed"); + Tooltip.SetDefault("20% increased movement speed\n" + + "24% increased jump speed"); } public override void SetDefaults() { item.width = 20; item.height = 24; - item.value = CalamityGlobalItem.Rarity4BuyPrice; - item.rare = 4; + item.value = CalamityGlobalItem.Rarity3BuyPrice; + item.rare = 3; item.accessory = true; } + public override void ModifyTooltips(List list) + { + bool autoJump = Main.player[Main.myPlayer].autoJump; + string jumpAmt = autoJump ? "6" : "24"; + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip1") + { + line2.text = jumpAmt + "% increased jump speed"; + } + } + } + public override void UpdateAccessory(Player player, bool hideVisual) { - player.moveSpeed += 0.1f; - player.jumpSpeedBoost += player.autoJump ? 0.5f : 2.0f; + player.moveSpeed += 0.2f; + player.jumpSpeedBoost += player.autoJump ? 0.3f : 1.2f; } } } diff --git a/Items/Accessories/VoidofExtinction.cs b/Items/Accessories/VoidofExtinction.cs index 48c478d3a1..ccbe436768 100644 --- a/Items/Accessories/VoidofExtinction.cs +++ b/Items/Accessories/VoidofExtinction.cs @@ -55,6 +55,7 @@ namespace CalamityMod.Items.Accessories { CalamityPlayer modPlayer = player.Calamity(); modPlayer.calamityRing = true; + modPlayer.voidOfExtinction = true; player.lavaRose = true; player.lavaMax += 240; player.allDamage += 0.15f; diff --git a/Items/Accessories/Wings/HadarianWings.cs b/Items/Accessories/Wings/HadarianWings.cs index 74844d49be..7ee4b9e037 100644 --- a/Items/Accessories/Wings/HadarianWings.cs +++ b/Items/Accessories/Wings/HadarianWings.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Accessories.Wings "Acceleration multiplier: 1.75\n" + "Good vertical speed\n" + "Flight time: 120\n" + - "20% increased movement speed and 40% increased jump speed while wearing the Astral Armor"); + "20% increased movement speed and 8% increased jump speed while wearing the Astral Armor"); } public override void SetDefaults() diff --git a/Items/Accessories/Wings/MOAB.cs b/Items/Accessories/Wings/MOAB.cs index a66df6b8a8..67ff14258b 100644 --- a/Items/Accessories/Wings/MOAB.cs +++ b/Items/Accessories/Wings/MOAB.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Accessories.Wings "Acceleration multiplier: 1\n" + "Good vertical speed\n" + "Flight time: 75\n" + - "Increases jump height and allows auto-jump\n" + + "16% increased jump speed and allows auto-jump\n" + "Grants the player cloud, blizzard, and sandstorm mid-air jumps"); } diff --git a/Items/Accessories/Wings/SkylineWings.cs b/Items/Accessories/Wings/SkylineWings.cs index facddd0bc4..1df024f0af 100644 --- a/Items/Accessories/Wings/SkylineWings.cs +++ b/Items/Accessories/Wings/SkylineWings.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Accessories.Wings "Acceleration multiplier: 1\n" + "Average vertical speed\n" + "Flight time: 60\n" + - "25% increased jump speed while wearing the Aerospec armor"); + "5% increased jump speed while wearing the Aerospec armor"); } public override void SetDefaults() diff --git a/Items/Accessories/Wings/XerocWings.cs b/Items/Accessories/Wings/XerocWings.cs index 8afbc8cd60..ad99258922 100644 --- a/Items/Accessories/Wings/XerocWings.cs +++ b/Items/Accessories/Wings/XerocWings.cs @@ -13,13 +13,13 @@ namespace CalamityMod.Items.Accessories.Wings { public override void SetStaticDefaults() { - DisplayName.SetDefault("Xeroc Wings"); + DisplayName.SetDefault("Exodus Wings"); Tooltip.SetDefault("Highly radioactive\n" + "Horizontal speed: 8.5\n" + "Acceleration multiplier: 2\n" + "Good vertical speed\n" + "Flight time: 180\n" + - "5% increased rogue damage and critical strike chance while wearing the Xeroc Armor"); + "5% increased rogue damage and critical strike chance while wearing the Empyrean Armor"); } public override void SetDefaults() diff --git a/Items/Ammo/AccelerationBullet.cs b/Items/Ammo/AccelerationBullet.cs index c67e963118..5d096e116e 100644 --- a/Items/Ammo/AccelerationBullet.cs +++ b/Items/Ammo/AccelerationBullet.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Ammo item.rare = 1; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 1f; - item.ammo = 97; + item.ammo = AmmoID.Bullet; } public override void AddRecipes() diff --git a/Items/Ammo/VeriumBullet.cs b/Items/Ammo/VeriumBullet.cs index 55ed586105..a3d7e56632 100644 --- a/Items/Ammo/VeriumBullet.cs +++ b/Items/Ammo/VeriumBullet.cs @@ -9,7 +9,8 @@ namespace CalamityMod.Items.Ammo public override void SetStaticDefaults() { DisplayName.SetDefault("Verium Bullet"); - Tooltip.SetDefault("There is no escape!"); + Tooltip.SetDefault("There is no escape!\n" + + "Homes in after striking an enemy"); } public override void SetDefaults() @@ -25,7 +26,7 @@ namespace CalamityMod.Items.Ammo item.rare = 3; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 16f; - item.ammo = 97; + item.ammo = AmmoID.Bullet; } public override void AddRecipes() diff --git a/Items/Armor/FearmongerGreathelm.cs b/Items/Armor/FearmongerGreathelm.cs index 78cdc5f32f..6d7d929d53 100644 --- a/Items/Armor/FearmongerGreathelm.cs +++ b/Items/Armor/FearmongerGreathelm.cs @@ -53,7 +53,7 @@ namespace CalamityMod.Items.Armor public override void UpdateArmorSet(Player player) { player.setBonus = @"30% increased minion damage -Minions deal full damage while wielding weaponry +The minion damage nerf while wielding weaponry is reduced Immunity to all forms of frost and flame All minion attacks grant colossal life regeneration 15% increased damage reduction during the Pumpkin and Frost Moons diff --git a/Items/Armor/ForbiddenCirclet.cs b/Items/Armor/ForbiddenCirclet.cs index f26db05c40..42a07d15bd 100644 --- a/Items/Armor/ForbiddenCirclet.cs +++ b/Items/Armor/ForbiddenCirclet.cs @@ -48,7 +48,7 @@ namespace CalamityMod.Items.Armor player.setBonus = "Press " + hotkey + " to call an ancient storm to the cursor location\n" + "The ancient storm costs " + stormMana + " mana and benefits from both summon and rogue bonuses\n" + "Rogue stealth strikes spawn homing eaters on enemy hits\n" + - "Minions deal full damage while wielding rogue weapons\n" + + "The minion damage nerf is reduced while wielding rogue weapons\n" + "Rogue and summon attacks will scale off of the stat with a higher boost\n" + "Rogue stealth builds while not attacking and slower while moving, up to a max of 100\n" + "Once you have built max stealth, you will be able to perform a Stealth Strike\n" + diff --git a/Items/Armor/PlagueReaperVest.cs b/Items/Armor/PlagueReaperVest.cs index 797920e71e..32ec1ac593 100644 --- a/Items/Armor/PlagueReaperVest.cs +++ b/Items/Armor/PlagueReaperVest.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Armor public override void SetStaticDefaults() { DisplayName.SetDefault("Plague Reaper Vest"); - Tooltip.SetDefault("Immunity to the Plague\n" + + Tooltip.SetDefault("Reduces the damage caused to you by the plague\n" + "15% increased ranged damage and 5% increased ranged critical strike chance"); } @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Armor { player.rangedDamage += 0.15f; player.rangedCrit += 5; - player.buffImmune[ModContent.BuffType()] = true; + player.Calamity().reducedPlagueDmg = true; } public override void AddRecipes() diff --git a/Items/Armor/PlaguebringerCarapace.cs b/Items/Armor/PlaguebringerCarapace.cs index 066a4dafbb..8a9461f946 100644 --- a/Items/Armor/PlaguebringerCarapace.cs +++ b/Items/Armor/PlaguebringerCarapace.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Armor public override void SetStaticDefaults() { DisplayName.SetDefault("Plaguebringer Carapace"); - Tooltip.SetDefault("Immunity to the Plague\n" + + Tooltip.SetDefault("Reduces the damage caused to you by the plague\n" + "12% increased minion damage and +1 max minions\n" + "Friendly bees inflict the plague"); } @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Armor player.Calamity().plaguebringerCarapace = true; player.maxMinions += 2; player.minionDamage += 0.12f; - player.buffImmune[ModContent.BuffType()] = true; + player.Calamity().reducedPlagueDmg = true; } public override void AddRecipes() diff --git a/Items/Armor/PrismaticGreaves.cs b/Items/Armor/PrismaticGreaves.cs index 89c4ebf7ef..29b5d83c97 100644 --- a/Items/Armor/PrismaticGreaves.cs +++ b/Items/Armor/PrismaticGreaves.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Armor DisplayName.SetDefault("Prismatic Greaves"); Tooltip.SetDefault("10% increased magic damage and 12% increased magic crit\n" + "20% decreased non-magic damage\n" + - "Increases flight time and jump speed by 10%"); + "10% increased flight time and 2% increased jump speed"); } public override void SetDefaults() diff --git a/Items/Armor/StatigelCap.cs b/Items/Armor/StatigelCap.cs index c6fd840397..4ac3046f6d 100644 --- a/Items/Armor/StatigelCap.cs +++ b/Items/Armor/StatigelCap.cs @@ -34,7 +34,8 @@ namespace CalamityMod.Items.Armor public override void UpdateArmorSet(Player player) { player.setBonus = "When you take over 100 damage in one hit you become immune to damage for an extended period of time\n" + - "Grants an extra jump and increased jump height"; + "Grants an extra jump and increased jump height\n" + + "30% increased jump speed"; CalamityPlayer modPlayer = player.Calamity(); modPlayer.statigelSet = true; player.doubleJumpSail = true; diff --git a/Items/Armor/StatigelHeadgear.cs b/Items/Armor/StatigelHeadgear.cs index cb81719099..0f199aa456 100644 --- a/Items/Armor/StatigelHeadgear.cs +++ b/Items/Armor/StatigelHeadgear.cs @@ -34,7 +34,8 @@ namespace CalamityMod.Items.Armor public override void UpdateArmorSet(Player player) { player.setBonus = "When you take over 100 damage in one hit you become immune to damage for an extended period of time\n" + - "Grants an extra jump and increased jump height"; + "Grants an extra jump and increased jump height\n" + + "30% increased jump speed"; CalamityPlayer modPlayer = player.Calamity(); modPlayer.statigelSet = true; player.doubleJumpSail = true; diff --git a/Items/Armor/StatigelHelm.cs b/Items/Armor/StatigelHelm.cs index 3eb6b9d3f6..42e3982386 100644 --- a/Items/Armor/StatigelHelm.cs +++ b/Items/Armor/StatigelHelm.cs @@ -34,7 +34,8 @@ namespace CalamityMod.Items.Armor public override void UpdateArmorSet(Player player) { player.setBonus = "When you take over 100 damage in one hit you become immune to damage for an extended period of time\n" + - "Grants an extra jump and increased jump height"; + "Grants an extra jump and increased jump height\n" + + "30% increased jump speed"; CalamityPlayer modPlayer = player.Calamity(); modPlayer.statigelSet = true; player.doubleJumpSail = true; diff --git a/Items/Armor/StatigelHood.cs b/Items/Armor/StatigelHood.cs index f46db6e48c..b19e5d77fa 100644 --- a/Items/Armor/StatigelHood.cs +++ b/Items/Armor/StatigelHood.cs @@ -37,7 +37,8 @@ namespace CalamityMod.Items.Armor player.setBonus = "18% increased minion damage\n" + "Summons a mini slime god to fight for you, the type depends on what world evil you have\n" + "When you take over 100 damage in one hit you become immune to damage for an extended period of time\n" + - "Grants an extra jump and increased jump height"; + "Grants an extra jump and increased jump height\n" + + "30% increased jump speed"; CalamityPlayer modPlayer = player.Calamity(); modPlayer.statigelSet = true; modPlayer.slimeGod = true; diff --git a/Items/Armor/StatigelMask.cs b/Items/Armor/StatigelMask.cs index 215328946b..8625f8e775 100644 --- a/Items/Armor/StatigelMask.cs +++ b/Items/Armor/StatigelMask.cs @@ -35,6 +35,7 @@ namespace CalamityMod.Items.Armor { player.setBonus = "When you take over 100 damage in one hit you become immune to damage for an extended period of time\n" + "Grants an extra jump and increased jump height\n" + + "30% increased jump speed\n" + "Rogue stealth builds while not attacking and slower while moving, up to a max of 100\n" + "Once you have built max stealth, you will be able to perform a Stealth Strike\n" + "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + diff --git a/Items/Armor/TitanHeartBoots.cs b/Items/Armor/TitanHeartBoots.cs index 68ced6a884..03bd012f0e 100644 --- a/Items/Armor/TitanHeartBoots.cs +++ b/Items/Armor/TitanHeartBoots.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -32,7 +33,7 @@ namespace CalamityMod.Items.Armor public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 14); + recipe.AddIngredient(ModContent.ItemType(), 14); recipe.AddIngredient(ModContent.ItemType()); recipe.AddTile(TileID.MythrilAnvil); recipe.SetResult(this); diff --git a/Items/Armor/TitanHeartMantle.cs b/Items/Armor/TitanHeartMantle.cs index 5ddc500f41..1b38d8e86d 100644 --- a/Items/Armor/TitanHeartMantle.cs +++ b/Items/Armor/TitanHeartMantle.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -33,7 +34,7 @@ namespace CalamityMod.Items.Armor public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 20); + recipe.AddIngredient(ModContent.ItemType(), 20); recipe.AddIngredient(ModContent.ItemType()); recipe.AddTile(TileID.MythrilAnvil); recipe.SetResult(this); diff --git a/Items/Armor/TitanHeartMask.cs b/Items/Armor/TitanHeartMask.cs index db9b696842..cbba9c0f80 100644 --- a/Items/Armor/TitanHeartMask.cs +++ b/Items/Armor/TitanHeartMask.cs @@ -1,5 +1,6 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -54,7 +55,7 @@ namespace CalamityMod.Items.Armor public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 10); + recipe.AddIngredient(ModContent.ItemType(), 10); recipe.AddIngredient(ModContent.ItemType()); recipe.AddTile(TileID.MythrilAnvil); recipe.SetResult(this); diff --git a/Items/Armor/VictideHelm.cs b/Items/Armor/VictideHelm.cs index 7d1d7582b0..786d277b0b 100644 --- a/Items/Armor/VictideHelm.cs +++ b/Items/Armor/VictideHelm.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Armor player.setBonus = "Increased life regen and melee damage while submerged in liquid\n" + "When using any weapon you have a 10% chance to throw a returning seashell projectile\n" + "This seashell does true damage and does not benefit from any damage class\n" + - "Slightly reduces breath loss in the abyss"; + "Provides increased underwater mobility and slightly reduces breath loss in the abyss"; CalamityPlayer modPlayer = player.Calamity(); modPlayer.victideSet = true; player.ignoreWater = true; diff --git a/Items/Armor/VictideHelmet.cs b/Items/Armor/VictideHelmet.cs index 8f8c1a1996..55b19a5e9c 100644 --- a/Items/Armor/VictideHelmet.cs +++ b/Items/Armor/VictideHelmet.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Items.Armor "Summons a sea urchin to protect you\n" + "When using any weapon you have a 10% chance to throw a returning seashell projectile\n" + "This seashell does true damage and does not benefit from any damage class\n" + - "Slightly reduces breath loss in the abyss"; + "Provides increased underwater mobility and slightly reduces breath loss in the abyss"; CalamityPlayer modPlayer = player.Calamity(); modPlayer.victideSet = true; modPlayer.urchin = true; diff --git a/Items/Armor/VictideMask.cs b/Items/Armor/VictideMask.cs index 8cd1e26784..e1852913c2 100644 --- a/Items/Armor/VictideMask.cs +++ b/Items/Armor/VictideMask.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Armor player.setBonus = "Increased life regen and magic damage while submerged in liquid\n" + "When using any weapon you have a 10% chance to throw a returning seashell projectile\n" + "This seashell does true damage and does not benefit from any damage class\n" + - "Slightly reduces breath loss in the abyss"; + "Provides increased underwater mobility and slightly reduces breath loss in the abyss"; CalamityPlayer modPlayer = player.Calamity(); modPlayer.victideSet = true; player.ignoreWater = true; diff --git a/Items/Armor/VictideVisage.cs b/Items/Armor/VictideVisage.cs index 86641b1a04..98dc42a033 100644 --- a/Items/Armor/VictideVisage.cs +++ b/Items/Armor/VictideVisage.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Armor player.setBonus = "Increased life regen and ranged damage while submerged in liquid\n" + "When using any weapon you have a 10% chance to throw a returning seashell projectile\n" + "This seashell does true damage and does not benefit from any damage class\n" + - "Slightly reduces breath loss in the abyss"; + "Provides increased underwater mobility and slightly reduces breath loss in the abyss"; CalamityPlayer modPlayer = player.Calamity(); modPlayer.victideSet = true; player.ignoreWater = true; diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index b059ce17ab..a039cc81fe 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -154,12 +154,12 @@ namespace CalamityMod.Items item.defense = 41; //7 more defense else if (item.type == ItemID.SolarFlareLeggings) item.defense = 24; //4 more defense - else if (item.type == ItemID.GladiatorHelmet) //total defense pre-buff = 7 post-buff = 21 - item.defense = 4; //2 more defense + else if (item.type == ItemID.GladiatorHelmet) //total defense pre-buff = 7 post-buff = 15 + item.defense = 3; //1 more defense else if (item.type == ItemID.GladiatorBreastplate) - item.defense = 7; //4 more defense + item.defense = 5; //2 more defense else if (item.type == ItemID.GladiatorLeggings) - item.defense = 5; //3 more defense + item.defense = 4; //2 more defense else if (item.type == ItemID.HallowedPlateMail) //total defense pre-buff = 31, 50, 35 post-buff = 36, 55, 40 item.defense = 18; //3 more defense else if (item.type == ItemID.HallowedGreaves) @@ -878,16 +878,17 @@ namespace CalamityMod.Items return false; } - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0 && - item.pick == 0 && item.axe == 0 && item.hammer == 0 && item.autoReuse && (item.Calamity().rogue || item.magic || item.ranged || item.melee)) + if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) { - if (player.altFunctionUse == 0) + if (item.type == ItemID.WireKite) + return false; + if (item.pick > 0 && item.axe > 0 && item.hammer > 0) + return false; + if (item.Calamity().rogue || item.magic || item.ranged || item.melee) { - return PerformAndromedaAttacks(item, player); - } - else - { - return AltFunctionUse(item, player); + if (player.altFunctionUse == 0) + return PerformAndromedaAttacks(item, player); + else return false; } } @@ -1721,7 +1722,7 @@ namespace CalamityMod.Items { if (line2.mod == "Terraria" && line2.Name == "SetBonus") { - line2.text += "\nMinions deal full damage while wielding magic weapons"; + line2.text += "\nThe minion damage nerf is reduced while wielding magic weapons"; } } } @@ -1732,7 +1733,7 @@ namespace CalamityMod.Items { if (line2.mod == "Terraria" && line2.Name == "Defense") { - line2.text = "4 defense\n" + + line2.text = "3 defense\n" + "3% increased rogue damage"; } } @@ -1743,7 +1744,7 @@ namespace CalamityMod.Items { if (line2.mod == "Terraria" && line2.Name == "Defense") { - line2.text = "7 defense\n" + + line2.text = "5 defense\n" + "3% increased rogue critical strike chance"; } } @@ -1754,7 +1755,7 @@ namespace CalamityMod.Items { if (line2.mod == "Terraria" && line2.Name == "Defense") { - line2.text = "5 defense\n" + + line2.text = "4 defense\n" + "3% increased rogue velocity"; } } @@ -2050,7 +2051,7 @@ Provides heat and cold protection in Death Mode"; "Flight time: 100\n" + "Gills effect and you can move freely through liquids\n" + "You fall faster while submerged in liquid\n" + - "20% increased movement speed and 180% increased jump speed"; + "20% increased movement speed and 36% increased jump speed"; } } } @@ -2112,7 +2113,7 @@ Provides heat and cold protection in Death Mode"; "Average vertical speed\n" + "Flight time: 140\n" + "At night or during an eclipse, you will gain the following boosts:\n" + - "10% increased movement speed, 100% increased jump speed,\n" + + "10% increased movement speed, 20% increased jump speed,\n" + "+15 defense, 10% increased damage, and 5% increased critical strike chance"; } } @@ -2208,7 +2209,7 @@ Provides heat and cold protection in Death Mode"; "Average vertical speed\n" + "Flight time: 160\n" + "+5 defense, 5% increased damage, " + - "10% increased movement speed and 120% increased jump speed"; + "10% increased movement speed and 24% increased jump speed"; } } } @@ -2934,8 +2935,8 @@ Provides heat and cold protection in Death Mode"; modPlayer.wearingRogueArmor = true; player.Calamity().throwingDamage += 0.05f; player.Calamity().throwingVelocity += 0.1f; - player.statDefense += 5; - player.setBonus = "+5 defense\n" + + player.statDefense += 3; + player.setBonus = "+3 defense\n" + "5% increased rogue damage and 10% increased velocity\n" + "Rogue stealth builds while not attacking and not moving, up to a max of 70\n" + "Once you have built max stealth, you will be able to perform a Stealth Strike\n" + @@ -3506,11 +3507,8 @@ Provides heat and cold protection in Death Mode"; { int value = item.value; ItemLoader.ReforgePrice(item, ref value, ref Main.LocalPlayer.discount); - if (Main.LocalPlayer.Calamity().reforges <= 9) //to be reset later - { - Main.LocalPlayer.Calamity().moneyStolenByBandit += value / 5; - Main.LocalPlayer.Calamity().reforges++; - } + CalamityWorld.MoneyStolenByBandit += value / 5; + CalamityWorld.Reforges++; } } #endregion diff --git a/Items/DifficultyItems/Revenge.cs b/Items/DifficultyItems/Revenge.cs index a681d76e41..2736aca44a 100644 --- a/Items/DifficultyItems/Revenge.cs +++ b/Items/DifficultyItems/Revenge.cs @@ -1,6 +1,7 @@ using CalamityMod.NPCs.SlimeGod; using CalamityMod.World; using Microsoft.Xna.Framework; +using System.Collections.Generic; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -13,23 +14,21 @@ namespace CalamityMod.Items.DifficultyItems public override void SetStaticDefaults() { DisplayName.SetDefault("Revengeance"); - Tooltip.SetDefault("Activates Revengeance Mode, can only be used in expert mode.\n" + - "Activates rage. When rage is maxed press V to activate rage mode.\n" + + Tooltip.SetDefault("Enables/disables Revengeance Mode, can only be used in expert mode.\n" + + "RAGE TOOLTIP LINE HERE\n" + "You gain rage whenever you take damage or hit an enemy with a true melee weapon.\n" + - "Activates adrenaline. When adrenaline is maxed press B to activate adrenaline mode.\n" + + "ADRENALINE TOOLTIP LINE HERE\n" + "You gain adrenaline whenever a boss is alive. Getting hit drops adrenaline back to 0.\n" + - "All enemies drop 50% more cash.\n" + + "All enemies drop 50% more cash and spawn 15% more frequently\n" + + "Certain enemies and projectiles deal between 5% and 25% more damage.\n" + "Makes certain enemies immune to life steal and nerfs the effectiveness of life steal.\n" + - "Increases enemy damage by 25% and spawn rates by 15%.\n" + "Nerfs the effectiveness of the Titanium Armor set bonus.\n" + "Makes life regen scale with your current HP, the higher your HP the lower your life regen (this is not based on max HP).\n" + - "Reduces maximum asphalt run speed by 33%.\n" + - "Increases Nurse healing price.\n" + + "Asphalt run speed is reduced by 33%, and the Nurse's healing cost is increased\n" + "Allows certain enemies to inflict the Horror and Marked debuffs.\n" + "Before you have killed your first boss you take 20% less damage from everything.\n" + "Changes ALL boss AIs and some enemy AIs in vanilla and the Calamity Mod.\n" + - "DO NOT USE IF A BOSS IS ALIVE!\n" + - "Can be toggled on and off."); + "Using this while a boss is alive will instantly kill you and despawn the boss."); } public override void SetDefaults() @@ -44,25 +43,35 @@ namespace CalamityMod.Items.DifficultyItems item.consumable = false; } - public override bool CanUseItem(Player player) + public override void ModifyTooltips(List list) { - if (!Main.expertMode || CalamityWorld.bossRushActive) + string rageKey = CalamityMod.RageHotKey.TooltipHotkeyString(); + string adrenKey = CalamityMod.AdrenalineHotKey.TooltipHotkeyString(); + foreach (TooltipLine line2 in list) { - return false; + if (line2.mod == "Terraria" && line2.Name == "Tooltip1") + { + line2.text = "Activates rage. When rage is maxed press " + rageKey + " to activate rage mode."; + } + if (line2.mod == "Terraria" && line2.Name == "Tooltip3") + { + line2.text = "Activates adrenaline. When adrenaline is maxed press " + adrenKey + " to activate adrenaline mode."; + } } - return true; } + public override bool CanUseItem(Player player) => Main.expertMode && !CalamityWorld.bossRushActive; + public override bool UseItem(Player player) { for (int doom = 0; doom < Main.npc.Length; doom++) { - if ((Main.npc[doom].active && (Main.npc[doom].boss || Main.npc[doom].type == NPCID.EaterofWorldsHead || Main.npc[doom].type == NPCID.EaterofWorldsTail || Main.npc[doom].type == ModContent.NPCType() || - Main.npc[doom].type == ModContent.NPCType() || Main.npc[doom].type == ModContent.NPCType() || Main.npc[doom].type == ModContent.NPCType())) || CalamityWorld.DoGSecondStageCountdown > 0) + NPC npc = Main.npc[doom]; + if ((npc.active && (npc.boss || npc.type == NPCID.EaterofWorldsHead || npc.type == NPCID.EaterofWorldsTail || npc.type == ModContent.NPCType() || npc.type == ModContent.NPCType() || npc.type == ModContent.NPCType() || npc.type == ModContent.NPCType())) || CalamityWorld.DoGSecondStageCountdown > 0) { player.KillMe(PlayerDeathReason.ByCustomReason(player.name + " tried to change the rules."), 1000.0, 0, false); - Main.npc[doom].active = Main.npc[doom].friendly; - Main.npc[doom].netUpdate = true; + npc.active = npc.friendly; + npc.netUpdate = true; } } if (!CalamityWorld.revenge) diff --git a/Items/Fishing/BrimstoneCragCatches/Bloodfin.cs b/Items/Fishing/BrimstoneCragCatches/Bloodfin.cs index 4ea4280573..a7b68b1b4a 100644 --- a/Items/Fishing/BrimstoneCragCatches/Bloodfin.cs +++ b/Items/Fishing/BrimstoneCragCatches/Bloodfin.cs @@ -2,6 +2,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using CalamityMod.Buffs.Potions; +using CalamityMod.World; using System.Collections.Generic; namespace CalamityMod.Items.Fishing.BrimstoneCragCatches @@ -38,14 +39,16 @@ The life regen boost is stronger if below 75% health"); public override void OnConsumeItem(Player player) { - player.statLife += 240; + int healAmt = CalamityWorld.ironHeart ? 0 : 240; + player.statLife += healAmt; if (player.statLife > player.statLifeMax2) { player.statLife = player.statLifeMax2; } if (Main.myPlayer == player.whoAmI) { - player.HealEffect(240, true); + if (!CalamityWorld.ironHeart) + player.HealEffect(healAmt, true); } player.AddBuff(ModContent.BuffType(), 600); @@ -63,7 +66,7 @@ The life regen boost is stronger if below 75% health"); // Forces the "Restores X life" tooltip to display the actual life restored instead of zero (due to the previous function). public override void ModifyTooltips(List tooltips) { - tooltips.Find(line => line.Name == "HealLife").text = "Restores " + item.healLife + " life"; + tooltips.Find(line => line.Name == "HealLife").text = "Restores " + (CalamityWorld.ironHeart ? 0 : item.healLife) + " life"; } } } diff --git a/Items/Fishing/BrimstoneCragCatches/BrimstoneCrate.cs b/Items/Fishing/BrimstoneCragCatches/BrimstoneCrate.cs index 0d0297c164..bb644037cb 100644 --- a/Items/Fishing/BrimstoneCragCatches/BrimstoneCrate.cs +++ b/Items/Fishing/BrimstoneCragCatches/BrimstoneCrate.cs @@ -39,7 +39,7 @@ namespace CalamityMod.Items.Fishing.BrimstoneCragCatches DropHelper.DropItem(player, ModContent.ItemType(), 3, 5); DropHelper.DropItemCondition(player, ModContent.ItemType(), Main.hardMode, 0.5f, 5, 15); DropHelper.DropItemCondition(player, ModContent.ItemType(), Main.hardMode, 0.15f, 2, 6); - DropHelper.DropItemCondition(player, ModContent.ItemType(), NPC.downedMechBoss1 && NPC.downedMechBoss2 && NPC.downedMechBoss3, 0.5f, 5, 15); + DropHelper.DropItemCondition(player, ModContent.ItemType(), CalamityWorld.downedBrimstoneElemental, 0.5f, 5, 15); DropHelper.DropItemCondition(player, ModContent.ItemType(), CalamityWorld.downedProvidence, 0.25f, 8, 10); // Weapons (none) diff --git a/Items/LoreItems/KnowledgeAquaticScourge.cs b/Items/LoreItems/KnowledgeAquaticScourge.cs index c00a8083ea..58d2e763bf 100644 --- a/Items/LoreItems/KnowledgeAquaticScourge.cs +++ b/Items/LoreItems/KnowledgeAquaticScourge.cs @@ -14,9 +14,8 @@ namespace CalamityMod.Items.LoreItems DisplayName.SetDefault("Aquatic Scourge"); Tooltip.SetDefault("A horror born of pollution and insatiable hunger; based on size alone this was merely a juvenile.\n" + "These scourge creatures are the largest aquatic predators and very rarely do they frequent such shallow waters.\n" + - "Place in your inventory to gain immunity to the sulphurous waters and increase the stat gains from the Well Fed buff.\n" + - "However, without the Well Fed buff your stats will decrease due to your insatiable hunger.\n" + - "These effects only occur if the item is favorited."); + "Favorite this item to gain immunity to the sulphurous waters and increase the stat gains from the Well Fed buff.\n" + + "However, without the Well Fed buff your stats will decrease due to your insatiable hunger."); } public override void SetDefaults() diff --git a/Items/LoreItems/KnowledgeAstrumAureus.cs b/Items/LoreItems/KnowledgeAstrumAureus.cs index afff87fd71..c651b54717 100644 --- a/Items/LoreItems/KnowledgeAstrumAureus.cs +++ b/Items/LoreItems/KnowledgeAstrumAureus.cs @@ -14,8 +14,7 @@ namespace CalamityMod.Items.LoreItems DisplayName.SetDefault("Astrum Aureus"); Tooltip.SetDefault("A titanic cyborg infected by a star-borne disease expelled from the belly of an ancient god.\n" + "The destruction of this creature will not prevent the spread of the disease.\n" + - "Place in your inventory to gain increased jump speed in space.\n" + - "This effect only occurs if the item is favorited."); + "Favorite this item to gain 10% increased jump speed in space."); } public override void SetDefaults() diff --git a/Items/LoreItems/KnowledgeAstrumDeus.cs b/Items/LoreItems/KnowledgeAstrumDeus.cs index a8b5376105..9a369f5a92 100644 --- a/Items/LoreItems/KnowledgeAstrumDeus.cs +++ b/Items/LoreItems/KnowledgeAstrumDeus.cs @@ -14,8 +14,7 @@ namespace CalamityMod.Items.LoreItems DisplayName.SetDefault("Astrum Deus"); Tooltip.SetDefault("God of the stars and largest vessel for the Astral Infection.\n" + "Though struck down from its place among the stars its remnants have gathered strength, aiming to take its rightful place in the cosmos once more.\n" + - "Place in your inventory to gain increased movement speed in space.\n" + - "This effect only occurs if the item is favorited."); + "Favorite this item to gain increased movement speed in space."); } public override void SetDefaults() diff --git a/Items/LoreItems/KnowledgeBrimstoneElemental.cs b/Items/LoreItems/KnowledgeBrimstoneElemental.cs index d9a666e5d1..1cc9c218e6 100644 --- a/Items/LoreItems/KnowledgeBrimstoneElemental.cs +++ b/Items/LoreItems/KnowledgeBrimstoneElemental.cs @@ -14,8 +14,7 @@ namespace CalamityMod.Items.LoreItems DisplayName.SetDefault("Brimstone Elemental"); Tooltip.SetDefault("The most powerful of the elementals, bent on exacting revenge upon the bloody inferno that demolished her home.\n" + "Finally put to rest, she will suffer no longer from the grief caused by the deaths of her people.\n" + - "Place in your inventory to improve the inferno potion effect.\n" + - "This effect only occurs if the item is favorited."); + "Favorite this item to improve the inferno potion effect."); } public override void SetDefaults() diff --git a/Items/LoreItems/KnowledgeCalamitas.cs b/Items/LoreItems/KnowledgeCalamitas.cs index d2cddd9d9c..09f6cd25a4 100644 --- a/Items/LoreItems/KnowledgeCalamitas.cs +++ b/Items/LoreItems/KnowledgeCalamitas.cs @@ -15,8 +15,7 @@ namespace CalamityMod.Items.LoreItems Tooltip.SetDefault("The witch unrivaled. Perhaps the only one amongst my cohorts to have ever given me cause for doubt.\n" + "Now that you have defeated her your destiny is clear.\n" + "Come now, face me.\n" + - "Place in your inventory to die instantly from every hit.\n" + - "This effect only occurs if the item is favorited."); + "Favorite this item to die instantly from every hit."); } public override void SetDefaults() diff --git a/Items/LoreItems/KnowledgeCalamitasClone.cs b/Items/LoreItems/KnowledgeCalamitasClone.cs index d7fc3ef186..cd8a243315 100644 --- a/Items/LoreItems/KnowledgeCalamitasClone.cs +++ b/Items/LoreItems/KnowledgeCalamitasClone.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.LoreItems DisplayName.SetDefault("Calamitas Clone"); Tooltip.SetDefault("You are indeed stronger than I thought.\n" + "Though the bloody inferno still lingers, observing your progress.\n" + - "Place in your inventory to gain a boost to your minion slots but at the cost of reduced max health."); + "Favorite this item to gain a boost to your minion slots but at the cost of reduced max health."); } public override void SetDefaults() @@ -33,7 +33,8 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.calamitasLore = true; + if (item.favorited) + modPlayer.calamitasLore = true; } public override void AddRecipes() diff --git a/Items/LoreItems/KnowledgeCorruption.cs b/Items/LoreItems/KnowledgeCorruption.cs index ca722fac4e..7841002d85 100644 --- a/Items/LoreItems/KnowledgeCorruption.cs +++ b/Items/LoreItems/KnowledgeCorruption.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.LoreItems DisplayName.SetDefault("The Corruption"); Tooltip.SetDefault("The rotten and forever-deteriorating landscape of infected life, brought upon by a deadly microbe long ago.\n" + "It is rumored that the microbe was created through experimentation by a long-dead race, predating the Terrarians.\n" + - "Place in your inventory to prevent hive cysts from spawning."); + "Favorite this item to prevent hive cysts from spawning."); } public override void SetDefaults() @@ -32,7 +32,8 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.corruptionLore = true; + if (item.favorited) + modPlayer.corruptionLore = true; } public override void AddRecipes() diff --git a/Items/LoreItems/KnowledgeCrabulon.cs b/Items/LoreItems/KnowledgeCrabulon.cs index 1b2116ca4e..55583c83f1 100644 --- a/Items/LoreItems/KnowledgeCrabulon.cs +++ b/Items/LoreItems/KnowledgeCrabulon.cs @@ -13,9 +13,8 @@ namespace CalamityMod.Items.LoreItems DisplayName.SetDefault("Crabulon"); Tooltip.SetDefault("A crab and its mushrooms, a love story.\n" + "It's interesting how creatures can adapt given certain circumstances.\n" + - "Place in your inventory to gain the Mushy buff while underground or in the mushroom biome.\n" + - "However, your movement speed will be decreased while in these areas due to you being covered in fungi.\n" + - "These effects only occur if the item is favorited."); + "Favorite this item to gain the Mushy buff while underground or in the mushroom biome.\n" + + "However, your movement speed will be decreased while in these areas due to you being covered in fungi."); } public override void SetDefaults() diff --git a/Items/LoreItems/KnowledgeCrimson.cs b/Items/LoreItems/KnowledgeCrimson.cs index 6cdf1c5d07..08905ab61a 100644 --- a/Items/LoreItems/KnowledgeCrimson.cs +++ b/Items/LoreItems/KnowledgeCrimson.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.LoreItems DisplayName.SetDefault("The Crimson"); Tooltip.SetDefault("This bloody hell, spawned from a formless mass of flesh that fell from the stars eons ago.\n" + "It is now home to many hideous creatures, spawned from the pumping blood and lurching organs deep within.\n" + - "Place in your inventory to prevent perforator cysts from spawning."); + "Favorite this item to prevent perforator cysts from spawning."); } public override void SetDefaults() @@ -32,7 +32,8 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.crimsonLore = true; + if (item.favorited) + modPlayer.crimsonLore = true; } public override void AddRecipes() diff --git a/Items/LoreItems/KnowledgeCryogen.cs b/Items/LoreItems/KnowledgeCryogen.cs index 16b985b6f8..e3e40b1f1c 100644 --- a/Items/LoreItems/KnowledgeCryogen.cs +++ b/Items/LoreItems/KnowledgeCryogen.cs @@ -14,8 +14,7 @@ namespace CalamityMod.Items.LoreItems DisplayName.SetDefault("Cryogen"); Tooltip.SetDefault("The archmage's prison.\n" + "I am unsure if it has grown weaker over the decades of imprisonment.\n" + - "Place in your inventory to gain a frost dash that freezes enemies, at the cost of slightly reduced defense due to your brittle body.\n" + - "These effects only occur if the item is favorited."); + "Favorite this item to gain a frost dash that freezes enemies, at the cost of slightly reduced defense due to your brittle body."); } public override void SetDefaults() diff --git a/Items/LoreItems/KnowledgeDesertScourge.cs b/Items/LoreItems/KnowledgeDesertScourge.cs index a631c734fa..b97efbacf6 100644 --- a/Items/LoreItems/KnowledgeDesertScourge.cs +++ b/Items/LoreItems/KnowledgeDesertScourge.cs @@ -14,9 +14,8 @@ namespace CalamityMod.Items.LoreItems Tooltip.SetDefault("The great sea worm appears to have survived the extreme heat and has even adapted to it.\n" + "What used to be a majestic beast swimming through the water has now become a dried-up and\n" + "gluttonous husk, constantly on a voracious search for its next meal.\n" + - "Place in your inventory for an increase to defense while in the desert or sunken sea.\n" + - "However, you will deal decreased damage while in these areas due to being a husk of your former self.\n" + - "These effects only occur if the item is favorited."); + "Favorite this item for an increase to defense while in the desert or sunken sea.\n" + + "However, you will deal decreased damage while in these areas due to being a husk of your former self."); } public override void SetDefaults() diff --git a/Items/LoreItems/KnowledgeDestroyer.cs b/Items/LoreItems/KnowledgeDestroyer.cs index 5c3141b702..cea12b9e5e 100644 --- a/Items/LoreItems/KnowledgeDestroyer.cs +++ b/Items/LoreItems/KnowledgeDestroyer.cs @@ -13,9 +13,8 @@ namespace CalamityMod.Items.LoreItems DisplayName.SetDefault("The Destroyer"); Tooltip.SetDefault("A machine brought to life by the mighty souls of warriors, and built to excavate massive tunnels in planets to gather resources.\n" + "Could have proven useful if Draedon didn't have an obsession with turning everything into a tool of destruction.\n" + - "Place in your inventory to gain a boost to your pick speed.\n" + - "However, your max acceleration is decreased slightly due to you feeling heavier.\n" + - "These effects only occur if the item is favorited."); + "Favorite this item to gain a boost to your pick speed.\n" + + "However, your max acceleration is decreased slightly due to you feeling heavier."); } public override void SetDefaults() diff --git a/Items/LoreItems/KnowledgeDevourerofGods.cs b/Items/LoreItems/KnowledgeDevourerofGods.cs index 3cf2fa69fd..f34573d0fd 100644 --- a/Items/LoreItems/KnowledgeDevourerofGods.cs +++ b/Items/LoreItems/KnowledgeDevourerofGods.cs @@ -14,9 +14,8 @@ namespace CalamityMod.Items.LoreItems DisplayName.SetDefault("The Devourer of Gods"); Tooltip.SetDefault("This serpent’s power to assimilate the abilities and energy of those it consumed is unique in almost all the known cosmos, save for its lesser brethren.\n" + "I would have soon had to eliminate it as a threat had it been given more time and creatures to feast upon.\n" + - "Place in your inventory to boost the power of your true melee strikes by 25%.\n" + - "However, due to your reckless nature you will take increased damage.\n" + - "These effects only occur if the item is favorited."); + "Favorite this item to boost the power of your true melee strikes by 25%.\n" + + "However, due to your reckless nature you will take increased damage."); } public override void SetDefaults() diff --git a/Items/LoreItems/KnowledgeDukeFishron.cs b/Items/LoreItems/KnowledgeDukeFishron.cs index fdc59c60bd..e82c8dc7a7 100644 --- a/Items/LoreItems/KnowledgeDukeFishron.cs +++ b/Items/LoreItems/KnowledgeDukeFishron.cs @@ -13,9 +13,8 @@ namespace CalamityMod.Items.LoreItems DisplayName.SetDefault("Duke Fishron"); Tooltip.SetDefault("The mutant terror of the sea was once the trusted companion of an old king; he tamed it using its favorite treat.\n" + "Long ago, the creature flew in desperation from the raging bloody inferno consuming its home, ultimately finding its way to the ocean.\n" + - "Place in your inventory for an increase to all damage, crit and movement speed while submerged in liquid.\n" + - "However, while not submerged in liquid you will have slightly decreased damage, crit and movement speed due to feeling dried out.\n" + - "These effects only occur if the item is favorited."); + "Favorite this item for an increase to all damage, crit and movement speed while submerged in liquid.\n" + + "However, while not submerged in liquid you will have slightly decreased damage, crit and movement speed due to feeling dried out."); } public override void SetDefaults() diff --git a/Items/LoreItems/KnowledgeEaterofWorlds.cs b/Items/LoreItems/KnowledgeEaterofWorlds.cs index 83269fc9a3..9c69fba845 100644 --- a/Items/LoreItems/KnowledgeEaterofWorlds.cs +++ b/Items/LoreItems/KnowledgeEaterofWorlds.cs @@ -13,9 +13,8 @@ namespace CalamityMod.Items.LoreItems DisplayName.SetDefault("The Eater of Worlds"); Tooltip.SetDefault("Perhaps it was just a giant worm infected by the microbe, given centuries to feed and grow its festering body.\n" + "Seems likely, given the origins of this place.\n" + - "Deadly microbes spawn around you while this is placed in your inventory.\n" + - "However, you will have decreased life regen due to your skin rotting off.\n" + - "These effects only occur if the item is favorited."); + "Deadly microbes spawn around you while this item is favorited.\n" + + "However, you will have decreased life regen due to your skin rotting off."); } public override void SetDefaults() diff --git a/Items/LoreItems/KnowledgeEyeofCthulhu.cs b/Items/LoreItems/KnowledgeEyeofCthulhu.cs index 086355307c..34854f3d4b 100644 --- a/Items/LoreItems/KnowledgeEyeofCthulhu.cs +++ b/Items/LoreItems/KnowledgeEyeofCthulhu.cs @@ -12,9 +12,8 @@ namespace CalamityMod.Items.LoreItems DisplayName.SetDefault("The Eye of Cthulhu"); Tooltip.SetDefault("That eye...how peculiar.\n" + "I sensed it watching you more intensely as you grew stronger.\n" + - "Place in your inventory for night vision at night.\n" + - "However, your vision is reduced during the day.\n" + - "These effects only occur if the item is favorited."); + "Favorite this item for night vision at night.\n" + + "However, your vision is reduced during the day."); } public override void SetDefaults() diff --git a/Items/LoreItems/KnowledgeGolem.cs b/Items/LoreItems/KnowledgeGolem.cs index d661b84483..d2a7451b6c 100644 --- a/Items/LoreItems/KnowledgeGolem.cs +++ b/Items/LoreItems/KnowledgeGolem.cs @@ -13,8 +13,7 @@ namespace CalamityMod.Items.LoreItems DisplayName.SetDefault("Golem"); Tooltip.SetDefault("A primitive construct.\n" + "I admire the lihzahrd race for their ingenuity, though finding faith in such a flawed idol would invariably lead to their downfall.\n" + - "Place in your inventory to gain increased defense while standing still.\n" + - "This effect only occurs if the item is favorited."); + "Favorite this item to gain increased defense while standing still."); } public override void SetDefaults() diff --git a/Items/LoreItems/KnowledgeHiveMind.cs b/Items/LoreItems/KnowledgeHiveMind.cs index 9ad9b6dbd9..e2d694dd1c 100644 --- a/Items/LoreItems/KnowledgeHiveMind.cs +++ b/Items/LoreItems/KnowledgeHiveMind.cs @@ -14,9 +14,8 @@ namespace CalamityMod.Items.LoreItems DisplayName.SetDefault("The Hive Mind"); Tooltip.SetDefault("A hive of clustered microbial-infected flesh.\n" + "I do not believe killing it will lessen the corruption here.\n" + - "Place in your inventory for all of your projectiles to inflict cursed flames when in the corruption.\n" + - "However, enemy spawn rates will be greatly reduced while in the corruption due to your overwhelmingly-putrid odor.\n" + - "These effects only occur if the item is favorited."); + "Favorite this item for all of your projectiles to inflict cursed flames when in the corruption.\n" + + "However, enemy spawn rates will be greatly reduced while in the corruption due to your overwhelmingly-putrid odor."); } public override void SetDefaults() diff --git a/Items/LoreItems/KnowledgeKingSlime.cs b/Items/LoreItems/KnowledgeKingSlime.cs index 1af39c4988..fdd0f6a6f4 100644 --- a/Items/LoreItems/KnowledgeKingSlime.cs +++ b/Items/LoreItems/KnowledgeKingSlime.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Materials; +using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -12,9 +13,8 @@ namespace CalamityMod.Items.LoreItems DisplayName.SetDefault("King Slime"); Tooltip.SetDefault("Only a fool could be caught by this pitiful excuse for a hunter.\n" + "Unfortunately, our world has no shortage of those.\n" + - "Place in your inventory to gain a slight movement speed and jump boost.\n" + - "However, your defense is slightly reduced due to your gelatinous body.\n" + - "These effects only occur if the item is favorited."); + "Favorite this item to gain 5% increased movement speed and 2% increased jump speed.\n" + + "However, your defense is reduced by 3 due to your gelatinous body."); } public override void SetDefaults() @@ -25,6 +25,20 @@ namespace CalamityMod.Items.LoreItems item.consumable = false; } + public override void ModifyTooltips(List list) + { + bool autoJump = Main.player[Main.myPlayer].autoJump; + string hasJumpBoost = "Place in your inventory to gain 5% increased movement speed and 2% increased jump speed."; + string noJumpBoost = "Place in your inventory to gain 5% increased movement speed."; + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip2") + { + line2.text = autoJump ? noJumpBoost : hasJumpBoost; + } + } + } + public override bool CanUseItem(Player player) { return false; diff --git a/Items/LoreItems/KnowledgeLeviathanandSiren.cs b/Items/LoreItems/KnowledgeLeviathanandSiren.cs index e95bef421f..7dd1598dfe 100644 --- a/Items/LoreItems/KnowledgeLeviathanandSiren.cs +++ b/Items/LoreItems/KnowledgeLeviathanandSiren.cs @@ -14,10 +14,9 @@ namespace CalamityMod.Items.LoreItems DisplayName.SetDefault("Leviathan and Siren"); Tooltip.SetDefault("An odd pair of creatures; one seeking companionship and the other seeking sustenance.\n" + "Perhaps two genetic misfits outcast from their homes that found comfort in assisting one another.\n" + - "Place in your inventory to gain increased max health while wearing the siren heart and treasure detect while wearing the strange orb.\n" + + "Favorite this item to gain increased max health while wearing the siren heart and treasure detect while wearing the strange orb.\n" + "Allows the young siren pet to move normally while outside of liquids.\n" + - "However, if you're not submerged in liquid you will have decreased defense and damage reduction.\n" + - "These effects only occur if the item is favorited."); + "However, if you're not submerged in liquid you will have decreased defense and damage reduction."); } public override void SetDefaults() diff --git a/Items/LoreItems/KnowledgeLunaticCultist.cs b/Items/LoreItems/KnowledgeLunaticCultist.cs index 4ddea4544f..a701aee0f5 100644 --- a/Items/LoreItems/KnowledgeLunaticCultist.cs +++ b/Items/LoreItems/KnowledgeLunaticCultist.cs @@ -14,9 +14,8 @@ namespace CalamityMod.Items.LoreItems Tooltip.SetDefault("The gifted one that terminated my grand summoning so long ago with his uncanny powers over the arcane.\n" + "Someone I once held in such contempt for his actions is now...deceased, his sealing ritual undone...prepare for the end.\n" + "Your impending doom approaches...\n" + - "Place in your inventory for an increase to all stats during the lunar event.\n" + - "However, your vision is decreased due to eldritch knowledge damaging your mind.\n" + - "These effects only occur if the item is favorited."); + "Favorite this item for an increase to all stats during the lunar event.\n" + + "However, your vision is decreased due to eldritch knowledge damaging your mind."); } public override void SetDefaults() diff --git a/Items/LoreItems/KnowledgeMoonLord.cs b/Items/LoreItems/KnowledgeMoonLord.cs index 6d023e3fcb..113e46931d 100644 --- a/Items/LoreItems/KnowledgeMoonLord.cs +++ b/Items/LoreItems/KnowledgeMoonLord.cs @@ -14,9 +14,8 @@ namespace CalamityMod.Items.LoreItems Tooltip.SetDefault("What a waste.\n" + "Had it been fully restored it would have been a force to behold, but what you fought was an empty shell.\n" + "However, that doesn't diminish the immense potential locked within it, released upon its death.\n" + - "Place in your inventory to gain an improved Gravity Globe that gives you an increase to all stats while upside down.\n" + - "However, while not upside down you have permanent featherfall.\n" + - "These effects only occur if the item is favorited."); + "Favorite this item to gain an improved Gravity Globe that gives you an increase to all stats while upside down.\n" + + "However, while not upside down you have permanent featherfall."); } public override void SetDefaults() diff --git a/Items/LoreItems/KnowledgeOcean.cs b/Items/LoreItems/KnowledgeOcean.cs index 3928714138..7b3af37673 100644 --- a/Items/LoreItems/KnowledgeOcean.cs +++ b/Items/LoreItems/KnowledgeOcean.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.LoreItems DisplayName.SetDefault("The Ocean"); Tooltip.SetDefault("Take care to not disturb the deep waters of this world.\n" + "You may awaken something more terrifying than death itself.\n" + - "Place in your inventory to prevent the mysterious siren lure from spawning."); + "Favorite this item to prevent the mysterious siren lure from spawning."); } public override void SetDefaults() @@ -33,7 +33,8 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.oceanLore = true; + if (item.favorited) + modPlayer.oceanLore = true; } public override void AddRecipes() diff --git a/Items/LoreItems/KnowledgeOldDuke.cs b/Items/LoreItems/KnowledgeOldDuke.cs index 6df689a8c1..0747a4d8d1 100644 --- a/Items/LoreItems/KnowledgeOldDuke.cs +++ b/Items/LoreItems/KnowledgeOldDuke.cs @@ -14,8 +14,7 @@ namespace CalamityMod.Items.LoreItems DisplayName.SetDefault("Old Duke"); Tooltip.SetDefault("Strange, to find out that the mutant terror of the seas was not alone in its unique biology.\n" + "Perhaps I was mistaken to classify the creature from its relation to pigrons alone.\n" + - "Place in your inventory to convert negative effects from the Acid Rain debuff to positive effects.\n" + - "These effects only occur if the item is favorited."); + "Favorite this item to convert negative effects from the Acid Rain debuff to positive effects."); } public override void SetDefaults() diff --git a/Items/LoreItems/KnowledgePerforators.cs b/Items/LoreItems/KnowledgePerforators.cs index 53dbe77a77..b3a903fa69 100644 --- a/Items/LoreItems/KnowledgePerforators.cs +++ b/Items/LoreItems/KnowledgePerforators.cs @@ -13,9 +13,8 @@ namespace CalamityMod.Items.LoreItems { DisplayName.SetDefault("The Perforators and their Hive"); Tooltip.SetDefault("An abomination of comingled flesh, bone, and organ, infested primarily by blood-slurping worms.\n" + - "Place in your inventory for all of your projectiles to inflict ichor when in the crimson.\n" + - "However, enemy spawn rates will be greatly increased while in the crimson due to your body excreting a sweet-smelling pus.\n" + - "These effects only occur if the item is favorited."); + "Favorite this item for all of your projectiles to inflict ichor when in the crimson.\n" + + "However, enemy spawn rates will be greatly increased while in the crimson due to your body excreting a sweet-smelling pus."); } public override void SetDefaults() diff --git a/Items/LoreItems/KnowledgePlaguebringerGoliath.cs b/Items/LoreItems/KnowledgePlaguebringerGoliath.cs index 4f88bf176c..6e781bb644 100644 --- a/Items/LoreItems/KnowledgePlaguebringerGoliath.cs +++ b/Items/LoreItems/KnowledgePlaguebringerGoliath.cs @@ -14,8 +14,7 @@ namespace CalamityMod.Items.LoreItems DisplayName.SetDefault("The Plaguebringer Goliath"); Tooltip.SetDefault("A horrific amalgam of steel, flesh, and infection, capable of destroying an entire civilization in just one onslaught.\n" + "Its plague nuke barrage can leave an entire area uninhabitable for months. A shame that it came to this but the plague must be contained.\n" + - "Place in your inventory to gain increased wing flight time, but at the cost of reduced life regen.\n" + - "These effects only occur if the item is favorited."); + "Favorite this item to gain increased wing flight time, but at the cost of reduced life regen."); } public override void SetDefaults() diff --git a/Items/LoreItems/KnowledgePlantera.cs b/Items/LoreItems/KnowledgePlantera.cs index 7c71900847..4ad06181b9 100644 --- a/Items/LoreItems/KnowledgePlantera.cs +++ b/Items/LoreItems/KnowledgePlantera.cs @@ -14,8 +14,7 @@ namespace CalamityMod.Items.LoreItems Tooltip.SetDefault("Well done, you killed a plant.\n" + "It was used as a vessel to house the spirits of those unfortunate enough to find their way down here.\n" + "I wish you luck in dealing with the fallout.\n" + - "Place in your inventory to gain increased item grab range.\n" + - "This effect only occurs if the item is favorited."); + "Favorite this item to gain increased item grab range."); } public override void SetDefaults() diff --git a/Items/LoreItems/KnowledgePolterghast.cs b/Items/LoreItems/KnowledgePolterghast.cs index acce6e2081..4cb59d9af4 100644 --- a/Items/LoreItems/KnowledgePolterghast.cs +++ b/Items/LoreItems/KnowledgePolterghast.cs @@ -14,8 +14,7 @@ namespace CalamityMod.Items.LoreItems DisplayName.SetDefault("Polterghast"); Tooltip.SetDefault("A creature born of hatred and anger, formed by countless human souls with all of their energy entirely devoted to consuming others.\n" + "It seems a waste to have had such a potent source of power ravage mindlessly through these empty halls.\n" + - "Place in your inventory to gain increased item grab range.\n" + - "This effect only occurs if the item is favorited."); + "Favorite this item to gain increased item grab range."); } public override void SetDefaults() diff --git a/Items/LoreItems/KnowledgeProvidence.cs b/Items/LoreItems/KnowledgeProvidence.cs index 16183e5179..73be8e36d1 100644 --- a/Items/LoreItems/KnowledgeProvidence.cs +++ b/Items/LoreItems/KnowledgeProvidence.cs @@ -14,9 +14,8 @@ namespace CalamityMod.Items.LoreItems DisplayName.SetDefault("Providence, the Profaned Goddess"); Tooltip.SetDefault("A core surrounded by stone and flame, a simple origin and a simple goal.\n" + "What would have become of us had she not been defeated is a frightening concept to consider.\n" + - "Place in your inventory to imbue all projectiles with profaned flames, causing them to inflict extra damage.\n" + - "However, your max life is decreased due to a part of your soul being required to fuel the profaned flames.\n" + - "These effects only occur if the item is favorited."); + "Favorite this item to imbue all projectiles with profaned flames, causing them to inflict extra damage.\n" + + "However, your max life is decreased due to a part of your soul being required to fuel the profaned flames."); } public override void SetDefaults() diff --git a/Items/LoreItems/KnowledgeQueenBee.cs b/Items/LoreItems/KnowledgeQueenBee.cs index b91706e5ae..6981252208 100644 --- a/Items/LoreItems/KnowledgeQueenBee.cs +++ b/Items/LoreItems/KnowledgeQueenBee.cs @@ -12,8 +12,7 @@ namespace CalamityMod.Items.LoreItems { DisplayName.SetDefault("Queen Bee"); Tooltip.SetDefault("As crude as the giant insects are they can prove useful in certain situations...given the ability to control them.\n" + - "Place in your inventory to make small bees and weak hornets friendly.\n" + - "This effect only occurs if the item is favorited."); + "Favorite this item to make small bees and weak hornets friendly."); } public override void SetDefaults() diff --git a/Items/LoreItems/KnowledgeRavager.cs b/Items/LoreItems/KnowledgeRavager.cs index 461310f14d..736ed52ef6 100644 --- a/Items/LoreItems/KnowledgeRavager.cs +++ b/Items/LoreItems/KnowledgeRavager.cs @@ -14,8 +14,7 @@ namespace CalamityMod.Items.LoreItems DisplayName.SetDefault("Ravager"); Tooltip.SetDefault("The flesh golem constructed using twisted necromancy during the time of my conquest to counter my unstoppable forces.\n" + "Its creators were slaughtered by it moments after its conception. It is for the best that it has been destroyed.\n" + - "Place in your inventory to gain an increase to all damage, but at the cost of reduced wing flight time.\n" + - "These effects only occur if the item is favorited."); + "Favorite this item to gain an increase to all damage, but at the cost of reduced wing flight time."); } public override void SetDefaults() diff --git a/Items/LoreItems/KnowledgeSkeletron.cs b/Items/LoreItems/KnowledgeSkeletron.cs index 8f54da002b..ece05bc9b5 100644 --- a/Items/LoreItems/KnowledgeSkeletron.cs +++ b/Items/LoreItems/KnowledgeSkeletron.cs @@ -13,9 +13,8 @@ namespace CalamityMod.Items.LoreItems DisplayName.SetDefault("Skeletron"); Tooltip.SetDefault("The curse is said to only affect the elderly.\n" + "After they are afflicted they become an immortal vessel for an ancient demon of the underworld.\n" + - "Place in your inventory to gain increased damage while in the dungeon.\n" + - "However, your max health is decreased due to Skeletron's curse.\n" + - "These effects only occur if the item is favorited."); + "Favorite this item to gain increased damage while in the dungeon.\n" + + "However, your max health is decreased due to Skeletron's curse."); } public override void SetDefaults() diff --git a/Items/LoreItems/KnowledgeSkeletronPrime.cs b/Items/LoreItems/KnowledgeSkeletronPrime.cs index 22239ad9f4..9e89adf1f1 100644 --- a/Items/LoreItems/KnowledgeSkeletronPrime.cs +++ b/Items/LoreItems/KnowledgeSkeletronPrime.cs @@ -13,9 +13,8 @@ namespace CalamityMod.Items.LoreItems DisplayName.SetDefault("Skeletron Prime"); Tooltip.SetDefault("What a silly and pointless contraption for something created with the essence of pure terror.\n" + "Draedon obviously took several liberties with its design...I am not impressed.\n" + - "Place in your inventory to gain a boost to your armor penetration.\n" + - "However, your max acceleration is decreased due to you feeling heavier.\n" + - "These effects only occur if the item is favorited."); + "Favorite this item to gain a boost to your armor penetration.\n" + + "However, your max acceleration is decreased due to you feeling heavier."); } public override void SetDefaults() diff --git a/Items/LoreItems/KnowledgeSlimeGod.cs b/Items/LoreItems/KnowledgeSlimeGod.cs index c194ec932f..358c2b67b7 100644 --- a/Items/LoreItems/KnowledgeSlimeGod.cs +++ b/Items/LoreItems/KnowledgeSlimeGod.cs @@ -13,9 +13,8 @@ namespace CalamityMod.Items.LoreItems DisplayName.SetDefault("The Slime God"); Tooltip.SetDefault("It is a travesty, one of the most threatening biological terrors ever created.\n" + "If this creature were allowed to combine every slime on the planet it would become nearly unstoppable.\n" + - "Place in your inventory to become slimed and able to slide around on tiles quickly, at the cost of reduced defense.\n" + - "This effect makes dashing more difficult and does not work with mounts.\n" + - "These effects only occur if the item is favorited."); + "Favorite this item to become slimed and able to slide around on tiles quickly, at the cost of reduced defense.\n" + + "This effect makes dashing more difficult and does not work with mounts."); } public override void SetDefaults() diff --git a/Items/LoreItems/KnowledgeTwins.cs b/Items/LoreItems/KnowledgeTwins.cs index 1514675839..c4a4cc77bf 100644 --- a/Items/LoreItems/KnowledgeTwins.cs +++ b/Items/LoreItems/KnowledgeTwins.cs @@ -13,10 +13,9 @@ namespace CalamityMod.Items.LoreItems DisplayName.SetDefault("The Twins"); Tooltip.SetDefault("The bio-mechanical watchers of the night, originally created as security using the souls extracted from human eyes.\n" + "These creatures did not belong in this world, it's best to be rid of them.\n" + - "Place in your inventory to gain invisibility and rogue bonuses at night.\n" + + "Favorite this item to gain invisibility and rogue bonuses at night.\n" + "However, your defense is reduced while above 50% life due to you feeling softer.\n" + - "Your max acceleration is reduced while below 50% life due to you feeling heavier.\n" + - "These effects only occur if the item is favorited."); + "Your max acceleration is reduced while below 50% life due to you feeling heavier."); } public override void SetDefaults() diff --git a/Items/LoreItems/KnowledgeUnderworld.cs b/Items/LoreItems/KnowledgeUnderworld.cs index 4d86b79d3d..e4c3123334 100644 --- a/Items/LoreItems/KnowledgeUnderworld.cs +++ b/Items/LoreItems/KnowledgeUnderworld.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.LoreItems DisplayName.SetDefault("The Underworld"); Tooltip.SetDefault("These obsidian and hellstone towers were once home to thousands of...'people'.\n" + "Unfortunately for them, they were twisted by their inner demons until they were beyond saving.\n" + - "Place in your inventory to prevent voodoo demons from spawning."); + "Favorite this item to prevent voodoo demons from dropping voodoo dolls."); } public override void SetDefaults() @@ -32,7 +32,8 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.underworldLore = true; + if (item.favorited) + modPlayer.underworldLore = true; } public override void AddRecipes() diff --git a/Items/LoreItems/KnowledgeWallofFlesh.cs b/Items/LoreItems/KnowledgeWallofFlesh.cs index 6c4b7a7015..cff5e2c5b6 100644 --- a/Items/LoreItems/KnowledgeWallofFlesh.cs +++ b/Items/LoreItems/KnowledgeWallofFlesh.cs @@ -14,8 +14,7 @@ namespace CalamityMod.Items.LoreItems Tooltip.SetDefault("I see the deed is done.\n" + "The unholy amalgamation of flesh and hatred has been defeated.\n" + "Prepare to face the terrors that lurk in the light and dark parts of this world.\n" + - "Place in your inventory to gain increased item grab range.\n" + - "This effect only occurs if the item is favorited."); + "Favorite this item to gain increased item grab range."); } public override void SetDefaults() diff --git a/Items/LoreItems/KnowledgeYharon.cs b/Items/LoreItems/KnowledgeYharon.cs index bbf5a90a42..586afec642 100644 --- a/Items/LoreItems/KnowledgeYharon.cs +++ b/Items/LoreItems/KnowledgeYharon.cs @@ -14,8 +14,7 @@ namespace CalamityMod.Items.LoreItems DisplayName.SetDefault("Jungle Dragon, Yharon"); Tooltip.SetDefault("I would not be able to bear a world without my faithful companion by my side.\n" + "Fortunately, fate will have it so that it is a world I shall never have to see, for better or for worse.\n" + - "Place in your inventory to gain nearly-infinite wing flight time, but at the cost of a 25% decrease to all damage.\n" + - "These effects only occur if the item is favorited."); + "Favorite this item to gain nearly-infinite wing flight time, but at the cost of a 25% decrease to all damage."); } public override void SetDefaults() diff --git a/Items/Materials/CruptixBar.cs b/Items/Materials/CruptixBar.cs index 5ab4c43ff1..a9d7be51db 100644 --- a/Items/Materials/CruptixBar.cs +++ b/Items/Materials/CruptixBar.cs @@ -1,46 +1,73 @@ using CalamityMod.Items.Placeables.Ores; +using CalamityMod.Tiles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Tiles; namespace CalamityMod.Items.Materials { - public class CruptixBar : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Scoria Bar"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(6, 6)); - Tooltip.SetDefault("The smoke feels warm\n" + - "Looks funky when placed"); //explaining the texture shown when placed. same bug as red lightning container and ectoheart tbh - } + public class CruptixBar : ModItem + { + private int frameCounter = 0; + private int frame = 0; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Scoria Bar"); + Tooltip.SetDefault("The smoke feels warm"); + } - public override void SetDefaults() - { - item.createTile = ModContent.TileType(); - item.noUseGraphic = true; //no use graphic because animated things swing their entire sheet - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.autoReuse = true; - item.consumable = true; - item.width = 30; - item.height = 24; - item.maxStack = 999; - item.value = Item.sellPrice(gold: 1, silver: 20); - item.rare = 8; - } + public override void SetDefaults() + { + item.createTile = ModContent.TileType(); + item.useStyle = ItemUseStyleID.SwingThrow; + item.useTurn = true; + item.useAnimation = 15; + item.useTime = 10; + item.autoReuse = true; + item.consumable = true; + item.width = 40; + item.height = 52; + item.maxStack = 999; + item.value = Item.sellPrice(gold: 1, silver: 20); + item.rare = 8; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(TileID.AdamantiteForge); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + internal Rectangle GetCurrentFrame() + { + int frameAmt = 6; + if (frameCounter >= 6) + { + frameCounter = -1; + frame = frame == frameAmt - 1 ? 0 : frame + 1; + } + frameCounter++; + return new Rectangle(0, item.height * frame, item.width, item.height); + } + + public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + Texture2D texture = ModContent.GetTexture("CalamityMod/Items/Materials/CruptixBar_Animated"); + spriteBatch.Draw(texture, position, GetCurrentFrame(), Color.White, 0f, origin, scale, SpriteEffects.None, 0); + return false; + } + + public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) + { + Texture2D texture = ModContent.GetTexture("CalamityMod/Items/Materials/CruptixBar_Animated"); + spriteBatch.Draw(texture, item.position - Main.screenPosition, GetCurrentFrame(), lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 5); + recipe.AddTile(TileID.AdamantiteForge); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Materials/CruptixBar.png b/Items/Materials/CruptixBar.png index 670ec3fa3a..f1adabf4a3 100644 Binary files a/Items/Materials/CruptixBar.png and b/Items/Materials/CruptixBar.png differ diff --git a/Items/Materials/CruptixBar_Animated.png b/Items/Materials/CruptixBar_Animated.png new file mode 100644 index 0000000000..670ec3fa3a Binary files /dev/null and b/Items/Materials/CruptixBar_Animated.png differ diff --git a/Items/PermanentBoosters/Ectoheart.cs b/Items/PermanentBoosters/Ectoheart.cs index e187a6d4b0..20f868f541 100644 --- a/Items/PermanentBoosters/Ectoheart.cs +++ b/Items/PermanentBoosters/Ectoheart.cs @@ -9,52 +9,73 @@ using Terraria.ModLoader; namespace CalamityMod.Items.PermanentBoosters { public class Ectoheart : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ectoheart"); - Tooltip.SetDefault("Permanently makes Adrenaline Mode take 5 less seconds to charge\n" + - "Revengeance drop"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(8, 3)); - } + { + private int frameCounter = 0; + private int frame = 0; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ectoheart"); + Tooltip.SetDefault("Permanently makes Adrenaline Mode take 5 less seconds to charge\n" + + "Revengeance drop"); + } - public override void SetDefaults() - { - item.width = 42; - item.height = 44; - item.useAnimation = 30; - item.useTime = 30; - item.useStyle = ItemUseStyleID.HoldingUp; - item.UseSound = SoundID.Item122; - item.consumable = true; - item.rare = 10; - item.Calamity().customRarity = CalamityRarity.PureGreen; - } + public override void SetDefaults() + { + item.width = 42; + item.height = 44; + item.useAnimation = 30; + item.useTime = 30; + item.useStyle = ItemUseStyleID.HoldingUp; + item.UseSound = SoundID.Item122; + item.consumable = true; + item.rare = 10; + item.Calamity().customRarity = CalamityRarity.PureGreen; + } - public override bool CanUseItem(Player player) - { - CalamityPlayer modPlayer = player.Calamity(); - if (modPlayer.adrenalineBoostThree) - { - return false; - } - return true; - } + public override bool CanUseItem(Player player) => !player.Calamity().adrenalineBoostThree; - public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) - { - CalamityUtils.DrawItemGlowmask(item, spriteBatch, 3, rotation, ModContent.GetTexture("CalamityMod/Items/PermanentBoosters/EctoheartGlow")); - } + internal Rectangle GetCurrentFrame(bool frameCounterUp = true) + { + int frameAmt = 3; + if (frameCounter >= 8) + { + frameCounter = -1; + frame = frame == frameAmt - 1 ? 0 : frame + 1; + } + if (frameCounterUp) + frameCounter++; + return new Rectangle(0, item.height * frame, item.width, item.height); + } - public override bool UseItem(Player player) - { - if (player.itemAnimation > 0 && player.itemTime == 0) - { - player.itemTime = item.useTime; - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.adrenalineBoostThree = true; - } - return true; - } - } + public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + Texture2D texture = ModContent.GetTexture("CalamityMod/Items/PermanentBoosters/Ectoheart_Animated"); + spriteBatch.Draw(texture, position, GetCurrentFrame(), Color.White, 0f, origin, scale, SpriteEffects.None, 0); + return false; + } + + public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) + { + Texture2D texture = ModContent.GetTexture("CalamityMod/Items/PermanentBoosters/Ectoheart_Animated"); + spriteBatch.Draw(texture, item.position - Main.screenPosition, GetCurrentFrame(), lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); + return false; + } + + public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) + { + Texture2D texture = ModContent.GetTexture("CalamityMod/Items/PermanentBoosters/EctoheartGlow"); + spriteBatch.Draw(texture, item.position - Main.screenPosition, GetCurrentFrame(false), Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); + } + + public override bool UseItem(Player player) + { + if (player.itemAnimation > 0 && player.itemTime == 0) + { + player.itemTime = item.useTime; + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.adrenalineBoostThree = true; + } + return true; + } + } } diff --git a/Items/PermanentBoosters/Ectoheart.png b/Items/PermanentBoosters/Ectoheart.png index 26d587ff6e..e03dbaa21e 100644 Binary files a/Items/PermanentBoosters/Ectoheart.png and b/Items/PermanentBoosters/Ectoheart.png differ diff --git a/Items/PermanentBoosters/Ectoheart_Animated.png b/Items/PermanentBoosters/Ectoheart_Animated.png new file mode 100644 index 0000000000..26d587ff6e Binary files /dev/null and b/Items/PermanentBoosters/Ectoheart_Animated.png differ diff --git a/Items/PermanentBoosters/RedLightningContainer.cs b/Items/PermanentBoosters/RedLightningContainer.cs index eaf3a9e1a9..99a9c38cd4 100644 --- a/Items/PermanentBoosters/RedLightningContainer.cs +++ b/Items/PermanentBoosters/RedLightningContainer.cs @@ -1,4 +1,6 @@ using CalamityMod.CalPlayer; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -6,48 +8,74 @@ using Terraria.ModLoader; namespace CalamityMod.Items.PermanentBoosters { - public class RedLightningContainer : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Red Lightning Container"); - Tooltip.SetDefault("Permanently makes Rage Mode do 15% more damage\n" + - "Revengeance drop"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(5, 6)); - } + public class RedLightningContainer : ModItem + { + private int frameCounter = 0; + private int frame = 0; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Red Lightning Container"); + Tooltip.SetDefault("Permanently makes Rage Mode do 15% more damage\n" + + "Revengeance drop"); + } - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.useAnimation = 30; - item.useTime = 30; - item.useStyle = ItemUseStyleID.HoldingUp; - item.UseSound = SoundID.Item122; - item.consumable = true; - item.rare = 10; - item.Calamity().customRarity = CalamityRarity.Turquoise; - } + public override void SetDefaults() + { + item.width = 30; + item.height = 40; + item.useAnimation = 30; + item.useTime = 30; + item.useStyle = ItemUseStyleID.HoldingUp; + item.UseSound = SoundID.Item122; + item.consumable = true; + item.rare = 10; + item.Calamity().customRarity = CalamityRarity.Turquoise; + } - public override bool CanUseItem(Player player) - { - CalamityPlayer modPlayer = player.Calamity(); - if (modPlayer.rageBoostThree) - { - return false; - } - return true; - } + public override bool CanUseItem(Player player) => !player.Calamity().rageBoostThree; - public override bool UseItem(Player player) - { - if (player.itemAnimation > 0 && player.itemTime == 0) - { - player.itemTime = item.useTime; - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.rageBoostThree = true; - } - return true; - } - } + internal Rectangle GetCurrentFrame(bool frameCounterUp = true) + { + int frameAmt = 6; + if (frameCounter >= 5) + { + frameCounter = -1; + frame = frame == frameAmt - 1 ? 0 : frame + 1; + } + if (frameCounterUp) + frameCounter++; + return new Rectangle(0, item.height * frame, item.width, item.height); + } + + public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + Texture2D texture = ModContent.GetTexture("CalamityMod/Items/PermanentBoosters/RedLightningContainer_Animated"); + spriteBatch.Draw(texture, position, GetCurrentFrame(), Color.White, 0f, origin, scale, SpriteEffects.None, 0); + return false; + } + + public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) + { + Texture2D texture = ModContent.GetTexture("CalamityMod/Items/PermanentBoosters/RedLightningContainer_Animated"); + spriteBatch.Draw(texture, item.position - Main.screenPosition, GetCurrentFrame(), lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); + return false; + } + + public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) + { + Texture2D texture = ModContent.GetTexture("CalamityMod/Items/PermanentBoosters/RedLightningContainerGlow"); + spriteBatch.Draw(texture, item.position - Main.screenPosition, GetCurrentFrame(false), Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); + } + + public override bool UseItem(Player player) + { + if (player.itemAnimation > 0 && player.itemTime == 0) + { + player.itemTime = item.useTime; + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.rageBoostThree = true; + } + return true; + } + } } diff --git a/Items/PermanentBoosters/RedLightningContainer.png b/Items/PermanentBoosters/RedLightningContainer.png index c859aca470..e47f72a848 100644 Binary files a/Items/PermanentBoosters/RedLightningContainer.png and b/Items/PermanentBoosters/RedLightningContainer.png differ diff --git a/Items/PermanentBoosters/RedLightningContainerGlow.png b/Items/PermanentBoosters/RedLightningContainerGlow.png new file mode 100644 index 0000000000..523b6d4572 Binary files /dev/null and b/Items/PermanentBoosters/RedLightningContainerGlow.png differ diff --git a/Items/PermanentBoosters/RedLightningContainer_Animated.png b/Items/PermanentBoosters/RedLightningContainer_Animated.png new file mode 100644 index 0000000000..c859aca470 Binary files /dev/null and b/Items/PermanentBoosters/RedLightningContainer_Animated.png differ diff --git a/Items/Placeables/BrimstoneSlag.cs b/Items/Placeables/BrimstoneSlag.cs index 772a990283..fbaaaba216 100644 --- a/Items/Placeables/BrimstoneSlag.cs +++ b/Items/Placeables/BrimstoneSlag.cs @@ -1,5 +1,6 @@ -using Terraria.ModLoader; +using CalamityMod.Items.Placeables.Walls; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables { @@ -25,5 +26,14 @@ namespace CalamityMod.Items.Placeables item.value = 1000; item.rare = 3; } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 4); + recipe.AddTile(TileID.WorkBenches); + recipe.SetResult(this); + recipe.AddRecipe(); + } } } diff --git a/Items/Placeables/Furniture/EffigyOfDecay.cs b/Items/Placeables/Furniture/EffigyOfDecay.cs index 5f3a3c6292..2104794598 100644 --- a/Items/Placeables/Furniture/EffigyOfDecay.cs +++ b/Items/Placeables/Furniture/EffigyOfDecay.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Placeables.Furniture public override void SetStaticDefaults() { DisplayName.SetDefault("Effigy of Decay"); - Tooltip.SetDefault("When placed down, nearby players can breath underwater\n" + + Tooltip.SetDefault("When placed down, nearby players can breathe underwater\n" + "This effect does not work in the abyss\n" + "Nearby players are also immune to the sulphuric poisoning"); } diff --git a/Items/Potions/Alcohol/GrapeBeer.cs b/Items/Potions/Alcohol/GrapeBeer.cs index 68c3e97a5e..4f0a0bc2f4 100644 --- a/Items/Potions/Alcohol/GrapeBeer.cs +++ b/Items/Potions/Alcohol/GrapeBeer.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.Alcohol; +using CalamityMod.World; using System.Collections.Generic; using Terraria; using Terraria.ID; @@ -40,7 +41,8 @@ Reduces defense by 2 and movement speed by 5%"); public override void OnConsumeItem(Player player) { - player.statLife += 100; + int healAmt = CalamityWorld.ironHeart ? 0 : 100; + player.statLife += healAmt; player.statMana += 100; if (player.statLife > player.statLifeMax2) { @@ -53,7 +55,8 @@ Reduces defense by 2 and movement speed by 5%"); player.AddBuff(BuffID.ManaSickness, Player.manaSickTime, true); if (Main.myPlayer == player.whoAmI) { - player.HealEffect(100, true); + if (!CalamityWorld.ironHeart) + player.HealEffect(healAmt, true); player.ManaEffect(100); } player.AddBuff(ModContent.BuffType(), 3600); @@ -68,7 +71,7 @@ Reduces defense by 2 and movement speed by 5%"); // Forces the "Restores X life" tooltip to display the actual life restored instead of zero (due to the previous function). public override void ModifyTooltips(List tooltips) { - tooltips.Find(line => line.Name == "HealLife").text = "Restores " + item.healLife + " life"; + tooltips.Find(line => line.Name == "HealLife").text = "Restores " + (CalamityWorld.ironHeart ? 0 : item.healLife) + " life"; } } } diff --git a/Items/Potions/Alcohol/Margarita.cs b/Items/Potions/Alcohol/Margarita.cs index 613329475c..884fd01e9d 100644 --- a/Items/Potions/Alcohol/Margarita.cs +++ b/Items/Potions/Alcohol/Margarita.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.Alcohol; +using CalamityMod.World; using System.Collections.Generic; using Terraria; using Terraria.ID; @@ -43,7 +44,8 @@ Reduces defense by 6 and life regen by 1"); public override void OnConsumeItem(Player player) { - player.statLife += 200; + int healAmt = CalamityWorld.ironHeart ? 0 : 200; + player.statLife += healAmt; player.statMana += 200; if (player.statLife > player.statLifeMax2) { @@ -56,7 +58,8 @@ Reduces defense by 6 and life regen by 1"); player.AddBuff(BuffID.ManaSickness, Player.manaSickTime, true); if (Main.myPlayer == player.whoAmI) { - player.HealEffect(200, true); + if (!CalamityWorld.ironHeart) + player.HealEffect(healAmt, true); player.ManaEffect(200); } player.AddBuff(ModContent.BuffType(), 10800); @@ -71,7 +74,7 @@ Reduces defense by 6 and life regen by 1"); // Forces the "Restores X life" tooltip to display the actual life restored instead of zero (due to the previous function). public override void ModifyTooltips(List tooltips) { - tooltips.Find(line => line.Name == "HealLife").text = "Restores " + item.healLife + " life"; + tooltips.Find(line => line.Name == "HealLife").text = "Restores " + (CalamityWorld.ironHeart ? 0 : item.healLife) + " life"; } } } diff --git a/Items/Potions/Alcohol/RedWine.cs b/Items/Potions/Alcohol/RedWine.cs index 48facc24f6..d982e67b2d 100644 --- a/Items/Potions/Alcohol/RedWine.cs +++ b/Items/Potions/Alcohol/RedWine.cs @@ -34,33 +34,20 @@ Reduces life regen by 1"); public override bool CanUseItem(Player player) { - return player.FindBuffIndex(BuffID.PotionSickness) == -1; + if (player.Calamity().baguette) + { + item.healLife = 250; + } + else + { + item.healLife = 200; + } + return base.CanUseItem(player); } public override void OnConsumeItem(Player player) { - player.statLife += (player.Calamity().baguette ? 250 : 200); - if (player.statLife > player.statLifeMax2) - { - player.statLife = player.statLifeMax2; - } - if (Main.myPlayer == player.whoAmI) - { - player.HealEffect((player.Calamity().baguette ? 250 : 200), true); - } player.AddBuff(ModContent.BuffType(), 900); } - - // Zeroes out the hardcoded healing function from having a healLife value. The item still heals in the UseItem hook. - public override void GetHealLife(Player player, bool quickHeal, ref int healValue) - { - healValue = 0; - } - - // Forces the "Restores X life" tooltip to display the actual life restored instead of zero (due to the previous function). - public override void ModifyTooltips(List tooltips) - { - tooltips.Find(line => line.Name == "HealLife").text = "Restores " + item.healLife + " life"; - } } } \ No newline at end of file diff --git a/Items/Potions/Baguette.cs b/Items/Potions/Baguette.cs index 6c20b1b2b9..8236baf7bf 100644 --- a/Items/Potions/Baguette.cs +++ b/Items/Potions/Baguette.cs @@ -29,10 +29,17 @@ namespace CalamityMod.Items.Potions item.consumable = true; item.value = Item.buyPrice(0, 0, 50, 0); item.buffType = ModContent.BuffType(); - item.buffTime = 72000; + item.buffTime = CalamityUtils.SecondsToFrames(300f); item.Calamity().customRarity = CalamityRarity.Dedicated; } + public override void OnConsumeItem(Player player) + { + //5 minutes for both + player.AddBuff(ModContent.BuffType(), CalamityUtils.SecondsToFrames(300f)); + player.AddBuff(BuffID.WellFed, CalamityUtils.SecondsToFrames(300f)); + } + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); diff --git a/Items/Potions/BoundingPotion.cs b/Items/Potions/BoundingPotion.cs index 83c761a909..b5e6d45a15 100644 --- a/Items/Potions/BoundingPotion.cs +++ b/Items/Potions/BoundingPotion.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Potions public override void SetStaticDefaults() { DisplayName.SetDefault("Bounding Potion"); - Tooltip.SetDefault("Increases jump height, jump speed, and fall damage resistance"); + Tooltip.SetDefault("Grants 10% increased jump speed, 25 extra blocks of fall damage resistance, and increased jump height"); } public override void SetDefaults() diff --git a/Items/Potions/CalamitasBrew.cs b/Items/Potions/CalamitasBrew.cs index 72c46ae0f2..edca20e9b1 100644 --- a/Items/Potions/CalamitasBrew.cs +++ b/Items/Potions/CalamitasBrew.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.Potions; +using CalamityMod.Items.Fishing.BrimstoneCragCatches; using CalamityMod.Items.Materials; using Terraria; using Terraria.ID; @@ -35,14 +36,16 @@ namespace CalamityMod.Items.Potions public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ItemID.BottledWater, 3); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType(), 3); recipe.AddTile(TileID.ImbuingStation); - recipe.SetResult(this); + recipe.SetResult(this, 3); recipe.AddRecipe(); recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.BottledWater); recipe.AddIngredient(ModContent.ItemType(), 20); + recipe.AddIngredient(ModContent.ItemType()); recipe.AddTile(TileID.ImbuingStation); recipe.SetResult(this); recipe.AddRecipe(); diff --git a/Items/Potions/SunkenStew.cs b/Items/Potions/SunkenStew.cs index 2376a0ab90..3c4ec5bf6a 100644 --- a/Items/Potions/SunkenStew.cs +++ b/Items/Potions/SunkenStew.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Placeables; using CalamityMod.Items.Fishing.BrimstoneCragCatches; +using CalamityMod.World; using System.Collections.Generic; using Terraria; using Terraria.ID; @@ -43,7 +44,8 @@ Grants Well Fed"); public override bool UseItem(Player player) { - player.statLife += 120; + int healAmt = CalamityWorld.ironHeart ? 0 : 120; + player.statLife += healAmt; player.statMana += 150; if (player.statLife > player.statLifeMax2) { @@ -56,7 +58,8 @@ Grants Well Fed"); player.AddBuff(BuffID.ManaSickness, Player.manaSickTime, true); if (Main.myPlayer == player.whoAmI) { - player.HealEffect(120, true); + if (!CalamityWorld.ironHeart) + player.HealEffect(healAmt, true); player.ManaEffect(150); } @@ -76,7 +79,7 @@ Grants Well Fed"); // Forces the "Restores X life" tooltip to display the actual life restored instead of zero (due to the previous function). public override void ModifyTooltips(List tooltips) { - tooltips.Find(line => line.Name == "HealLife").text = "Restores " + item.healLife + " life"; + tooltips.Find(line => line.Name == "HealLife").text = "Restores " + (CalamityWorld.ironHeart ? 0 : item.healLife) + " life"; } public override void AddRecipes() diff --git a/Items/SuperDummy.cs b/Items/SuperDummy.cs index b8b41984d0..529903f6f9 100644 --- a/Items/SuperDummy.cs +++ b/Items/SuperDummy.cs @@ -5,80 +5,80 @@ using Terraria.ModLoader; namespace CalamityMod.Items { - public class SuperDummy : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Super Dummy"); - Tooltip.SetDefault("Creates a super dummy\n" + - "Regenerates 1 million life per second\n" + - "Will not die when taking damage over time from debuffs\n" + - "Right click to kill all super dummies"); - } + public class SuperDummy : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Super Dummy"); + Tooltip.SetDefault("Creates a super dummy\n" + + "Regenerates 1 million life per second\n" + + "Will not die when taking damage over time from debuffs\n" + + "Right click to kill all super dummies"); + } - public override void SetDefaults() - { - item.damage = 0; - item.width = 20; - item.height = 30; - item.useTime = 15; - item.useAnimation = 15; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTurn = true; - item.value = 0; - item.rare = 1; - item.autoReuse = true; - } + public override void SetDefaults() + { + item.damage = 0; + item.width = 20; + item.height = 30; + item.useTime = 15; + item.useAnimation = 15; + item.useStyle = ItemUseStyleID.SwingThrow; + item.useTurn = true; + item.value = 0; + item.rare = 1; + item.autoReuse = true; + } - public override bool AltFunctionUse(Player player) - { - return true; - } + public override bool AltFunctionUse(Player player) + { + return true; + } - public override bool UseItem(Player player) - { - if (player.altFunctionUse == 2) - { - for (int i = 0; i < Main.maxNPCs; i++) - { - if (Main.npc[i].type == ModContent.NPCType()) - { - Main.npc[i].life = 0; - Main.npc[i].lifeRegen = 0; - Main.npc[i].checkDead(); - Main.npc[i].netUpdate = true; - } - } - } - else if (player.whoAmI == Main.myPlayer) - { - int x = (int)Main.MouseWorld.X - 9; - int y = (int)Main.MouseWorld.Y - 20; + public override bool UseItem(Player player) + { + if (player.altFunctionUse == 2) + { + for (int i = 0; i < Main.maxNPCs; i++) + { + NPC npc = Main.npc[i]; + if (npc.type == ModContent.NPCType() && npc.active) + { + npc.active = false; + npc.netUpdate = true; + Main.PlaySound(SoundID.NPCDeath2, npc.Center); + } + } + } + else if (player.whoAmI == Main.myPlayer) + { + int x = (int)Main.MouseWorld.X - 9; + int y = (int)Main.MouseWorld.Y - 20; - // In single player, just spawn the dummy. - if (Main.netMode == NetmodeID.SinglePlayer) - NPC.NewNPC(x, y, ModContent.NPCType()); + // In single player, just spawn the dummy. + if (Main.netMode == NetmodeID.SinglePlayer) + NPC.NewNPC(x, y, ModContent.NPCType()); - // Otherwise, send a message to the server indicating that a Super Dummy should be spawned at this position. - else - { - var netMessage = mod.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.SpawnSuperDummy); - netMessage.Write(x); - netMessage.Write(y); - netMessage.Send(); - } - } - return true; - } + // Otherwise, send a message to the server indicating that a Super Dummy should be spawned at this position. + else + { + var netMessage = mod.GetPacket(); + netMessage.Write((byte)CalamityModMessageType.SpawnSuperDummy); + netMessage.Write(x); + netMessage.Write(y); + netMessage.Send(); + } + } + return true; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.TargetDummy); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.TargetDummy); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/Magic/AlphaRay.cs b/Items/Weapons/Magic/AlphaRay.cs index ff2716da9e..10c235f734 100644 --- a/Items/Weapons/Magic/AlphaRay.cs +++ b/Items/Weapons/Magic/AlphaRay.cs @@ -67,7 +67,7 @@ namespace CalamityMod.Items.Weapons.Magic value9 -= vector7; } Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX, speedY, type, (int)(damage * 0.8), knockBack, player.whoAmI, 0.0f, 0.0f); - int laser = Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX * 2f, speedY * 2f, ProjectileID.LaserMachinegunLaser, (int)(damage * 0.4), knockBack, player.whoAmI, 0.0f, 0.0f); + int laser = Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX * 2f, speedY * 2f, ProjectileID.LaserMachinegunLaser, (int)(damage * 0.4), knockBack, player.whoAmI, 0f, 0f); Main.projectile[laser].timeLeft = 120; Main.projectile[laser].tileCollide = false; } diff --git a/Items/Weapons/Magic/Climax.cs b/Items/Weapons/Magic/Climax.cs index b4be338026..83b316841c 100644 --- a/Items/Weapons/Magic/Climax.cs +++ b/Items/Weapons/Magic/Climax.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 75; + item.damage = 131; item.magic = true; item.mana = 30; item.width = 78; @@ -69,11 +69,10 @@ namespace CalamityMod.Items.Weapons.Magic double startAngle = Math.Atan2(speedX, speedY) - spread / 2; double deltaAngle = spread / 8f; double offsetAngle; - int i; - for (i = 0; i < 4; i++) + for (int i = 0; i < 4; i++) { offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - Projectile.NewProjectile(vector2.X, vector2.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), type, damage, knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(vector2.X, vector2.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), type, damage, knockBack, player.whoAmI, 1f, 0f); Projectile.NewProjectile(vector2.X, vector2.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), type, damage, knockBack, player.whoAmI, 0f, 0f); } return false; diff --git a/Items/Weapons/Magic/Fabstaff.cs b/Items/Weapons/Magic/Fabstaff.cs index 1542e17e2d..12267f8077 100644 --- a/Items/Weapons/Magic/Fabstaff.cs +++ b/Items/Weapons/Magic/Fabstaff.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 800; + item.damage = 880; item.magic = true; item.mana = 50; item.width = 84; diff --git a/Items/Weapons/Magic/HeliumFlash.cs b/Items/Weapons/Magic/HeliumFlash.cs index 93d52b70f6..2deb75603c 100644 --- a/Items/Weapons/Magic/HeliumFlash.cs +++ b/Items/Weapons/Magic/HeliumFlash.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Weapons.Magic item.width = 76; item.height = 76; item.magic = true; - item.damage = 1110; + item.damage = 1111; item.knockBack = 9.5f; item.mana = 26; item.useAnimation = 37; diff --git a/Items/Weapons/Magic/MagneticMeltdown.cs b/Items/Weapons/Magic/MagneticMeltdown.cs index 8cebeba233..86e69eadd3 100644 --- a/Items/Weapons/Magic/MagneticMeltdown.cs +++ b/Items/Weapons/Magic/MagneticMeltdown.cs @@ -48,7 +48,7 @@ namespace CalamityMod.Items.Weapons.Magic { float SpeedX = speedX + (float)Main.rand.Next(-50, 51) * 0.05f; float SpeedY = speedY + (float)Main.rand.Next(-50, 51) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 1.0f, 0.0f); + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 1f, 0f); } return false; } diff --git a/Items/Weapons/Magic/PlasmaRifle.cs b/Items/Weapons/Magic/PlasmaRifle.cs index 29142fe633..8d356262df 100644 --- a/Items/Weapons/Magic/PlasmaRifle.cs +++ b/Items/Weapons/Magic/PlasmaRifle.cs @@ -23,8 +23,7 @@ namespace CalamityMod.Items.Weapons.Magic item.magic = true; item.width = 48; item.height = 22; - item.useTime = 40; - item.useAnimation = 40; + item.useTime = item.useAnimation = 8; item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 4f; @@ -51,21 +50,28 @@ namespace CalamityMod.Items.Weapons.Magic { if (player.altFunctionUse == 2) { - item.mana = 5; - item.useTime = 8; - item.useAnimation = 8; item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PlasmaBolt"); } else { - item.mana = 40; - item.useTime = 40; - item.useAnimation = 40; item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PlasmaBlast"); } return base.CanUseItem(player); } + public override void ModifyManaCost(Player player, ref float reduce, ref float mult) + { + if (player.altFunctionUse == 2) + mult *= 0.125f; + } + + public override float UseTimeMultiplier (Player player) + { + if (player.altFunctionUse == 2) + return 1f; + return 0.2f; + } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { if (player.altFunctionUse == 2) diff --git a/Items/Weapons/Magic/SHPC.cs b/Items/Weapons/Magic/SHPC.cs index 8a3b91912c..6a6cdd625e 100644 --- a/Items/Weapons/Magic/SHPC.cs +++ b/Items/Weapons/Magic/SHPC.cs @@ -24,8 +24,7 @@ namespace CalamityMod.Items.Weapons.Magic item.mana = 20; item.width = 96; item.height = 34; - item.useTime = 50; - item.useAnimation = 50; + item.useTime = item.useAnimation = 7; item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 3.25f; @@ -52,21 +51,28 @@ namespace CalamityMod.Items.Weapons.Magic { if (player.altFunctionUse == 2) { - item.useTime = 7; - item.useAnimation = 7; - item.mana = 6; item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"); } else { - item.useTime = 50; - item.useAnimation = 50; - item.mana = 20; item.UseSound = SoundID.Item92; } return base.CanUseItem(player); } + public override void ModifyManaCost(Player player, ref float reduce, ref float mult) + { + if (player.altFunctionUse == 2) + mult *= 0.3f; + } + + public override float UseTimeMultiplier (Player player) + { + if (player.altFunctionUse == 2) + return 1f; + return 0.14f; + } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { if (player.altFunctionUse == 2) @@ -75,7 +81,7 @@ namespace CalamityMod.Items.Weapons.Magic { float SpeedX = speedX + (float)Main.rand.Next(-20, 21) * 0.05f; float SpeedY = speedY + (float)Main.rand.Next(-20, 21) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), damage, knockBack * 0.5f, player.whoAmI, 0.0f, 0.0f); + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), damage, knockBack * 0.5f, player.whoAmI, 0f, 0f); } return false; } @@ -85,7 +91,7 @@ namespace CalamityMod.Items.Weapons.Magic { float SpeedX = speedX + (float)Main.rand.Next(-40, 41) * 0.05f; float SpeedY = speedY + (float)Main.rand.Next(-40, 41) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), (int)((double)damage * 1.1), knockBack, player.whoAmI, 0.0f, 0.0f); + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), (int)(damage * 1.1), knockBack, player.whoAmI, 0f, 0f); } return false; } diff --git a/Items/Weapons/Magic/Vesuvius.cs b/Items/Weapons/Magic/Vesuvius.cs index 8f22d466d8..e277392e5b 100644 --- a/Items/Weapons/Magic/Vesuvius.cs +++ b/Items/Weapons/Magic/Vesuvius.cs @@ -26,8 +26,7 @@ namespace CalamityMod.Items.Weapons.Magic item.damage = 75; item.mana = 6; item.magic = true; - item.useAnimation = 20; - item.useTime = 20; + item.useAnimation = item.useTime = 15; item.noMelee = true; item.useStyle = ItemUseStyleID.HoldingOut; item.knockBack = 3f; @@ -53,21 +52,22 @@ namespace CalamityMod.Items.Weapons.Magic public override bool CanUseItem(Player player) { - if (player.altFunctionUse == 2) - { - item.mana = 9; - item.useTime = 20; - item.useAnimation = 20; - } - else - { - item.mana = 6; - item.useTime = 15; - item.useAnimation = 15; - } return base.CanUseItem(player); } + public override void ModifyManaCost(Player player, ref float reduce, ref float mult) + { + if (player.altFunctionUse == 2) + mult *= 1.5f; + } + + public override float UseTimeMultiplier (Player player) + { + if (player.altFunctionUse != 2) + return 1f; + return 0.75f; + } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { if (player.altFunctionUse == 2) diff --git a/Items/Weapons/Melee/AbyssBlade.cs b/Items/Weapons/Melee/AbyssBlade.cs index 81e597cecb..6ca2dd8606 100644 --- a/Items/Weapons/Melee/AbyssBlade.cs +++ b/Items/Weapons/Melee/AbyssBlade.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Weapons.Melee { item.width = 74; item.height = 74; - item.damage = 110; + item.damage = 100; item.melee = true; item.useAnimation = 26; item.useTime = 26; @@ -38,6 +38,12 @@ namespace CalamityMod.Items.Weapons.Melee item.shootSpeed = 9f; } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, (int)(damage * 0.8), knockBack, player.whoAmI); + return false; + } + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); diff --git a/Items/Weapons/Melee/AegisBlade.cs b/Items/Weapons/Melee/AegisBlade.cs index 67d9db46ac..5419d91703 100644 --- a/Items/Weapons/Melee/AegisBlade.cs +++ b/Items/Weapons/Melee/AegisBlade.cs @@ -22,8 +22,7 @@ namespace CalamityMod.Items.Weapons.Melee item.width = 58; item.damage = 68; item.melee = true; - item.useAnimation = 20; - item.useTime = 20; + item.useAnimation = item.useTime = 15; item.useTurn = true; item.useStyle = ItemUseStyleID.SwingThrow; item.knockBack = 4.25f; @@ -46,22 +45,25 @@ namespace CalamityMod.Items.Weapons.Melee if (player.altFunctionUse == 2) { item.noMelee = true; - item.useTime = 20; - item.useAnimation = 20; item.UseSound = SoundID.Item73; item.shoot = ModContent.ProjectileType(); } else { item.noMelee = false; - item.useTime = 15; - item.useAnimation = 15; item.UseSound = SoundID.Item1; item.shoot = ProjectileID.None; } return base.CanUseItem(player); } + public override float UseTimeMultiplier (Player player) + { + if (player.altFunctionUse != 2) + return 1f; + return 0.75f; + } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), (int)(damage * 0.85), knockBack, player.whoAmI, 0f, 0f); diff --git a/Items/Weapons/Melee/AnarchyBlade.cs b/Items/Weapons/Melee/AnarchyBlade.cs index 3e5cd7ccca..c6dbbd8650 100644 --- a/Items/Weapons/Melee/AnarchyBlade.cs +++ b/Items/Weapons/Melee/AnarchyBlade.cs @@ -63,12 +63,12 @@ namespace CalamityMod.Items.Weapons.Melee public override void ModifyWeaponDamage(Player player, ref float add, ref float mult, ref float flat) { int lifeAmount = player.statLifeMax2 - player.statLife; - flat += lifeAmount * 0.1f * player.meleeDamage; + flat += lifeAmount * 0.1f * player.MeleeDamage(); } public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(item.damage * (player.allDamage + player.meleeDamage - 1f)), knockback, Main.myPlayer); + Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(item.damage * player.MeleeDamage()), knockback, Main.myPlayer); target.AddBuff(ModContent.BuffType(), 300); if (player.statLife < (player.statLifeMax2 * 0.5f) && Main.rand.NextBool(5)) @@ -85,7 +85,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitPvp(Player player, Player target, int damage, bool crit) { - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(item.damage * (player.allDamage + player.meleeDamage - 1f)), item.knockBack, Main.myPlayer); + Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(item.damage * player.MeleeDamage()), item.knockBack, Main.myPlayer); target.AddBuff(ModContent.BuffType(), 300); } } diff --git a/Items/Weapons/Melee/BrimlashBuster.cs b/Items/Weapons/Melee/BrimlashBuster.cs index 9f9b0afda6..aa700055ef 100644 --- a/Items/Weapons/Melee/BrimlashBuster.cs +++ b/Items/Weapons/Melee/BrimlashBuster.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { item.width = item.height = 72; - item.damage = 100; + item.damage = 126; item.melee = true; item.useAnimation = 25; item.useTime = 25; @@ -55,30 +55,24 @@ namespace CalamityMod.Items.Weapons.Melee } } + public override void ModifyWeaponDamage(Player player, ref float add, ref float mult, ref float flat) + { + float damageMult = 0f; + if (player.Calamity().brimlashBusterBoost) + damageMult = 2f; + mult += damageMult; + } + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { target.AddBuff(ModContent.BuffType(), 300); - if (Main.rand.NextBool(3)) - { - item.damage = 378; - } - else - { - item.damage = 126; - } + player.Calamity().brimlashBusterBoost = Main.rand.NextBool(3); } public override void OnHitPvp(Player player, Player target, int damage, bool crit) { target.AddBuff(ModContent.BuffType(), 300); - if (Main.rand.NextBool(3)) - { - item.damage = 378; - } - else - { - item.damage = 126; - } + player.Calamity().brimlashBusterBoost = Main.rand.NextBool(3); } } } diff --git a/Items/Weapons/Melee/BrinyBaron.cs b/Items/Weapons/Melee/BrinyBaron.cs index a273951ccf..2660df2619 100644 --- a/Items/Weapons/Melee/BrinyBaron.cs +++ b/Items/Weapons/Melee/BrinyBaron.cs @@ -22,8 +22,7 @@ namespace CalamityMod.Items.Weapons.Melee item.width = 62; item.damage = 75; item.melee = true; - item.useAnimation = 20; - item.useTime = 20; + item.useAnimation = item.useTime = 15; item.useTurn = true; item.useStyle = ItemUseStyleID.SwingThrow; item.knockBack = 4f; @@ -47,8 +46,6 @@ namespace CalamityMod.Items.Weapons.Melee { item.noMelee = true; item.noUseGraphic = true; - item.useTime = 15; - item.useAnimation = 15; item.UseSound = SoundID.Item84; item.shoot = ModContent.ProjectileType(); } @@ -56,14 +53,19 @@ namespace CalamityMod.Items.Weapons.Melee { item.noMelee = false; item.noUseGraphic = false; - item.useTime = 20; - item.useAnimation = 20; item.UseSound = SoundID.Item1; item.shoot = ProjectileID.None; } return base.CanUseItem(player); } + public override float UseTimeMultiplier (Player player) + { + if (player.altFunctionUse == 2) + return 1f; + return 0.75f; + } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); @@ -80,12 +82,12 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(item.damage * (player.allDamage + player.meleeDamage - 1f) * 0.5f), knockback, player.whoAmI); + Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(item.damage * player.MeleeDamage() * 0.5f), knockback, player.whoAmI); } public override void OnHitPvp(Player player, Player target, int damage, bool crit) { - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(item.damage * (player.allDamage + player.meleeDamage - 1f) * 0.5f), item.knockBack, player.whoAmI); + Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(item.damage * player.MeleeDamage() * 0.5f), item.knockBack, player.whoAmI); } } } diff --git a/Items/Weapons/Melee/ElementalShortsword.cs b/Items/Weapons/Melee/ElementalShortsword.cs index 98bc836fdb..229c8de2e5 100644 --- a/Items/Weapons/Melee/ElementalShortsword.cs +++ b/Items/Weapons/Melee/ElementalShortsword.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Weapons.Melee { DisplayName.SetDefault("Elemental Shiv"); Tooltip.SetDefault("Don't underestimate the power of shivs\n" + - "Shoots a rainbow orb that spawns shivs at multiple locations"); + "Shoots a rainbow shiv that spawns additional shivs on hit"); } public override void SetDefaults() @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Melee item.useTime = 10; item.width = 44; item.height = 44; - item.damage = 180; + item.damage = 160; item.melee = true; item.knockBack = 8.5f; item.UseSound = SoundID.Item1; @@ -41,7 +41,7 @@ namespace CalamityMod.Items.Weapons.Melee public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - Projectile.NewProjectile(position.X, position.Y, item.shootSpeed * player.direction, 0f, type, damage, knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(position.X, position.Y, item.shootSpeed * player.direction, 0f, type, (int)(damage * 0.5), knockBack, player.whoAmI, 0f, 0f); return false; } diff --git a/Items/Weapons/Melee/FlameScytheMelee.cs b/Items/Weapons/Melee/FlameScytheMelee.cs index e5abf72199..7d8d78e68c 100644 --- a/Items/Weapons/Melee/FlameScytheMelee.cs +++ b/Items/Weapons/Melee/FlameScytheMelee.cs @@ -21,9 +21,9 @@ namespace CalamityMod.Items.Weapons.Melee item.noMelee = true; item.noUseGraphic = true; item.autoReuse = true; - item.useAnimation = 19; + item.useAnimation = 20; item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 19; + item.useTime = 20; item.knockBack = 8.5f; item.UseSound = SoundID.Item1; item.melee = true; diff --git a/Items/Weapons/Melee/GaelsGreatsword.cs b/Items/Weapons/Melee/GaelsGreatsword.cs index b1e3f5aa89..245e107d74 100644 --- a/Items/Weapons/Melee/GaelsGreatsword.cs +++ b/Items/Weapons/Melee/GaelsGreatsword.cs @@ -51,8 +51,7 @@ namespace CalamityMod.Items.Weapons.Melee item.height = 84; item.damage = BaseDamage; item.melee = true; - item.useAnimation = 17; - item.useTime = 17; + item.useAnimation = item.useTime = 12; item.useTurn = true; item.knockBack = 9; item.UseSound = SoundID.Item1; @@ -70,20 +69,14 @@ namespace CalamityMod.Items.Weapons.Melee } public override bool AltFunctionUse(Player player) => true; public override Vector2? HoldoutOffset() => new Vector2(12, 12); - public override bool CanUseItem(Player player) - { - if (player.altFunctionUse == 2) - { - item.useAnimation = 46; - item.useTime = 46; - } - else - { - item.useAnimation = 12; - item.useTime = 12; - } - return true; - } + + public override float UseTimeMultiplier (Player player) + { + if (player.altFunctionUse == 2) + return (12f/46f); + return 1f; + } + public override void MeleeEffects(Player player, Rectangle hitbox) { if (CalamityUtils.CountProjectiles(ModContent.ProjectileType()) < 3 && diff --git a/Items/Weapons/Melee/GalileoGladius.cs b/Items/Weapons/Melee/GalileoGladius.cs index ac9aac6711..fbdac3cadb 100644 --- a/Items/Weapons/Melee/GalileoGladius.cs +++ b/Items/Weapons/Melee/GalileoGladius.cs @@ -10,112 +10,98 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Melee { - public class GalileoGladius : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Galileo Gladius"); - Tooltip.SetDefault("Don't underestimate the power of small space swords\n" + - "Shoots a homing crescent moon\n" + + public class GalileoGladius : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Galileo Gladius"); + Tooltip.SetDefault("Don't underestimate the power of small space swords\n" + + "Shoots a homing crescent moon\n" + "Spawns planetoids on enemy hits"); - } + } - public override void SetDefaults() - { - item.useStyle = ItemUseStyleID.Stabbing; - item.useTurn = false; - item.useAnimation = 10; - item.useTime = 10; - item.width = 44; - item.height = 44; - item.damage = 200; - item.melee = true; - item.knockBack = 10f; - item.UseSound = SoundID.Item1; - item.useTurn = true; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 14f; - item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = 10; - item.Calamity().customRarity = CalamityRarity.PureGreen; - } + public override void SetDefaults() + { + item.useStyle = ItemUseStyleID.Stabbing; + item.useTurn = false; + item.useAnimation = 10; + item.useTime = 10; + item.width = 44; + item.height = 44; + item.damage = 200; + item.melee = true; + item.knockBack = 10f; + item.UseSound = SoundID.Item1; + item.useTurn = true; + item.autoReuse = true; + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 14f; + item.value = Item.buyPrice(1, 40, 0, 0); + item.rare = 10; + item.Calamity().customRarity = CalamityRarity.PureGreen; + } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - Projectile.NewProjectile(position.X, position.Y, item.shootSpeed * player.direction, 0f, type, damage, knockBack, player.whoAmI, 0f, 0f); - return false; - } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + Projectile.NewProjectile(position.X, position.Y, item.shootSpeed * player.direction, 0f, type, (int)(damage * 0.5), knockBack, player.whoAmI, 0f, 0f); + return false; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 8); + recipe.AddIngredient(ModContent.ItemType(), 5); + recipe.AddIngredient(ModContent.ItemType(), 15); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.NextBool(5)) - { - int num250 = Dust.NewDust(new Vector2((float)hitbox.X, (float)hitbox.Y), hitbox.Width, hitbox.Height, (Main.rand.NextBool(2) ? 20 : 176), (float)(player.direction * 2), 0f, 150, default, 1.3f); - Main.dust[num250].velocity *= 0.2f; - Main.dust[num250].noGravity = true; - } - } + public override void MeleeEffects(Player player, Rectangle hitbox) + { + if (Main.rand.NextBool(5)) + { + int num250 = Dust.NewDust(new Vector2((float)hitbox.X, (float)hitbox.Y), hitbox.Width, hitbox.Height, (Main.rand.NextBool(2) ? 20 : 176), (float)(player.direction * 2), 0f, 150, default, 1.3f); + Main.dust[num250].velocity *= 0.2f; + Main.dust[num250].noGravity = true; + } + } - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(ModContent.BuffType(), 300); - float x = player.position.X + (float)Main.rand.Next(-400, 400); - float y = player.position.Y - (float)Main.rand.Next(500, 800); - Vector2 vector = new Vector2(x, y); - float num15 = player.position.X + (float)(player.width / 2) - vector.X; - float num16 = player.position.Y + (float)(player.height / 2) - vector.Y; - num15 += (float)Main.rand.Next(-100, 101); - int num17 = 25; - float num18 = (float)Math.Sqrt((double)(num15 * num15 + num16 * num16)); - num18 = (float)num17 / num18; - num15 *= num18; - num16 *= num18; - if (player.whoAmI == Main.myPlayer) - { + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 300); + SpawnMeteor(player); + } + + public override void OnHitPvp(Player player, Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 300); + SpawnMeteor(player); + } + + private void SpawnMeteor(Player player) + { + float x = player.Center.X + (float)Main.rand.Next(-400, 400); + float y = player.Center.Y - (float)Main.rand.Next(500, 800); + Vector2 startPos = new Vector2(x, y); + Vector2 velocity = player.Center - startPos; + velocity.X += (float)Main.rand.Next(-100, 101); + float speed = 25f; + float targetDist = velocity.Length(); + targetDist = speed / targetDist; + velocity.X *= targetDist; + velocity.Y *= targetDist; + if (player.whoAmI == Main.myPlayer) + { if (player.Calamity().galileoCooldown <= 0) { - int num19 = Projectile.NewProjectile(x, y, num15, num16, ModContent.ProjectileType(), (int)(item.damage * (player.allDamage + player.meleeDamage - 1f) * 2f), 15f, player.whoAmI, 0f, 0f); - Main.projectile[num19].ai[1] = player.position.Y; + int damage = player.GetWeaponDamage(player.ActiveItem()) * 2; + int meteor = Projectile.NewProjectile(startPos, velocity, ModContent.ProjectileType(), damage, 15f, player.whoAmI); + Main.projectile[meteor].ai[1] = player.position.Y; player.Calamity().galileoCooldown = 15; } - } - } - - public override void OnHitPvp(Player player, Player target, int damage, bool crit) - { - target.AddBuff(ModContent.BuffType(), 300); - float x = player.position.X + (float)Main.rand.Next(-400, 400); - float y = player.position.Y - (float)Main.rand.Next(500, 800); - Vector2 vector = new Vector2(x, y); - float num15 = player.position.X + (float)(player.width / 2) - vector.X; - float num16 = player.position.Y + (float)(player.height / 2) - vector.Y; - num15 += (float)Main.rand.Next(-100, 101); - int num17 = 25; - float num18 = (float)Math.Sqrt((double)(num15 * num15 + num16 * num16)); - num18 = (float)num17 / num18; - num15 *= num18; - num16 *= num18; - if (player.whoAmI == Main.myPlayer) - { - if (player.Calamity().galileoCooldown <= 0) - { - int num19 = Projectile.NewProjectile(x, y, num15, num16, ModContent.ProjectileType(), (int)(item.damage * (player.allDamage + player.meleeDamage - 1f) * 2f), 15f, player.whoAmI, 0f, 0f); - Main.projectile[num19].ai[1] = player.position.Y; - player.Calamity().galileoCooldown = 15; - } - } - } - } + } + } + } } diff --git a/Items/Weapons/Melee/Murasama.cs b/Items/Weapons/Melee/Murasama.cs index 96056ec929..0f73f79295 100644 --- a/Items/Weapons/Melee/Murasama.cs +++ b/Items/Weapons/Melee/Murasama.cs @@ -44,7 +44,7 @@ namespace CalamityMod.Items.Weapons.Melee Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(5, 14)); } - internal Rectangle GetCurrentFrame() + internal Rectangle GetCurrentFrame(bool frameCounterUp = true) { //0 = 6 frames, 8 = 3 frames] int applicableCounter = frame == 0 ? 36 : frame == 8 ? 24 : 6; @@ -54,7 +54,8 @@ namespace CalamityMod.Items.Weapons.Melee frameCounter = -1; frame = frame == 13 ? 0 : frame + 1; } - frameCounter++; + if (frameCounterUp) + frameCounter++; return new Rectangle(0, item.height * frame, item.width, item.height); } @@ -68,10 +69,16 @@ namespace CalamityMod.Items.Weapons.Melee public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) { Texture2D texture = ModContent.GetTexture(Texture); - spriteBatch.Draw(texture, item.position - Main.screenPosition, GetCurrentFrame(), Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); + spriteBatch.Draw(texture, item.position - Main.screenPosition, GetCurrentFrame(), lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); return false; } + public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) + { + Texture2D texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Melee/MurasamaGlow"); + spriteBatch.Draw(texture, item.position - Main.screenPosition, GetCurrentFrame(false), Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); + } + public override bool CanUseItem(Player player) { if (player.ownedProjectileCounts[item.shoot] > 0) diff --git a/Items/Weapons/Melee/MurasamaGlow.png b/Items/Weapons/Melee/MurasamaGlow.png new file mode 100644 index 0000000000..33b3f5b00e Binary files /dev/null and b/Items/Weapons/Melee/MurasamaGlow.png differ diff --git a/Items/Weapons/Melee/PwnagehammerMelee.cs b/Items/Weapons/Melee/PwnagehammerMelee.cs index 357ec3a8dc..d0bbda9e53 100644 --- a/Items/Weapons/Melee/PwnagehammerMelee.cs +++ b/Items/Weapons/Melee/PwnagehammerMelee.cs @@ -1,4 +1,5 @@ using CalamityMod.Projectiles.Hybrid; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -10,19 +11,21 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Pwnagehammer"); - Tooltip.SetDefault("Throws an extremely fast hammer"); + Tooltip.SetDefault("Throws a heavy, gravity-affected hammer that creates a loud blast of hallowed energy when it hits something\n" + + "There is a 20 percent chance for the hammer to home in on a target\n" + + "Homing hammers summon an additional spectral hammer on hit and are guaranteed to land a critical hit"); } public override void SetDefaults() { item.width = 68; - item.damage = 90; + item.damage = 210; + item.crit = 10; item.noMelee = true; item.noUseGraphic = true; item.autoReuse = true; - item.useAnimation = 15; + item.useAnimation = item.useTime = 48; item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 15; item.knockBack = 10f; item.UseSound = SoundID.Item1; item.melee = true; @@ -30,7 +33,19 @@ namespace CalamityMod.Items.Weapons.Melee item.value = Item.buyPrice(0, 48, 0, 0); item.rare = 6; item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 12f; + item.shootSpeed = 24.4f; + } + + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + Vector2 speed = new Vector2(speedX, speedY); + Vector2 yeetOffset = Vector2.Normalize(speed) * 40f; + if (Collision.CanHit(position, 0, 0, position + yeetOffset, 0, 0)) + { + position += yeetOffset; + } + Projectile.NewProjectile(position, speed, type, damage, knockBack, player.whoAmI, Main.rand.NextBool(5) ? 1f : 0f); + return false; } public override void AddRecipes() diff --git a/Items/Weapons/Melee/Roxcalibur.cs b/Items/Weapons/Melee/Roxcalibur.cs index 1956ae9588..c238771905 100644 --- a/Items/Weapons/Melee/Roxcalibur.cs +++ b/Items/Weapons/Melee/Roxcalibur.cs @@ -192,7 +192,8 @@ namespace CalamityMod.Items.Weapons.Melee } } // Makes the player forcefully dive down - player.velocity.Y = player.maxFallSpeed; + if (CalamityUtils.CountHookProj() <= 0) + player.velocity.Y = player.maxFallSpeed; //Rotates the sprite of the item on alt fire to have it point downwards player.itemRotation = player.direction * MathHelper.ToRadians(135f); //Dust trail @@ -228,7 +229,7 @@ namespace CalamityMod.Items.Weapons.Melee { positionx = position.X - 8; } - Projectile.NewProjectile(positionx, positiony, player.velocity.X, player.velocity.Y, ModContent.ProjectileType(), 0, 0, player.whoAmI, cooldown); + Projectile.NewProjectile(positionx, positiony - (player.height / 10f), player.velocity.X, player.velocity.Y, ModContent.ProjectileType(), 0, 0, player.whoAmI, cooldown); //Resets the cooldown after shooting if (Roxcooldown >= 600) { diff --git a/Items/Weapons/Melee/TrueForbiddenOathblade.cs b/Items/Weapons/Melee/TrueForbiddenOathblade.cs index 97fcab0849..47a0e58a32 100644 --- a/Items/Weapons/Melee/TrueForbiddenOathblade.cs +++ b/Items/Weapons/Melee/TrueForbiddenOathblade.cs @@ -2,6 +2,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -20,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Melee { item.width = 88; item.height = 88; - item.damage = 200; + item.damage = 150; item.melee = true; item.useAnimation = 23; item.useTime = 23; @@ -74,25 +75,25 @@ namespace CalamityMod.Items.Weapons.Melee { target.AddBuff(BuffID.ShadowFlame, 900); target.AddBuff(BuffID.OnFire, 900); - player.ApplyDamageToNPC(target, (int)(item.damage * (player.allDamage + player.meleeDamage - 1f)) * 3, 0f, 0, false); + player.ApplyDamageToNPC(target, player.GetWeaponDamage(player.ActiveItem()) * 2, 0f, 0, false); float num50 = 1.7f; float num51 = 0.8f; float num52 = 2f; - Vector2 value3 = (target.rotation - 1.57079637f).ToRotationVector2(); + Vector2 value3 = (target.rotation - MathHelper.PiOver2).ToRotationVector2(); Vector2 value4 = value3 * target.velocity.Length(); Main.PlaySound(SoundID.Item14, target.position); int num3; for (int num53 = 0; num53 < 40; num53 = num3 + 1) { - int num54 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 173, 0f, 0f, 200, default, num50); + int num54 = Dust.NewDust(target.position, target.width, target.height, 173, 0f, 0f, 200, default, num50); Dust dust = Main.dust[num54]; - dust.position = target.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)target.width / 2f; + dust.position = target.Center + Vector2.UnitY.RotatedByRandom(Math.PI) * (float)Main.rand.NextDouble() * (float)target.width / 2f; dust.noGravity = true; dust.velocity.Y -= 4.5f; dust.velocity *= 3f; dust.velocity += value4 * Main.rand.NextFloat(); - num54 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 173, 0f, 0f, 100, default, num51); - dust.position = target.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)target.width / 2f; + num54 = Dust.NewDust(target.position, target.width, target.height, 173, 0f, 0f, 100, default, num51); + dust.position = target.Center + Vector2.UnitY.RotatedByRandom(Math.PI) * (float)Main.rand.NextDouble() * (float)target.width / 2f; dust.velocity.Y -= 3f; dust.velocity *= 2f; dust.noGravity = true; @@ -103,9 +104,9 @@ namespace CalamityMod.Items.Weapons.Melee } for (int num55 = 0; num55 < 20; num55 = num3 + 1) { - int num56 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 173, 0f, 0f, 0, default, num52); + int num56 = Dust.NewDust(target.position, target.width, target.height, 173, 0f, 0f, 0, default, num52); Dust dust = Main.dust[num56]; - dust.position = target.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)target.velocity.ToRotation(), default) * (float)target.width / 3f; + dust.position = target.Center + Vector2.UnitX.RotatedByRandom(Math.PI).RotatedBy((double)target.velocity.ToRotation(), default) * (float)target.width / 3f; dust.noGravity = true; dust.velocity.Y -= 1.5f; dust.velocity *= 0.5f; diff --git a/Items/Weapons/Melee/TyphonsGreed.cs b/Items/Weapons/Melee/TyphonsGreed.cs index 402c10ed16..dc3b122407 100644 --- a/Items/Weapons/Melee/TyphonsGreed.cs +++ b/Items/Weapons/Melee/TyphonsGreed.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.damage = 75; + item.damage = 65; item.melee = true; item.width = 16; item.height = 16; diff --git a/Items/Weapons/Ranged/Alluvion.cs b/Items/Weapons/Ranged/Alluvion.cs index f35b97d54f..e817cc39e9 100644 --- a/Items/Weapons/Ranged/Alluvion.cs +++ b/Items/Weapons/Ranged/Alluvion.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Items.Weapons.Ranged item.autoReuse = true; item.shoot = ProjectileID.WoodenArrowFriendly; item.shootSpeed = 17f; - item.useAmmo = 40; + item.useAmmo = AmmoID.Arrow; item.Calamity().customRarity = CalamityRarity.DarkBlue; } diff --git a/Items/Weapons/Ranged/AngelicShotgun.cs b/Items/Weapons/Ranged/AngelicShotgun.cs index 91cfeca001..eac6e4b69b 100644 --- a/Items/Weapons/Ranged/AngelicShotgun.cs +++ b/Items/Weapons/Ranged/AngelicShotgun.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Items.Weapons.Ranged { public class AngelicShotgun : ModItem { - private static int BaseDamage = 90; + private static int BaseDamage = 100; private static float BulletSpeed = 12f; public override void SetStaticDefaults() @@ -31,8 +31,8 @@ Fighting 'til the war's won"); item.width = 44; item.height = 7; - item.useTime = 26; - item.useAnimation = 26; + item.useTime = 24; + item.useAnimation = 24; item.UseSound = SoundID.Item38; item.useStyle = ItemUseStyleID.HoldingOut; diff --git a/Items/Weapons/Ranged/ArterialAssault.cs b/Items/Weapons/Ranged/ArterialAssault.cs index 5e2db0fb4b..4d954653d1 100644 --- a/Items/Weapons/Ranged/ArterialAssault.cs +++ b/Items/Weapons/Ranged/ArterialAssault.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Weapons.Ranged { DisplayName.SetDefault("Arterial Assault"); Tooltip.SetDefault("Fires a chain of arrows from the sky\n" + - "Wooden arrows are converted to bloodfire arrows"); + "Wooden arrows are converted to homing bloodfire arrows"); } public override void SetDefaults() @@ -91,7 +91,7 @@ namespace CalamityMod.Items.Weapons.Ranged float speedY5 = num79; if (type == ProjectileID.WoodenArrowFriendly) { - int bloodfire = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, (float)Main.rand.Next(15)); + int bloodfire = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 80f); Main.projectile[bloodfire].tileCollide = false; } else diff --git a/Items/Weapons/Ranged/BlissfulBombardier.cs b/Items/Weapons/Ranged/BlissfulBombardier.cs index 6924c37d28..88d05dc3a7 100644 --- a/Items/Weapons/Ranged/BlissfulBombardier.cs +++ b/Items/Weapons/Ranged/BlissfulBombardier.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 62; + item.damage = 75; item.ranged = true; item.width = 76; item.height = 30; diff --git a/Items/Weapons/Ranged/BloodBoiler.cs b/Items/Weapons/Ranged/BloodBoiler.cs index 73d60211db..429d3b1ba1 100644 --- a/Items/Weapons/Ranged/BloodBoiler.cs +++ b/Items/Weapons/Ranged/BloodBoiler.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 400; + item.damage = 415; item.ranged = true; item.width = 60; item.height = 30; diff --git a/Items/Weapons/Ranged/Galeforce.cs b/Items/Weapons/Ranged/Galeforce.cs index 5a943c7e28..f6524c3c2e 100644 --- a/Items/Weapons/Ranged/Galeforce.cs +++ b/Items/Weapons/Ranged/Galeforce.cs @@ -40,7 +40,7 @@ namespace CalamityMod.Items.Weapons.Ranged for (int i = -8; i <= 8; i += 8) { Vector2 perturbedSpeed = new Vector2(speedX, speedY).RotatedBy(MathHelper.ToRadians(i)); - Projectile.NewProjectile(position.X, position.Y, perturbedSpeed.X, perturbedSpeed.Y, ModContent.ProjectileType(), damage / 4, 0f, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(position, perturbedSpeed, ModContent.ProjectileType(), damage / 4, 0f, player.whoAmI, 0f, 0f); } return true; } diff --git a/Items/Weapons/Ranged/HalibutCannon.cs b/Items/Weapons/Ranged/HalibutCannon.cs index 464f2bcce8..6743f3464a 100644 --- a/Items/Weapons/Ranged/HalibutCannon.cs +++ b/Items/Weapons/Ranged/HalibutCannon.cs @@ -29,28 +29,31 @@ namespace CalamityMod.Items.Weapons.Ranged item.value = Item.buyPrice(1, 0, 0, 0); item.UseSound = SoundID.Item38; item.autoReuse = true; - item.shoot = ProjectileID.PurificationPowder; + item.shoot = ProjectileID.Bullet; item.shootSpeed = 12f; - item.useAmmo = 97; + item.useAmmo = AmmoID.Bullet; } - public override Vector2? HoldoutOffset() - { - return new Vector2(-15, 0); - } + public override Vector2? HoldoutOffset() => new Vector2(-15, 0); + + public override void ModifyWeaponDamage(Player player, ref float add, ref float mult, ref float flat) + { + float damageMult = 0f; + if (Main.hardMode) + damageMult = 1f; + if (NPC.downedMoonlord) + damageMult = 3f; + mult += damageMult; + } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - if (Main.hardMode) - { item.damage = 12; } - if (NPC.downedMoonlord) - { item.damage = 24; } - int num6 = Main.rand.Next(25, 36); - for (int index = 0; index < num6; ++index) + int bulletAmt = Main.rand.Next(25, 36); + for (int index = 0; index < bulletAmt; ++index) { float SpeedX = speedX + (float)Main.rand.Next(-10, 11) * 0.05f; float SpeedY = speedY + (float)Main.rand.Next(-10, 11) * 0.05f; - int shot = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); + int shot = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); Main.projectile[shot].timeLeft = 180; } return false; diff --git a/Items/Weapons/Ranged/HandheldTank.cs b/Items/Weapons/Ranged/HandheldTank.cs index a06e8e1fab..4d0ebd6e89 100644 --- a/Items/Weapons/Ranged/HandheldTank.cs +++ b/Items/Weapons/Ranged/HandheldTank.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Ranged item.width = 110; item.height = 46; item.ranged = true; - item.damage = 1850; + item.damage = 1000; item.crit += 15; item.knockBack = 16f; item.useTime = 71; diff --git a/Items/Weapons/Ranged/Megalodon.cs b/Items/Weapons/Ranged/Megalodon.cs index c97ada1a85..7d2f4d9b5e 100644 --- a/Items/Weapons/Ranged/Megalodon.cs +++ b/Items/Weapons/Ranged/Megalodon.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 28; + item.damage = 34; item.ranged = true; item.width = 72; item.height = 32; diff --git a/Items/Weapons/Ranged/MolecularManipulator.cs b/Items/Weapons/Ranged/MolecularManipulator.cs index c1ca27efe4..2257236e07 100644 --- a/Items/Weapons/Ranged/MolecularManipulator.cs +++ b/Items/Weapons/Ranged/MolecularManipulator.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 700; + item.damage = 890; item.ranged = true; item.width = 60; item.height = 30; diff --git a/Items/Weapons/Ranged/NettlelineGreatbow.cs b/Items/Weapons/Ranged/NettlelineGreatbow.cs index 10efe736e6..b7fc40d441 100644 --- a/Items/Weapons/Ranged/NettlelineGreatbow.cs +++ b/Items/Weapons/Ranged/NettlelineGreatbow.cs @@ -17,12 +17,12 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 120; + item.damage = 115; item.ranged = true; item.width = 36; item.height = 64; - item.useTime = 17; - item.useAnimation = 17; + item.useTime = 18; + item.useAnimation = 18; item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 3f; diff --git a/Items/Weapons/Ranged/PristineFury.cs b/Items/Weapons/Ranged/PristineFury.cs index 4976c299d0..d15fb38d28 100644 --- a/Items/Weapons/Ranged/PristineFury.cs +++ b/Items/Weapons/Ranged/PristineFury.cs @@ -1,5 +1,6 @@ using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,7 +9,9 @@ namespace CalamityMod.Items.Weapons.Ranged { public class PristineFury : ModItem { - public static int BaseDamage = 100; + private int frameCounter = 0; + private int frame = 0; + public static int BaseDamage = 140; public override void SetStaticDefaults() { @@ -23,8 +26,8 @@ namespace CalamityMod.Items.Weapons.Ranged { item.damage = BaseDamage; item.ranged = true; - item.width = 88; - item.height = 44; + item.width = 100; + item.height = 46; item.useTime = 3; item.useAnimation = 15; item.useStyle = ItemUseStyleID.HoldingOut; @@ -40,15 +43,9 @@ namespace CalamityMod.Items.Weapons.Ranged item.useAmmo = 23; } - public override Vector2? HoldoutOffset() - { - return new Vector2(-25, -10); - } + public override Vector2? HoldoutOffset() => new Vector2(-25, -10); - public override bool AltFunctionUse(Player player) - { - return true; - } + public override bool AltFunctionUse(Player player) => true; public override bool CanUseItem(Player player) { @@ -83,5 +80,38 @@ namespace CalamityMod.Items.Weapons.Ranged } return false; } + + internal Rectangle GetCurrentFrame(bool frameCounterUp = true) + { + int frameAmt = 4; + if (frameCounter >= 5) + { + frameCounter = -1; + frame = frame == frameAmt - 1 ? 0 : frame + 1; + } + if (frameCounterUp) + frameCounter++; + return new Rectangle(0, item.height * frame, item.width, item.height); + } + + public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + Texture2D texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Ranged/PristineFury_Animated"); + spriteBatch.Draw(texture, position, GetCurrentFrame(), Color.White, 0f, origin, scale, SpriteEffects.None, 0); + return false; + } + + public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) + { + Texture2D texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Ranged/PristineFury_Animated"); + spriteBatch.Draw(texture, item.position - Main.screenPosition, GetCurrentFrame(), lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); + return false; + } + + public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) + { + Texture2D texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Ranged/PristineFuryGlow"); + spriteBatch.Draw(texture, item.position - Main.screenPosition, GetCurrentFrame(false), Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); + } } } diff --git a/Items/Weapons/Ranged/PristineFuryGlow.png b/Items/Weapons/Ranged/PristineFuryGlow.png new file mode 100644 index 0000000000..d7e2dd7ea1 Binary files /dev/null and b/Items/Weapons/Ranged/PristineFuryGlow.png differ diff --git a/Items/Weapons/Ranged/PristineFury_Animated.png b/Items/Weapons/Ranged/PristineFury_Animated.png new file mode 100644 index 0000000000..f1e9271516 Binary files /dev/null and b/Items/Weapons/Ranged/PristineFury_Animated.png differ diff --git a/Items/Weapons/Ranged/Scorpion.cs b/Items/Weapons/Ranged/Scorpion.cs index 7febcd2dcb..ba3eb73002 100644 --- a/Items/Weapons/Ranged/Scorpion.cs +++ b/Items/Weapons/Ranged/Scorpion.cs @@ -21,8 +21,7 @@ namespace CalamityMod.Items.Weapons.Ranged item.ranged = true; item.width = 58; item.height = 26; - item.useTime = 14; - item.useAnimation = 14; + item.useTime = item.useAnimation = 13; item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 6.5f; @@ -47,24 +46,21 @@ namespace CalamityMod.Items.Weapons.Ranged public override bool CanUseItem(Player player) { - if (player.altFunctionUse == 2) - { - item.useTime = 42; - item.useAnimation = 42; - } - else - { - item.useTime = 13; - item.useAnimation = 13; - } return base.CanUseItem(player); } + public override float UseTimeMultiplier (Player player) + { + if (player.altFunctionUse == 2) + return (13f/42f); + return 1f; + } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { if (player.altFunctionUse == 2) { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), (int)((double)damage * 2.2999), knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), (int)(damage * 2.2999), knockBack, player.whoAmI, 0f, 0f); return false; } else diff --git a/Items/Weapons/Ranged/Spyker.cs b/Items/Weapons/Ranged/Spyker.cs index 63674d439d..834abf780c 100644 --- a/Items/Weapons/Ranged/Spyker.cs +++ b/Items/Weapons/Ranged/Spyker.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 250; + item.damage = 240; item.ranged = true; item.width = 44; item.height = 26; @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Ranged item.autoReuse = true; item.shootSpeed = 9f; item.shoot = ModContent.ProjectileType(); - item.useAmmo = 97; + item.useAmmo = AmmoID.Bullet; item.Calamity().customRarity = CalamityRarity.Turquoise; } diff --git a/Items/Weapons/Ranged/StormDragoon.cs b/Items/Weapons/Ranged/StormDragoon.cs index 9bca0f55a4..0b80a58e10 100644 --- a/Items/Weapons/Ranged/StormDragoon.cs +++ b/Items/Weapons/Ranged/StormDragoon.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 90; + item.damage = 94; item.ranged = true; item.width = 74; item.height = 34; diff --git a/Items/Weapons/Ranged/TheStorm.cs b/Items/Weapons/Ranged/TheStorm.cs index edda608153..105bce9557 100644 --- a/Items/Weapons/Ranged/TheStorm.cs +++ b/Items/Weapons/Ranged/TheStorm.cs @@ -41,7 +41,6 @@ namespace CalamityMod.Items.Weapons.Ranged { int i = Main.myPlayer; float num72 = Main.rand.Next(25, 30); - int num73 = damage; float num74 = knockBack; num74 = player.GetWeaponKnockback(item, num74); player.itemTime = item.useTime; @@ -88,17 +87,17 @@ namespace CalamityMod.Items.Weapons.Ranged float speedY5 = num79 + (float)Main.rand.Next(-120, 121) * 0.02f; if (type == ProjectileID.WoodenArrowFriendly) { - Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5 * 0.9f, ModContent.ProjectileType(), num73, num74, i, 0f, 0f); - Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5 * 0.8f, ModContent.ProjectileType(), num73, num74, i, 0f, 0f); - Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5 * 0.7f, ModContent.ProjectileType(), num73, num74, i, 0f, 0f); + Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5 * 0.9f, ModContent.ProjectileType(), damage, num74, i, 0f, 0f); + Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5 * 0.8f, ModContent.ProjectileType(), damage, num74, i, 0f, 0f); + Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5 * 0.7f, ModContent.ProjectileType(), damage, num74, i, 0f, 0f); } else { - int num121 = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5 * 0.9f, type, num73, num74, i, 0f, 0f); + int num121 = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5 * 0.9f, type, damage, num74, i, 0f, 0f); Main.projectile[num121].noDropItem = true; - int num122 = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5 * 0.8f, type, num73, num74, i, 0f, 0f); + int num122 = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5 * 0.8f, type, damage, num74, i, 0f, 0f); Main.projectile[num122].noDropItem = true; - int num123 = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5 * 0.7f, type, num73, num74, i, 0f, 0f); + int num123 = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5 * 0.7f, type, damage, num74, i, 0f, 0f); Main.projectile[num123].noDropItem = true; } } diff --git a/Items/Weapons/Ranged/Triploon.cs b/Items/Weapons/Ranged/Triploon.cs index 8b931de2b6..ccab6173d2 100644 --- a/Items/Weapons/Ranged/Triploon.cs +++ b/Items/Weapons/Ranged/Triploon.cs @@ -18,12 +18,12 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 80; + item.damage = 75; item.ranged = true; item.width = 46; item.height = 24; - item.useTime = 12; - item.useAnimation = 12; + item.useTime = 16; + item.useAnimation = 16; item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 7.5f; diff --git a/Items/Weapons/Ranged/Ultima.cs b/Items/Weapons/Ranged/Ultima.cs index f51f49efef..4ac1d21e23 100644 --- a/Items/Weapons/Ranged/Ultima.cs +++ b/Items/Weapons/Ranged/Ultima.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 210; + item.damage = 119; item.ranged = true; item.width = 44; item.height = 58; diff --git a/Items/Weapons/Rogue/BallisticPoisonBomb.cs b/Items/Weapons/Rogue/BallisticPoisonBomb.cs index 8753a50292..45d20c00b4 100644 --- a/Items/Weapons/Rogue/BallisticPoisonBomb.cs +++ b/Items/Weapons/Rogue/BallisticPoisonBomb.cs @@ -20,12 +20,12 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { item.width = 30; - item.damage = 55; + item.damage = 50; item.noMelee = true; item.noUseGraphic = true; - item.useAnimation = 22; + item.useAnimation = 26; item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 22; + item.useTime = 26; item.knockBack = 6.5f; item.UseSound = SoundID.Item1; item.autoReuse = true; diff --git a/Items/Weapons/Rogue/FinalDawn.cs b/Items/Weapons/Rogue/FinalDawn.cs index 1b05b1c4e2..15c1c17a54 100644 --- a/Items/Weapons/Rogue/FinalDawn.cs +++ b/Items/Weapons/Rogue/FinalDawn.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Weapons.Rogue Tooltip.SetDefault("We shall ride into the sunrise once more\n" + "Attack enemies with a giant scythe swing to replenish stealth\n" + "Press up and attack to throw the scythe \n" + - "Stealth strikes perform a vertical swing that leaves a lingering fire aura\n" + + "Stealth strikes perform a horizontal swing that leaves a lingering fire aura\n" + "Stealth strikes performed while pressing up fling yourself at the enemy and slice through them, causing homing fireballs to emerge"); } public override void SafeSetDefaults() diff --git a/Items/Weapons/Rogue/FlameScythe.cs b/Items/Weapons/Rogue/FlameScythe.cs index d56eeac022..d301f2742d 100644 --- a/Items/Weapons/Rogue/FlameScythe.cs +++ b/Items/Weapons/Rogue/FlameScythe.cs @@ -24,8 +24,8 @@ namespace CalamityMod.Items.Weapons.Rogue item.noUseGraphic = true; item.autoReuse = true; item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 21; - item.useAnimation = 21; + item.useTime = 20; + item.useAnimation = 20; item.knockBack = 8.5f; item.UseSound = SoundID.Item1; item.value = Item.buyPrice(gold: 80); diff --git a/Items/Weapons/Rogue/LeonidProgenitor.cs b/Items/Weapons/Rogue/LeonidProgenitor.cs index 3155da29e8..fa62e10005 100644 --- a/Items/Weapons/Rogue/LeonidProgenitor.cs +++ b/Items/Weapons/Rogue/LeonidProgenitor.cs @@ -48,19 +48,24 @@ namespace CalamityMod.Items.Weapons.Rogue { if (player.Calamity().StealthStrikeAvailable() || player.altFunctionUse != 2) { - item.useTime = item.useAnimation = 15; item.UseSound = SoundID.Item61; item.shoot = ModContent.ProjectileType(); } else { - item.useTime = item.useAnimation = 20; item.UseSound = SoundID.Item88; item.shoot = ModContent.ProjectileType(); } return base.CanUseItem(player); } + public override float UseTimeMultiplier (Player player) + { + if (player.Calamity().StealthStrikeAvailable() || player.altFunctionUse != 2) + return 1f; + return 0.75f; + } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { if (player.Calamity().StealthStrikeAvailable() || player.altFunctionUse != 2) diff --git a/Items/Weapons/Rogue/Malachite.cs b/Items/Weapons/Rogue/Malachite.cs index f4094c5815..9cf65f1c0e 100644 --- a/Items/Weapons/Rogue/Malachite.cs +++ b/Items/Weapons/Rogue/Malachite.cs @@ -24,8 +24,7 @@ namespace CalamityMod.Items.Weapons.Rogue item.damage = 62; item.noMelee = true; item.noUseGraphic = true; - item.useTime = 10; - item.useAnimation = 10; + item.useTime = item.useAnimation = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.knockBack = 1.25f; item.UseSound = SoundID.Item1; @@ -45,25 +44,29 @@ namespace CalamityMod.Items.Weapons.Rogue { if (player.Calamity().StealthStrikeAvailable()) { - item.useTime = item.useAnimation = 10; item.UseSound = SoundID.Item109; item.shoot = ModContent.ProjectileType(); } else if (player.altFunctionUse == 2) { - item.useTime = item.useAnimation = 10; item.UseSound = SoundID.Item109; item.shoot = ModContent.ProjectileType(); } else { - item.useTime = item.useAnimation = 5; item.UseSound = SoundID.Item1; item.shoot = ModContent.ProjectileType(); } return base.CanUseItem(player); } + public override float UseTimeMultiplier (Player player) + { + if (player.Calamity().StealthStrikeAvailable() || player.altFunctionUse == 2) + return 1f; + return 2f; + } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { float dmgMult = 1f; diff --git a/Items/Weapons/Rogue/Pwnagehammer.cs b/Items/Weapons/Rogue/Pwnagehammer.cs index c3a55d46f6..c28f22cfaf 100644 --- a/Items/Weapons/Rogue/Pwnagehammer.cs +++ b/Items/Weapons/Rogue/Pwnagehammer.cs @@ -11,32 +11,40 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Pwnagehammer"); - Tooltip.SetDefault("Throws an extremely fast hammer"); + Tooltip.SetDefault("Throws a heavy, gravity-affected hammer that creates a loud blast of hallowed energy when it hits something\n" + + "There is a 20 percent chance for the hammer to home in on a target\n" + + "Homing hammers summon an additional spectral hammer on hit and are guaranteed to land a critical hit"); } public override void SafeSetDefaults() { item.width = 68; - item.damage = 90; + item.damage = 210; + item.crit = 10; item.noMelee = true; item.noUseGraphic = true; item.autoReuse = true; - item.useAnimation = 15; + item.useAnimation = item.useTime = 48; item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 15; item.knockBack = 10f; item.UseSound = SoundID.Item1; + item.Calamity().rogue = true; item.height = 68; item.value = Item.buyPrice(0, 48, 0, 0); item.rare = 6; item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 12f; - item.Calamity().rogue = true; + item.shootSpeed = 24.4f; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + Vector2 speed = new Vector2(speedX, speedY); + Vector2 yeetOffset = Vector2.Normalize(speed) * 40f; + if (Collision.CanHit(position, 0, 0, position + yeetOffset, 0, 0)) + { + position += yeetOffset; + } + int proj = Projectile.NewProjectile(position, speed, type, damage, knockBack, player.whoAmI, Main.rand.NextBool(5) ? 1f : 0f); Main.projectile[proj].Calamity().forceRogue = true; Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); return false; diff --git a/Items/Weapons/Summon/AbandonedSlimeStaff.cs b/Items/Weapons/Summon/AbandonedSlimeStaff.cs index fa629db71e..d6bd213542 100644 --- a/Items/Weapons/Summon/AbandonedSlimeStaff.cs +++ b/Items/Weapons/Summon/AbandonedSlimeStaff.cs @@ -1,6 +1,7 @@ using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using System; +using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -16,7 +17,8 @@ namespace CalamityMod.Items.Weapons.Summon Tooltip.SetDefault("Cast down from the heavens in disgust, this relic sings a song of quiet tragedy...\n" + "Consumes all of the remaining minion slots on use\n" + "Must be used from the hotbar\n" + - "Increased power and size based on the number of minion slots used"); + "Increased power and size based on the number of minion slots used\n" + + "Holding this weapon grants 20% increased jump speed"); } public override void SetDefaults() @@ -40,6 +42,19 @@ namespace CalamityMod.Items.Weapons.Summon item.Calamity().customRarity = CalamityRarity.Dedicated; //rarity 21 } + public override void ModifyTooltips(List list) + { + bool autoJump = Main.player[Main.myPlayer].autoJump; + string jumpAmt = autoJump ? "5" : "20"; + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip4") + { + line2.text = "Holding this weapon grants " + jumpAmt + "% increased jump speed"; + } + } + } + public override void HoldItem(Player player) { //same boost as Aero Stone diff --git a/Items/Weapons/Summon/BlightedEyeStaff.cs b/Items/Weapons/Summon/BlightedEyeStaff.cs index 85b17abb35..45094ef7de 100644 --- a/Items/Weapons/Summon/BlightedEyeStaff.cs +++ b/Items/Weapons/Summon/BlightedEyeStaff.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.damage = 35; + item.damage = 40; item.mana = 10; item.width = 62; item.height = 62; diff --git a/Items/Weapons/Summon/ColdDivinity.cs b/Items/Weapons/Summon/ColdDivinity.cs index 792e9fa1b0..9252d4b813 100644 --- a/Items/Weapons/Summon/ColdDivinity.cs +++ b/Items/Weapons/Summon/ColdDivinity.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Summon item.useStyle = ItemUseStyleID.HoldingUp; item.noMelee = true; item.knockBack = 4.5f; - item.value = Item.buyPrice(0, 48, 0, 0); + item.value = Item.buyPrice(0, 36, 0, 0); item.rare = 5; item.Calamity().customRarity = CalamityRarity.ItemSpecific; item.UseSound = SoundID.Item30; diff --git a/Items/Weapons/Summon/CorvidHarbringerStaff.cs b/Items/Weapons/Summon/CorvidHarbringerStaff.cs index 90c65ff242..62e00f7e15 100644 --- a/Items/Weapons/Summon/CorvidHarbringerStaff.cs +++ b/Items/Weapons/Summon/CorvidHarbringerStaff.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Summon item.UseSound = SoundID.DD2_BetsyFlyingCircleAttack; item.summon = true; item.mana = 11; - item.damage = 250; + item.damage = 300; item.knockBack = 2f; item.autoReuse = true; item.useTime = item.useAnimation = 10; diff --git a/Items/Weapons/Summon/EndoHydraStaff.cs b/Items/Weapons/Summon/EndoHydraStaff.cs index 4363b83103..a5a5e746ea 100644 --- a/Items/Weapons/Summon/EndoHydraStaff.cs +++ b/Items/Weapons/Summon/EndoHydraStaff.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Summon item.UseSound = SoundID.Item60; item.summon = true; item.mana = 25; - item.damage = 400; + item.damage = 450; item.knockBack = 3f; item.autoReuse = true; item.useTime = item.useAnimation = 10; diff --git a/Items/Weapons/Summon/EnergyStaff.cs b/Items/Weapons/Summon/EnergyStaff.cs index 14e62b75f1..d297a1659f 100644 --- a/Items/Weapons/Summon/EnergyStaff.cs +++ b/Items/Weapons/Summon/EnergyStaff.cs @@ -36,11 +36,11 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - position = Main.MouseWorld; - speedX = 0; - speedY = 0; - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); - player.UpdateMaxTurrets(); + if (player.altFunctionUse != 2) + { + Projectile.NewProjectile(Main.MouseWorld, Vector2.Zero, type, damage, knockBack, player.whoAmI, 8f); + player.UpdateMaxTurrets(); + } return false; } } diff --git a/Items/Weapons/Summon/MidnightSunBeacon.cs b/Items/Weapons/Summon/MidnightSunBeacon.cs index c917b687e9..18e914fde0 100644 --- a/Items/Weapons/Summon/MidnightSunBeacon.cs +++ b/Items/Weapons/Summon/MidnightSunBeacon.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.damage = 230; + item.damage = 200; item.mana = 12; item.width = item.height = 32; item.useTime = item.useAnimation = 10; diff --git a/Items/Weapons/Summon/PlantationStaff.cs b/Items/Weapons/Summon/PlantationStaff.cs index e11daf2b26..50228da310 100644 --- a/Items/Weapons/Summon/PlantationStaff.cs +++ b/Items/Weapons/Summon/PlantationStaff.cs @@ -9,84 +9,82 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Summon { public class PlantationStaff : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Plantation Staff"); - Tooltip.SetDefault("Summons a miniature plantera to protect you\n" + + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Plantation Staff"); + Tooltip.SetDefault("Summons a miniature plantera to protect you\n" + "Fires seeds and spiky balls from afar to poison targets\n" + "Enrages when you get under 50% health and begins ramming enemies\n" + + "While enraged, it will additionally start firing spore clouds\n" + "Occupies 2 minion slots and there can only be one"); - } + } - public override void SetDefaults() - { - item.damage = 70; - item.mana = 10; - item.width = 66; - item.height = 70; - item.useTime = item.useAnimation = 20; - item.useStyle = ItemUseStyleID.SwingThrow; - item.noMelee = true; - item.knockBack = 1f; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; - item.UseSound = SoundID.Item76; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; - item.summon = true; - } + public override void SetDefaults() + { + item.damage = 70; + item.mana = 10; + item.width = 66; + item.height = 70; + item.useTime = item.useAnimation = 20; + item.useStyle = ItemUseStyleID.SwingThrow; + item.noMelee = true; + item.knockBack = 1f; + item.value = Item.buyPrice(0, 80, 0, 0); + item.rare = 8; + item.UseSound = SoundID.Item76; + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 10f; + item.summon = true; + } - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0 && player.maxMinions >= 2; + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0 && player.maxMinions >= 2; - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.OpticStaff); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 10); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ItemID.OpticStaff); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - if (player.altFunctionUse != 2) - { - int i = Main.myPlayer; - float num72 = item.shootSpeed; - float num74 = knockBack; - num74 = player.GetWeaponKnockback(item, num74); + { + if (player.altFunctionUse != 2) + { + float speed = item.shootSpeed; player.itemTime = item.useTime; - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; + Vector2 playerPos = player.RotatedRelativePoint(player.MountedCenter, true); + float directionX = (float)Main.mouseX + Main.screenPosition.X - playerPos.X; + float directionY = (float)Main.mouseY + Main.screenPosition.Y - playerPos.Y; if (player.gravDir == -1f) { - num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; + directionY = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - playerPos.Y; } - float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) + Vector2 spinningpoint = new Vector2(directionX, directionY); + float vectorDist = spinningpoint.Length(); + if ((float.IsNaN(spinningpoint.X) && float.IsNaN(spinningpoint.Y)) || (spinningpoint.X == 0f && spinningpoint.Y == 0f)) { - num78 = (float)player.direction; - num79 = 0f; - num80 = num72; + spinningpoint.X = (float)player.direction; + spinningpoint.Y = 0f; + vectorDist = speed; } else { - num80 = num72 / num80; + vectorDist = speed / vectorDist; } - num78 *= num80; - num79 *= num80; - vector2.X = (float)Main.mouseX + Main.screenPosition.X; - vector2.Y = (float)Main.mouseY + Main.screenPosition.Y; - Vector2 spinningpoint = new Vector2(num78, num79); - spinningpoint = spinningpoint.RotatedBy(1.5707963705062866, default); - Projectile.NewProjectile(vector2.X + spinningpoint.X, vector2.Y + spinningpoint.Y, spinningpoint.X, spinningpoint.Y, type, damage, num74, i, 0f, 0f); + spinningpoint.X *= vectorDist; + spinningpoint.Y *= vectorDist; + playerPos.X = (float)Main.mouseX + Main.screenPosition.X; + playerPos.Y = (float)Main.mouseY + Main.screenPosition.Y; + spinningpoint = spinningpoint.RotatedBy(MathHelper.PiOver2, default); + Projectile.NewProjectile(playerPos + spinningpoint, spinningpoint, type, damage, knockBack, player.whoAmI, 0f, 0f); } return false; - } - } + } + } } diff --git a/Items/Weapons/Summon/PrototypeAndromechaRing.cs b/Items/Weapons/Summon/PrototypeAndromechaRing.cs index 54ee78dbdc..40e99b27d8 100644 --- a/Items/Weapons/Summon/PrototypeAndromechaRing.cs +++ b/Items/Weapons/Summon/PrototypeAndromechaRing.cs @@ -53,7 +53,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 100); + recipe.AddIngredient(ModContent.ItemType(), 5); recipe.AddIngredient(ModContent.ItemType(), 4); recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ItemID.WingsVortex); diff --git a/Items/Weapons/Summon/RustyBeaconPrototype.cs b/Items/Weapons/Summon/RustyBeaconPrototype.cs index 95760c4e02..86a81dc44f 100644 --- a/Items/Weapons/Summon/RustyBeaconPrototype.cs +++ b/Items/Weapons/Summon/RustyBeaconPrototype.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Weapons.Summon DisplayName.SetDefault("Rusty Beacon Prototype"); Tooltip.SetDefault("Summons a long-abandoned drone to support you\n" + "Clicking on an enemy gives them a tiny prick, causing them to become aggravated\n" + - "The drone hovers above nearby enemies and gives them various debuffs"); + "The drone hovers above nearby enemies and inflicts irradiated"); } public override void SetDefaults() diff --git a/Items/Weapons/Summon/SarosPossession.cs b/Items/Weapons/Summon/SarosPossession.cs index bd973983f8..e1e49715f2 100644 --- a/Items/Weapons/Summon/SarosPossession.cs +++ b/Items/Weapons/Summon/SarosPossession.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Summon item.summon = true; item.mana = 100; - item.damage = 681; + item.damage = 640; item.knockBack = 4f; item.useTime = item.useAnimation = 10; item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Typeless/AethersWhisper.cs b/Items/Weapons/Typeless/AethersWhisper.cs index b4dfa58729..1872f216d8 100644 --- a/Items/Weapons/Typeless/AethersWhisper.cs +++ b/Items/Weapons/Typeless/AethersWhisper.cs @@ -50,17 +50,21 @@ namespace CalamityMod.Items.Weapons.Typeless { item.ranged = true; item.magic = false; - item.mana = 0; } else { item.ranged = false; item.magic = true; - item.mana = 30; } return base.CanUseItem(player); } + public override void ModifyManaCost(Player player, ref float reduce, ref float mult) + { + if (player.altFunctionUse == 2) + mult *= 0f; + } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { float ai0 = player.altFunctionUse == 2 ? 1f : 0f; diff --git a/ModSupport/WeakReferenceSupport.cs b/ModSupport/WeakReferenceSupport.cs index ee867273d1..42a01ddd1c 100644 --- a/ModSupport/WeakReferenceSupport.cs +++ b/ModSupport/WeakReferenceSupport.cs @@ -274,7 +274,7 @@ namespace CalamityMod List loot = new List() { ItemType(), ItemID.Gel, ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemID.HealingPotion }; List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; string instructions = $"Use an [i:{summon}]"; - string despawn = CalamityUtils.ColorMessage("The gelatinous monstrosity achieved vengeance for its breathren.", new Color(0xBA, 0x55, 0x33)); + string despawn = CalamityUtils.ColorMessage("The gelatinous monstrosity achieved vengeance for its brethren.", new Color(0xBA, 0x55, 0x33)); AddBoss(bossChecklist, calamity, "Slime God", order, bosses, DownedSlimeGod, summon, loot, collection, instructions, despawn); } diff --git a/NPCs/Abyss/MirageJelly.cs b/NPCs/Abyss/MirageJelly.cs index 7e7c93dab3..656cd69964 100644 --- a/NPCs/Abyss/MirageJelly.cs +++ b/NPCs/Abyss/MirageJelly.cs @@ -213,7 +213,7 @@ namespace CalamityMod.NPCs.Abyss DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas && Main.expertMode, 2, 5, 7); DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 5 : 7); DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 5 : 7); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), Main.hardMode, Main.expertMode ? 5 : 7, 1, 1); + DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 5 : 7); float necklaceDropRate = CalamityWorld.defiled ? DropHelper.DefiledDropRateFloat : 0.01f; DropHelper.DropItemChance(npc, ItemID.JellyfishNecklace, necklaceDropRate); } diff --git a/NPCs/AcidRain/GammaSlime.cs b/NPCs/AcidRain/GammaSlime.cs index b54bf77436..f5c6b234e3 100644 --- a/NPCs/AcidRain/GammaSlime.cs +++ b/NPCs/AcidRain/GammaSlime.cs @@ -76,7 +76,7 @@ namespace CalamityMod.NPCs.AcidRain Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.6f, 0.8f, 0.6f); npc.TargetClosest(false); Player player = Main.player[npc.target]; - if (npc.velocity.Y == 0f && npc.ai[3] <= 0f) + if (npc.velocity.Y == 0f && npc.ai[3] <= 0f && !player.npcTypeNoAggro[npc.type]) { npc.velocity.X *= 0.8f; if (npc.ai[0]++ >= 30f) @@ -164,7 +164,7 @@ namespace CalamityMod.NPCs.AcidRain if (Math.Abs(player.Center.X - npc.Center.X) < 250f && player.Center.X - npc.Center.X < 0f && npc.ai[3] == 0f && - Main.rand.NextBool(110)) + Main.rand.NextBool(110) && !player.npcTypeNoAggro[npc.type]) { npc.ai[3] = 600f; npc.netUpdate = true; diff --git a/NPCs/Astral/Mantis.cs b/NPCs/Astral/Mantis.cs index 8f9f7da46d..ade6f8e031 100644 --- a/NPCs/Astral/Mantis.cs +++ b/NPCs/Astral/Mantis.cs @@ -110,12 +110,12 @@ namespace CalamityMod.NPCs.Astral { npc.ai[2] += 1f; npc.velocity.X *= 0.95f; - if (npc.ai[2] >= 20f) + if (npc.ai[2] == 20f) //Don't do >= 20f or it'll cause a wave of scythes { Main.PlaySound(SoundID.Item71, npc.position); Vector2 vector = Main.player[npc.target].Center - npc.Center; vector.Normalize(); - int damage = CalamityWorld.downedAstrageldon ? 45 : 55; + int damage = CalamityWorld.downedAstrageldon ? 55 : 45; Projectile.NewProjectile(npc.Center + (npc.Center.X < target.Center.X ? -14f : 14f) * Vector2.UnitX, vector * 7f, ModContent.ProjectileType(), damage, 0f); } } diff --git a/NPCs/CalamityAI.cs b/NPCs/CalamityAI.cs index ab31cf030e..229575ced9 100644 --- a/NPCs/CalamityAI.cs +++ b/NPCs/CalamityAI.cs @@ -5846,7 +5846,7 @@ namespace CalamityMod.NPCs Vector2 targetVector = player.Center - vectorCenter; float offsetAngle = 0f; int totalProjectiles = 0; - int chains = 0; + //int chains = 0; // Parabolic Arcs if (npc.localAI[0] % 60f == 0f) diff --git a/NPCs/CalamityGlobalAI.cs b/NPCs/CalamityGlobalAI.cs index 3a3c63b4f6..facb50be4f 100644 --- a/NPCs/CalamityGlobalAI.cs +++ b/NPCs/CalamityGlobalAI.cs @@ -12759,18 +12759,18 @@ namespace CalamityMod.NPCs if (npc.ai[1] == 60f) { - for (int num1161 = 0; num1161 < Main.maxProjectiles; num1161++) + for (int i = 0; i < Main.maxProjectiles; i++) { - Projectile projectile = Main.projectile[num1161]; + Projectile projectile = Main.projectile[i]; if (projectile.active && (projectile.type == ProjectileID.MoonLeech || projectile.type == ProjectileID.PhantasmalBolt || projectile.type == ProjectileID.PhantasmalDeathray || projectile.type == ProjectileID.PhantasmalEye || projectile.type == ProjectileID.PhantasmalSphere)) projectile.Kill(); } - for (int num1162 = 0; num1162 < Main.maxNPCs; num1162++) + for (int j = 0; j < Main.maxNPCs; j++) { - NPC nPC3 = Main.npc[num1162]; + NPC nPC3 = Main.npc[j]; if (nPC3.active && nPC3.type == NPCID.MoonLordFreeEye) { nPC3.HitEffect(0, 9999.0); @@ -12888,9 +12888,6 @@ namespace CalamityMod.NPCs npc.HitEffect(0, 1337.0); npc.checkDead(); - if (!CalamityWorld.bossRushActive) - MoonLordLoot(npc); - for (int num1174 = 0; num1174 < Main.maxNPCs; num1174++) { NPC nPC5 = Main.npc[num1174]; @@ -14655,98 +14652,6 @@ namespace CalamityMod.NPCs } return false; } - - #region Moon Lord Loot - private static void MoonLordLoot(NPC npc) - { - DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !NPC.downedMoonlord); - DropHelper.DropResidentEvilAmmo(npc, NPC.downedMoonlord, 5, 2, 1); - - string key = "Mods.CalamityMod.MoonBossText"; - Color messageColor = Color.Orange; - string key2 = "Mods.CalamityMod.MoonBossText2"; - Color messageColor2 = Color.Violet; - string key3 = "Mods.CalamityMod.MoonBossText3"; - Color messageColor3 = Color.Crimson; - string key4 = "Mods.CalamityMod.ProfanedBossText2"; - Color messageColor4 = Color.Cyan; - string key5 = "Mods.CalamityMod.FutureOreText"; - Color messageColor5 = Color.LightGray; - - // Spawn Exodium and send messages about Providence, Bloodstone, Phantoplasm, etc. if ML has not been killed yet - if (!NPC.downedMoonlord) - { - WorldGenerationMethods.SpawnOre(ModContent.TileType(), 12E-05, .01f, .07f); - - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key), messageColor); - Main.NewText(Language.GetTextValue(key2), messageColor2); - Main.NewText(Language.GetTextValue(key3), messageColor3); - Main.NewText(Language.GetTextValue(key4), messageColor4); - Main.NewText(Language.GetTextValue(key5), messageColor5); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key2), messageColor2); - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key3), messageColor3); - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key4), messageColor4); - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key5), messageColor5); - } - } - - if (CalamityWorld.armageddon) - { - DropHelper.DropArmageddonBags(npc); - } - - if (Main.netMode != NetmodeID.Server) - { - if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active) - { - Main.player[Main.myPlayer].Calamity().adrenaline = 0; - } - } - - NPC.downedMoonlord = true; - NPC.LunarApocalypseIsUp = false; - - npc.DropBossBags(); - - if (Main.rand.NextBool(10)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, 3595, 1, false, 0, false, false); - } - - int stack = Main.rand.Next(5, 16); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, 499, stack, false, 0, false, false); - - int num70 = Main.rand.Next(5) + 5; - for (int num71 = 0; num71 < num70; num71++) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, 58, 1, false, 0, false, false); - } - - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue("Announcement.HasBeenDefeated_Single", Language.GetTextValue("Enemies.MoonLord")), 175, 75, 255, false); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey("Announcement.HasBeenDefeated_Single", new object[] - { - NetworkText.FromKey("Enemies.MoonLord", new object[0]) - }), new Color(175, 75, 255), -1); - } - - if (Main.netMode == NetmodeID.Server) - { - NetMessage.SendData(MessageID.WorldData, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); - } - } - #endregion - #endregion #region Buffed Mothron AI @@ -14856,7 +14761,7 @@ namespace CalamityMod.NPCs npc.ai[0] = 2f; else if (num1355 == 1) npc.ai[0] = 3f; - else if (num1355 == 2 && NPC.CountNPCS(478) + NPC.CountNPCS(479) < 2) + else if (num1355 == 2 && NPC.CountNPCS(NPCID.MothronEgg) + NPC.CountNPCS(NPCID.MothronSpawn) < 2) npc.ai[0] = 4f; } } @@ -15791,43 +15696,44 @@ namespace CalamityMod.NPCs #region Revengeance Dungeon Guardian AI public static void RevengeanceDungeonGuardianAI(NPC npc, bool configBossRushBoost, bool enraged) { - Vector2 vector21 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float num177 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector21.X; - float num178 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector21.Y; - float num179 = (float)Math.Sqrt(num177 * num177 + num178 * num178); - num179 = 12f / num179; - npc.velocity.X = num177 * num179; - npc.velocity.Y = num178 * num179; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[1] += 1f; - if (npc.localAI[1] >= 60f) - { - npc.localAI[1] = 0f; - Vector2 vector16 = npc.Center; - if (Collision.CanHit(vector16, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - float num159 = 5f; - float num160 = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - vector16.X + Main.rand.Next(-20, 21); - float num161 = Main.player[npc.target].position.Y + Main.player[npc.target].height * 0.5f - vector16.Y + Main.rand.Next(-20, 21); - float num162 = (float)Math.Sqrt(num160 * num160 + num161 * num161); - num162 = num159 / num162; - num160 *= num162; - num161 *= num162; - Vector2 value = new Vector2(num160 * 1f + Main.rand.Next(-50, 51) * 0.01f, num161 * 1f + Main.rand.Next(-50, 51) * 0.01f); - value.Normalize(); - value *= num159; - value += npc.velocity; - num160 = value.X; - num161 = value.Y; - int num163 = 2500; - int num164 = ProjectileID.Skull; - vector16 += value * 5f; - int num165 = Projectile.NewProjectile(vector16.X, vector16.Y, num160, num161, num164, num163, 0f, Main.myPlayer, -1f, 0f); - Main.projectile[num165].timeLeft = 300; - } - } - } + Player target = Main.player[npc.target]; + if (npc.ai[1] != 3f) + { + Vector2 targetVector = target.Center - npc.Center; + float targetDist = targetVector.Length(); + targetDist = 12f / targetDist; + npc.velocity.X = targetVector.X * targetDist; + npc.velocity.Y = targetVector.Y * targetDist; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (npc.localAI[1]++ % 60f == 59f) + { + Vector2 source = npc.Center; + if (Collision.CanHit(source, 1, 1, target.Center, target.width, target.height)) + { + float speed = 5f; + float xDist = target.Center.X - source.X + Main.rand.Next(-20, 21); + float yDist = target.Center.Y - source.Y + Main.rand.Next(-20, 21); + Vector2 velocity = new Vector2(xDist, yDist); + float distTarget = velocity.Length(); + distTarget = speed / distTarget; + velocity.X *= distTarget; + velocity.Y *= distTarget; + Vector2 offset = new Vector2(velocity.X * 1f + Main.rand.Next(-50, 51) * 0.01f, velocity.Y * 1f + Main.rand.Next(-50, 51) * 0.01f); + offset.Normalize(); + offset *= speed; + offset += npc.velocity; + velocity.X = offset.X; + velocity.Y = offset.Y; + int damage = 2500; + int projType = ProjectileID.Skull; + source += offset * 5f; + int skull = Projectile.NewProjectile(source, velocity, projType, damage, 0f, Main.myPlayer, -1f, 0f); + Main.projectile[skull].timeLeft = 300; + } + } + } + } } #endregion @@ -20010,7 +19916,7 @@ namespace CalamityMod.NPCs bool foundGoodTeleport = true; // I don't understand why the hell this exists if it's only for Chaos Elementals, but I suppose I'll // Leave it here - if (npcType == NPCID.DarkCaster && Main.tile[randX, num181 - 1].wall == 0) + if (npcType == NPCID.DarkCaster && Main.tile[randX, num181 - 1].wall == WallID.None) { foundGoodTeleport = false; } diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 38a6933144..46696928e0 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -1071,8 +1071,6 @@ namespace CalamityMod.NPCs if (npc.type == NPCID.GreenJellyfish && !Main.hardMode) { - npc.damage = 40; - npc.defDamage = npc.damage; npc.defense = 4; npc.defDefense = npc.defense; } @@ -1414,7 +1412,7 @@ namespace CalamityMod.NPCs bool eaterofWorldsResist = EaterofWorldsIDs.Contains(npc.type) && CalamityWorld.bossRushActive; if (destroyerResist || eaterofWorldsResist || AstrumDeusIDs.Contains(npc.type)) { - if (newAI[1] < 600f || (newAI[2] > 0f && DestroyerIDs.Contains(npc.type))) + if (newAI[1] < 480f || (newAI[2] > 0f && DestroyerIDs.Contains(npc.type))) { damage *= 0.01; } @@ -3522,7 +3520,7 @@ namespace CalamityMod.NPCs if (modPlayer.nucleogenesis) { - if (projectile.minion || projectile.sentry || ProjectileID.Sets.MinionShot[projectile.type] || ProjectileID.Sets.SentryShot[projectile.type] || CalamityMod.projectileMinionList.Contains(projectile.type)) + if (projectile.IsSummon()) { damage = npc.lifeMax * 3; } @@ -3595,6 +3593,10 @@ namespace CalamityMod.NPCs projectile.penetrate = projectile.Calamity().stealthStrike ? 6 : 9; damage = (int)(damage * 0.75); } + else if (projectile.type == ProjectileType() || projectile.type == ProjectileType()) + { + damage = (int)(damage * 0.5); + } else if (projectile.type == ProjectileType() || projectile.type == ProjectileType()) { damage = (int)(damage * 0.5); @@ -3677,7 +3679,7 @@ namespace CalamityMod.NPCs { damage = (int)(damage * 0.2); } - else if (projectile.type == ProjectileType() || projectile.type == ProjectileType()) + else if (projectile.type == ProjectileType()) { damage = (int)(damage * 0.5); } @@ -3725,7 +3727,7 @@ namespace CalamityMod.NPCs private void PierceResistGlobal(Projectile projectile, ref int damage) { - if (projectile.minion) + if (projectile.IsSummon()) return; if (projectile.penetrate == -1) @@ -3762,7 +3764,7 @@ namespace CalamityMod.NPCs Player player = Main.player[projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); - bool isSummon = projectile.minion || projectile.sentry || CalamityMod.projectileMinionList.Contains(projectile.type) || ProjectileID.Sets.MinionShot[projectile.type] || ProjectileID.Sets.SentryShot[projectile.type]; + bool isSummon = projectile.IsSummon(); if (modPlayer.sGenerator) { @@ -4073,7 +4075,7 @@ namespace CalamityMod.NPCs spawnRate = (int)(spawnRate * 2.5); maxSpawns = (int)(maxSpawns * 0.3f); } - if (player.Calamity().bossZen || CalamityWorld.DoGSecondStageCountdown > 0) + if ((player.Calamity().bossZen || CalamityWorld.DoGSecondStageCountdown > 0) && CalamityConfig.Instance.BossZen) { spawnRate *= 5; maxSpawns = (int)(maxSpawns * 0.001f); @@ -4095,16 +4097,7 @@ namespace CalamityMod.NPCs #region Edit Spawn Pool public override void EditSpawnPool(IDictionary pool, NPCSpawnInfo spawnInfo) { - // Spawn Green Jellyfish in prehm and Blue Jellyfish in hardmode - if (spawnInfo.player.ZoneRockLayerHeight && spawnInfo.water) - { - if (!Main.hardMode) - pool[NPCID.GreenJellyfish] = SpawnCondition.CaveJellyfish.Chance * 0.5f; - else - pool[NPCID.BlueJellyfish] = SpawnCondition.CaveJellyfish.Chance; - } - - if (spawnInfo.player.Calamity().ZoneAbyss || + if (spawnInfo.player.Calamity().ZoneAbyss || spawnInfo.player.Calamity().ZoneCalamity || spawnInfo.player.Calamity().ZoneSulphur || spawnInfo.player.Calamity().ZoneSunkenSea || @@ -4113,8 +4106,14 @@ namespace CalamityMod.NPCs pool[0] = 0f; } - if (spawnInfo.player.Calamity().underworldLore) - pool[NPCID.VoodooDemon] = 0f; + // Spawn Green Jellyfish in prehm and Blue Jellyfish in hardmode + if (spawnInfo.player.ZoneRockLayerHeight && spawnInfo.water) + { + if (!Main.hardMode) + pool[NPCID.GreenJellyfish] = SpawnCondition.CaveJellyfish.Chance * 0.5f; + else + pool[NPCID.BlueJellyfish] = SpawnCondition.CaveJellyfish.Chance; + } if (spawnInfo.player.Calamity().ZoneSulphur && !spawnInfo.player.Calamity().ZoneAbyss && CalamityWorld.rainingAcid) { @@ -4543,7 +4542,7 @@ namespace CalamityMod.NPCs { if (npc.type != NPCID.BrainofCthulhu && (npc.type != NPCID.DukeFishron || npc.ai[0] <= 9f)) { - if (CalamityConfig.Instance.DebuffDisplay && (npc.boss || BossHealthBarManager.MinibossHPBarList.Contains(npc.type) || BossHealthBarManager.OneToMany.ContainsKey(npc.type))) + if (CalamityConfig.Instance.DebuffDisplay && (npc.boss || BossHealthBarManager.MinibossHPBarList.Contains(npc.type) || BossHealthBarManager.OneToMany.ContainsKey(npc.type) || CalamityMod.needsDebuffIconDisplayList.Contains(npc.type))) { List buffTextureList = new List(); @@ -5319,7 +5318,7 @@ namespace CalamityMod.NPCs break; case NPCID.GoblinTinkerer: - if (Main.rand.NextBool(3) && thief != -1 && Main.LocalPlayer.Calamity().reforges >= 10) + if (Main.rand.NextBool(3) && thief != -1 && CalamityWorld.Reforges >= 1) { chat = $"Hey, is it just me or have my pockets gotten lighter ever since " + Main.npc[thief].GivenName + " arrived?"; } @@ -5613,10 +5612,10 @@ namespace CalamityMod.NPCs SetShopItem(ref shop, ref nextSlot, ItemID.Flare, (Main.LocalPlayer.HasItem(ItemType()) || Main.LocalPlayer.HasItem(ItemType())) && !Main.LocalPlayer.HasItem(ItemID.FlareGun)); SetShopItem(ref shop, ref nextSlot, ItemID.BlueFlare, (Main.LocalPlayer.HasItem(ItemType()) || Main.LocalPlayer.HasItem(ItemType())) && !Main.LocalPlayer.HasItem(ItemID.FlareGun)); SetShopItem(ref shop, ref nextSlot, ItemID.ApprenticeBait, NPC.downedBoss1); - SetShopItem(ref shop, ref nextSlot, ItemID.JourneymanBait, NPC.downedBoss2); + SetShopItem(ref shop, ref nextSlot, ItemID.JourneymanBait, NPC.downedBoss3); SetShopItem(ref shop, ref nextSlot, WorldGen.crimson ? ItemID.Vilethorn : ItemID.CrimsonRod, WorldGen.shadowOrbSmashed || NPC.downedBoss2); SetShopItem(ref shop, ref nextSlot, WorldGen.crimson ? ItemID.BallOHurt : ItemID.TheRottedFork, WorldGen.shadowOrbSmashed || NPC.downedBoss2); - SetShopItem(ref shop, ref nextSlot, ItemID.MasterBait, NPC.downedBoss3); + SetShopItem(ref shop, ref nextSlot, ItemID.MasterBait, NPC.downedPlantBoss); SetShopItem(ref shop, ref nextSlot, ItemID.AngelStatue, NPC.FindFirstNPC(NPCType()) != -1, Item.buyPrice(0, 5)); SetShopItem(ref shop, ref nextSlot, ItemID.UltrabrightTorch, CalamityWorld.death); } diff --git a/NPCs/CalamityGlobalNPCLoot.cs b/NPCs/CalamityGlobalNPCLoot.cs index debfe75091..8619fd92ba 100644 --- a/NPCs/CalamityGlobalNPCLoot.cs +++ b/NPCs/CalamityGlobalNPCLoot.cs @@ -91,7 +91,7 @@ namespace CalamityMod.NPCs if (CalamityWorld.revenge) { - if (npc.type == NPCID.Probe || npc.type == NPCID.ServantofCthulhu || npc.type == NPCID.MoonLordCore) + if (npc.type == NPCID.Probe || npc.type == NPCID.ServantofCthulhu) { return false; } @@ -174,22 +174,22 @@ namespace CalamityMod.NPCs // First kill text (this is not a loot function) if (!Main.hardMode) - { - string key2 = "Mods.CalamityMod.UglyBossText"; //Sunken Sea buff - string key = "Mods.CalamityMod.SteelSkullBossText"; //clone can now be fought - Color messageColor2 = Color.Aquamarine; - Color messageColor = Color.Crimson; - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key2), messageColor2); - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key2), messageColor2); - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - } + { + string key2 = "Mods.CalamityMod.UglyBossText"; //Sunken Sea buff + //string key = "Mods.CalamityMod.SteelSkullBossText"; //clone can now be fought + Color messageColor2 = Color.Aquamarine; + //Color messageColor = Color.Crimson; + if (Main.netMode == NetmodeID.SinglePlayer) + { + Main.NewText(Language.GetTextValue(key2), messageColor2); + // Main.NewText(Language.GetTextValue(key), messageColor); + } + else if (Main.netMode == NetmodeID.Server) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key2), messageColor2); + //NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + } + } } else if (lastTwinStanding) { @@ -380,6 +380,21 @@ namespace CalamityMod.NPCs } } } + //Since Calamity makes it spawn in pre-hardmode, don't want to cause other mods to freak out if they use it as a tier gate (like a new weapon or something) + else if (npc.type == NPCID.GreenJellyfish && !Main.hardMode) + { + DropHelper.DropItem(npc, ItemID.Glowstick, 1, 4); + DropHelper.DropItemChance(npc, ItemID.JellyfishNecklace, 0.1f); + DropHelper.DropItemChance(npc, ItemID.Megaphone, Main.expertMode ? 0.2f : 0.1f); + DropHelper.DropItemCondition(npc, ItemID.JellyfishNecklace, CalamityWorld.defiled, DropHelper.DefiledDropRateFloat); + DropHelper.DropItemCondition(npc, ItemID.Megaphone, CalamityWorld.defiled, DropHelper.DefiledDropRateFloat); + DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 5 : 7); + return false; + } + else if (npc.type == NPCID.VoodooDemon && Main.player[npc.target].Calamity().underworldLore) + { + NPCLoader.blockLoot.Add(ItemID.GuideVoodooDoll); + } return true; } @@ -1417,7 +1432,7 @@ namespace CalamityMod.NPCs break; case NPCID.PinkJellyfish: - DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 5 : 7); + DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 20 : 25); break; case NPCID.BlueJellyfish: @@ -1665,6 +1680,7 @@ namespace CalamityMod.NPCs case NPCID.IcyMerman: case NPCID.IceTortoise: + case NPCID.IceElemental: DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 2 : 3); break; diff --git a/NPCs/Cryogen/Cryogen.cs b/NPCs/Cryogen/Cryogen.cs index f717acd207..6ce5843b65 100644 --- a/NPCs/Cryogen/Cryogen.cs +++ b/NPCs/Cryogen/Cryogen.cs @@ -68,6 +68,7 @@ namespace CalamityMod.NPCs.Cryogen npc.buffImmune[BuffID.DryadsWardDebuff] = false; npc.buffImmune[BuffID.Oiled] = false; npc.buffImmune[BuffID.BoneJavelin] = false; + npc.buffImmune[BuffID.ShadowFlame] = false; npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; diff --git a/NPCs/DevourerofGods/DevourerofGodsHead.cs b/NPCs/DevourerofGods/DevourerofGodsHead.cs index 12dd1004d6..8bbcdf93de 100644 --- a/NPCs/DevourerofGods/DevourerofGodsHead.cs +++ b/NPCs/DevourerofGods/DevourerofGodsHead.cs @@ -846,41 +846,21 @@ namespace CalamityMod.NPCs.DevourerofGods player.KillMe(PlayerDeathReason.ByCustomReason(player.name + "'s essence was consumed by the devourer."), 1000.0, 0, false); } - // TODO: don't talk if the player has iframes - if (player.immuneTime > 0 || player.immune) - return; - - int num = Main.rand.Next(5); - string key = "Mods.CalamityMod.EdgyBossText3"; - if (num == 0) - { - key = "Mods.CalamityMod.EdgyBossText3"; - } - else if (num == 1) - { - key = "Mods.CalamityMod.EdgyBossText4"; - } - else if (num == 2) - { - key = "Mods.CalamityMod.EdgyBossText5"; - } - else if (num == 3) - { - key = "Mods.CalamityMod.EdgyBossText6"; - } - else if (num == 4) - { - key = "Mods.CalamityMod.EdgyBossText7"; - } - Color messageColor = Color.Cyan; - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } + if (player.Calamity().dogTextCooldown <= 0) + { + string text = Utils.SelectRandom(Main.rand, new string[] + { + "Mods.CalamityMod.EdgyBossText3", + "Mods.CalamityMod.EdgyBossText4", + "Mods.CalamityMod.EdgyBossText5", + "Mods.CalamityMod.EdgyBossText6", + "Mods.CalamityMod.EdgyBossText7" + }); + Color messageColor = Color.Cyan; + Rectangle location = new Microsoft.Xna.Framework.Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height); + CombatText.NewText(location, messageColor, Language.GetTextValue(text), true); + player.Calamity().dogTextCooldown = 60; + } } } } diff --git a/NPCs/DevourerofGods/DevourerofGodsHeadS.cs b/NPCs/DevourerofGods/DevourerofGodsHeadS.cs index 610b7e57d5..a16e97dd5d 100644 --- a/NPCs/DevourerofGods/DevourerofGodsHeadS.cs +++ b/NPCs/DevourerofGods/DevourerofGodsHeadS.cs @@ -1192,41 +1192,21 @@ namespace CalamityMod.NPCs.DevourerofGods player.KillMe(PlayerDeathReason.ByCustomReason(player.name + "'s essence was consumed by the devourer."), 1000.0, 0, false); } - // TODO: don't talk if the player has iframes - if (player.immuneTime > 0 || player.immune) - return; - - int num = Main.rand.Next(5); - string key = "Mods.CalamityMod.EdgyBossText3"; - if (num == 0) - { - key = "Mods.CalamityMod.EdgyBossText3"; - } - else if (num == 1) - { - key = "Mods.CalamityMod.EdgyBossText4"; - } - else if (num == 2) - { - key = "Mods.CalamityMod.EdgyBossText5"; - } - else if (num == 3) - { - key = "Mods.CalamityMod.EdgyBossText6"; - } - else if (num == 4) - { - key = "Mods.CalamityMod.EdgyBossText7"; - } - Color messageColor = Color.Cyan; - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } + if (player.Calamity().dogTextCooldown <= 0) + { + string text = Utils.SelectRandom(Main.rand, new string[] + { + "Mods.CalamityMod.EdgyBossText3", + "Mods.CalamityMod.EdgyBossText4", + "Mods.CalamityMod.EdgyBossText5", + "Mods.CalamityMod.EdgyBossText6", + "Mods.CalamityMod.EdgyBossText7" + }); + Color messageColor = Color.Cyan; + Rectangle location = new Microsoft.Xna.Framework.Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height); + CombatText.NewText(location, messageColor, Language.GetTextValue(text), true); + player.Calamity().dogTextCooldown = 60; + } } } } diff --git a/NPCs/DevourerofGods/DevourerofGodsTail.cs b/NPCs/DevourerofGods/DevourerofGodsTail.cs index ddd575f3af..ec3715cd16 100644 --- a/NPCs/DevourerofGods/DevourerofGodsTail.cs +++ b/NPCs/DevourerofGods/DevourerofGodsTail.cs @@ -253,29 +253,18 @@ namespace CalamityMod.NPCs.DevourerofGods player.AddBuff(ModContent.BuffType(), 240, true); player.AddBuff(BuffID.Frostburn, 180, true); - // TODO: don't talk if the player has iframes - if (player.immuneTime > 0 || player.immune) - return; - - int num = Main.rand.Next(2); - string key = "Mods.CalamityMod.EdgyBossText8"; - if (num == 0) - { - key = "Mods.CalamityMod.EdgyBossText8"; - } - else if (num == 1) - { - key = "Mods.CalamityMod.EdgyBossText9"; - } - Color messageColor = Color.Cyan; - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } + if (player.Calamity().dogTextCooldown <= 0) + { + string text = Utils.SelectRandom(Main.rand, new string[] + { + "Mods.CalamityMod.EdgyBossText8", + "Mods.CalamityMod.EdgyBossText9" + }); + Color messageColor = Color.Cyan; + Rectangle location = new Microsoft.Xna.Framework.Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height); + CombatText.NewText(location, messageColor, Language.GetTextValue(text), true); + player.Calamity().dogTextCooldown = 60; + } } } } diff --git a/NPCs/DevourerofGods/DevourerofGodsTailS.cs b/NPCs/DevourerofGods/DevourerofGodsTailS.cs index 7d16ef4faf..7bbc4a6bd5 100644 --- a/NPCs/DevourerofGods/DevourerofGodsTailS.cs +++ b/NPCs/DevourerofGods/DevourerofGodsTailS.cs @@ -333,29 +333,18 @@ namespace CalamityMod.NPCs.DevourerofGods player.AddBuff(ModContent.BuffType(), 240, true); player.AddBuff(BuffID.Frostburn, 180, true); - // TODO: don't talk if the player has iframes - if (player.immune || player.immuneTime > 0) - return; - - int num = Main.rand.Next(2); - string key = "Mods.CalamityMod.EdgyBossText8"; - if (num == 0) - { - key = "Mods.CalamityMod.EdgyBossText8"; - } - else if (num == 1) - { - key = "Mods.CalamityMod.EdgyBossText9"; - } - Color messageColor = Color.Cyan; - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } + if (player.Calamity().dogTextCooldown <= 0) + { + string text = Utils.SelectRandom(Main.rand, new string[] + { + "Mods.CalamityMod.EdgyBossText8", + "Mods.CalamityMod.EdgyBossText9" + }); + Color messageColor = Color.Cyan; + Rectangle location = new Microsoft.Xna.Framework.Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height); + CombatText.NewText(location, messageColor, Language.GetTextValue(text), true); + player.Calamity().dogTextCooldown = 60; + } } } } diff --git a/NPCs/NormalNPCs/PlaguedJungleSlime.cs b/NPCs/NormalNPCs/PlaguedJungleSlime.cs index 916954369d..22513e92ce 100644 --- a/NPCs/NormalNPCs/PlaguedJungleSlime.cs +++ b/NPCs/NormalNPCs/PlaguedJungleSlime.cs @@ -53,7 +53,7 @@ namespace CalamityMod.NPCs.NormalNPCs { spikeTimer -= 1f; } - if (!npc.wet && !Main.player[npc.target].Calamity().royalGel) + if (!npc.wet && !Main.player[npc.target].npcTypeNoAggro[npc.type]) { Vector2 vector3 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); float num14 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector3.X; diff --git a/NPCs/NormalNPCs/SunBat.cs b/NPCs/NormalNPCs/SunBat.cs index 7506a805c1..47fee87ff6 100644 --- a/NPCs/NormalNPCs/SunBat.cs +++ b/NPCs/NormalNPCs/SunBat.cs @@ -23,7 +23,7 @@ namespace CalamityMod.NPCs.NormalNPCs npc.width = 26; npc.height = 20; npc.defense = 10; - npc.lifeMax = 120; + npc.lifeMax = 200; npc.knockBackResist = 0.65f; npc.value = Item.buyPrice(0, 0, 5, 0); npc.HitSound = SoundID.NPCHit1; diff --git a/NPCs/NormalNPCs/SuperDummyNPC.cs b/NPCs/NormalNPCs/SuperDummyNPC.cs index 7cff1f8b9b..034a8ac109 100644 --- a/NPCs/NormalNPCs/SuperDummyNPC.cs +++ b/NPCs/NormalNPCs/SuperDummyNPC.cs @@ -3,45 +3,47 @@ using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.NPCs.NormalNPCs { - public class SuperDummyNPC : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Super Dummy"); - } + public class SuperDummyNPC : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Super Dummy"); + } - public override void SetDefaults() - { - npc.width = 18; - npc.height = 48; - npc.damage = 0; - npc.defense = 0; - npc.lifeMax = 9999999; - npc.HitSound = SoundID.NPCHit15; - npc.DeathSound = SoundID.NPCDeath2; - npc.value = 0f; - npc.knockBackResist = 0f; + public override void SetDefaults() + { + npc.width = 18; + npc.height = 48; + npc.damage = 0; + npc.defense = 0; + npc.lifeMax = 9999999; + npc.HitSound = SoundID.NPCHit15; + npc.DeathSound = SoundID.NPCDeath2; + npc.value = 0f; + npc.knockBackResist = 0f; npc.buffImmune[BuffID.Confused] = false; - } + npc.netAlways = true; + npc.aiStyle = 0; + } - public override void UpdateLifeRegen(ref int damage) - { - npc.lifeRegen += 2000000; - } + public override void UpdateLifeRegen(ref int damage) + { + npc.lifeRegen += 2000000; + } - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } - public override bool CheckDead() - { - if (npc.lifeRegen < 0) - { - npc.life = npc.lifeMax; - return false; - } - return true; - } - } + public override bool CheckDead() + { + if (npc.lifeRegen < 0) + { + npc.life = npc.lifeMax; + return false; + } + return true; + } + } } diff --git a/NPCs/OldDuke/OldDukeSharkron.cs b/NPCs/OldDuke/OldDukeSharkron.cs index 5ce832eb15..4e26e973e4 100644 --- a/NPCs/OldDuke/OldDukeSharkron.cs +++ b/NPCs/OldDuke/OldDukeSharkron.cs @@ -13,6 +13,7 @@ namespace CalamityMod.NPCs.OldDuke { public class OldDukeSharkron : ModNPC { + bool spawnedProjectiles = false; public override void SetStaticDefaults() { DisplayName.SetDefault("Sulphurous Sharkron"); @@ -45,12 +46,14 @@ namespace CalamityMod.NPCs.OldDuke { writer.Write(npc.dontTakeDamage); writer.Write(npc.noGravity); + writer.Write(spawnedProjectiles); } public override void ReceiveExtraAI(BinaryReader reader) { npc.dontTakeDamage = reader.ReadBoolean(); npc.noGravity = reader.ReadBoolean(); + spawnedProjectiles = reader.ReadBoolean(); } public override void AI() @@ -231,8 +234,9 @@ namespace CalamityMod.NPCs.OldDuke Main.dust[num624].velocity.X *= 2f; } - if (Main.netMode != NetmodeID.MultiplayerClient) + if (Main.netMode != NetmodeID.MultiplayerClient && !spawnedProjectiles) { + spawnedProjectiles = true; int spawnX = npc.width / 2; int damage = Main.expertMode ? 55 : 70; for (int i = 0; i < 2; i++) diff --git a/NPCs/OldDuke/OldDukeToothBall.cs b/NPCs/OldDuke/OldDukeToothBall.cs index 5cff54dff9..b5cb511a8f 100644 --- a/NPCs/OldDuke/OldDukeToothBall.cs +++ b/NPCs/OldDuke/OldDukeToothBall.cs @@ -12,6 +12,7 @@ namespace CalamityMod.NPCs.OldDuke { public class OldDukeToothBall : ModNPC { + bool spawnedProjectiles = false; public override void SetStaticDefaults() { DisplayName.SetDefault("Tooth Ball"); @@ -42,11 +43,13 @@ namespace CalamityMod.NPCs.OldDuke public override void SendExtraAI(BinaryWriter writer) { writer.Write(npc.dontTakeDamage); + writer.Write(spawnedProjectiles); } public override void ReceiveExtraAI(BinaryReader reader) { npc.dontTakeDamage = reader.ReadBoolean(); + spawnedProjectiles = reader.ReadBoolean(); } public override void AI() @@ -201,8 +204,9 @@ namespace CalamityMod.NPCs.OldDuke Main.dust[num624].noGravity = true; } - if (Main.netMode != NetmodeID.MultiplayerClient) + if (Main.netMode != NetmodeID.MultiplayerClient && !spawnedProjectiles) { + spawnedProjectiles = true; int totalProjectiles = 4; float radians = MathHelper.TwoPi / totalProjectiles; int damage = Main.expertMode ? 55 : 70; diff --git a/NPCs/SunkenSea/PrismTurtle.cs b/NPCs/SunkenSea/PrismTurtle.cs index 0f1d7f69f8..eb1217ba61 100644 --- a/NPCs/SunkenSea/PrismTurtle.cs +++ b/NPCs/SunkenSea/PrismTurtle.cs @@ -11,8 +11,6 @@ namespace CalamityMod.NPCs.SunkenSea { public class PrismTurtle : ModNPC { - public bool hasBeenHit = false; - public override void SetStaticDefaults() { DisplayName.SetDefault("Prism-Back"); @@ -36,18 +34,17 @@ namespace CalamityMod.NPCs.SunkenSea npc.knockBackResist = 0.15f; banner = npc.type; bannerItem = ModContent.ItemType(); + npc.chaseable = false; } public override void SendExtraAI(BinaryWriter writer) { writer.Write(npc.chaseable); - writer.Write(hasBeenHit); } public override void ReceiveExtraAI(BinaryReader reader) { npc.chaseable = reader.ReadBoolean(); - hasBeenHit = reader.ReadBoolean(); } public override void AI() @@ -123,7 +120,7 @@ namespace CalamityMod.NPCs.SunkenSea { if (projectile.minion && !projectile.Calamity().overridesMinionDamagePrevention) { - return hasBeenHit; + return npc.chaseable; } return null; } diff --git a/NPCs/SupremeCalamitas/SCalWormHeart.cs b/NPCs/SupremeCalamitas/SCalWormHeart.cs index f75e9ef0b0..f9f859796a 100644 --- a/NPCs/SupremeCalamitas/SCalWormHeart.cs +++ b/NPCs/SupremeCalamitas/SCalWormHeart.cs @@ -53,7 +53,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas { if (projectile.type == ModContent.ProjectileType()) { - damage = (int)((double)damage * 0.66); + damage = (int)(damage * 0.66); } } diff --git a/NPCs/TownNPCs/THIEF.cs b/NPCs/TownNPCs/THIEF.cs index e7d0e8556a..f4a75b7319 100644 --- a/NPCs/TownNPCs/THIEF.cs +++ b/NPCs/TownNPCs/THIEF.cs @@ -192,13 +192,13 @@ namespace CalamityMod.NPCs.TownNPCs public string Refund() { int goblinIndex = NPC.FindFirstNPC(NPCID.GoblinTinkerer); - if (goblinIndex != -1 && Main.LocalPlayer.Calamity().reforges >= 10) + if (goblinIndex != -1 && CalamityWorld.Reforges >= 1) { - Main.LocalPlayer.Calamity().reforges = 0; - Main.LocalPlayer.SellItem((int)Main.LocalPlayer.Calamity().moneyStolenByBandit, 1); - Main.LocalPlayer.Calamity().moneyStolenByBandit = 0; + CalamityWorld.Reforges = 0; + Main.LocalPlayer.SellItem(CalamityWorld.MoneyStolenByBandit, 1); + CalamityWorld.MoneyStolenByBandit = 0; NPC goblinFucker = Main.npc[goblinIndex]; - Main.PlaySound(SoundID.Coins, -1, -1, 1, 1f, 0f); //money dink sound + Main.PlaySound(SoundID.Coins, -1, -1, 1, 1f, 0f); // Money dink sound switch (Main.rand.Next(2)) { case 0: @@ -206,8 +206,9 @@ namespace CalamityMod.NPCs.TownNPCs case 1: return "Hey, if government officials can get tax, why can't I? The heck do you mean that these two things are nothing alike?"; } + CalamityMod.UpdateServerBoolean(); } - return "Sorry, I got nothing."; + return "Sorry, I got nothing. Perhaps you could reforge something and come back later..."; } public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) diff --git a/Projectiles/Boss/BrimstoneBarrage.cs b/Projectiles/Boss/BrimstoneBarrage.cs index 2fdcad9788..8bbb9d2785 100644 --- a/Projectiles/Boss/BrimstoneBarrage.cs +++ b/Projectiles/Boss/BrimstoneBarrage.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Projectiles.Boss if (projectile.velocity.Length() < (projectile.ai[1] == 0f ? 14f : 10f)) projectile.velocity *= 1.01f; - projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver2; + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; projectile.frameCounter++; if (projectile.frameCounter > 4) diff --git a/Projectiles/Boss/BrimstoneFireblast.cs b/Projectiles/Boss/BrimstoneFireblast.cs index 04b877bd74..bf53bdbcdb 100644 --- a/Projectiles/Boss/BrimstoneFireblast.cs +++ b/Projectiles/Boss/BrimstoneFireblast.cs @@ -47,7 +47,7 @@ namespace CalamityMod.Projectiles.Boss Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.9f / 255f, 0f, 0f); - projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver2; + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; if (projectile.localAI[0] == 0f) { @@ -55,27 +55,27 @@ namespace CalamityMod.Projectiles.Boss Main.PlaySound(SoundID.Item, (int)projectile.position.X, (int)projectile.position.Y, 20); } - int num103 = Player.FindClosest(projectile.Center, 1, 1); + int target = Player.FindClosest(projectile.Center, 1, 1); projectile.ai[0] += 1f; if (projectile.ai[0] > 20f) { - float scaleFactor2 = projectile.velocity.Length(); - Vector2 vector11 = Main.player[num103].Center - projectile.Center; - vector11.Normalize(); - vector11 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 24f + vector11) / 25f; + float projSpeed = projectile.velocity.Length(); + Vector2 playerVec = Main.player[target].Center - projectile.Center; + playerVec.Normalize(); + playerVec *= projSpeed; + projectile.velocity = (projectile.velocity * 24f + playerVec) / 25f; projectile.velocity.Normalize(); - projectile.velocity *= scaleFactor2; + projectile.velocity *= projSpeed; } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; + Texture2D texture = Main.projectileTexture[projectile.type]; + int frameHeight = texture.Height / Main.projFrames[projectile.type]; + int drawStart = frameHeight * projectile.frame; lightColor.R = (byte)(255 * projectile.Opacity); - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2(texture2D13.Width / 2f, num214 / 2f), projectile.scale, SpriteEffects.None, 0f); + Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, drawStart, texture.Width, frameHeight)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2(texture.Width / 2f, frameHeight / 2f), projectile.scale, SpriteEffects.None, 0f); return false; } @@ -96,14 +96,13 @@ namespace CalamityMod.Projectiles.Boss if (projectile.ai[1] == 0f) { - float spread = 12f * 0.0174f; + float spread = 12f * MathHelper.PiOver2 * 0.01f; double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; double deltaAngle = spread / 30f; double offsetAngle; - int i; if (projectile.owner == Main.myPlayer) { - for (i = 0; i < 30; i++) + for (int i = 0; i < 30; i++) { offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 1f); @@ -112,18 +111,18 @@ namespace CalamityMod.Projectiles.Boss } } - for (int num193 = 0; num193 < 2; num193++) + for (int j = 0; j < 2; j++) { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 50, default, 1f); + Dust.NewDust(projectile.position, projectile.width, projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 50, default, 1f); } - for (int num194 = 0; num194 < 20; num194++) + for (int k = 0; k < 20; k++) { - int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 0, default, 1.5f); - Main.dust[num195].noGravity = true; - Main.dust[num195].velocity *= 3f; - num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 50, default, 1f); - Main.dust[num195].velocity *= 2f; - Main.dust[num195].noGravity = true; + int redFire = Dust.NewDust(projectile.position, projectile.width, projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 0, default, 1.5f); + Main.dust[redFire].noGravity = true; + Main.dust[redFire].velocity *= 3f; + redFire = Dust.NewDust(projectile.position, projectile.width, projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 50, default, 1f); + Main.dust[redFire].velocity *= 2f; + Main.dust[redFire].noGravity = true; } } diff --git a/Projectiles/Boss/BrimstoneGigaBlast.cs b/Projectiles/Boss/BrimstoneGigaBlast.cs index 866d3ab238..4134292304 100644 --- a/Projectiles/Boss/BrimstoneGigaBlast.cs +++ b/Projectiles/Boss/BrimstoneGigaBlast.cs @@ -50,7 +50,7 @@ namespace CalamityMod.Projectiles.Boss else projectile.Opacity = MathHelper.Clamp(1f - ((projectile.timeLeft - 90) / 60f), 0f, 1f); - projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver2; + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; if (projectile.localAI[0] == 0f) { @@ -58,19 +58,19 @@ namespace CalamityMod.Projectiles.Boss Main.PlaySound(SoundID.Item, (int)projectile.position.X, (int)projectile.position.Y, 20); } - float num953 = revenge ? 100f : 80f; //100 - float scaleFactor12 = revenge ? 20f : 15f; //5 - float num954 = 40f; - int num959 = (int)projectile.ai[0]; - if (num959 >= 0 && Main.player[num959].active && !Main.player[num959].dead) + float turnSpeed = revenge ? 100f : 80f; //100 + float homeSpeed = revenge ? 20f : 15f; //5 + float minDist = 40f; + int target = (int)projectile.ai[0]; + if (target >= 0 && Main.player[target].active && !Main.player[target].dead) { - if (projectile.Distance(Main.player[num959].Center) > num954) + if (projectile.Distance(Main.player[target].Center) > minDist) { - Vector2 vector102 = projectile.DirectionTo(Main.player[num959].Center); - if (vector102.HasNaNs()) - vector102 = Vector2.UnitY; + Vector2 targetVec = projectile.DirectionTo(Main.player[target].Center); + if (targetVec.HasNaNs()) + targetVec = Vector2.UnitY; - projectile.velocity = (projectile.velocity * (num953 - 1f) + vector102 * scaleFactor12) / num953; + projectile.velocity = (projectile.velocity * (turnSpeed - 1f) + targetVec * homeSpeed) / turnSpeed; } } else @@ -85,11 +85,11 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; + Texture2D texture = Main.projectileTexture[projectile.type]; + int frameHeight = texture.Height / Main.projFrames[projectile.type]; + int drawStart = frameHeight * projectile.frame; lightColor.R = (byte)(255 * projectile.Opacity); - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2(texture2D13.Width / 2f, num214 / 2f), projectile.scale, SpriteEffects.None, 0f); + Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, drawStart, texture.Width, frameHeight)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2(texture.Width / 2f, frameHeight / 2f), projectile.scale, SpriteEffects.None, 0f); return false; } @@ -110,14 +110,13 @@ namespace CalamityMod.Projectiles.Boss if (projectile.ai[1] == 0f) { - float spread = 45f * 0.0174f; + float spread = 45f * MathHelper.PiOver2 * 0.01f; double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; double deltaAngle = spread / 8f; double offsetAngle; - int i; if (projectile.owner == Main.myPlayer) { - for (i = 0; i < 8; i++) + for (int i = 0; i < 8; i++) { offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 7f), (float)(Math.Cos(offsetAngle) * 7f), ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 1f); @@ -126,15 +125,15 @@ namespace CalamityMod.Projectiles.Boss } } - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 50, default, 1f); - for (int num194 = 0; num194 < 10; num194++) + Dust.NewDust(projectile.position, projectile.width, projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 50, default, 1f); + for (int j = 0; j < 10; j++) { - int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 0, default, 1.5f); - Main.dust[num195].noGravity = true; - Main.dust[num195].velocity *= 3f; - num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 50, default, 1f); - Main.dust[num195].velocity *= 2f; - Main.dust[num195].noGravity = true; + int redFire = Dust.NewDust(projectile.position, projectile.width, projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 0, default, 1.5f); + Main.dust[redFire].noGravity = true; + Main.dust[redFire].velocity *= 3f; + redFire = Dust.NewDust(projectile.position, projectile.width, projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 50, default, 1f); + Main.dust[redFire].velocity *= 2f; + Main.dust[redFire].noGravity = true; } } diff --git a/Projectiles/Boss/BrimstoneHellblast2.cs b/Projectiles/Boss/BrimstoneHellblast2.cs index bb0dc2ae76..be51d96d10 100644 --- a/Projectiles/Boss/BrimstoneHellblast2.cs +++ b/Projectiles/Boss/BrimstoneHellblast2.cs @@ -61,11 +61,11 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { SpriteEffects spriteEffects = projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; + Texture2D texture = Main.projectileTexture[projectile.type]; + int frameHeight = texture.Height / Main.projFrames[projectile.type]; + int drawStart = frameHeight * projectile.frame; lightColor.R = (byte)(255 * projectile.Opacity); - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2(texture2D13.Width / 2f, num214 / 2f), projectile.scale, spriteEffects, 0f); + Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, drawStart, texture.Width, frameHeight)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2(texture.Width / 2f, frameHeight / 2f), projectile.scale, spriteEffects, 0f); return false; } diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index 1782a8476e..4a4b3c0fbe 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -1015,35 +1015,38 @@ namespace CalamityMod.Projectiles defCrit = modPlayer.critStats[2]; else if (rogue) defCrit = modPlayer.critStats[3]; - else if (projectile.minion || projectile.sentry || CalamityMod.projectileMinionList.Contains(projectile.type) || ProjectileID.Sets.MinionShot[projectile.type] || ProjectileID.Sets.SentryShot[projectile.type]) + else if (projectile.IsSummon()) defCrit = 4; } - int x = (int)(projectile.Center.X / 16f); - int y = (int)(projectile.Center.Y / 16f); - for (int i = x - 1; i <= x + 1; i++) - { - for (int j = y - 1; j <= y + 1; j++) - { - if (projectile.type == ProjectileID.PureSpray || projectile.type == ProjectileID.PurificationPowder) - { - WorldGenerationMethods.ConvertFromAstral(i, j, ConvertType.Pure); - } - //commented out for Terraria 1.4 when vile/vicious powder spread corruption/crimson - if (projectile.type == ProjectileID.CorruptSpray)// || projectile.type == ProjectileID.VilePowder) - { - WorldGenerationMethods.ConvertFromAstral(i, j, ConvertType.Corrupt); - } - if (projectile.type == ProjectileID.CrimsonSpray)// || projectile.type == ProjectileID.ViciousPowder) - { - WorldGenerationMethods.ConvertFromAstral(i, j, ConvertType.Crimson); - } - if (projectile.type == ProjectileID.HallowSpray) - { - WorldGenerationMethods.ConvertFromAstral(i, j, ConvertType.Hallow); - } - } - } + if (projectile.owner == Main.myPlayer/* && Main.netMode != NetmodeID.MultiplayerClient*/) + { + int x = (int)(projectile.Center.X / 16f); + int y = (int)(projectile.Center.Y / 16f); + for (int i = x - 1; i <= x + 1; i++) + { + for (int j = y - 1; j <= y + 1; j++) + { + if (projectile.type == ProjectileID.PureSpray || projectile.type == ProjectileID.PurificationPowder) + { + WorldGenerationMethods.ConvertFromAstral(i, j, ConvertType.Pure); + } + //commented out for Terraria 1.4 when vile/vicious powder spread corruption/crimson + if (projectile.type == ProjectileID.CorruptSpray)// || projectile.type == ProjectileID.VilePowder) + { + WorldGenerationMethods.ConvertFromAstral(i, j, ConvertType.Corrupt); + } + if (projectile.type == ProjectileID.CrimsonSpray)// || projectile.type == ProjectileID.ViciousPowder) + { + WorldGenerationMethods.ConvertFromAstral(i, j, ConvertType.Crimson); + } + if (projectile.type == ProjectileID.HallowSpray) + { + WorldGenerationMethods.ConvertFromAstral(i, j, ConvertType.Hallow); + } + } + } + } } #endregion @@ -1067,6 +1070,10 @@ namespace CalamityMod.Projectiles crit = Main.rand.NextBool(6); } + //Needs to be done in here. If done in the projectile file, it's overridden by the thing above + if (projectile.type == ProjectileType() && projectile.ai[0] == 1f) + crit = true; + if (rogue && stealthStrike && modPlayer.stealthStrikeAlwaysCrits) crit = true; } @@ -1081,7 +1088,7 @@ namespace CalamityMod.Projectiles if (projectile.owner == Main.myPlayer && !projectile.npcProj && !projectile.trap && projectile.friendly) { - if (projectile.type == (ProjectileID.StardustDragon1 | ProjectileID.StardustDragon2 | ProjectileID.StardustDragon3 | ProjectileID.StardustDragon4)) + if (ProjectileID.Sets.StardustDragon[projectile.type]) { target.immune[projectile.owner] = 10; } @@ -1180,8 +1187,10 @@ namespace CalamityMod.Projectiles if (modPlayer.vampiricTalisman && rogue && crit) { float heal = MathHelper.Clamp(damage * 0.015f, 0f, 6f); - Main.player[Main.myPlayer].lifeSteal -= heal * 2f; - Projectile.NewProjectile(target.position.X, target.position.Y, 0f, 0f, ProjectileID.VampireHeal, 0, 0f, projectile.owner, projectile.owner, heal); + if ((int)heal > 0) + { + SpawnLifeStealProjectile(projectile, player, heal, ProjectileID.VampireHeal, 1200f, 2f); + } } if ((modPlayer.bloodyGlove || modPlayer.electricianGlove) && rogue && stealthStrike) @@ -1293,7 +1302,7 @@ namespace CalamityMod.Projectiles OTHEREFFECTS: if (modPlayer.alchFlask && - (projectile.magic || rogue || projectile.melee || projectile.minion || projectile.ranged || projectile.sentry || CalamityMod.projectileMinionList.Contains(projectile.type) || ProjectileID.Sets.MinionShot[projectile.type] || ProjectileID.Sets.SentryShot[projectile.type]) && + (projectile.magic || rogue || projectile.melee || projectile.IsSummon() || projectile.ranged) && player.ownedProjectileCounts[ProjectileType()] < 6) { int plague = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ProjectileType(), CalamityUtils.DamageSoftCap(projectile.damage * 0.25, 30), 0f, projectile.owner, 0f, 0f); @@ -1608,7 +1617,7 @@ namespace CalamityMod.Projectiles } } } - if (projectile.minion || projectile.sentry || CalamityMod.projectileMinionList.Contains(projectile.type) || ProjectileID.Sets.MinionShot[projectile.type] || ProjectileID.Sets.SentryShot[projectile.type]) + if (projectile.IsSummon()) { if (modPlayer.profanedCrystalBuffs || (modPlayer.pArtifact && !modPlayer.profanedCrystal)) { @@ -1766,12 +1775,12 @@ namespace CalamityMod.Projectiles #region Drawing public override Color? GetAlpha(Projectile projectile, Color lightColor) { - if (Main.player[Main.myPlayer].Calamity().omniscience && projectile.hostile) - return Color.Coral; - if (Main.player[Main.myPlayer].Calamity().trippy) return new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, projectile.alpha); + if (Main.player[Main.myPlayer].Calamity().omniscience && projectile.hostile) + return Color.Coral; + if (projectile.type == ProjectileID.PinkLaser) { if (projectile.alpha < 200) @@ -2068,6 +2077,11 @@ namespace CalamityMod.Projectiles } } + if (!projectile.friendly) + { + homeIn = false; + } + if (homeIn) { Vector2 homeInVector = projectile.DirectionTo(center); @@ -2135,7 +2149,7 @@ namespace CalamityMod.Projectiles projectile.type == ProjectileType() || projectile.type == ProjectileType() || (projectile.type == ProjectileType() && projectile.melee)) Main.projectile[projectile2].Calamity().forceMelee = true; - if (projectile.type == ProjectileType() && projectile.Calamity().rogue) + else if (projectile.type == ProjectileType() && projectile.Calamity().rogue) Main.projectile[projectile2].Calamity().forceRogue = true; } } diff --git a/Projectiles/Hybrid/PwnagehammerProj.cs b/Projectiles/Hybrid/PwnagehammerProj.cs index 4f9bf797e2..ffe1be0e76 100644 --- a/Projectiles/Hybrid/PwnagehammerProj.cs +++ b/Projectiles/Hybrid/PwnagehammerProj.cs @@ -1,41 +1,211 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Hybrid { - public class PwnagehammerProj : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Hammer"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + public class PwnagehammerProj : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Hammer"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 30; - projectile.height = 30; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.aiStyle = 3; - projectile.timeLeft = 120; - projectile.extraUpdates = 3; - aiType = ProjectileID.PaladinsHammerFriendly; - projectile.melee = true; - } + public override void SetDefaults() + { + projectile.width = projectile.height = 40; + projectile.friendly = true; + projectile.timeLeft = 3600; + projectile.melee = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + } - public override void AI() - { - projectile.velocity.X *= 1.06f; - projectile.velocity.Y *= 1.06f; - } + public override void AI() + { + projectile.direction = projectile.spriteDirection = (projectile.velocity.X > 0f) ? 1 : -1; + projectile.rotation += MathHelper.ToRadians(22.5f) * projectile.direction; - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } - } + if (projectile.ai[0] == 1f) + { + float distance = 400f; + if (projectile.ai[1] == -1) + { + // used for finding a target + for (int i = 0; i < Main.maxNPCs; i++) + { + NPC npc = Main.npc[i]; + if (npc.CanBeChasedBy(projectile, false)) + { + Vector2 vec = npc.Center - projectile.Center; + float distanceTo = vec.Length(); + distanceTo -= (float)Math.Sqrt(npc.width * npc.width + npc.height * npc.height) * 0.75f; + if (distanceTo < distance && Collision.CanHit(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) + { + projectile.ai[1] = i; + } + } + } + } + else + { + int index = (int)projectile.ai[1]; + float speed = 34f; + float inertia = 15f; + + if (!Main.npc[index].CanBeChasedBy(projectile, false)) + projectile.ai[1] = -1; + + Vector2 direction = Main.npc[index].Center - projectile.Center; + direction.Normalize(); + direction *= speed; + projectile.velocity = (projectile.velocity * (inertia - 1) + direction) / inertia; + } + } + else + { + projectile.velocity.X *= 0.9711f; + projectile.velocity.Y += 0.426f; + } + + if (Main.rand.NextBool(2)) + { + Vector2 offset = new Vector2(12, 0).RotatedByRandom(MathHelper.ToRadians(360f)); + Vector2 velOffset = new Vector2(4, 0).RotatedBy(offset.ToRotation()); + Dust dust = Dust.NewDustPerfect(new Vector2(projectile.Center.X, projectile.Center.Y) + offset, DustID.GoldFlame, new Vector2((projectile.velocity.X * 0.2f) + velOffset.X, (projectile.velocity.Y * 0.2f) + velOffset.Y), 100, new Color(255, 245, 198), 2f); + dust.noGravity = true; + } + + if (Main.rand.NextBool(6)) + { + Vector2 offset = new Vector2(12, 0).RotatedByRandom(MathHelper.ToRadians(360f)); + Vector2 velOffset = new Vector2(4, 0).RotatedBy(offset.ToRotation()); + Dust dust = Dust.NewDustPerfect(new Vector2(projectile.Center.X, projectile.Center.Y) + offset, DustID.GoldFlame, new Vector2((projectile.velocity.X * 0.2f) + velOffset.X, (projectile.velocity.Y * 0.2f) + velOffset.Y), 100, new Color(255, 245, 198), 2f); + dust.noGravity = true; + } + } + + public override void Kill(int timeLeft) + { + Player player = Main.player[projectile.owner]; + if (projectile.ai[0] == 1f) + { + float numberOfDusts = 40f; + float rotFactor = 360f / numberOfDusts; + for (int i = 0; i < numberOfDusts; i++) + { + float rot = MathHelper.ToRadians(i * rotFactor); + Vector2 offset = new Vector2(15f, 0).RotatedBy(rot); + Vector2 velOffset = new Vector2(10f, 0).RotatedBy(rot); + Dust dust = Dust.NewDustPerfect(projectile.position + offset, 269, new Vector2(velOffset.X, velOffset.Y)); + dust.noGravity = true; + dust.velocity = velOffset; + dust.scale = 2.5f; + if ((i % 2) == 0) + { + dust = Dust.NewDustPerfect(projectile.position + offset, 269, new Vector2(velOffset.X, velOffset.Y)); + dust.noGravity = true; + dust.velocity = velOffset * 2f; + dust.scale = 2.5f; + } + if ((i % 4) == 0) + { + dust = Dust.NewDustPerfect(projectile.position + offset, 269, new Vector2(velOffset.X, velOffset.Y)); + dust.noGravity = true; + dust.velocity = velOffset / 2f; + dust.scale = 2.5f; + } + } + + float distance = 240f; + + for (int k = 0; k < Main.maxNPCs; k++) + { + NPC npc = Main.npc[k]; + Vector2 vec = npc.Center - projectile.Center; + float distanceTo = (float)Math.Sqrt(vec.X * vec.X + vec.Y * vec.Y); + distanceTo -= (float)Math.Sqrt(npc.width * npc.width + npc.height * npc.height) * 0.75f; + if (distanceTo < distance && npc.CanBeChasedBy(projectile, false) && k != projectile.localAI[0]) + { + float alldamage = projectile.damage * 1.25f; + double damage = npc.StrikeNPC((int)alldamage, projectile.knockBack, (projectile.velocity.X > 0f) ? 1 : -1); + player.addDPS((int)damage); + } + } + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PwnagehammerHoming").WithVolume(1f), projectile.Center); + Main.PlaySound(SoundID.Item14.WithVolume(.75f), projectile.position); + } + else + { + float numberOfDusts = 32f; + float rotFactor = 360f / numberOfDusts; + for (int i = 0; i < numberOfDusts; i++) + { + float rot = MathHelper.ToRadians(i * rotFactor); + Vector2 offset = new Vector2(15f, 0).RotatedBy(rot); + Vector2 velOffset = new Vector2(12.5f, 0).RotatedBy(rot); + Dust dust = Dust.NewDustPerfect(projectile.position + offset, 269, new Vector2(velOffset.X, velOffset.Y)); + dust.noGravity = true; + dust.velocity = velOffset; + dust.scale = 2.5f; + } + + float distance = 168f; + + for (int k = 0; k < Main.maxNPCs; k++) + { + NPC npc = Main.npc[k]; + Vector2 vec = npc.Center - projectile.Center; + float distanceTo = (float)Math.Sqrt(vec.X * vec.X + vec.Y * vec.Y); + distanceTo -= (float)Math.Sqrt(npc.width * npc.width + npc.height * npc.height) * 0.75f; + if (distanceTo < distance && npc.CanBeChasedBy(projectile, false) && k != projectile.localAI[0]) + { + float alldamage = projectile.damage * 0.75f; + double damage = npc.StrikeNPC((int)alldamage, projectile.knockBack, (projectile.velocity.X > 0f) ? 1 : -1); + player.addDPS((int)damage); + } + } + + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PwnagehammerSound").WithVolume(1f).WithPitchVariance(.08f), projectile.Center); + Main.PlaySound(SoundID.Item14.WithVolume(.60f), projectile.position); + } + } + + public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + if (projectile.ai[0] == 1f && Main.myPlayer == projectile.owner) + { + int hammer = Projectile.NewProjectile(projectile.Center, new Vector2(0, -15f), ModContent.ProjectileType(), projectile.damage * 2, projectile.knockBack, projectile.owner, 0f, projectile.ai[1]); + Main.projectile[hammer].localAI[0] = Math.Sign(projectile.velocity.X); + Main.projectile[hammer].melee = projectile.melee; + Main.projectile[hammer].Calamity().rogue = projectile.Calamity().rogue; + } + } + + public override void ModifyHitPvp(Player target, ref int damage, ref bool crit) + { + if (projectile.ai[0] == 1f && Main.myPlayer == projectile.owner) + { + int hammer = Projectile.NewProjectile(projectile.Center, new Vector2(0, -15f), ModContent.ProjectileType(), projectile.damage * 2, projectile.knockBack, projectile.owner, 0f, projectile.ai[1]); + Main.projectile[hammer].localAI[0] = Math.Sign(projectile.velocity.X); + Main.projectile[hammer].melee = projectile.melee; + Main.projectile[hammer].Calamity().rogue = projectile.Calamity().rogue; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + projectile.localAI[0] = target.whoAmI; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + } } diff --git a/Projectiles/Hybrid/PwnagehammerProjStealthStrike.cs b/Projectiles/Hybrid/PwnagehammerProjStealthStrike.cs new file mode 100644 index 0000000000..c717c1ccd6 --- /dev/null +++ b/Projectiles/Hybrid/PwnagehammerProjStealthStrike.cs @@ -0,0 +1,143 @@ +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Hybrid +{ + public class PwnagehammerProjStealthStrike : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Spectral Hammer"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 7; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } + + public override void SetDefaults() + { + projectile.width = 40; + projectile.height = 40; + projectile.aiStyle = 0; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.usesLocalNPCImmunity = true; + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(255, 248, 124, 255); + } + + public override void AI() + { + projectile.ai[0] += 1f; + if (projectile.ai[0] < 42f) + { + projectile.velocity.Y *= 0.9575f; + projectile.rotation += MathHelper.ToRadians(projectile.ai[0] * 0.5f) * projectile.localAI[0]; + } + else if (projectile.ai[0] < 44f) + { + NPC target = Main.npc[(int)projectile.ai[1]]; + float velConst = 3f; + projectile.velocity = new Vector2((target.Center.X - projectile.Center.X) / velConst, (target.Center.Y - projectile.Center.Y) / velConst); + projectile.rotation += MathHelper.ToRadians(48f) * projectile.localAI[0]; + } + + if (Main.rand.NextBool(2)) + { + Vector2 offset = new Vector2(7, 0).RotatedByRandom(MathHelper.ToRadians(360f)); + Vector2 velOffset = new Vector2(3, 0).RotatedBy(offset.ToRotation()); + Dust dust = Dust.NewDustPerfect(new Vector2(projectile.position.X, projectile.position.Y) + offset, DustID.GoldFlame, new Vector2((projectile.velocity.X * 0.2f) + velOffset.X, (projectile.velocity.Y * 0.2f) + velOffset.Y), 100, new Color(255, 245, 198), 2f); + dust.noGravity = true; + } + + if (Main.rand.NextBool(6)) + { + Vector2 offset = new Vector2(7, 0).RotatedByRandom(MathHelper.ToRadians(360f)); + Vector2 velOffset = new Vector2(3, 0).RotatedBy(offset.ToRotation()); + Dust dust = Dust.NewDustPerfect(new Vector2(projectile.position.X, projectile.position.Y) + offset, DustID.GoldFlame, new Vector2((projectile.velocity.X * 0.2f) + velOffset.X, (projectile.velocity.Y * 0.2f) + velOffset.Y), 100, new Color(255, 245, 198), 2f); + dust.noGravity = true; + } + } + + public override bool? CanHitNPC(NPC target) + { + if (projectile.ai[0] <= 42f) + { + return false; + } + return null; + } + + public override bool CanHitPvp(Player target) + { + return projectile.ai[0] > 42f; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + projectile.localAI[0] = target.whoAmI; + } + + public override bool PreKill(int timeLeft) + { + Player player = Main.player[projectile.owner]; + + float numberOfDusts = 32f; + float rotFactor = 360f / numberOfDusts; + for (int i = 0; i < numberOfDusts; i++) + { + float rot = MathHelper.ToRadians(i * rotFactor); + Vector2 offset = new Vector2(15f, 0).RotatedBy(rot); + Vector2 velOffset = new Vector2(12.5f, 0).RotatedBy(rot); + int dust = Dust.NewDust(projectile.position + offset, projectile.width, projectile.height, 269, velOffset.X, velOffset.Y); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity = velOffset; + Main.dust[dust].scale = 2.5f; + } + + float distance = 168f; + + for (int k = 0; k < Main.maxNPCs; k++) + { + NPC npc = Main.npc[k]; + Vector2 vec = npc.Center - projectile.Center; + float distanceTo = (float)Math.Sqrt(vec.X * vec.X + vec.Y * vec.Y); + if (distanceTo < distance && npc.CanBeChasedBy(projectile, false) && k != projectile.localAI[0]) + { + float alldamage = projectile.damage * 0.5f; + double damage = npc.StrikeNPC((int)alldamage, projectile.knockBack, projectile.velocity.X > 0f ? 1 : -1, true); + player.addDPS((int)damage); + } + } + return false; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; + if (projectile.spriteDirection == -1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Texture2D texture = Main.projectileTexture[projectile.type]; + Rectangle sourceRectangle = new Rectangle(0, 0, texture.Width, texture.Height); + Vector2 origin = sourceRectangle.Size() / 2f; + + for (int i = 0; i < projectile.oldPos.Length; i++) + { + float rot = MathHelper.ToRadians(22.5f) * Math.Sign(projectile.velocity.X); + Vector2 drawPos = projectile.oldPos[i] - Main.screenPosition + origin + new Vector2(0f, projectile.gfxOffY); + Color color = projectile.GetAlpha(lightColor) * ((float)(projectile.oldPos.Length - i) / (float)projectile.oldPos.Length); + spriteBatch.Draw(texture, drawPos, new Rectangle?(), color, projectile.rotation - (i * rot), origin, projectile.scale, spriteEffects, 0f); + } + return false; + } + } +} \ No newline at end of file diff --git a/Projectiles/Hybrid/PwnagehammerProjStealthStrike.png b/Projectiles/Hybrid/PwnagehammerProjStealthStrike.png new file mode 100644 index 0000000000..705864283e Binary files /dev/null and b/Projectiles/Hybrid/PwnagehammerProjStealthStrike.png differ diff --git a/Projectiles/Magic/Climax2.cs b/Projectiles/Magic/Climax2.cs index 721d7ddd32..52e15ca516 100644 --- a/Projectiles/Magic/Climax2.cs +++ b/Projectiles/Magic/Climax2.cs @@ -77,5 +77,7 @@ namespace CalamityMod.Projectiles.Magic Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); return false; } + + public override bool CanDamage() => false; } } diff --git a/Projectiles/Magic/ClimaxProj.cs b/Projectiles/Magic/ClimaxProj.cs index 24c196528a..4260c256a8 100644 --- a/Projectiles/Magic/ClimaxProj.cs +++ b/Projectiles/Magic/ClimaxProj.cs @@ -49,7 +49,8 @@ namespace CalamityMod.Projectiles.Magic } } - CalamityGlobalProjectile.MagnetSphereHitscan(projectile, 400f, 8f, 4f, 5, ModContent.ProjectileType()); + if (projectile.timeLeft % 2 == projectile.ai[0]) + CalamityGlobalProjectile.MagnetSphereHitscan(projectile, 400f, 8f, 4f, 5, ModContent.ProjectileType()); } public override Color? GetAlpha(Color lightColor) @@ -70,5 +71,7 @@ namespace CalamityMod.Projectiles.Magic Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); return false; } + + public override bool CanDamage() => false; } } diff --git a/Projectiles/Magic/EnormousConsumingVortex.cs b/Projectiles/Magic/EnormousConsumingVortex.cs index 12665a5124..6abcb381e3 100644 --- a/Projectiles/Magic/EnormousConsumingVortex.cs +++ b/Projectiles/Magic/EnormousConsumingVortex.cs @@ -71,7 +71,7 @@ namespace CalamityMod.Projectiles.Magic if (Time < 300) { TargetingMovement(); - if (Time % TentacleSpawnRate == TentacleSpawnRate - 1 && Main.netMode != NetmodeID.MultiplayerClient) + if (Time % TentacleSpawnRate == TentacleSpawnRate - 1 && Main.myPlayer == projectile.owner) { ProduceSubsumingHentai(); } @@ -110,7 +110,7 @@ namespace CalamityMod.Projectiles.Magic public void TargetingMovement() { - NPC potentialTarget = projectile.Center.ClosestNPCAt(1500f, true); + NPC potentialTarget = projectile.Center.ClosestNPCAt(1500f, true, true); if (potentialTarget != null) { projectile.velocity = (projectile.velocity * 5f + projectile.DirectionTo(potentialTarget.Center) * 7f) / 6f; @@ -151,9 +151,9 @@ namespace CalamityMod.Projectiles.Magic dust.noGravity = true; } } - if (Main.netMode != NetmodeID.MultiplayerClient) + if (Main.myPlayer == projectile.owner) { - NPC closestTarget = projectile.Center.ClosestNPCAt(1600f, true); + NPC closestTarget = projectile.Center.ClosestNPCAt(1600f, true, true); for (int i = 0; i < 12; i++) { float rotation = Main.rand.NextFloat(MathHelper.TwoPi); diff --git a/Projectiles/Magic/EternityBook.cs b/Projectiles/Magic/EternityBook.cs index d1ded915c0..571189b2b5 100644 --- a/Projectiles/Magic/EternityBook.cs +++ b/Projectiles/Magic/EternityBook.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Projectiles.Magic projectile.ai[0]++; if (projectile.ai[0] == 1f) { - NPC target = projectile.Center.ClosestNPCAt(4400f, true); + NPC target = Main.MouseWorld.ClosestNPCAt(4400f, true, true); if (target != null) { diff --git a/Projectiles/Magic/EternityHex.cs b/Projectiles/Magic/EternityHex.cs index 63e7f91b3d..fc60339ed0 100644 --- a/Projectiles/Magic/EternityHex.cs +++ b/Projectiles/Magic/EternityHex.cs @@ -40,7 +40,7 @@ namespace CalamityMod.Projectiles.Magic if (!target.active) { - NPC potentialNPC = projectile.Center.ClosestNPCAt(4400f, true); + NPC potentialNPC = projectile.Center.ClosestNPCAt(4400f, true, true); if (potentialNPC != null) { projectile.ai[0] = potentialNPC.whoAmI; diff --git a/Projectiles/Magic/EventHorizonBlackhole.cs b/Projectiles/Magic/EventHorizonBlackhole.cs index 1aa100d4de..75c6ed0500 100644 --- a/Projectiles/Magic/EventHorizonBlackhole.cs +++ b/Projectiles/Magic/EventHorizonBlackhole.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Magic projectile.magic = true; projectile.tileCollide = false; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 5; + projectile.localNPCHitCooldown = 8; } public override void AI() @@ -45,7 +45,7 @@ namespace CalamityMod.Projectiles.Magic } else { - if (projectile.frame == 0 || projectile.frame == 1 || projectile.frame == 2 || projectile.frame == 3) + if (projectile.frame < 4) projectile.frame = 4; if (projectile.frame >= 8) projectile.frame = 4; diff --git a/Projectiles/Magic/EventHorizonStar.cs b/Projectiles/Magic/EventHorizonStar.cs index 45a8c88f6d..1b6fa190c2 100644 --- a/Projectiles/Magic/EventHorizonStar.cs +++ b/Projectiles/Magic/EventHorizonStar.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Projectiles.Magic projectile.penetrate = 1; projectile.magic = true; projectile.tileCollide = false; - projectile.timeLeft = 600; + projectile.timeLeft = 300; projectile.alpha = 180; } @@ -124,7 +124,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(BuffID.Daybreak, 300); - Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(projectile.damage * 0.5f), projectile.knockBack * 0.5f, projectile.owner, 0f, 0f); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/Magic/FabRay.cs b/Projectiles/Magic/FabRay.cs index 0e52433323..4fab9f0e9d 100644 --- a/Projectiles/Magic/FabRay.cs +++ b/Projectiles/Magic/FabRay.cs @@ -25,27 +25,22 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - projectile.localAI[1] += 1f; - if (projectile.localAI[1] >= 6f && projectile.owner == Main.myPlayer) + Lighting.AddLight(projectile.Center, 0.2f, 0.01f, 0.1f); + projectile.ai[0] += 1f; + if (projectile.ai[0] % 6f == 0f && projectile.owner == Main.myPlayer) { - projectile.localAI[1] = 0f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 16f) + if (projectile.ai[0] > 16f && projectile.ai[0] % 2f == 0f) { - for (int num447 = 0; num447 < 2; num447++) - { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * (num447 * 0.25f); - int num448 = Dust.NewDust(vector33, 1, 1, 234, 0f, 0f, 0, default, 1f); - Main.dust[num448].noGravity = true; - Main.dust[num448].noLight = true; - Main.dust[num448].position = vector33; - Main.dust[num448].scale = Main.rand.Next(70, 110) * 0.013f; - Main.dust[num448].velocity *= 0.1f; - } + Vector2 source = projectile.position; + int pink = Dust.NewDust(source, 1, 1, 234, 0f, 0f, 0, default, 1.25f); + Main.dust[pink].noGravity = true; + Main.dust[pink].noLight = true; + Main.dust[pink].position = source; + Main.dust[pink].scale = (float)Main.rand.Next(70, 110) * 0.013f; + Main.dust[pink].velocity *= 0.1f; } } @@ -58,7 +53,6 @@ namespace CalamityMod.Projectiles.Magic } else { - projectile.ai[0] += 0.1f; if (projectile.velocity.X != oldVelocity.X) { projectile.velocity.X = -oldVelocity.X; diff --git a/Projectiles/Magic/GranitePulse.cs b/Projectiles/Magic/GranitePulse.cs index 7aaecbf6db..c085cb6789 100644 --- a/Projectiles/Magic/GranitePulse.cs +++ b/Projectiles/Magic/GranitePulse.cs @@ -168,5 +168,7 @@ namespace CalamityMod.Projectiles.Magic Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, frameHeight, texture.Width, height)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture.Width / 2f, (float)height / 2f), projectile.scale, spriteEffects, 0f); return false; } + + public override bool CanDamage() => false; } } diff --git a/Projectiles/Magic/InfernalBlade.cs b/Projectiles/Magic/InfernalBlade.cs index a7fd668903..ae4b69cf78 100644 --- a/Projectiles/Magic/InfernalBlade.cs +++ b/Projectiles/Magic/InfernalBlade.cs @@ -119,35 +119,18 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - float xPos = projectile.ai[0] > 0 ? projectile.position.X + 800 : projectile.position.X - 800; - Vector2 vector2 = new Vector2(xPos, projectile.position.Y + Main.rand.Next(-800, 801)); - - float num80 = xPos; - float speedX = (float)target.position.X - vector2.X; - float speedY = (float)target.position.Y - vector2.Y; - float dir = (float)Math.Sqrt((double)(speedX * speedX + speedY * speedY)); - dir = 10 / num80; - speedX *= dir * 150; - speedY *= dir * 150; - if (speedX > 15f) - { - speedX = 15f; - } - if (speedX < -15f) - { - speedX = -15f; - } - if (speedY > 15f) - { - speedY = 15f; - } - if (speedY < -15f) - { - speedY = -15f; - } + float xPos = projectile.Center.X + 800 * Main.rand.NextBool(2).ToDirectionInt(); + float yPos = projectile.Center.Y + Main.rand.Next(-800, 801); + Vector2 spawnPosition = new Vector2(xPos, yPos); + Vector2 velocity = target.Center - spawnPosition; + float dir = 10 / spawnPosition.X; + velocity.X *= dir * 150; + velocity.Y *= dir * 150; + velocity.X = MathHelper.Clamp(velocity.X, -15f, 15f); + velocity.Y = MathHelper.Clamp(velocity.Y, -15f, 15f); if (projectile.owner == Main.myPlayer) { - Projectile.NewProjectile(vector2.X, vector2.Y, speedX, speedY, ModContent.ProjectileType(), (int)((double)projectile.damage * 0.75), 1f, projectile.owner); + Projectile.NewProjectile(spawnPosition, velocity, ModContent.ProjectileType(), (int)((double)projectile.damage * 0.75), 1f, projectile.owner); } target.AddBuff(ModContent.BuffType(), 240); } diff --git a/Projectiles/Magic/LiquidBlade.cs b/Projectiles/Magic/LiquidBlade.cs index 46aeaeea72..7ff3f82483 100644 --- a/Projectiles/Magic/LiquidBlade.cs +++ b/Projectiles/Magic/LiquidBlade.cs @@ -120,34 +120,18 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - float xPos = projectile.ai[0] > 0 ? projectile.position.X + 800 : projectile.position.X - 800; - Vector2 vector2 = new Vector2(xPos, projectile.position.Y + Main.rand.Next(-800, 801)); - float num80 = xPos; - float speedX = (float)target.position.X - vector2.X; - float speedY = (float)target.position.Y - vector2.Y; - float dir = (float)Math.Sqrt((double)(speedX * speedX + speedY * speedY)); - dir = 10 / num80; - speedX *= dir * 150; - speedY *= dir * 150; - if (speedX > 15f) - { - speedX = 15f; - } - if (speedX < -15f) - { - speedX = -15f; - } - if (speedY > 15f) - { - speedY = 15f; - } - if (speedY < -15f) - { - speedY = -15f; - } + float xPos = projectile.Center.X + 800 * Main.rand.NextBool(2).ToDirectionInt(); + float yPos = projectile.Center.Y + Main.rand.Next(-800, 801); + Vector2 spawnPosition = new Vector2(xPos, yPos); + Vector2 velocity = target.Center - spawnPosition; + float dir = 10 / spawnPosition.X; + velocity.X *= dir * 150; + velocity.Y *= dir * 150; + velocity.X = MathHelper.Clamp(velocity.X, -15f, 15f); + velocity.Y = MathHelper.Clamp(velocity.Y, -15f, 15f); if (projectile.owner == Main.myPlayer) { - Projectile.NewProjectile(vector2.X, vector2.Y, speedX, speedY, ModContent.ProjectileType(), (int)(projectile.damage * 0.75), 1f, projectile.owner); + Projectile.NewProjectile(spawnPosition, velocity, ModContent.ProjectileType(), (int)(projectile.damage * 0.75), 1f, projectile.owner); } target.AddBuff(BuffID.Ichor, 240); target.AddBuff(BuffID.Frostburn, 240); diff --git a/Projectiles/Magic/MagneticOrb.cs b/Projectiles/Magic/MagneticOrb.cs index 799b640ce6..6d34c01a26 100644 --- a/Projectiles/Magic/MagneticOrb.cs +++ b/Projectiles/Magic/MagneticOrb.cs @@ -70,5 +70,7 @@ namespace CalamityMod.Projectiles.Magic Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); return false; } + + public override bool CanDamage() => false; } } diff --git a/Projectiles/Magic/SubsumingTentacle.cs b/Projectiles/Magic/SubsumingTentacle.cs index bf66907557..e6ab77c645 100644 --- a/Projectiles/Magic/SubsumingTentacle.cs +++ b/Projectiles/Magic/SubsumingTentacle.cs @@ -70,7 +70,7 @@ namespace CalamityMod.Projectiles.Magic projectile.tileCollide = false; } - NPC closestTarget = projectile.Center.ClosestNPCAt(MaxEnemyDistance, true); + NPC closestTarget = projectile.Center.ClosestNPCAt(MaxEnemyDistance, true, true); if (closestTarget != null) { HomingMovement(closestTarget); diff --git a/Projectiles/Magic/Vehemence.cs b/Projectiles/Magic/Vehemence.cs index 228160bdac..0f9f39ab4b 100644 --- a/Projectiles/Magic/Vehemence.cs +++ b/Projectiles/Magic/Vehemence.cs @@ -30,11 +30,11 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; Lighting.AddLight(projectile.Center, 0.45f, 0f, 0.45f); for (int num457 = 0; num457 < 2; num457++) { - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 65, 0f, 0f, 100, default, 2f); + int num458 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 65, 0f, 0f, 100, default, 2f); Main.dust[num458].noGravity = true; Main.dust[num458].velocity *= 0.15f; Main.dust[num458].velocity += projectile.velocity * 0.1f; @@ -46,7 +46,7 @@ namespace CalamityMod.Projectiles.Magic Main.PlaySound(SoundID.Item74, projectile.position); for (int j = 0; j <= 25; j++) { - int num459 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 65, 0f, 0f, 100, default, 1f); + int num459 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 65, 0f, 0f, 100, default, 1f); Main.dust[num459].noGravity = true; Main.dust[num459].velocity *= 0.1f; } diff --git a/Projectiles/Magic/VenusianFlame.cs b/Projectiles/Magic/VenusianFlame.cs index 66ea6493c3..e7b70c8a49 100644 --- a/Projectiles/Magic/VenusianFlame.cs +++ b/Projectiles/Magic/VenusianFlame.cs @@ -9,6 +9,8 @@ namespace CalamityMod.Projectiles.Magic { public class VenusianFlame : ModProjectile { + private bool initialized = false; + public override void SetStaticDefaults() { DisplayName.SetDefault("Venusian Cinder"); @@ -31,6 +33,23 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { + //Rotation + if (projectile.ai[1] > 0f) + { + projectile.rotation = -projectile.velocity.X * 0.05f + MathHelper.PiOver2; + } + else + { + projectile.rotation = projectile.velocity.ToRotation(); + } + projectile.ai[1]--; + + //frames + if (!initialized) + { + initialized = true; + projectile.frame = Main.rand.Next(Main.projFrames[projectile.type]); + } projectile.frameCounter++; if (projectile.frameCounter > 4) { @@ -41,6 +60,8 @@ namespace CalamityMod.Projectiles.Magic { projectile.frame = 0; } + + //movement if (projectile.velocity.X != projectile.velocity.X) { projectile.velocity.X *= -0.1f; @@ -68,13 +89,25 @@ namespace CalamityMod.Projectiles.Magic } projectile.velocity.Y += 0.2f; } - projectile.rotation += projectile.velocity.X * 0.1f; - if (projectile.ai[1] == 0f && projectile.type >= 326 && projectile.type <= 328) + if (projectile.velocity.Y < 0.25f && projectile.velocity.Y > 0.15f) { - projectile.ai[1] = 1f; - Main.PlaySound(SoundID.Item13, projectile.position); + projectile.velocity.X *= 0.8f; } - if (Main.rand.NextBool(2)) + if (projectile.velocity.Y > 16f) + { + projectile.velocity.Y = 16f; + } + if (projectile.velocity.Y < 0.25f && projectile.velocity.Y > 0.15f) + { + projectile.velocity.X *= 0.8f; + } + if (projectile.velocity.Y > 16f) + { + projectile.velocity.Y = 16f; + } + + //Dust + if (Main.rand.NextBool(4)) { int num199 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 55, 0f, 0f, 100, default, 1f); Dust dust = Main.dust[num199]; @@ -84,7 +117,7 @@ namespace CalamityMod.Projectiles.Magic dust.noGravity = true; dust.velocity.Y -= 2f; } - if (Main.rand.NextBool(3)) + if (Main.rand.NextBool(10)) { int num200 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 55, 0f, 0f, 100, default, 1f); Dust dust2 = Main.dust[num200]; @@ -94,15 +127,6 @@ namespace CalamityMod.Projectiles.Magic dust2.noGravity = true; dust2.velocity *= 0.1f; } - if (projectile.velocity.Y < 0.25f && projectile.velocity.Y > 0.15f) - { - projectile.velocity.X *= 0.8f; - } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); - if (projectile.velocity.Y > 16f) - { - projectile.velocity.Y = 16f; - } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) @@ -110,7 +134,11 @@ namespace CalamityMod.Projectiles.Magic target.AddBuff(BuffID.OnFire, 300); } - public override bool OnTileCollide(Vector2 oldVelocity) => false; + public override bool OnTileCollide(Vector2 oldVelocity) + { + projectile.ai[1] = 10f; + return false; + } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { diff --git a/Projectiles/Magic/Vortex.cs b/Projectiles/Magic/Vortex.cs index 86462050c7..390bd05184 100644 --- a/Projectiles/Magic/Vortex.cs +++ b/Projectiles/Magic/Vortex.cs @@ -80,7 +80,7 @@ namespace CalamityMod.Projectiles.Magic // Attempt to find a target if the projectile has none. if (TargetIndex == -1 && TargetCheckCooldown <= 0f) { - NPC potentialTarget = projectile.Center.ClosestNPCAt(targetCheckDistance, true); + NPC potentialTarget = projectile.Center.ClosestNPCAt(targetCheckDistance, true, true); if (potentialTarget != null) TargetIndex = potentialTarget.whoAmI; projectile.netUpdate = true; @@ -111,7 +111,7 @@ namespace CalamityMod.Projectiles.Magic int dustCount = 5; for (int i = 0; i < dustCount; i++) { - Vector2 spawnPosition = projectile.Center + projectile.Size.RotatedBy(i / (float)dustCount * MathHelper.TwoPi) * 0.5f; + Vector2 spawnPosition = projectile.Center + projectile.Size.RotatedBy(i / (float)dustCount * MathHelper.TwoPi) * 0.333f; Vector2 velocity = Main.rand.NextFloat(MathHelper.TwoPi).ToRotationVector2() * Main.rand.NextFloat(6f, 16f); Dust dust = Dust.NewDustPerfect(spawnPosition, 66, velocity, 0, Main.DiscoColor, 0.7f); dust.noGravity = true; diff --git a/Projectiles/Melee/AmidiasWhirlpool.cs b/Projectiles/Melee/AmidiasWhirlpool.cs index 87f4500b25..6dc23c828d 100644 --- a/Projectiles/Melee/AmidiasWhirlpool.cs +++ b/Projectiles/Melee/AmidiasWhirlpool.cs @@ -86,6 +86,7 @@ namespace CalamityMod.Projectiles.Melee vector145 = center13; flag59 = true; num1016 = num1017; + break; } } num3 = num1017; diff --git a/Projectiles/Melee/DepthOrb.cs b/Projectiles/Melee/DepthOrb.cs index 55372a55a9..820ef425cf 100644 --- a/Projectiles/Melee/DepthOrb.cs +++ b/Projectiles/Melee/DepthOrb.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { Lighting.AddLight(projectile.Center, 0f, 0f, 0.5f); - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default, 0.6f); + int num458 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 33, 0f, 0f, 100, default, 0.6f); Main.dust[num458].noGravity = true; Main.dust[num458].velocity *= 0.5f; Main.dust[num458].velocity += projectile.velocity * 0.1f; @@ -66,7 +66,7 @@ namespace CalamityMod.Projectiles.Melee num466 = num465 / num466; num463 *= num466; num464 *= num466; - int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default, 1.2f); + int num467 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 33, 0f, 0f, 100, default, 1.2f); Dust dust = Main.dust[num467]; dust.noGravity = true; dust.position.X = projectile.Center.X; @@ -85,7 +85,8 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(ModContent.BuffType(), 300); + if (Main.rand.NextBool(2)) + target.AddBuff(ModContent.BuffType(), 180); } } } diff --git a/Projectiles/Melee/DepthOrb2.cs b/Projectiles/Melee/DepthOrb2.cs index 330c767bd4..856ff6d7e7 100644 --- a/Projectiles/Melee/DepthOrb2.cs +++ b/Projectiles/Melee/DepthOrb2.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Projectiles.Melee { Lighting.AddLight(projectile.Center, 0f, 0f, 0.5f); - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default, 0.4f); + int num458 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 33, 0f, 0f, 100, default, 0.4f); Main.dust[num458].noGravity = true; Main.dust[num458].velocity *= 0.5f; Main.dust[num458].velocity += projectile.velocity * 0.1f; @@ -70,7 +70,7 @@ namespace CalamityMod.Projectiles.Melee num466 = num465 / num466; num463 *= num466; num464 *= num466; - int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default, 1.2f); + int num467 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 33, 0f, 0f, 100, default, 1.2f); Dust dust = Main.dust[num467]; dust.noGravity = true; dust.position.X = projectile.Center.X; diff --git a/Projectiles/Melee/ElementBallShiv.cs b/Projectiles/Melee/ElementBallShiv.cs index a3ebd7e5db..687772a7b8 100644 --- a/Projectiles/Melee/ElementBallShiv.cs +++ b/Projectiles/Melee/ElementBallShiv.cs @@ -55,22 +55,22 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - float xPos = projectile.ai[0] > 0 ? projectile.position.X + 800 : projectile.position.X - 800; - Vector2 vector2 = new Vector2(xPos, projectile.position.Y + Main.rand.Next(-800, 801)); - - float num80 = xPos; - float speedX = (float)target.position.X - vector2.X; - float speedY = (float)target.position.Y - vector2.Y; - float dir = (float)Math.Sqrt((double)(speedX * speedX + speedY * speedY)); - dir = 10 / num80; - float random = (float)Main.rand.Next(1, 150); if (projectile.owner == Main.myPlayer) { for (int i = 0; i < 4; i++) { - speedX *= dir * random; - speedY *= dir * random; - Projectile.NewProjectile(vector2.X, vector2.Y, speedX, speedY, ModContent.ProjectileType(), projectile.damage, 1f, projectile.owner); + float xPos = i < 2 ? projectile.Center.X + 800 : projectile.Center.X - 800; + Vector2 source = new Vector2(xPos, projectile.Center.Y + Main.rand.Next(-800, 801)); + + float xStart = xPos; + Vector2 speed = target.Center - source; + float dir = speed.Length(); + dir = 10 / xStart; + float random = (float)Main.rand.Next(1, 150); + + speed.X *= dir * random; + speed.Y *= dir * random; + Projectile.NewProjectile(source, speed, ModContent.ProjectileType(), projectile.damage, 1f, projectile.owner); } } target.AddBuff(ModContent.BuffType(), 120); diff --git a/Projectiles/Melee/HellionSpike.cs b/Projectiles/Melee/HellionSpike.cs index a682079272..2e7c6bc864 100644 --- a/Projectiles/Melee/HellionSpike.cs +++ b/Projectiles/Melee/HellionSpike.cs @@ -59,10 +59,10 @@ namespace CalamityMod.Projectiles.Melee target.AddBuff(BuffID.Venom, 300); if (crit) { - float xPos = projectile.position.X + 800 * Main.rand.NextBool(2).ToDirectionInt(); - float yPos = projectile.position.Y + Main.rand.Next(-800, 801); + float xPos = projectile.Center.X + 800 * Main.rand.NextBool(2).ToDirectionInt(); + float yPos = projectile.Center.Y + Main.rand.Next(-800, 801); Vector2 spawnPosition = new Vector2(xPos, yPos); - Vector2 velocity = target.position - spawnPosition; + Vector2 velocity = target.Center - spawnPosition; float dir = 10 / spawnPosition.X; velocity.X *= dir * 150; velocity.Y *= dir * 150; @@ -70,7 +70,7 @@ namespace CalamityMod.Projectiles.Melee velocity.Y = MathHelper.Clamp(velocity.Y, -15f, 15f); if (projectile.owner == Main.myPlayer) { - int petal = Projectile.NewProjectile(spawnPosition, velocity, ProjectileID.FlowerPetal, (int)(projectile.damage * 0.5), 2f, projectile.owner); + int petal = Projectile.NewProjectile(spawnPosition, velocity, ProjectileID.FlowerPetal, (int)(projectile.damage * 0.5), projectile.knockBack * 0.5f, projectile.owner); Main.projectile[petal].Calamity().forceMelee = true; Main.projectile[petal].localNPCHitCooldown = -1; } diff --git a/Projectiles/Melee/RoxSlam.cs b/Projectiles/Melee/RoxSlam.cs index f2aeb687ed..feecfb4671 100644 --- a/Projectiles/Melee/RoxSlam.cs +++ b/Projectiles/Melee/RoxSlam.cs @@ -1,7 +1,7 @@ using Microsoft.Xna.Framework; using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { @@ -9,8 +9,8 @@ namespace CalamityMod.Projectiles.Melee { public override void SetDefaults() { - projectile.width = 50; - projectile.height = 50; + projectile.width = 10; + projectile.height = 35; projectile.friendly = true; projectile.melee = true; projectile.timeLeft = 400; @@ -33,15 +33,15 @@ namespace CalamityMod.Projectiles.Melee public override bool OnTileCollide(Vector2 oldVelocity) { //This will only happen if the cooldown was full - if (projectile.ai[0] == 1) + if (projectile.ai[0] == 1 && Main.myPlayer == projectile.owner) { - Player player = Main.player[Main.myPlayer]; + Player player = Main.player[projectile.owner]; //Bounce player.velocity.Y = -18f; //reset player fall damage player.fallStart = (int)(player.position.Y / 16f); //Spawns the shockwave - Projectile.NewProjectile(projectile.position.X + 25, projectile.position.Y + 25, 0f, 0f, ModContent.ProjectileType(), 300, 12, projectile.owner); + Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), 300, 12, projectile.owner); Main.PlaySound(SoundID.Item14, projectile.position); projectile.Kill(); //Pretty things @@ -55,9 +55,9 @@ namespace CalamityMod.Projectiles.Melee return false; } //If the cooldown wasnt full, just bounce - else + else if (Main.myPlayer == projectile.owner) { - Player player = Main.player[Main.myPlayer]; + Player player = Main.player[projectile.owner]; player.velocity.Y = -14f; //reset player fall damage player.fallStart = (int)(player.position.Y / 16f); @@ -66,6 +66,7 @@ namespace CalamityMod.Projectiles.Melee return false; } + return false; } } } diff --git a/Projectiles/Melee/Spears/TenebreusTidesProjectile.cs b/Projectiles/Melee/Spears/TenebreusTidesProjectile.cs index 1c64eed847..d228b7851f 100644 --- a/Projectiles/Melee/Spears/TenebreusTidesProjectile.cs +++ b/Projectiles/Melee/Spears/TenebreusTidesProjectile.cs @@ -48,17 +48,17 @@ namespace CalamityMod.Projectiles.Melee.Spears public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(ModContent.BuffType(), 300); - SwordSpam(target, damage, knockback, crit); + SwordSpam(target.Center); } public override void OnHitPvp(Player target, int damage, bool crit) { target.AddBuff(ModContent.BuffType(), 300); - SwordSpamPvp(target, damage, crit); + SwordSpam(target.Center); } // Spawns a storm of water projectiles on-hit. - public void SwordSpam(NPC target, int damage, float knockback, bool crit) + public void SwordSpam(Vector2 targetPos) { int projAmt = 3; for (int i = 0; i < projAmt; ++i) @@ -66,35 +66,8 @@ namespace CalamityMod.Projectiles.Melee.Spears int type = Main.rand.NextBool() ? ModContent.ProjectileType() : ModContent.ProjectileType(); float startOffsetX = Main.rand.NextFloat(1000f, 1400f) * (Main.rand.NextBool() ? -1f : 1f); float startOffsetY = Main.rand.NextFloat(80f, 900f) * (Main.rand.NextBool() ? -1f : 1f); - Vector2 startPos = new Vector2(target.Center.X + startOffsetX, target.Center.Y + startOffsetY); - Vector2 projVel = target.Center - startPos; - - // Add some randomness / inaccuracy to the projectile target location - projVel.X += Main.rand.NextFloat(-5f, 5f); - projVel.Y += Main.rand.NextFloat(-5f, 5f); - float speed = Main.rand.NextFloat(25f, 35f); - float dist = projVel.Length(); - dist = speed / dist; - projVel.X *= dist; - projVel.Y *= dist; - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(startPos, projVel, type, projectile.damage / 2, projectile.knockBack * 0.5f, projectile.owner, 0f, 0f); - } - } - } - - // Spawns a storm of water projectiles on-hit. - public void SwordSpamPvp(Player target, int damage, bool crit) - { - int projAmt = 3; - for (int i = 0; i < projAmt; ++i) - { - int type = Main.rand.NextBool() ? ModContent.ProjectileType() : ModContent.ProjectileType(); - float startOffsetX = Main.rand.NextFloat(1000f, 1400f) * (Main.rand.NextBool() ? -1f : 1f); - float startOffsetY = Main.rand.NextFloat(80f, 900f) * (Main.rand.NextBool() ? -1f : 1f); - Vector2 startPos = new Vector2(target.Center.X + startOffsetX, target.Center.Y + startOffsetY); - Vector2 projVel = target.Center - startPos; + Vector2 startPos = new Vector2(targetPos.X + startOffsetX, targetPos.Y + startOffsetY); + Vector2 projVel = targetPos - startPos; // Add some randomness / inaccuracy to the projectile target location projVel.X += Main.rand.NextFloat(-5f, 5f); diff --git a/Projectiles/Melee/TenebreusTidesWaterProjectile.cs b/Projectiles/Melee/TenebreusTidesWaterProjectile.cs index 11c42e25f4..9860c3de00 100644 --- a/Projectiles/Melee/TenebreusTidesWaterProjectile.cs +++ b/Projectiles/Melee/TenebreusTidesWaterProjectile.cs @@ -29,17 +29,18 @@ namespace CalamityMod.Projectiles.Melee projectile.usesIDStaticNPCImmunity = true; projectile.idStaticNPCHitCooldown = 10; projectile.tileCollide = false; + aiType = ProjectileID.LightBeam; } public override void AI() { Lighting.AddLight((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16, 0f, 0f, (255 - projectile.alpha) * 1f / 255f); - int water = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default, 0.4f); + int water = Dust.NewDust(projectile.position, projectile.width, projectile.height, 33, 0f, 0f, 100, default, 0.4f); Main.dust[water].noGravity = true; Main.dust[water].velocity *= 0.5f; Main.dust[water].velocity += projectile.velocity * 0.1f; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + MathHelper.ToRadians(135f); + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.ToRadians(135f); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) @@ -57,8 +58,8 @@ namespace CalamityMod.Projectiles.Melee Main.PlaySound(SoundID.Item10, projectile.position); projectile.position = projectile.Center; projectile.width = projectile.height = 64; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.position.X -= (float)(projectile.width / 2); + projectile.position.Y -= (float)(projectile.height / 2); for (int dustIndex = 0; dustIndex <= 30; dustIndex++) { Vector2 dustVel = new Vector2(Main.rand.Next(-10, 11), Main.rand.Next(-10, 11)); @@ -67,7 +68,7 @@ namespace CalamityMod.Projectiles.Melee dist = dustSpeed / dist; dustVel.X *= dist; dustVel.Y *= dist; - int water = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default, 1.2f); + int water = Dust.NewDust(projectile.position, projectile.width, projectile.height, 33, 0f, 0f, 100, default, 1.2f); Dust dust = Main.dust[water]; dust.noGravity = true; dust.position.X = projectile.Center.X; @@ -81,17 +82,17 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(ModContent.BuffType(), 240); - SwordSpam(target, damage, knockback, crit); + SwordSpam(target.Center); } public override void OnHitPvp(Player target, int damage, bool crit) { target.AddBuff(ModContent.BuffType(), 240); - SwordSpamPvp(target, damage, crit); + SwordSpam(target.Center); } // Spawns a storm of water projectiles on-hit. - public void SwordSpam(NPC target, int damage, float knockback, bool crit) + public void SwordSpam(Vector2 targetPos) { int projAmt = 3; for (int i = 0; i < projAmt; ++i) @@ -99,35 +100,8 @@ namespace CalamityMod.Projectiles.Melee int type = Main.rand.NextBool() ? ModContent.ProjectileType() : ModContent.ProjectileType(); float startOffsetX = Main.rand.NextFloat(1000f, 1400f) * (Main.rand.NextBool() ? -1f : 1f); float startOffsetY = Main.rand.NextFloat(80f, 900f) * (Main.rand.NextBool() ? -1f : 1f); - Vector2 startPos = new Vector2(target.Center.X + startOffsetX, target.Center.Y + startOffsetY); - Vector2 projVel = target.Center - startPos; - - // Add some randomness / inaccuracy to the projectile target location - projVel.X += Main.rand.NextFloat(-5f, 5f); - projVel.Y += Main.rand.NextFloat(-5f, 5f); - float speed = Main.rand.NextFloat(25f, 35f); - float dist = projVel.Length(); - dist = speed / dist; - projVel.X *= dist; - projVel.Y *= dist; - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(startPos, projVel, type, projectile.damage / 2, projectile.knockBack * 0.5f, projectile.owner, 0f, 0f); - } - } - } - - // Spawns a storm of water projectiles on-hit. - public void SwordSpamPvp(Player target, int damage, bool crit) - { - int projAmt = 3; - for (int i = 0; i < projAmt; ++i) - { - int type = Main.rand.NextBool() ? ModContent.ProjectileType() : ModContent.ProjectileType(); - float startOffsetX = Main.rand.NextFloat(1000f, 1400f) * (Main.rand.NextBool() ? -1f : 1f); - float startOffsetY = Main.rand.NextFloat(80f, 900f) * (Main.rand.NextBool() ? -1f : 1f); - Vector2 startPos = new Vector2(target.Center.X + startOffsetX, target.Center.Y + startOffsetY); - Vector2 projVel = target.Center - startPos; + Vector2 startPos = new Vector2(targetPos.X + startOffsetX, targetPos.Y + startOffsetY); + Vector2 projVel = targetPos - startPos; // Add some randomness / inaccuracy to the projectile target location projVel.X += Main.rand.NextFloat(-5f, 5f); diff --git a/Projectiles/Melee/TyphonsGreedBubble.cs b/Projectiles/Melee/TyphonsGreedBubble.cs index 77220055cf..b15fa59403 100644 --- a/Projectiles/Melee/TyphonsGreedBubble.cs +++ b/Projectiles/Melee/TyphonsGreedBubble.cs @@ -39,32 +39,27 @@ namespace CalamityMod.Projectiles.Melee { projectile.frame = 0; } - float num953 = 50f * projectile.ai[1]; //100 - float scaleFactor12 = 10f * projectile.ai[1]; //5 + float inertia = 50f * projectile.ai[1]; //100 + float speed = 10f * projectile.ai[1]; //5 float num954 = 40f; - if ((double)Math.Abs(projectile.velocity.X) > 0.2) + if (Math.Abs(projectile.velocity.X) > 0.2f) { projectile.spriteDirection = -projectile.direction; } - if (projectile.velocity.X < 0f) - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); - } - else - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); - } + projectile.rotation = projectile.velocity.ToRotation(); Lighting.AddLight(projectile.Center, 0f, 0.1f, 0.7f); - if (Main.player[projectile.owner].active && !Main.player[projectile.owner].dead) + + Player player = Main.player[projectile.owner]; + if (player.active && !player.dead) { - if (projectile.Distance(Main.player[projectile.owner].Center) > num954) + if (projectile.Distance(player.Center) > num954) { - Vector2 vector102 = projectile.DirectionTo(Main.player[projectile.owner].Center); + Vector2 vector102 = projectile.DirectionTo(player.Center); if (vector102.HasNaNs()) { vector102 = Vector2.UnitY; } - projectile.velocity = (projectile.velocity * (num953 - 1f) + vector102 * scaleFactor12) / num953; + projectile.velocity = (projectile.velocity * (inertia - 1f) + vector102 * speed) / inertia; } } else @@ -90,7 +85,8 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(ModContent.BuffType(), 180); + if (Main.rand.NextBool(3)) + target.AddBuff(ModContent.BuffType(), 180); } public override void Kill(int timeLeft) @@ -98,18 +94,18 @@ namespace CalamityMod.Projectiles.Melee Main.PlaySound(SoundID.Item21, projectile.position); projectile.position = projectile.Center; projectile.width = projectile.height = 64; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.position.X -= (float)(projectile.width / 2); + projectile.position.Y -= (float)(projectile.height / 2); for (int num193 = 0; num193 < 2; num193++) { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + Dust.NewDust(projectile.position, projectile.width, projectile.height, 33, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); } for (int num194 = 0; num194 < 6; num194++) { - int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 186, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); + int num195 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 186, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); Main.dust[num195].noGravity = true; Main.dust[num195].velocity *= 3f; - num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 186, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + num195 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 186, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); Main.dust[num195].velocity *= 2f; Main.dust[num195].noGravity = true; } @@ -117,6 +113,7 @@ namespace CalamityMod.Projectiles.Melee projectile.penetrate = -1; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 10; + projectile.damage /= 2; projectile.Damage(); } } diff --git a/Projectiles/Melee/TyphonsGreedStaff.cs b/Projectiles/Melee/TyphonsGreedStaff.cs index 7c659b2b56..1ff3b8b1a3 100644 --- a/Projectiles/Melee/TyphonsGreedStaff.cs +++ b/Projectiles/Melee/TyphonsGreedStaff.cs @@ -140,38 +140,21 @@ namespace CalamityMod.Projectiles.Melee player.itemAnimation = 2; player.itemRotation = MathHelper.WrapAngle(projectile.rotation); projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= 12f) + if (projectile.localAI[0] % 12f == 0f) { - projectile.localAI[0] = 0f; - float xPos = Main.rand.NextBool(2) ? projectile.position.X + 800f : projectile.position.X - 800f; - Vector2 vector20 = new Vector2(xPos, projectile.position.Y + (float)Main.rand.Next(-800, 801)); - float num80 = xPos; - float speedX = (float)player.position.X - vector20.X; - float speedY = (float)player.position.Y - vector20.Y; - float dir = (float)Math.Sqrt((double)(speedX * speedX + speedY * speedY)); - dir = 10 / num80; - speedX *= dir * 150; - speedY *= dir * 150; - if (speedX > 15f) - { - speedX = 15f; - } - if (speedX < -15f) - { - speedX = -15f; - } - if (speedY > 15f) - { - speedY = 15f; - } - if (speedY < -15f) - { - speedY = -15f; - } + float xPos = projectile.Center.X + 800 * Main.rand.NextBool(2).ToDirectionInt(); + float yPos = projectile.Center.Y + Main.rand.Next(-800, 801); + Vector2 spawnPosition = new Vector2(xPos, yPos); + Vector2 velocity = player.Center - spawnPosition; + float dir = 10 / spawnPosition.X; + velocity.X *= dir * 150; + velocity.Y *= dir * 150; + velocity.X = MathHelper.Clamp(velocity.X, -15f, 15f); + velocity.Y = MathHelper.Clamp(velocity.Y, -15f, 15f); if (projectile.owner == Main.myPlayer) { float ai1 = Main.rand.NextFloat() + 0.5f; - Projectile.NewProjectile(vector20.X, vector20.Y, speedX, speedY, ModContent.ProjectileType(), projectile.damage, 2f, projectile.owner, 0.0f, ai1); + Projectile.NewProjectile(spawnPosition, velocity, ModContent.ProjectileType(), (int)(projectile.damage * 0.5), projectile.knockBack * 0.5f, projectile.owner, 0f, ai1); } } } diff --git a/Projectiles/Ranged/AMRShot.cs b/Projectiles/Ranged/AMRShot.cs index 08b817254f..c7d8403d73 100644 --- a/Projectiles/Ranged/AMRShot.cs +++ b/Projectiles/Ranged/AMRShot.cs @@ -44,18 +44,17 @@ namespace CalamityMod.Projectiles.Ranged { for (int x = 0; x < 8; x++) { - float xPos = x > 4 ? projectile.position.X + 500 : projectile.position.X - 500; - Vector2 vector2 = new Vector2(xPos, projectile.position.Y + Main.rand.Next(-500, 501)); - float num80 = xPos; - float speedX = (float)target.position.X - vector2.X; - float speedY = (float)target.position.Y - vector2.Y; - float dir = (float)Math.Sqrt((double)(speedX * speedX + speedY * speedY)); - dir = 10 / num80; - speedX *= dir * 150; - speedY *= dir * 150; + float xPos = x > 4 ? projectile.Center.X + 500 : projectile.Center.X - 500; + float yPos = projectile.Center.Y + Main.rand.Next(-500, 501); + Vector2 spawnPosition = new Vector2(xPos, yPos); + Vector2 velocity = target.Center - spawnPosition; + float dir = velocity.Length(); + dir = 10 / spawnPosition.X; + velocity.X *= dir * 150; + velocity.Y *= dir * 150; if (projectile.owner == Main.myPlayer) { - Projectile.NewProjectile(vector2.X, vector2.Y, speedX, speedY, ModContent.ProjectileType(), (int)(projectile.damage * 0.1), 1f, projectile.owner); + Projectile.NewProjectile(spawnPosition, velocity, ModContent.ProjectileType(), (int)(projectile.damage * 0.1), 1f, projectile.owner); } } } diff --git a/Projectiles/Ranged/AstralRound.cs b/Projectiles/Ranged/AstralRound.cs index 919fdbb32d..a43f9b7e03 100644 --- a/Projectiles/Ranged/AstralRound.cs +++ b/Projectiles/Ranged/AstralRound.cs @@ -10,6 +10,7 @@ namespace CalamityMod.Projectiles.Ranged { public class AstralRound : ModProjectile { + private float speed = 0f; public override void SetStaticDefaults() { DisplayName.SetDefault("Astral Round"); @@ -50,95 +51,20 @@ namespace CalamityMod.Projectiles.Ranged projectile.spriteDirection = projectile.direction; if (Main.rand.NextBool(2)) { - int randomDust = Main.rand.Next(2); - if (randomDust == 0) - { - randomDust = ModContent.DustType(); - } - else - { - randomDust = ModContent.DustType(); - } - int num137 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), 1, 1, randomDust, 0f, 0f, 0, default, 0.5f); - Main.dust[num137].alpha = projectile.alpha; - Main.dust[num137].velocity *= 0f; - Main.dust[num137].noGravity = true; - } - float num138 = (float)Math.Sqrt((double)(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y)); - float num139 = projectile.localAI[0]; - if (num139 == 0f) - { - projectile.localAI[0] = num138; - num139 = num138; - } - float num140 = projectile.position.X; - float num141 = projectile.position.Y; - float num142 = 200f; - bool flag4 = false; - int num143 = 0; - if (projectile.ai[1] == 0f) - { - for (int num144 = 0; num144 < 200; num144++) - { - if (Main.npc[num144].CanBeChasedBy(projectile, false) && (projectile.ai[1] == 0f || projectile.ai[1] == (float)(num144 + 1))) - { - float num145 = Main.npc[num144].position.X + (float)(Main.npc[num144].width / 2); - float num146 = Main.npc[num144].position.Y + (float)(Main.npc[num144].height / 2); - float num147 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num145) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num146); - if (num147 < num142 && Collision.CanHit(new Vector2(projectile.position.X + (float)(projectile.width / 2), projectile.position.Y + (float)(projectile.height / 2)), 1, 1, Main.npc[num144].position, Main.npc[num144].width, Main.npc[num144].height)) - { - num142 = num147; - num140 = num145; - num141 = num146; - flag4 = true; - num143 = num144; - } - } - } - if (flag4) - { - projectile.ai[1] = (float)(num143 + 1); - } - flag4 = false; - } - if (projectile.ai[1] > 0f) - { - int num148 = (int)(projectile.ai[1] - 1f); - if (Main.npc[num148].active && Main.npc[num148].CanBeChasedBy(projectile, true) && !Main.npc[num148].dontTakeDamage) - { - float num149 = Main.npc[num148].position.X + (float)(Main.npc[num148].width / 2); - float num150 = Main.npc[num148].position.Y + (float)(Main.npc[num148].height / 2); - float num151 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num149) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num150); - if (num151 < 1000f) - { - flag4 = true; - num140 = Main.npc[num148].position.X + (float)(Main.npc[num148].width / 2); - num141 = Main.npc[num148].position.Y + (float)(Main.npc[num148].height / 2); - } - } - else - { - projectile.ai[1] = 0f; - } - } - if (!projectile.friendly) - { - flag4 = false; - } - if (flag4) - { - float num152 = num139; - Vector2 vector13 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num153 = num140 - vector13.X; - float num154 = num141 - vector13.Y; - float num155 = (float)Math.Sqrt((double)(num153 * num153 + num154 * num154)); - num155 = num152 / num155; - num153 *= num155; - num154 *= num155; - int num156 = 12; - projectile.velocity.X = (projectile.velocity.X * (float)(num156 - 1) + num153) / (float)num156; - projectile.velocity.Y = (projectile.velocity.Y * (float)(num156 - 1) + num154) / (float)num156; + int randomDust = Utils.SelectRandom(Main.rand, new int[] + { + ModContent.DustType(), + ModContent.DustType() + }); + int astral = Dust.NewDust(projectile.position, 1, 1, randomDust, 0f, 0f, 0, default, 0.5f); + Main.dust[astral].alpha = projectile.alpha; + Main.dust[astral].velocity *= 0f; + Main.dust[astral].noGravity = true; } + + if (speed == 0f) + speed = projectile.velocity.Length(); + CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 200f, speed, 12f); return false; } diff --git a/Projectiles/Ranged/BloodfireArrowProj.cs b/Projectiles/Ranged/BloodfireArrowProj.cs index c8b41d9cfa..12ac42b282 100644 --- a/Projectiles/Ranged/BloodfireArrowProj.cs +++ b/Projectiles/Ranged/BloodfireArrowProj.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; +using CalamityMod.Items.Weapons.Ranged; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; @@ -39,10 +40,8 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) - MathHelper.ToRadians(90); - projectile.localAI[0] += 1f; - if (projectile.localAI[0] == 15f) + if (projectile.timeLeft % 15 == 0) { - projectile.localAI[0] = 0f; for (int l = 0; l < 12; l++) { Vector2 vector3 = Vector2.UnitX * (float)-(float)projectile.width / 2f; @@ -56,6 +55,10 @@ namespace CalamityMod.Projectiles.Ranged Main.dust[num9].velocity = Vector2.Normalize(projectile.Center - projectile.velocity * 3f - Main.dust[num9].position) * 1.25f; } } + if (projectile.ai[1] == 80f) //means it's from Arterial Assault's wooden arrow conversion + { + CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 400f, 20f, 20f); + } } public override void Kill(int timeLeft) @@ -86,7 +89,12 @@ namespace CalamityMod.Projectiles.Ranged return; } Player player = Main.player[projectile.owner]; - if (Main.rand.NextBool(3)) + int chance = 3; + if (player.ActiveItem().type == ModContent.ItemType()) + { + chance = 6; + } + if (Main.rand.NextBool(chance)) { player.statLife += 1; player.HealEffect(1); diff --git a/Projectiles/Ranged/Bolt.cs b/Projectiles/Ranged/Bolt.cs index 15d4aba20f..cbe59afe1f 100644 --- a/Projectiles/Ranged/Bolt.cs +++ b/Projectiles/Ranged/Bolt.cs @@ -26,6 +26,7 @@ namespace CalamityMod.Projectiles.Ranged projectile.ranged = true; projectile.alpha = 255; projectile.penetrate = 1; + projectile.timeLeft = 600; } public override void AI() @@ -33,11 +34,9 @@ namespace CalamityMod.Projectiles.Ranged Lighting.AddLight(projectile.Center, 0f, 0.5f, 0.65f); projectile.velocity.X *= 1.015f; projectile.velocity.Y *= 1.015f; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - projectile.localAI[0] += 1f; - if (projectile.localAI[0] == 30f) + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + if (projectile.timeLeft % 30 == 0) { - projectile.localAI[0] = 0f; for (int l = 0; l < 12; l++) { Vector2 vector3 = Vector2.UnitX * (float)-(float)projectile.width / 2f; @@ -69,5 +68,25 @@ namespace CalamityMod.Projectiles.Ranged CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); return false; } + + public override void Kill(int timeLeft) + { + projectile.position = projectile.Center; + projectile.width = projectile.height = 32; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.maxPenetrate = -1; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + projectile.Damage(); + int num212 = Main.rand.Next(4, 8); + for (int num213 = 0; num213 < num212; num213++) + { + int num214 = Dust.NewDust(projectile.Center - projectile.velocity / 2f, 0, 0, 135, 0f, 0f, 100, default, 2f); + Main.dust[num214].velocity *= 2f; + Main.dust[num214].noGravity = true; + } + } } } diff --git a/Projectiles/Ranged/ExoLightBurst.cs b/Projectiles/Ranged/ExoLightBurst.cs index f6545889c5..dc68a71e89 100644 --- a/Projectiles/Ranged/ExoLightBurst.cs +++ b/Projectiles/Ranged/ExoLightBurst.cs @@ -50,7 +50,7 @@ namespace CalamityMod.Projectiles.Ranged } if (projectile.ai[0] == 0f) { - NPC potentialTarget = projectile.Center.ClosestNPCAt(MaxDistanceFromTarget, true); + NPC potentialTarget = projectile.Center.ClosestNPCAt(MaxDistanceFromTarget, true, true); if (potentialTarget != null) { if (projectile.Distance(potentialTarget.Center) > MinDistanceFromTarget) diff --git a/Projectiles/Ranged/HyperiusBulletProj.cs b/Projectiles/Ranged/HyperiusBulletProj.cs index 14f578fa0d..f580d96470 100644 --- a/Projectiles/Ranged/HyperiusBulletProj.cs +++ b/Projectiles/Ranged/HyperiusBulletProj.cs @@ -75,35 +75,20 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - float xPos = Main.rand.NextBool(2) ? projectile.position.X + 800 : projectile.position.X - 800; - Vector2 vector2 = new Vector2(xPos, projectile.position.Y + Main.rand.Next(-800, 801)); - float num80 = xPos; - float speedX = (float)target.position.X - vector2.X; - float speedY = (float)target.position.Y - vector2.Y; - float dir = 10 / num80; - speedX *= dir * 150; - speedY *= dir * 150; - if (speedX > 15f) - { - speedX = 15f; - } - if (speedX < -15f) - { - speedX = -15f; - } - if (speedY > 15f) - { - speedY = 15f; - } - if (speedY < -15f) - { - speedY = -15f; - } + float xPos = projectile.Center.X + 800 * Main.rand.NextBool(2).ToDirectionInt(); + float yPos = projectile.Center.Y + Main.rand.Next(-800, 801); + Vector2 spawnPosition = new Vector2(xPos, yPos); + Vector2 velocity = target.Center - spawnPosition; + float dir = 10 / spawnPosition.X; + velocity.X *= dir * 150; + velocity.Y *= dir * 150; + velocity.X = MathHelper.Clamp(velocity.X, -15f, 15f); + velocity.Y = MathHelper.Clamp(velocity.Y, -15f, 15f); if (projectile.owner == Main.myPlayer) { int splitDamage = (int)(projectile.damage * 0.6f); float splitKB = 1f; - Projectile.NewProjectile(vector2, new Vector2(speedX, speedY), ModContent.ProjectileType(), splitDamage, splitKB, projectile.owner); + Projectile.NewProjectile(spawnPosition, velocity, ModContent.ProjectileType(), splitDamage, splitKB, projectile.owner); } } diff --git a/Projectiles/Ranged/NapalmArrowProj.cs b/Projectiles/Ranged/NapalmArrowProj.cs index ff82a970b4..61d1a7012e 100644 --- a/Projectiles/Ranged/NapalmArrowProj.cs +++ b/Projectiles/Ranged/NapalmArrowProj.cs @@ -1,3 +1,4 @@ +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using System; using Terraria; @@ -29,7 +30,7 @@ namespace CalamityMod.Projectiles.Ranged projectile.rotation = projectile.velocity.ToRotation() - MathHelper.PiOver2; if (Main.rand.NextBool(5)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 6, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, DustID.Fire, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); } } @@ -37,40 +38,42 @@ namespace CalamityMod.Projectiles.Ranged { projectile.position = projectile.Center; projectile.width = projectile.height = 32; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.position.X -= (float)(projectile.width / 2); + projectile.position.Y -= (float)(projectile.height / 2); Main.PlaySound(SoundID.Item14, projectile.position); - for (int num621 = 0; num621 < 5; num621++) + for (int j = 0; j < 5; j++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int fire = Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.Fire, 0f, 0f, 100, default, 2f); + Main.dust[fire].velocity *= 3f; 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[fire].scale = 0.5f; + Main.dust[fire].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 10; num623++) + for (int k = 0; k < 10; k++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; + int fire = Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.Fire, 0f, 0f, 100, default, 3f); + Main.dust[fire].noGravity = true; + Main.dust[fire].velocity *= 5f; + fire = Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.Fire, 0f, 0f, 100, default, 2f); + Main.dust[fire].velocity *= 2f; } projectile.ExplosionGores(3); if (projectile.owner == Main.myPlayer) { - for (int num252 = 0; num252 < 3; num252++) + for (int i = 0; i < 3; i++) { - Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - while (value15.X == 0f && value15.Y == 0f) + Vector2 velocity = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + while (velocity.X == 0f && velocity.Y == 0f) { - value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + velocity = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); } - value15.Normalize(); - value15 *= (float)Main.rand.Next(70, 101) * 0.1f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value15.X, value15.Y, ProjectileID.MolotovFire + Main.rand.Next(3), (int)((double)projectile.damage * 0.3), 0f, projectile.owner, 0f, 0f); + velocity.Normalize(); + velocity *= (float)Main.rand.Next(70, 101) * 0.1f; + int flames = Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), (int)(projectile.damage * 0.3), 0f, projectile.owner, 0f, 0f); + Main.projectile[flames].Calamity().forceRanged = true; + Main.projectile[flames].penetrate = 3; } } } diff --git a/Projectiles/Ranged/SeaDragonRocket.cs b/Projectiles/Ranged/SeaDragonRocket.cs index e3fc2e1452..757e5a6ad8 100644 --- a/Projectiles/Ranged/SeaDragonRocket.cs +++ b/Projectiles/Ranged/SeaDragonRocket.cs @@ -1,3 +1,4 @@ +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using System; using Terraria; @@ -26,53 +27,53 @@ namespace CalamityMod.Projectiles.Ranged { if (projectile.ai[1] == 0f) { - for (int num621 = 0; num621 < 5; num621++) + for (int i = 0; i < 5; i++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int fire = Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.Fire, 0f, 0f, 100, default, 2f); + Main.dust[fire].velocity *= 3f; 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[fire].scale = 0.5f; + Main.dust[fire].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } projectile.ai[1] = 1f; Main.PlaySound(SoundID.Item109, projectile.position); } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; if (projectile.owner == Main.myPlayer && projectile.timeLeft <= 3) { projectile.tileCollide = false; projectile.ai[1] = 0f; projectile.alpha = 255; - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.position.X = projectile.Center.X; + projectile.position.Y = projectile.Center.Y; projectile.width = 200; projectile.height = 200; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.position.X -= (float)(projectile.width / 2); + projectile.position.Y -= (float)(projectile.height / 2); projectile.knockBack = 10f; } else { if (Math.Abs(projectile.velocity.X) >= 8f || Math.Abs(projectile.velocity.Y) >= 8f) { - for (int num246 = 0; num246 < 2; num246++) + for (int j = 0; j < 2; j++) { float num247 = 0f; float num248 = 0f; - if (num246 == 1) + if (j == 1) { num247 = projectile.velocity.X * 0.5f; num248 = projectile.velocity.Y * 0.5f; } - int num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 6, 0f, 0f, 100, default, 1f); - Main.dust[num249].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; - Main.dust[num249].velocity *= 0.2f; - Main.dust[num249].noGravity = true; - num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 33, 0f, 0f, 100, default, 0.5f); - Main.dust[num249].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num249].velocity *= 0.05f; + int explosion = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, DustID.Fire, 0f, 0f, 100, default, 1f); + Main.dust[explosion].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[explosion].velocity *= 0.2f; + Main.dust[explosion].noGravity = true; + explosion = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 33, 0f, 0f, 100, default, 0.5f); + Main.dust[explosion].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[explosion].velocity *= 0.05f; } } } @@ -91,37 +92,39 @@ namespace CalamityMod.Projectiles.Ranged projectile.localNPCHitCooldown = 10; projectile.Damage(); Main.PlaySound(SoundID.Item110, projectile.position); - for (int num621 = 0; num621 < 15; num621++) + for (int i = 0; i < 15; i++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int smoke = Dust.NewDust(projectile.position, projectile.width, projectile.height, 33, 0f, 0f, 100, default, 2f); + Main.dust[smoke].velocity *= 3f; 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[smoke].scale = 0.5f; + Main.dust[smoke].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 25; num623++) + for (int j = 0; j < 25; j++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; + int fire = Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.Fire, 0f, 0f, 100, default, 3f); + Main.dust[fire].noGravity = true; + Main.dust[fire].velocity *= 5f; + fire = Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.Fire, 0f, 0f, 100, default, 2f); + Main.dust[fire].velocity *= 2f; } - int num251 = Main.rand.Next(2, 4); + int projAmt = Main.rand.Next(2, 4); if (projectile.owner == Main.myPlayer) { - for (int num252 = 0; num252 < num251; num252++) + for (int k = 0; k < projAmt; k++) { - Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - while (value15.X == 0f && value15.Y == 0f) + Vector2 velocity = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + while (velocity.X == 0f && velocity.Y == 0f) { - value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + velocity = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); } - value15.Normalize(); - value15 *= (float)Main.rand.Next(70, 101) * 0.1f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value15.X, value15.Y, ProjectileID.MolotovFire + Main.rand.Next(3), (int)((double)projectile.damage * 0.33), 0f, projectile.owner, 0f, 0f); + velocity.Normalize(); + velocity *= (float)Main.rand.Next(70, 101) * 0.1f; + int flames = Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), (int)(projectile.damage * 0.33), 0f, projectile.owner, 0f, 0f); + Main.projectile[flames].Calamity().forceRanged = true; + Main.projectile[flames].penetrate = 3; } } } diff --git a/Projectiles/Ranged/TerraArrowMain.cs b/Projectiles/Ranged/TerraArrowMain.cs index af9e439e3f..1e93a8e051 100644 --- a/Projectiles/Ranged/TerraArrowMain.cs +++ b/Projectiles/Ranged/TerraArrowMain.cs @@ -62,7 +62,7 @@ namespace CalamityMod.Projectiles.Ranged } value15.Normalize(); value15 *= (float)Main.rand.Next(70, 101) * 0.1f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value15.X, value15.Y, ModContent.ProjectileType(), (int)((double)projectile.damage * 0.25), 0f, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value15.X, value15.Y, ModContent.ProjectileType(), (int)(projectile.damage * 0.25), 0f, projectile.owner, 0f, 0f); } } } diff --git a/Projectiles/Ranged/TerraArrowSplit.cs b/Projectiles/Ranged/TerraArrowSplit.cs index 6b821fb134..7b26b855de 100644 --- a/Projectiles/Ranged/TerraArrowSplit.cs +++ b/Projectiles/Ranged/TerraArrowSplit.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { projectile.alpha -= 5; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 300f, 20f, 20f); } diff --git a/Projectiles/Ranged/TerraBulletMain.cs b/Projectiles/Ranged/TerraBulletMain.cs index bd0366cb1a..28bb65c8e0 100644 --- a/Projectiles/Ranged/TerraBulletMain.cs +++ b/Projectiles/Ranged/TerraBulletMain.cs @@ -80,7 +80,7 @@ namespace CalamityMod.Projectiles.Ranged } value15.Normalize(); value15 *= (float)Main.rand.Next(70, 101) * 0.1f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value15.X, value15.Y, ModContent.ProjectileType(), (int)((double)projectile.damage * 0.3), 0f, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value15.X, value15.Y, ModContent.ProjectileType(), (int)(projectile.damage * 0.3), 0f, projectile.owner, 0f, 0f); } } Main.PlaySound(SoundID.Item118, projectile.position); diff --git a/Projectiles/Ranged/TerraBulletSplit.cs b/Projectiles/Ranged/TerraBulletSplit.cs index 3f021bf8f2..b2f59896bc 100644 --- a/Projectiles/Ranged/TerraBulletSplit.cs +++ b/Projectiles/Ranged/TerraBulletSplit.cs @@ -9,6 +9,7 @@ namespace CalamityMod.Projectiles.Ranged { public class TerraBulletSplit : ModProjectile { + private float speed = 0f; public override void SetStaticDefaults() { DisplayName.SetDefault("Bullet"); @@ -57,81 +58,10 @@ namespace CalamityMod.Projectiles.Ranged Main.dust[num137].position.Y = y2; Main.dust[num137].velocity *= 0f; Main.dust[num137].noGravity = true; - float num138 = (float)Math.Sqrt((double)(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y)); - float num139 = projectile.localAI[0]; - if (num139 == 0f) - { - projectile.localAI[0] = num138; - num139 = num138; - } - float num140 = projectile.position.X; - float num141 = projectile.position.Y; - float num142 = 400f; - bool flag4 = false; - int num143 = 0; - if (projectile.ai[1] == 0f) - { - for (int num144 = 0; num144 < 200; num144++) - { - if (Main.npc[num144].CanBeChasedBy(projectile, false) && (projectile.ai[1] == 0f || projectile.ai[1] == (float)(num144 + 1))) - { - float num145 = Main.npc[num144].position.X + (float)(Main.npc[num144].width / 2); - float num146 = Main.npc[num144].position.Y + (float)(Main.npc[num144].height / 2); - float num147 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num145) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num146); - if (num147 < num142 && Collision.CanHit(new Vector2(projectile.position.X + (float)(projectile.width / 2), projectile.position.Y + (float)(projectile.height / 2)), 1, 1, Main.npc[num144].position, Main.npc[num144].width, Main.npc[num144].height)) - { - num142 = num147; - num140 = num145; - num141 = num146; - flag4 = true; - num143 = num144; - } - } - } - if (flag4) - { - projectile.ai[1] = (float)(num143 + 1); - } - flag4 = false; - } - if (projectile.ai[1] > 0f) - { - int num148 = (int)(projectile.ai[1] - 1f); - if (Main.npc[num148].active && Main.npc[num148].CanBeChasedBy(projectile, true) && !Main.npc[num148].dontTakeDamage) - { - float num149 = Main.npc[num148].position.X + (float)(Main.npc[num148].width / 2); - float num150 = Main.npc[num148].position.Y + (float)(Main.npc[num148].height / 2); - float num151 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num149) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num150); - if (num151 < 1000f) - { - flag4 = true; - num140 = Main.npc[num148].position.X + (float)(Main.npc[num148].width / 2); - num141 = Main.npc[num148].position.Y + (float)(Main.npc[num148].height / 2); - } - } - else - { - projectile.ai[1] = 0f; - } - } - if (!projectile.friendly) - { - flag4 = false; - } - if (flag4) - { - float num152 = num139; - Vector2 vector13 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num153 = num140 - vector13.X; - float num154 = num141 - vector13.Y; - float num155 = (float)Math.Sqrt((double)(num153 * num153 + num154 * num154)); - num155 = num152 / num155; - num153 *= num155; - num154 *= num155; - int num156 = 12; - projectile.velocity.X = (projectile.velocity.X * (float)(num156 - 1) + num153) / (float)num156; - projectile.velocity.Y = (projectile.velocity.Y * (float)(num156 - 1) + num154) / (float)num156; - } - } + + if (speed == 0f) + speed = projectile.velocity.Length(); + CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 400f, speed, 12f); + } } } diff --git a/Projectiles/Ranged/VeriumBulletProj.cs b/Projectiles/Ranged/VeriumBulletProj.cs index 25615a3b50..855bdf7477 100644 --- a/Projectiles/Ranged/VeriumBulletProj.cs +++ b/Projectiles/Ranged/VeriumBulletProj.cs @@ -9,6 +9,7 @@ namespace CalamityMod.Projectiles.Ranged { public class VeriumBulletProj : ModProjectile { + private float speed = 0f; public override void SetStaticDefaults() { DisplayName.SetDefault("Bullet"); @@ -23,10 +24,12 @@ namespace CalamityMod.Projectiles.Ranged projectile.aiStyle = 1; projectile.friendly = true; projectile.ranged = true; - projectile.penetrate = 1; + projectile.penetrate = 2; projectile.timeLeft = 600; projectile.extraUpdates = 1; aiType = ProjectileID.Bullet; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) @@ -41,87 +44,104 @@ namespace CalamityMod.Projectiles.Ranged projectile.spriteDirection = projectile.direction; if (Main.rand.NextBool(2)) { - int num137 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), 1, 1, 70, 0f, 0f, 0, default, 0.5f); - Main.dust[num137].alpha = projectile.alpha; - Main.dust[num137].velocity *= 0f; - Main.dust[num137].noGravity = true; + int purple = Dust.NewDust(projectile.position, 1, 1, 70, 0f, 0f, 0, default, 0.5f); + Main.dust[purple].alpha = projectile.alpha; + Main.dust[purple].velocity *= 0f; + Main.dust[purple].noGravity = true; } - float num138 = (float)Math.Sqrt((double)(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y)); - float num139 = projectile.localAI[0]; - if (num139 == 0f) - { - projectile.localAI[0] = num138; - num139 = num138; - } - float num140 = projectile.position.X; - float num141 = projectile.position.Y; - float num142 = 300f; - bool flag4 = false; - int num143 = 0; - if (projectile.ai[1] == 0f) - { - for (int num144 = 0; num144 < 200; num144++) - { - if (Main.npc[num144].CanBeChasedBy(projectile, false) && (projectile.ai[1] == 0f || projectile.ai[1] == (float)(num144 + 1))) - { - float num145 = Main.npc[num144].position.X + (float)(Main.npc[num144].width / 2); - float num146 = Main.npc[num144].position.Y + (float)(Main.npc[num144].height / 2); - float num147 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num145) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num146); - if (num147 < num142 && Collision.CanHit(new Vector2(projectile.position.X + (float)(projectile.width / 2), projectile.position.Y + (float)(projectile.height / 2)), 1, 1, Main.npc[num144].position, Main.npc[num144].width, Main.npc[num144].height)) - { - num142 = num147; - num140 = num145; - num141 = num146; - flag4 = true; - num143 = num144; - } - } - } - if (flag4) - { - projectile.ai[1] = (float)(num143 + 1); - } - flag4 = false; - } - if (projectile.ai[1] > 0f) - { - int num148 = (int)(projectile.ai[1] - 1f); - if (Main.npc[num148].active && Main.npc[num148].CanBeChasedBy(projectile, true) && !Main.npc[num148].dontTakeDamage) - { - float num149 = Main.npc[num148].position.X + (float)(Main.npc[num148].width / 2); - float num150 = Main.npc[num148].position.Y + (float)(Main.npc[num148].height / 2); - float num151 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num149) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num150); - if (num151 < 1000f) - { - flag4 = true; - num140 = Main.npc[num148].position.X + (float)(Main.npc[num148].width / 2); - num141 = Main.npc[num148].position.Y + (float)(Main.npc[num148].height / 2); - } - } - else - { - projectile.ai[1] = 0f; - } - } - if (!projectile.friendly) - { - flag4 = false; - } - if (flag4) - { - float num152 = num139; - Vector2 vector13 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num153 = num140 - vector13.X; - float num154 = num141 - vector13.Y; - float num155 = (float)Math.Sqrt((double)(num153 * num153 + num154 * num154)); - num155 = num152 / num155; - num153 *= num155; - num154 *= num155; - int num156 = 12; - projectile.velocity.X = (projectile.velocity.X * (float)(num156 - 1) + num153) / (float)num156; - projectile.velocity.Y = (projectile.velocity.Y * (float)(num156 - 1) + num154) / (float)num156; - } - return false; + + if (projectile.ai[0] > 0f) + projectile.ai[0]--; + if (speed == 0f) + speed = projectile.velocity.Length(); + if (projectile.penetrate == 1 && projectile.ai[0] <= 0f) + { + float inertia = 15f; + Vector2 center = projectile.Center; + float maxDistance = 300f; + bool homeIn = false; + + int targetIndex = (int)projectile.ai[1]; + NPC target = Main.npc[targetIndex]; + if (target.CanBeChasedBy(projectile, false)) + { + float extraDistance = (target.width / 2) + (target.height / 2); + + bool canHit = true; + if (extraDistance < maxDistance) + canHit = Collision.CanHit(projectile.Center, 1, 1, target.Center, 1, 1); + + if (Vector2.Distance(target.Center, projectile.Center) < (maxDistance + extraDistance) && canHit) + { + center = target.Center; + homeIn = true; + } + } + + if (!homeIn) + { + for (int i = 0; i < Main.maxNPCs; i++) + { + NPC npc = Main.npc[i]; + if (npc.CanBeChasedBy(projectile, false)) + { + float extraDistance = (npc.width / 2) + (npc.height / 2); + + bool canHit = true; + if (extraDistance < maxDistance) + canHit = Collision.CanHit(projectile.Center, 1, 1, npc.Center, 1, 1); + + if (Vector2.Distance(npc.Center, projectile.Center) < (maxDistance + extraDistance) && canHit) + { + center = npc.Center; + homeIn = true; + break; + } + } + } + } + + if (!projectile.friendly) + { + homeIn = false; + } + + if (homeIn) + { + Vector2 homeInVector = projectile.DirectionTo(center); + if (homeInVector.HasNaNs()) + homeInVector = Vector2.UnitY; + + projectile.velocity = (projectile.velocity * inertia + homeInVector * speed) / (inertia + 1f); + } + return false; + } + return true; + } + + public override bool? CanHitNPC(NPC target) + { + if (projectile.ai[0] > 0f) + { + return false; + } + return null; + } + + public override bool CanHitPvp(Player target) => projectile.ai[0] <= 0f; + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + projectile.ai[0] = 10f; + projectile.damage /= 2; + if (target.life > 0) + projectile.ai[1] = target.whoAmI; + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + projectile.ai[0] = 10f; + projectile.damage /= 2; } } } diff --git a/Projectiles/Rogue/BallisticPoisonBombProj.cs b/Projectiles/Rogue/BallisticPoisonBombProj.cs index 7b76aa05f5..2cd7f8ad45 100644 --- a/Projectiles/Rogue/BallisticPoisonBombProj.cs +++ b/Projectiles/Rogue/BallisticPoisonBombProj.cs @@ -130,7 +130,7 @@ namespace CalamityMod.Projectiles.Rogue Vector2 vector15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); vector15.Normalize(); vector15 *= (float)Main.rand.Next(10, 201) * 0.01f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, vector15.X, vector15.Y, ModContent.ProjectileType(), (int)(projectile.damage * 0.3), 1f, projectile.owner, 0f, (float)Main.rand.Next(-45, 1)); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, vector15.X, vector15.Y, ModContent.ProjectileType(), (int)(projectile.damage * 0.25), 1f, projectile.owner, 0f, (float)Main.rand.Next(-45, 1)); num3 = num321; } } diff --git a/Projectiles/Rogue/CelestialReaperProjectile.cs b/Projectiles/Rogue/CelestialReaperProjectile.cs index a005b94e1b..df056ca2c8 100644 --- a/Projectiles/Rogue/CelestialReaperProjectile.cs +++ b/Projectiles/Rogue/CelestialReaperProjectile.cs @@ -53,7 +53,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool? CanHitNPC(NPC target) { - if (HomingCooldown != 0) + if (HomingCooldown > 0) { return false; } @@ -62,7 +62,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool CanHitPvp(Player target) { - return HomingCooldown == 0; + return HomingCooldown <= 0; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Rogue/PlaguenadeBee.cs b/Projectiles/Rogue/PlaguenadeBee.cs index f08bcae8a1..49d5978846 100644 --- a/Projectiles/Rogue/PlaguenadeBee.cs +++ b/Projectiles/Rogue/PlaguenadeBee.cs @@ -7,161 +7,160 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { - public class PlaguenadeBee : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Plague Bee"); - Main.projFrames[projectile.type] = 4; - } + public class PlaguenadeBee : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Plague Bee"); + Main.projFrames[projectile.type] = 4; + } - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.penetrate = 2; - projectile.timeLeft = 420; - projectile.ignoreWater = true; - projectile.Calamity().rogue = true; - } + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.penetrate = 2; + projectile.timeLeft = 240; + projectile.ignoreWater = true; + projectile.Calamity().rogue = true; + } - public override void AI() - { - if (projectile.velocity.X > 0f) - { - projectile.spriteDirection = projectile.direction = 1; - } - else if (projectile.velocity.X < 0f) - { - projectile.spriteDirection = projectile.direction = -1; - } - projectile.rotation = projectile.velocity.X * 0.05f; - projectile.frameCounter++; - if (projectile.frameCounter >= 3) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame >= 3) - { - projectile.frame = 0; - } - float num373 = projectile.position.X; - float num374 = projectile.position.Y; - float num375 = 100000f; - bool flag10 = false; - projectile.ai[0] += 1f; - if (projectile.ai[0] > 30f) - { - projectile.ai[0] = 30f; - for (int num376 = 0; num376 < Main.maxNPCs; num376++) - { - if (Main.npc[num376].CanBeChasedBy(projectile, false) && (!Main.npc[num376].wet || projectile.type == 307)) - { - float num377 = Main.npc[num376].position.X + (float)(Main.npc[num376].width / 2); - float num378 = Main.npc[num376].position.Y + (float)(Main.npc[num376].height / 2); - float num379 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num377) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num378); - if (num379 < 800f && num379 < num375 && Collision.CanHit(projectile.position, projectile.width, projectile.height, Main.npc[num376].position, Main.npc[num376].width, Main.npc[num376].height)) - { - num375 = num379; - num373 = num377; - num374 = num378; - flag10 = true; - } - } - } - } - if (!flag10) - { - num373 = projectile.position.X + (float)(projectile.width / 2) + projectile.velocity.X * 100f; - num374 = projectile.position.Y + (float)(projectile.height / 2) + projectile.velocity.Y * 100f; - } - float num380 = 10f; - float num381 = 0.14f; - Vector2 vector30 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num382 = num373 - vector30.X; - float num383 = num374 - vector30.Y; - float num384 = (float)Math.Sqrt((double)(num382 * num382 + num383 * num383)); - num384 = num380 / num384; - num382 *= num384; - num383 *= num384; - if (projectile.velocity.X < num382) - { - projectile.velocity.X = projectile.velocity.X + num381; - if (projectile.velocity.X < 0f && num382 > 0f) - { - projectile.velocity.X = projectile.velocity.X + num381 * 2f; - } - } - else if (projectile.velocity.X > num382) - { - projectile.velocity.X = projectile.velocity.X - num381; - if (projectile.velocity.X > 0f && num382 < 0f) - { - projectile.velocity.X = projectile.velocity.X - num381 * 2f; - } - } - if (projectile.velocity.Y < num383) - { - projectile.velocity.Y = projectile.velocity.Y + num381; - if (projectile.velocity.Y < 0f && num383 > 0f) - { - projectile.velocity.Y = projectile.velocity.Y + num381 * 2f; - } - } - else if (projectile.velocity.Y > num383) - { - projectile.velocity.Y = projectile.velocity.Y - num381; - if (projectile.velocity.Y > 0f && num383 < 0f) - { - projectile.velocity.Y = projectile.velocity.Y - num381 * 2f; - } - } - } + public override void AI() + { + if (projectile.owner != Main.myPlayer) + projectile.Kill(); - public override bool OnTileCollide(Vector2 oldVelocity) - { - if (projectile.velocity.X != oldVelocity.X) - { - projectile.velocity.X = -oldVelocity.X; - } - if (projectile.velocity.Y != oldVelocity.Y) - { - projectile.velocity.Y = -oldVelocity.Y; - } - return false; - } + projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); + projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); + projectile.rotation += projectile.spriteDirection * MathHelper.ToRadians(45f); - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); - return false; - } + projectile.frameCounter++; + if (projectile.frameCounter >= 3) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame >= Main.projFrames[projectile.type]) + { + projectile.frame = 0; + } - public override void Kill(int timeLeft) - { - int num3; - for (int num418 = 0; num418 < 3; num418 = num3 + 1) - { - int num419 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 89, projectile.velocity.X, projectile.velocity.Y, 50, default, 1f); - Main.dust[num419].noGravity = true; - Main.dust[num419].scale = 1f; - num3 = num418; - } - } + Vector2 center = projectile.Center; + float maxDistance = 800f; + bool homeIn = false; + projectile.ai[0] += 1f; + if (projectile.ai[0] > 30f) + { + for (int npcIndex = 0; npcIndex < Main.maxNPCs; npcIndex++) + { + NPC npc = Main.npc[npcIndex]; + if (npc.CanBeChasedBy(projectile, false) && !npc.wet) + { + float extraDistance = (npc.width / 2) + (npc.height / 2); - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(ModContent.BuffType(), 300); - } + bool canHit = true; + if (extraDistance < maxDistance) + canHit = Collision.CanHit(projectile.Center, 1, 1, npc.Center, 1, 1); - public override void OnHitPvp(Player target, int damage, bool crit) - { - target.AddBuff(ModContent.BuffType(), 300); - } - } + if (Vector2.Distance(npc.Center, projectile.Center) < (maxDistance + extraDistance) && canHit) + { + center = npc.Center; + homeIn = true; + break; + } + } + } + } + if (!homeIn) + { + center.X = projectile.Center.X + projectile.velocity.X * 100f; + center.Y = projectile.Center.Y + projectile.velocity.Y * 100f; + } + float speed = 10f; + float velocityTweak = 0.14f; + Vector2 projPos = projectile.Center; + Vector2 velocity = center - projPos; + float targetDist = velocity.Length(); + targetDist = speed / targetDist; + velocity.X *= targetDist; + velocity.Y *= targetDist; + if (projectile.velocity.X < velocity.X) + { + projectile.velocity.X += velocityTweak; + if (projectile.velocity.X < 0f && velocity.X > 0f) + { + projectile.velocity.X += velocityTweak * 2f; + } + } + else if (projectile.velocity.X > velocity.X) + { + projectile.velocity.X -= velocityTweak; + if (projectile.velocity.X > 0f && velocity.X < 0f) + { + projectile.velocity.X -= velocityTweak * 2f; + } + } + if (projectile.velocity.Y < velocity.Y) + { + projectile.velocity.Y += velocityTweak; + if (projectile.velocity.Y < 0f && velocity.Y > 0f) + { + projectile.velocity.Y += velocityTweak * 2f; + } + } + else if (projectile.velocity.Y > velocity.Y) + { + projectile.velocity.Y -= velocityTweak; + if (projectile.velocity.Y > 0f && velocity.Y < 0f) + { + projectile.velocity.Y -= velocityTweak * 2f; + } + } + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + if (projectile.velocity.X != oldVelocity.X) + { + projectile.velocity.X = -oldVelocity.X; + } + if (projectile.velocity.Y != oldVelocity.Y) + { + projectile.velocity.Y = -oldVelocity.Y; + } + return false; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D texture = Main.projectileTexture[projectile.type]; + int frameHeight = texture.Height / Main.projFrames[projectile.type]; + int drawStart = frameHeight * projectile.frame; + SpriteEffects spriteEffects = SpriteEffects.None; + if (projectile.spriteDirection == -1) + spriteEffects = SpriteEffects.FlipHorizontally; + Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, drawStart, texture.Width, frameHeight)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture.Width / 2f, (float)frameHeight / 2f), projectile.scale, spriteEffects, 0f); + return false; + } + + public override void Kill(int timeLeft) + { + for (int i = 0; i < 2; i++) + { + int plague = Dust.NewDust(projectile.position, projectile.width, projectile.height, 89, projectile.velocity.X, projectile.velocity.Y, 50, default, 1f); + Main.dust[plague].noGravity = true; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 300); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 300); + } + } } diff --git a/Projectiles/Rogue/PlaguenadeProj.cs b/Projectiles/Rogue/PlaguenadeProj.cs index f287844bcb..99e82b2e9e 100644 --- a/Projectiles/Rogue/PlaguenadeProj.cs +++ b/Projectiles/Rogue/PlaguenadeProj.cs @@ -32,14 +32,14 @@ namespace CalamityMod.Projectiles.Rogue projectile.ai[0] = 5f; if (projectile.velocity.Y == 0f && projectile.velocity.X != 0f) { - projectile.velocity.X = projectile.velocity.X * 0.97f; - if ((double)projectile.velocity.X > -0.01 && (double)projectile.velocity.X < 0.01) + projectile.velocity.X *= 0.97f; + if (projectile.velocity.X > -0.01f && projectile.velocity.X < 0.01f) { projectile.velocity.X = 0f; projectile.netUpdate = true; } } - projectile.velocity.Y = projectile.velocity.Y + 0.2f; + projectile.velocity.Y += 0.2f; } projectile.rotation += projectile.velocity.X * 0.1f; if (projectile.velocity.Y > 16f) @@ -72,45 +72,47 @@ namespace CalamityMod.Projectiles.Rogue { if (projectile.owner == Main.myPlayer) { - for (int num639 = 0; num639 < (projectile.Calamity().stealthStrike ? 28 : 20); num639++) + Player player = Main.player[projectile.owner]; + int projAmt = projectile.Calamity().stealthStrike ? 28 : 20; + for (int projIndex = 0; projIndex < projAmt; projIndex++) { float speedX = (float)Main.rand.Next(-35, 36) * 0.02f; float speedY = (float)Main.rand.Next(-35, 36) * 0.02f; - Projectile.NewProjectile(projectile.position.X, projectile.position.Y, speedX, speedY, ModContent.ProjectileType(), Main.player[projectile.owner].beeDamage(projectile.damage), Main.player[projectile.owner].beeKB(0f), Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(projectile.position.X, projectile.position.Y, speedX, speedY, ModContent.ProjectileType(), player.beeDamage(projectile.damage), player.beeKB(0f), projectile.owner, 0f, 0f); } + Main.PlaySound(SoundID.Item14, projectile.position); + if (projectile.Calamity().stealthStrike) + { + projectile.position = projectile.Center; + projectile.width = projectile.height = 75; + } + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.maxPenetrate = -1; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + projectile.Damage(); + for (int i = 0; i < 10; i++) + { + int smoke = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 31, 0f, 0f, 100, default, 2f); + Main.dust[smoke].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[smoke].scale = 0.5f; + Main.dust[smoke].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int j = 0; j < 15; j++) + { + int plague = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 89, 0f, 0f, 100, default, 3f); + Main.dust[plague].noGravity = true; + Main.dust[plague].velocity *= 5f; + int fire = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, DustID.Fire, 0f, 0f, 100, default, 2f); + Main.dust[fire].velocity *= 2f; + } + projectile.ExplosionGores(3); } - Main.PlaySound(SoundID.Item14, projectile.position); - if (projectile.Calamity().stealthStrike) - { - projectile.position = projectile.Center; - projectile.width = projectile.height = 75; - } - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); - for (int num621 = 0; num621 < 20; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 31, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 30; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 89, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - projectile.ExplosionGores(3); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Rogue/RegulusRiotProj.cs b/Projectiles/Rogue/RegulusRiotProj.cs index 2ba65c9912..862e1f579d 100644 --- a/Projectiles/Rogue/RegulusRiotProj.cs +++ b/Projectiles/Rogue/RegulusRiotProj.cs @@ -96,6 +96,7 @@ namespace CalamityMod.Projectiles.Rogue targetCenter = npcCenter; homeIn = true; targetIndex = npcIndex; + break; } } } diff --git a/Projectiles/Rogue/TotalityFire.cs b/Projectiles/Rogue/TotalityFire.cs index b68e18a1bc..627421cb0f 100644 --- a/Projectiles/Rogue/TotalityFire.cs +++ b/Projectiles/Rogue/TotalityFire.cs @@ -1,4 +1,5 @@ using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using System; using Terraria; using Terraria.ID; @@ -8,10 +9,14 @@ namespace CalamityMod.Projectiles.Rogue { public class TotalityFire : ModProjectile { + private bool initialized = false; + public override void SetStaticDefaults() { DisplayName.SetDefault("Fire"); - Main.projFrames[projectile.type] = 4; + Main.projFrames[projectile.type] = 3; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 2; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; } public override void SetDefaults() @@ -24,30 +29,34 @@ namespace CalamityMod.Projectiles.Rogue projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = -1; projectile.Calamity().rogue = true; - projectile.alpha = 100; } public override void AI() { //make it face the way it's going - if (projectile.ai[1] == 1f) + if (projectile.ai[1] > 0f) { - projectile.rotation = -projectile.velocity.X * 0.05f; + projectile.rotation = -projectile.velocity.X * 0.05f + MathHelper.PiOver2; } else { - projectile.rotation = projectile.velocity.ToRotation() - MathHelper.PiOver2; - projectile.spriteDirection = ((projectile.velocity.X > 0f) ? -1 : 1); + projectile.rotation = projectile.velocity.ToRotation(); } + projectile.ai[1]--; //frames + if (!initialized) + { + initialized = true; + projectile.frame = Main.rand.Next(Main.projFrames[projectile.type]); + } projectile.frameCounter++; if (projectile.frameCounter > 6) { projectile.frame++; projectile.frameCounter = 0; } - if (projectile.frame > 3) + if (projectile.frame >= Main.projFrames[projectile.type]) { projectile.frame = 0; } @@ -80,6 +89,14 @@ namespace CalamityMod.Projectiles.Rogue } projectile.velocity.Y += 0.2f; } + if (projectile.velocity.Y < 0.25f && projectile.velocity.Y > 0.15f) + { + projectile.velocity.X *= 0.8f; + } + if (projectile.velocity.Y > 16f) + { + projectile.velocity.Y = 16f; + } //dust if (Main.rand.NextBool(4)) @@ -102,23 +119,11 @@ namespace CalamityMod.Projectiles.Rogue dust.noGravity = true; dust.velocity *= 0.1f; } - if (projectile.velocity.Y < 0.25f && projectile.velocity.Y > 0.15f) - { - projectile.velocity.X *= 0.8f; - } - if (projectile.velocity.Y > 16f) - { - projectile.velocity.Y = 16f; - } } public override bool OnTileCollide(Vector2 oldVelocity) { - projectile.ai[1] = 1f; - if (projectile.penetrate == 0) - { - projectile.Kill(); - } + projectile.ai[1] = 10f; return false; } @@ -131,5 +136,11 @@ namespace CalamityMod.Projectiles.Rogue { target.AddBuff(BuffID.OnFire, 120); } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } } } diff --git a/Projectiles/Rogue/TotalityFire.png b/Projectiles/Rogue/TotalityFire.png index 2313a2e798..2d6cfab7f2 100644 Binary files a/Projectiles/Rogue/TotalityFire.png and b/Projectiles/Rogue/TotalityFire.png differ diff --git a/Projectiles/Rogue/UmbraphileBoom.cs b/Projectiles/Rogue/UmbraphileBoom.cs index d06797acad..eb6d987646 100644 --- a/Projectiles/Rogue/UmbraphileBoom.cs +++ b/Projectiles/Rogue/UmbraphileBoom.cs @@ -6,97 +6,101 @@ using Terraria.ModLoader; using CalamityMod.Buffs.DamageOverTime; namespace CalamityMod.Projectiles.Rogue { - public class UmbraphileBoom : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Explosion"); - } + public class UmbraphileBoom : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Explosion"); + } - public override void SetDefaults() - { - projectile.width = 60; - projectile.height = 60; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 5; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = -1; + public override void SetDefaults() + { + projectile.width = 60; + projectile.height = 60; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.timeLeft = 5; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = -1; projectile.Calamity().rogue = true; - } + } - public override void Kill(int timeLeft) - { - int dustType = Main.rand.NextBool(2) ? 246 : 176; - bool flag15 = false; - bool flag16 = false; - if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) - { - flag15 = true; - } - if (projectile.velocity.X > 0f && projectile.position.X > projectile.ai[0]) - { - flag15 = true; - } - if (projectile.velocity.Y < 0f && projectile.position.Y < projectile.ai[1]) - { - flag16 = true; - } - if (projectile.velocity.Y > 0f && projectile.position.Y > projectile.ai[1]) - { - flag16 = true; - } - if (flag15 && flag16) - { - projectile.Kill(); - } - float num461 = 25f; - if (projectile.ai[0] > 180f) - { - num461 -= (projectile.ai[0] - 180f) / 2f; - } - if (num461 <= 0f) - { - num461 = 0f; - projectile.Kill(); - } - num461 *= 0.7f; - projectile.ai[0] += 4f; - int num462 = 0; - while ((float)num462 < num461) - { - float num463 = (float)Main.rand.Next(-10, 11); - float num464 = (float)Main.rand.Next(-10, 11); - float num465 = (float)Main.rand.Next(3, 9); - float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); - num466 = num465 / num466; - num463 *= num466; - num464 *= num466; - int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustType, 0f, 0f, 100, default, 1f); - Dust dust = Main.dust[num467]; - dust.noGravity = true; - dust.position.X = projectile.Center.X; - dust.position.Y = projectile.Center.Y; - dust.position.X += (float)Main.rand.Next(-10, 11); - dust.position.Y += (float)Main.rand.Next(-10, 11); - dust.velocity.X = num463; - dust.velocity.Y = num464; - num462++; - } - return; - } + public override void Kill(int timeLeft) + { + int dustType = Main.rand.NextBool(2) ? 246 : 176; + bool flag15 = false; + bool flag16 = false; + if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) + { + flag15 = true; + } + if (projectile.velocity.X > 0f && projectile.position.X > projectile.ai[0]) + { + flag15 = true; + } + if (projectile.velocity.Y < 0f && projectile.position.Y < projectile.ai[1]) + { + flag16 = true; + } + if (projectile.velocity.Y > 0f && projectile.position.Y > projectile.ai[1]) + { + flag16 = true; + } + if (flag15 && flag16) + { + projectile.Kill(); + } + float num461 = 25f; + if (projectile.ai[0] > 180f) + { + num461 -= (projectile.ai[0] - 180f) / 2f; + } + if (num461 <= 0f) + { + num461 = 0f; + projectile.Kill(); + } + num461 *= 0.7f; + projectile.ai[0] += 4f; + int num462 = 0; + while ((float)num462 < num461) + { + float num463 = (float)Main.rand.Next(-10, 11); + float num464 = (float)Main.rand.Next(-10, 11); + float num465 = (float)Main.rand.Next(3, 9); + float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); + num466 = num465 / num466; + num463 *= num466; + num464 *= num466; + int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustType, 0f, 0f, 100, default, 1f); + Dust dust = Main.dust[num467]; + dust.noGravity = true; + dust.position.X = projectile.Center.X; + dust.position.Y = projectile.Center.Y; + dust.position.X += (float)Main.rand.Next(-10, 11); + dust.position.Y += (float)Main.rand.Next(-10, 11); + dust.velocity.X = num463; + dust.velocity.Y = num464; + num462++; + } + return; + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Daybreak, 180); - target.AddBuff(ModContent.BuffType(), 180); - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (Main.dayTime || Main.rand.NextBool(3)) //100% during day, 33.33% chance at night + target.AddBuff(BuffID.Daybreak, 60); - public override void OnHitPvp(Player target, int damage, bool crit) - { - target.AddBuff(ModContent.BuffType(), 180); - } - } + if (!Main.dayTime || Main.rand.NextBool(3)) //100% at night, 33.33% chance during day + target.AddBuff(ModContent.BuffType(), 60); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + if (!Main.dayTime || Main.rand.NextBool(3)) //100% at night, 33.33% chance during day + target.AddBuff(ModContent.BuffType(), 60); + } + } } diff --git a/Projectiles/Summon/AstralProbeSummon.cs b/Projectiles/Summon/AstralProbeSummon.cs index 2f36a3d958..dcc163d511 100644 --- a/Projectiles/Summon/AstralProbeSummon.cs +++ b/Projectiles/Summon/AstralProbeSummon.cs @@ -153,9 +153,6 @@ namespace CalamityMod.Projectiles.Summon } } - public override bool CanDamage() - { - return false; - } + public override bool CanDamage() => false; } } diff --git a/Projectiles/Summon/BlackHawkBullet.cs b/Projectiles/Summon/BlackHawkBullet.cs index 74930940bf..71969f4126 100644 --- a/Projectiles/Summon/BlackHawkBullet.cs +++ b/Projectiles/Summon/BlackHawkBullet.cs @@ -28,6 +28,7 @@ namespace CalamityMod.Projectiles.Summon aiType = ProjectileID.BulletHighVelocity; projectile.penetrate = 1; projectile.timeLeft = 600; + projectile.tileCollide = false; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) @@ -35,5 +36,7 @@ namespace CalamityMod.Projectiles.Summon CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); return false; } + + public override Color? GetAlpha(Color lightColor) => new Color(200, 200, 200, 200); } } diff --git a/Projectiles/Summon/BlackHawkSummon.cs b/Projectiles/Summon/BlackHawkSummon.cs index c0974c50fd..40336956f6 100644 --- a/Projectiles/Summon/BlackHawkSummon.cs +++ b/Projectiles/Summon/BlackHawkSummon.cs @@ -241,7 +241,7 @@ namespace CalamityMod.Projectiles.Summon projectile.ai[1] += Main.rand.Next(1, 4); } //Set the minion to be ready for attack - if (projectile.ai[1] > 90f) + if (projectile.ai[1] > 130f) { projectile.ai[1] = 0f; projectile.netUpdate = true; diff --git a/Projectiles/Summon/BrimstoneElementalMinion.cs b/Projectiles/Summon/BrimstoneElementalMinion.cs index a80580b3e7..72b6832176 100644 --- a/Projectiles/Summon/BrimstoneElementalMinion.cs +++ b/Projectiles/Summon/BrimstoneElementalMinion.cs @@ -197,11 +197,16 @@ namespace CalamityMod.Projectiles.Summon projectile.ai[1] = 0f; projectile.netUpdate = true; } + + // Prevent firing immediately + if (projectile.localAI[0] < 120f) + projectile.localAI[0] += 1f; + if (projectile.ai[0] == 0f) { float scaleFactor3 = 14f; int num658 = ModContent.ProjectileType(); - if (flag25 && projectile.ai[1] == 0f) + if (flag25 && projectile.ai[1] == 0f && projectile.localAI[0] >= 120f) { projectile.ai[1] += 1f; if (Main.myPlayer == projectile.owner && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, vector46, 0, 0)) diff --git a/Projectiles/Summon/Calamitamini.cs b/Projectiles/Summon/Calamitamini.cs index 7ac5313243..e4b66fa0da 100644 --- a/Projectiles/Summon/Calamitamini.cs +++ b/Projectiles/Summon/Calamitamini.cs @@ -11,6 +11,11 @@ namespace CalamityMod.Projectiles.Summon { public class Calamitamini : ModProjectile { + public const float Range = 1300f; + public const float SeparationAnxietyMin = 1500f; + public const float SeparationAnxietyMax = 3200f; + public const float SafeDist = 200f; + public override void SetStaticDefaults() { DisplayName.SetDefault("Calamitamini"); @@ -61,10 +66,10 @@ namespace CalamityMod.Projectiles.Summon player.MinionDamage()); projectile.damage = damage2; } - float num633 = 700f; - float num634 = 1100f; - float num635 = 2400f; - float num636 = 150f; + float num633 = Range; + float num634 = SeparationAnxietyMin; + float num635 = SeparationAnxietyMax; + float num636 = SafeDist; bool flag64 = projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); if (flag64) @@ -166,14 +171,14 @@ namespace CalamityMod.Projectiles.Summon float num650 = 6f; if (flag26) { - num650 = 15f; + num650 = 18f; } Vector2 center2 = projectile.Center; Vector2 vector48 = player.Center - center2 + new Vector2(0f, -60f); float num651 = vector48.Length(); - if (num651 > 200f && num650 < 8f) + if (num651 > 200f && num650 < 10f) { - num650 = 8f; + num650 = 10f; } if (num651 < num636 && flag26 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) { diff --git a/Projectiles/Summon/Cataclymini.cs b/Projectiles/Summon/Cataclymini.cs index c3dfac0236..d2a9fcd293 100644 --- a/Projectiles/Summon/Cataclymini.cs +++ b/Projectiles/Summon/Cataclymini.cs @@ -61,10 +61,10 @@ namespace CalamityMod.Projectiles.Summon player.MinionDamage()); projectile.damage = damage2; } - float num633 = 700f; - float num634 = 1100f; - float num635 = 2400f; - float num636 = 150f; + float num633 = Calamitamini.Range; + float num634 = Calamitamini.SeparationAnxietyMin; + float num635 = Calamitamini.SeparationAnxietyMax; + float num636 = Calamitamini.SafeDist; bool flag64 = projectile.type == ModContent.ProjectileType(); if (flag64) { @@ -165,14 +165,14 @@ namespace CalamityMod.Projectiles.Summon float num650 = 6f; if (flag26) { - num650 = 15f; + num650 = 18f; } Vector2 center2 = projectile.Center; Vector2 vector48 = player.Center - center2 + new Vector2(0f, -60f); float num651 = vector48.Length(); - if (num651 > 200f && num650 < 8f) + if (num651 > 200f && num650 < 10f) { - num650 = 8f; + num650 = 10f; } if (num651 < num636 && flag26 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) { @@ -181,8 +181,8 @@ namespace CalamityMod.Projectiles.Summon } if (num651 > 2000f) { - projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); - projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.height / 2); + projectile.position.X = player.Center.X - (float)(projectile.width / 2); + projectile.position.Y = player.Center.Y - (float)(projectile.height / 2); projectile.netUpdate = true; } if (num651 > 70f) diff --git a/Projectiles/Summon/Catastromini.cs b/Projectiles/Summon/Catastromini.cs index 3232dff49a..c3c17ef818 100644 --- a/Projectiles/Summon/Catastromini.cs +++ b/Projectiles/Summon/Catastromini.cs @@ -86,7 +86,7 @@ namespace CalamityMod.Projectiles.Summon projectile.frame = 0; } - projectile.ChargingMinionAI(700f, 1100f, 2400f, 150f, 0, 40f, 8f, -4f, 40f, 8f, false, true); + projectile.ChargingMinionAI(Calamitamini.Range, Calamitamini.SeparationAnxietyMin, Calamitamini.SeparationAnxietyMax, Calamitamini.SafeDist, 0, 40f, 8f, -4f, 40f, 8f, false, true); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/Summon/EndoHydraBody.cs b/Projectiles/Summon/EndoHydraBody.cs index 2330afe3e8..46aebd9e56 100644 --- a/Projectiles/Summon/EndoHydraBody.cs +++ b/Projectiles/Summon/EndoHydraBody.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Projectiles.Summon { public class EndoHydraBody : ModProjectile { - public const float DistanceToCheck = 1350f; + public const float DistanceToCheck = 1600f; public override void SetStaticDefaults() { DisplayName.SetDefault("Hydra Body"); diff --git a/Projectiles/Summon/EndoHydraHead.cs b/Projectiles/Summon/EndoHydraHead.cs index 3c5837deba..38707d10be 100644 --- a/Projectiles/Summon/EndoHydraHead.cs +++ b/Projectiles/Summon/EndoHydraHead.cs @@ -90,7 +90,7 @@ namespace CalamityMod.Projectiles.Summon { Projectile.NewProjectile(projectile.Center, 6f * projectile.DirectionTo(Main.npc[(int)body.ai[0]].Center), - ModContent.ProjectileType(), projectile.damage, 2f, projectile.owner); + ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); } if (projectile.ai[1] % 40f >= 33f) diff --git a/Projectiles/Summon/PlagueBeeSmall.cs b/Projectiles/Summon/PlagueBeeSmall.cs index 8ae6a5c1c7..498bfc334a 100644 --- a/Projectiles/Summon/PlagueBeeSmall.cs +++ b/Projectiles/Summon/PlagueBeeSmall.cs @@ -26,120 +26,120 @@ namespace CalamityMod.Projectiles.Summon projectile.minion = true; } - public override void AI() - { - if (projectile.velocity.X > 0f) - { - projectile.spriteDirection = projectile.direction = 1; - } - else if (projectile.velocity.X < 0f) - { - projectile.spriteDirection = projectile.direction = -1; - } - projectile.rotation = projectile.velocity.X * 0.05f; - projectile.frameCounter++; - if (projectile.frameCounter >= 3) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame >= 3) - { - projectile.frame = 0; - } - float num373 = projectile.position.X; - float num374 = projectile.position.Y; - float num375 = 1000f; - bool flag10 = false; - projectile.ai[0] += 1f; - if (projectile.ai[0] > 30f) - { - projectile.ai[0] = 30f; + public override void AI() + { + if (projectile.owner != Main.myPlayer) + projectile.Kill(); + + projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); + projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); + projectile.rotation += projectile.spriteDirection * MathHelper.ToRadians(45f); + + projectile.frameCounter++; + if (projectile.frameCounter >= 3) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame >= Main.projFrames[projectile.type]) + { + projectile.frame = 0; + } + + Vector2 center = projectile.Center; + float maxDistance = 800f; + bool homeIn = false; + projectile.ai[0] += 1f; + if (projectile.ai[0] > 30f) + { Player player = Main.player[projectile.owner]; if (player.HasMinionAttackTargetNPC) { NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false) && (!npc.wet || projectile.type == 307)) + if (npc.CanBeChasedBy(projectile, false) && !npc.wet) { - float num377 = npc.position.X + (float)(npc.width / 2); - float num378 = npc.position.Y + (float)(npc.height / 2); - float num379 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num377) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num378); - if (num379 < 800f && num379 < num375 && Collision.CanHit(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) + float extraDistance = (npc.width / 2) + (npc.height / 2); + + bool canHit = true; + if (extraDistance < maxDistance) + canHit = Collision.CanHit(projectile.Center, 1, 1, npc.Center, 1, 1); + + if (Vector2.Distance(npc.Center, projectile.Center) < (maxDistance + extraDistance) && canHit) { - num375 = num379; - num373 = num377; - num374 = num378; - flag10 = true; + center = npc.Center; + homeIn = true; } } } else { - for (int num376 = 0; num376 < Main.maxNPCs; num376++) + for (int npcIndex = 0; npcIndex < Main.maxNPCs; npcIndex++) { - if (Main.npc[num376].CanBeChasedBy(projectile, false) && (!Main.npc[num376].wet || projectile.type == 307)) + NPC npc = Main.npc[npcIndex]; + if (npc.CanBeChasedBy(projectile, false) && !npc.wet) { - float num377 = Main.npc[num376].position.X + (float)(Main.npc[num376].width / 2); - float num378 = Main.npc[num376].position.Y + (float)(Main.npc[num376].height / 2); - float num379 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num377) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num378); - if (num379 < 800f && num379 < num375 && Collision.CanHit(projectile.position, projectile.width, projectile.height, Main.npc[num376].position, Main.npc[num376].width, Main.npc[num376].height)) + float extraDistance = (npc.width / 2) + (npc.height / 2); + + bool canHit = true; + if (extraDistance < maxDistance) + canHit = Collision.CanHit(projectile.Center, 1, 1, npc.Center, 1, 1); + + if (Vector2.Distance(npc.Center, projectile.Center) < (maxDistance + extraDistance) && canHit) { - num375 = num379; - num373 = num377; - num374 = num378; - flag10 = true; + center = npc.Center; + homeIn = true; + break; } } } } - } - if (!flag10) - { - num373 = projectile.position.X + (float)(projectile.width / 2) + projectile.velocity.X * 100f; - num374 = projectile.position.Y + (float)(projectile.height / 2) + projectile.velocity.Y * 100f; - } - float num380 = 10f; - float num381 = 0.14f; - Vector2 vector30 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num382 = num373 - vector30.X; - float num383 = num374 - vector30.Y; - float num384 = (float)Math.Sqrt((double)(num382 * num382 + num383 * num383)); - num384 = num380 / num384; - num382 *= num384; - num383 *= num384; - if (projectile.velocity.X < num382) - { - projectile.velocity.X = projectile.velocity.X + num381; - if (projectile.velocity.X < 0f && num382 > 0f) - { - projectile.velocity.X = projectile.velocity.X + num381 * 2f; - } - } - else if (projectile.velocity.X > num382) - { - projectile.velocity.X = projectile.velocity.X - num381; - if (projectile.velocity.X > 0f && num382 < 0f) - { - projectile.velocity.X = projectile.velocity.X - num381 * 2f; - } - } - if (projectile.velocity.Y < num383) - { - projectile.velocity.Y = projectile.velocity.Y + num381; - if (projectile.velocity.Y < 0f && num383 > 0f) - { - projectile.velocity.Y = projectile.velocity.Y + num381 * 2f; - } - } - else if (projectile.velocity.Y > num383) - { - projectile.velocity.Y = projectile.velocity.Y - num381; - if (projectile.velocity.Y > 0f && num383 < 0f) - { - projectile.velocity.Y = projectile.velocity.Y - num381 * 2f; - } - } - } + } + if (!homeIn) + { + center.X = projectile.Center.X + projectile.velocity.X * 100f; + center.Y = projectile.Center.Y + projectile.velocity.Y * 100f; + } + float speed = 10f; + float velocityTweak = 0.14f; + Vector2 projPos = projectile.Center; + Vector2 velocity = center - projPos; + float targetDist = velocity.Length(); + targetDist = speed / targetDist; + velocity.X *= targetDist; + velocity.Y *= targetDist; + if (projectile.velocity.X < velocity.X) + { + projectile.velocity.X += velocityTweak; + if (projectile.velocity.X < 0f && velocity.X > 0f) + { + projectile.velocity.X += velocityTweak * 2f; + } + } + else if (projectile.velocity.X > velocity.X) + { + projectile.velocity.X -= velocityTweak; + if (projectile.velocity.X > 0f && velocity.X < 0f) + { + projectile.velocity.X -= velocityTweak * 2f; + } + } + if (projectile.velocity.Y < velocity.Y) + { + projectile.velocity.Y += velocityTweak; + if (projectile.velocity.Y < 0f && velocity.Y > 0f) + { + projectile.velocity.Y += velocityTweak * 2f; + } + } + else if (projectile.velocity.Y > velocity.Y) + { + projectile.velocity.Y -= velocityTweak; + if (projectile.velocity.Y > 0f && velocity.Y < 0f) + { + projectile.velocity.Y -= velocityTweak * 2f; + } + } + } public override bool OnTileCollide(Vector2 oldVelocity) { @@ -154,26 +154,26 @@ namespace CalamityMod.Projectiles.Summon return false; } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D texture = Main.projectileTexture[projectile.type]; + int frameHeight = texture.Height / Main.projFrames[projectile.type]; + int drawStart = frameHeight * projectile.frame; + SpriteEffects spriteEffects = SpriteEffects.None; + if (projectile.spriteDirection == -1) + spriteEffects = SpriteEffects.FlipHorizontally; + Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, drawStart, texture.Width, frameHeight)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture.Width / 2f, (float)frameHeight / 2f), projectile.scale, spriteEffects, 0f); + return false; + } - public override void Kill(int timeLeft) - { - int num3; - for (int num418 = 0; num418 < 3; num418 = num3 + 1) - { - int num419 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 89, projectile.velocity.X, projectile.velocity.Y, 50, default, 1f); - Main.dust[num419].noGravity = true; - Main.dust[num419].scale = 1f; - num3 = num418; - } - } + public override void Kill(int timeLeft) + { + for (int i = 0; i < 2; i++) + { + int plague = Dust.NewDust(projectile.position, projectile.width, projectile.height, 89, projectile.velocity.X, projectile.velocity.Y, 50, default, 1f); + Main.dust[plague].noGravity = true; + } + } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { diff --git a/Projectiles/Summon/PlantSeed.cs b/Projectiles/Summon/PlantSeed.cs index f7c7cd3949..09ba64cec6 100644 --- a/Projectiles/Summon/PlantSeed.cs +++ b/Projectiles/Summon/PlantSeed.cs @@ -56,5 +56,10 @@ namespace CalamityMod.Projectiles.Summon { target.AddBuff(BuffID.Poisoned, 60); } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.AddBuff(BuffID.Poisoned, 60); + } } } diff --git a/Projectiles/Summon/PlantSeedGreen.cs b/Projectiles/Summon/PlantSeedGreen.cs index 0e31c597c2..78a91fef24 100644 --- a/Projectiles/Summon/PlantSeedGreen.cs +++ b/Projectiles/Summon/PlantSeedGreen.cs @@ -55,6 +55,15 @@ namespace CalamityMod.Projectiles.Summon public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(BuffID.Poisoned, 180); + if (projectile.ai[1] == 1f) + target.AddBuff(BuffID.Venom, 180); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.AddBuff(BuffID.Poisoned, 180); + if (projectile.ai[1] == 1f) + target.AddBuff(BuffID.Venom, 180); } } } diff --git a/Projectiles/Summon/PlantSporeCloud.cs b/Projectiles/Summon/PlantSporeCloud.cs new file mode 100644 index 0000000000..e260a8449c --- /dev/null +++ b/Projectiles/Summon/PlantSporeCloud.cs @@ -0,0 +1,70 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon +{ + public class PlantSporeCloud : ModProjectile + { + private int counter = 0; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Spore Cloud"); + ProjectileID.Sets.MinionShot[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 32; + projectile.height = 32; + projectile.friendly = true; + projectile.alpha = 60; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.minion = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 30; + } + + public override void AI() + { + projectile.velocity.X *= 0.985f; + projectile.velocity.Y *= 0.985f; + projectile.rotation += projectile.direction * 0.05f; + + if (counter % 5 == 0) + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 107, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + + counter++; + if (counter > 300) + projectile.alpha += 5; + if (projectile.alpha >= 255) + projectile.Kill(); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D tex = Main.projectileTexture[projectile.type]; + if (projectile.ai[0] == 1f) + tex = ModContent.GetTexture("CalamityMod/Projectiles/Summon/PlantSporeCloud2"); + if (projectile.ai[0] == 2f) + tex = ModContent.GetTexture("CalamityMod/Projectiles/Summon/PlantSporeCloud3"); + + spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + return false; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Poisoned, 180); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.AddBuff(BuffID.Poisoned, 180); + } + } +} diff --git a/Projectiles/Summon/PlantSporeCloud.png b/Projectiles/Summon/PlantSporeCloud.png new file mode 100644 index 0000000000..c8ac75bf7f Binary files /dev/null and b/Projectiles/Summon/PlantSporeCloud.png differ diff --git a/Projectiles/Summon/PlantSporeCloud2.png b/Projectiles/Summon/PlantSporeCloud2.png new file mode 100644 index 0000000000..230cd387e9 Binary files /dev/null and b/Projectiles/Summon/PlantSporeCloud2.png differ diff --git a/Projectiles/Summon/PlantSporeCloud3.png b/Projectiles/Summon/PlantSporeCloud3.png new file mode 100644 index 0000000000..297365d2a5 Binary files /dev/null and b/Projectiles/Summon/PlantSporeCloud3.png differ diff --git a/Projectiles/Summon/PlantSummon.cs b/Projectiles/Summon/PlantSummon.cs index 6c790344dc..546481e402 100644 --- a/Projectiles/Summon/PlantSummon.cs +++ b/Projectiles/Summon/PlantSummon.cs @@ -10,7 +10,12 @@ namespace CalamityMod.Projectiles.Summon { public class PlantSummon : ModProjectile { + private bool initialized = false; private bool enraged = false; + private int pinkSeed = ModContent.ProjectileType(); + private int greenSeed = ModContent.ProjectileType(); + private int thornBall = ModContent.ProjectileType(); + private int sporeClouds = ModContent.ProjectileType(); public override void SetStaticDefaults() { @@ -42,6 +47,7 @@ namespace CalamityMod.Projectiles.Summon { Player player = Main.player[projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); + CalamityGlobalProjectile modProj = projectile.Calamity(); if (player.statLife <= (int)((double)player.statLifeMax2 * 0.5)) { @@ -56,11 +62,355 @@ namespace CalamityMod.Projectiles.Summon projectile.extraUpdates = 0; } - projectile.frameCounter++; - if (projectile.frameCounter > 8) + Framing(); + + if (!initialized) + { + modProj.spawnedPlayerMinionDamageValue = player.MinionDamage(); + modProj.spawnedPlayerMinionProjectileDamageValue = projectile.damage; + SpawnDust(); + initialized = true; + } + if (player.MinionDamage() != modProj.spawnedPlayerMinionDamageValue) + { + int damage2 = (int)((float)modProj.spawnedPlayerMinionProjectileDamageValue / + modProj.spawnedPlayerMinionDamageValue * player.MinionDamage()); + projectile.damage = damage2; + } + + bool correctMinion = projectile.type == ModContent.ProjectileType(); + player.AddBuff(ModContent.BuffType(), 3600); + if (correctMinion) + { + if (player.dead) + { + modPlayer.plantera = false; + } + if (modPlayer.plantera) + { + projectile.timeLeft = 2; + } + } + + float range = 1000f; + Vector2 half = new Vector2(0.5f); + + //shouldn't need anti clump because there can only be one + + if (!enraged) + { + if (projectile.ai[0] >= 2f) + projectile.ai[0] = 0f; + Vector2 targetVec = projectile.position; + bool foundTarget = false; + if (player.HasMinionAttackTargetNPC) + { + NPC npc = Main.npc[player.MinionAttackTargetNPC]; + if (npc.CanBeChasedBy(projectile, false)) + { + Vector2 sizeCheck = npc.position + npc.Size * half; + float npcDist = Vector2.Distance(npc.Center, projectile.Center); + if (!foundTarget && npcDist < range) + { + range = npcDist; + targetVec = sizeCheck; + foundTarget = true; + } + } + } + else + { + for (int i = 0; i < Main.maxNPCs; i++) + { + NPC npc = Main.npc[i]; + if (npc.CanBeChasedBy(projectile, false)) + { + Vector2 sizeCheck = npc.position + npc.Size * half; + float npcDist = Vector2.Distance(npc.Center, projectile.Center); + if (!foundTarget && npcDist < range) + { + range = npcDist; + targetVec = sizeCheck; + foundTarget = true; + } + } + } + } + + CheckIfShouldReturnToPlayer(foundTarget); + + if (foundTarget && projectile.ai[0] == 0f) + { + StayCertainDistFromTarget(targetVec); + } + else + { + PassiveAI(); + } + + HandleRotation(foundTarget, targetVec); + + IncrementAttackCounter(); + if (projectile.ai[0] == 0f) + { + float projSpeed = 6f; + int projType = Main.rand.NextBool(2) ? greenSeed : pinkSeed; + int projDmg = (int)(projectile.damage * 0.7f); + float speedMult = 1f; + if (Main.rand.NextBool(4)) + { + projType = thornBall; + } + if (projType == thornBall) + { + speedMult = 2f; + projDmg = (int)(projectile.damage * 1.2f); + } + if (projectile.ai[1] == 0f && foundTarget && range < 500f) + { + Main.PlaySound(SoundID.Item20, projectile.position); + projectile.ai[1] += 1f; + if (Main.myPlayer == projectile.owner) + { + Vector2 velocity = targetVec - projectile.Center; + velocity.Normalize(); + velocity *= projSpeed; + velocity *= speedMult; + Projectile.NewProjectile(projectile.Center, velocity, projType, projDmg, projectile.knockBack, projectile.owner, 0f, 0f); + projectile.netUpdate = true; + } + } + } + } + else //enraged + { + bool charging = false; + if (projectile.ai[0] == 2f) + { + projectile.ai[1] += 1f; + projectile.extraUpdates = 1; + if (projectile.ai[1] > 30f) + { + projectile.ai[1] = 1f; + projectile.ai[0] = 0f; + projectile.extraUpdates = 0; + projectile.numUpdates = 0; + projectile.netUpdate = true; + } + else + { + charging = true; + } + } + if (charging) + { + return; + } + Vector2 targetVec = projectile.position; + bool foundTarget = false; + if (player.HasMinionAttackTargetNPC) + { + NPC npc = Main.npc[player.MinionAttackTargetNPC]; + if (npc.CanBeChasedBy(projectile, false)) + { + Vector2 sizeCheck = npc.position + npc.Size * half; + float npcDist = Vector2.Distance(npc.Center, projectile.Center); + if (!foundTarget && npcDist < range) + { + range = npcDist; + targetVec = sizeCheck; + foundTarget = true; + } + } + } + else + { + for (int num645 = 0; num645 < Main.maxNPCs; num645++) + { + NPC npc = Main.npc[num645]; + if (npc.CanBeChasedBy(projectile, false)) + { + Vector2 sizeCheck = npc.position + npc.Size * half; + float npcDist = Vector2.Distance(npc.Center, projectile.Center); + if (!foundTarget && npcDist < range) + { + range = npcDist; + targetVec = sizeCheck; + foundTarget = true; + } + } + } + } + + HandleRotation(foundTarget, targetVec); + + CheckIfShouldReturnToPlayer(foundTarget); + + if (foundTarget && projectile.ai[0] == 0f) + { + StayCertainDistFromTarget(targetVec); + } + else + { + PassiveAI(); + } + IncrementAttackCounter(); + if (projectile.ai[0] == 0f) + { + if (projectile.ai[1] == 0f && foundTarget && range < 500f) + { + projectile.ai[1] += 1f; + if (Main.myPlayer == projectile.owner) + { + projectile.ai[0] = 2f; + Vector2 whereIsTarget = targetVec - projectile.Center; + whereIsTarget.Normalize(); + int projType = thornBall; + if (Main.rand.NextBool(2)) + { + Vector2 projVelocity = whereIsTarget * 2f; + int projDmg = (int)(projectile.damage * 1.5f); + Projectile.NewProjectile(projectile.Center, projVelocity, projType, projDmg, projectile.knockBack, projectile.owner, 0f, 1f); + } + if (Main.rand.NextBool(3)) + { + float projSpeedMult = 3f; + if (Main.rand.NextBool(2) && CalamityUtils.CountProjectiles(sporeClouds) < 9) + { + projType = sporeClouds; + projSpeedMult = 10f; + } + else + { + projType = Main.rand.NextBool(2) ? greenSeed : pinkSeed; + } + int projDmg = (int)(projectile.damage * 0.8f); + Vector2 projVelocity = whereIsTarget * projSpeedMult; + for (int i = -8; i <= 8; i += 8) + { + Vector2 perturbedSpeed = projVelocity.RotatedBy(MathHelper.ToRadians(i)); + Projectile.NewProjectile(projectile.Center, perturbedSpeed, projType, projDmg, projectile.knockBack * 0.8f, player.whoAmI, Main.rand.Next(3), 1f); + } + } + float chargeSpeed = 8f; + projectile.velocity = whereIsTarget * chargeSpeed; + projectile.netUpdate = true; + } + } + } + } + } + + private void CheckIfShouldReturnToPlayer(bool targetLocated) + { + Player player = Main.player[projectile.owner]; + float separationAnxietyDist = 1300f; + if (targetLocated) + { + separationAnxietyDist = 2600f; + } + if (Vector2.Distance(player.Center, projectile.Center) > separationAnxietyDist) + { + projectile.ai[0] = 1f; + projectile.netUpdate = true; + } + } + + private void StayCertainDistFromTarget(Vector2 whereIsTarget) + { + Vector2 targetPos = whereIsTarget - projectile.Center; + float targetDist = targetPos.Length(); + targetPos.Normalize(); + if (targetDist > 200f) + { + float speedMult = 8f; + targetPos *= speedMult; + projectile.velocity = (projectile.velocity * 40f + targetPos) / 41f; + } + else + { + float reverseSpeedMult = 4f; + targetPos *= -reverseSpeedMult; + projectile.velocity = (projectile.velocity * 40f + targetPos) / 41f; + } + } + + private void PassiveAI() + { + Player player = Main.player[projectile.owner]; + bool returningToPlayer = false; + if (!returningToPlayer) + { + returningToPlayer = projectile.ai[0] == 1f; + } + float returnSpeed = 12f; + if (returningToPlayer) + { + returnSpeed = 30f; + } + Vector2 playerVec = player.Center - projectile.Center + new Vector2(0f, -120f); + float playerDist = playerVec.Length(); + if (playerDist > 200f && returnSpeed < 16f) + { + returnSpeed = 16f; + } + if (playerDist < 600f && returningToPlayer) + { + projectile.ai[0] = 0f; + projectile.netUpdate = true; + } + if (playerDist > 2000f) + { + projectile.position.X = player.Center.X - (float)(projectile.width / 2); + projectile.position.Y = player.Center.Y - (float)(projectile.height / 2); + projectile.netUpdate = true; + } + if (playerDist > 70f) + { + playerVec.Normalize(); + playerVec *= returnSpeed; + projectile.velocity = (projectile.velocity * 40f + playerVec) / 41f; + } + else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) + { + projectile.velocity.X = -0.15f; + projectile.velocity.Y = -0.05f; + } + } + + private void IncrementAttackCounter() + { + if (projectile.ai[1] > 0f) + { + projectile.ai[1] += (float)Main.rand.Next(1, 4); + } + if (projectile.ai[1] > 40f) + { + projectile.ai[1] = 0f; + projectile.netUpdate = true; + } + } + + private void HandleRotation(bool targetFound, Vector2 whereIsTarget) + { + if (targetFound && !enraged) + { + projectile.rotation = projectile.rotation.AngleTowards(projectile.AngleTo(whereIsTarget) + MathHelper.Pi, 0.1f); + } + else + { + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.Pi; + } + /*if (enraged) + projectile.rotation = (whereIsTarget - projectile.Center).ToRotation() + MathHelper.Pi; + else*/ + } + + private void Framing() + { + if (projectile.frameCounter++ % 8 == 7) { projectile.frame++; - projectile.frameCounter = 0; } if (!enraged) { @@ -76,387 +426,34 @@ namespace CalamityMod.Projectiles.Summon projectile.frame = 4; } } + } - if (projectile.localAI[0] == 0f) - { - projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; - int num226 = 36; - for (int num227 = 0; num227 < num226; num227++) - { - Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; - Vector2 vector7 = vector6 - projectile.Center; - int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 107, vector7.X * 1.75f, vector7.Y * 1.75f, 100, default, 1.1f); - Main.dust[num228].noGravity = true; - Main.dust[num228].velocity = vector7; - } - projectile.localAI[0] += 1f; - } - if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * - player.MinionDamage()); - projectile.damage = damage2; - } - - bool flag64 = projectile.type == ModContent.ProjectileType(); - player.AddBuff(ModContent.BuffType(), 3600); - if (flag64) - { - if (player.dead) - { - modPlayer.plantera = false; - } - if (modPlayer.plantera) - { - projectile.timeLeft = 2; - } - } - - float num633 = 1000f; - float num634 = 1300f; - float num635 = 2600f; - float num636 = 600f; - - //idle movement - projectile.MinionAntiClump(); - - if (!enraged) + private void SpawnDust() + { + int dustAmt = 36; + for (int dustIndex = 0; dustIndex < dustAmt; dustIndex++) { - if (projectile.ai[0] >= 2f) - projectile.ai[0] = 0f; - Vector2 vector46 = projectile.position; - bool flag25 = false; - Vector2 value = new Vector2(0.5f); - if (player.HasMinionAttackTargetNPC) - { - NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) - { - Vector2 vector2 = npc.position + npc.Size * value; - float num646 = Vector2.Distance(npc.Center, projectile.Center); - if (!flag25 && num646 < num633) - { - num633 = num646; - vector46 = vector2; - flag25 = true; - } - } - } - else - { - for (int num645 = 0; num645 < Main.maxNPCs; num645++) - { - NPC npc = Main.npc[num645]; - if (npc.CanBeChasedBy(projectile, false)) - { - Vector2 vector2 = npc.position + npc.Size * value; - float num646 = Vector2.Distance(npc.Center, projectile.Center); - if (!flag25 && num646 < num633) - { - num633 = num646; - vector46 = vector2; - flag25 = true; - } - } - } - } - float num647 = num634; - if (flag25) - { - num647 = num635; - } - if (Vector2.Distance(player.Center, projectile.Center) > num647) - { - projectile.ai[0] = 1f; - projectile.netUpdate = true; - } - if (flag25 && projectile.ai[0] == 0f) - { - Vector2 vector47 = vector46 - projectile.Center; - float num648 = vector47.Length(); - vector47.Normalize(); - if (num648 > 200f) - { - float scaleFactor2 = 18f; //12 - vector47 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; - } - else - { - float num649 = 9f; - vector47 *= -num649; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; - } - } - else - { - bool flag26 = false; - if (!flag26) - { - flag26 = projectile.ai[0] == 1f; - } - float num650 = 12f; - if (flag26) - { - num650 = 30f; - } - Vector2 center2 = projectile.Center; - Vector2 vector48 = player.Center - center2 + new Vector2(0f, -120f); - float num651 = vector48.Length(); - if (num651 > 200f && num650 < 16f) - { - num650 = 16f; - } - if (num651 < num636 && flag26) - { - projectile.ai[0] = 0f; - projectile.netUpdate = true; - } - if (num651 > 2000f) - { - projectile.position.X = player.Center.X - (float)(projectile.width / 2); - projectile.position.Y = player.Center.Y - (float)(projectile.height / 2); - projectile.netUpdate = true; - } - if (num651 > 70f) - { - vector48.Normalize(); - vector48 *= num650; - projectile.velocity = (projectile.velocity * 40f + vector48) / 41f; - } - else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) - { - projectile.velocity.X = -0.15f; - projectile.velocity.Y = -0.05f; - } - } - if (flag25) - { - projectile.rotation = projectile.rotation.AngleTowards(projectile.AngleTo(vector46) + MathHelper.Pi, 0.1f); - } - else - { - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.Pi; - } - if (projectile.ai[1] > 0f) - { - projectile.ai[1] += (float)Main.rand.Next(1, 4); - } - if (projectile.ai[1] > 90f) - { - projectile.ai[1] = 0f; - projectile.netUpdate = true; - } - if (projectile.ai[0] == 0f) - { - float scaleFactor3 = 6f; - int projType = (Main.rand.NextBool(2) ? ModContent.ProjectileType() : ModContent.ProjectileType()); - int projDmg = (int)(projectile.damage * 0.7f); - float speedMult = 1f; - if (Main.rand.NextBool(4)) - { - projType = ModContent.ProjectileType(); - } - if (projType == ModContent.ProjectileType()) - { - speedMult = 2f; - projDmg = (int)(projectile.damage * 1.2f); - } - if (projectile.ai[1] == 0f && flag25 && num633 < 500f) - { - Main.PlaySound(SoundID.Item20, projectile.position); - projectile.ai[1] += 1f; - if (Main.myPlayer == projectile.owner) - { - Vector2 value19 = vector46 - projectile.Center; - value19.Normalize(); - value19 *= scaleFactor3; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value19.X * speedMult, value19.Y * speedMult, projType, projDmg, 0f, projectile.owner, 0f, 0f); - projectile.netUpdate = true; - } - } - } + Vector2 source = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; + source = source.RotatedBy((double)((float)(dustIndex - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt), default) + projectile.Center; + Vector2 dustVel = source - projectile.Center; + int terra = Dust.NewDust(source + dustVel, 0, 0, 107, dustVel.X * 1.75f, dustVel.Y * 1.75f, 100, default, 1.1f); + Main.dust[terra].noGravity = true; + Main.dust[terra].velocity = dustVel; } - else //enraged - { - bool flag24 = false; - if (projectile.ai[0] == 2f) - { - projectile.ai[1] += 1f; - projectile.extraUpdates = 1; - if (projectile.ai[1] > 30f) - { - projectile.ai[1] = 1f; - projectile.ai[0] = 0f; - projectile.extraUpdates = 0; - projectile.numUpdates = 0; - projectile.netUpdate = true; - } - else - { - flag24 = true; - } - } - if (flag24) - { - return; - } - Vector2 vector46 = projectile.position; - bool flag25 = false; - Vector2 value = new Vector2(0.5f); - if (player.HasMinionAttackTargetNPC) - { - NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) - { - Vector2 vector2 = npc.position + npc.Size * value; - float num646 = Vector2.Distance(npc.Center, projectile.Center); - if ((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) - { - num633 = num646; - vector46 = vector2; - flag25 = true; - } - } - } - else - { - for (int num645 = 0; num645 < Main.maxNPCs; num645++) - { - NPC npc = Main.npc[num645]; - if (npc.CanBeChasedBy(projectile, false)) - { - Vector2 vector2 = npc.position + npc.Size * value; - float num646 = Vector2.Distance(npc.Center, projectile.Center); - if ((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) - { - num633 = num646; - vector46 = vector2; - flag25 = true; - } - } - } - } - if (flag25) - { - projectile.rotation = (vector46 - projectile.Center).ToRotation() + 3.14159274f; - } - else - { - projectile.rotation = projectile.velocity.ToRotation() + 3.14159274f; - } - float num647 = num634; - if (flag25) - { - num647 = num635; - } - if (Vector2.Distance(player.Center, projectile.Center) > num647) - { - projectile.ai[0] = 1f; - projectile.netUpdate = true; - } - if (flag25 && projectile.ai[0] == 0f) - { - Vector2 vector47 = vector46 - projectile.Center; - float num648 = vector47.Length(); - vector47.Normalize(); - if (num648 > 200f) - { - float scaleFactor2 = 8f; - vector47 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; - } - else - { - float num649 = 4f; - vector47 *= -num649; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; - } - } - else - { - bool flag26 = false; - if (!flag26) - { - flag26 = projectile.ai[0] == 1f; - } - float num650 = 6f; - if (flag26) - { - num650 = 15f; - } - Vector2 center2 = projectile.Center; - Vector2 vector48 = player.Center - center2 + new Vector2(0f, -60f); - float num651 = vector48.Length(); - if (num651 > 200f && num650 < 8f) - { - num650 = 8f; - } - if (num651 < num636 && flag26 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) - { - projectile.ai[0] = 0f; - projectile.netUpdate = true; - } - if (num651 > 2000f) - { - projectile.position.X = player.Center.X - (float)(projectile.width / 2); - projectile.position.Y = player.Center.Y - (float)(projectile.height / 2); - projectile.netUpdate = true; - } - if (num651 > 70f) - { - vector48.Normalize(); - vector48 *= num650; - projectile.velocity = (projectile.velocity * 40f + vector48) / 41f; - } - else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) - { - projectile.velocity.X = -0.15f; - projectile.velocity.Y = -0.05f; - } - } - if (projectile.ai[1] > 0f) - { - projectile.ai[1] += (float)Main.rand.Next(1, 4); - } - if (projectile.ai[1] > 40f) - { - projectile.ai[1] = 0f; - projectile.netUpdate = true; - } - if (projectile.ai[0] == 0f) - { - if (projectile.ai[1] == 0f && flag25 && num633 < 500f) - { - projectile.ai[1] += 1f; - if (Main.myPlayer == projectile.owner) - { - projectile.ai[0] = 2f; - Vector2 value20 = vector46 - projectile.Center; - value20.Normalize(); - if (Main.rand.NextBool(2)) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value20.X * 2f, value20.Y * 2f, ModContent.ProjectileType(), (int)(projectile.damage * 1.5f), 0f, Main.myPlayer, 0f, 0f); - } - projectile.velocity = value20 * 8f; - projectile.netUpdate = true; - } - } - } - } - } + } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(BuffID.Poisoned, 300); + target.AddBuff(BuffID.Venom, 300); } - public override bool CanDamage() + public override void OnHitPvp(Player target, int damage, bool crit) { - return enraged == true; + target.AddBuff(BuffID.Poisoned, 300); + target.AddBuff(BuffID.Venom, 300); } + + public override bool CanDamage() => enraged; } } diff --git a/Projectiles/Summon/PlantThornBall.cs b/Projectiles/Summon/PlantThornBall.cs index 76e3d07270..be0abf75a2 100644 --- a/Projectiles/Summon/PlantThornBall.cs +++ b/Projectiles/Summon/PlantThornBall.cs @@ -52,6 +52,15 @@ namespace CalamityMod.Projectiles.Summon public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(BuffID.Poisoned, 180); + if (projectile.ai[1] == 1f) + target.AddBuff(BuffID.Venom, 180); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.AddBuff(BuffID.Poisoned, 180); + if (projectile.ai[1] == 1f) + target.AddBuff(BuffID.Venom, 180); } } } diff --git a/Projectiles/Summon/ProfanedEnergy.cs b/Projectiles/Summon/ProfanedEnergy.cs index 7896ddc29c..503059565f 100644 --- a/Projectiles/Summon/ProfanedEnergy.cs +++ b/Projectiles/Summon/ProfanedEnergy.cs @@ -1,3 +1,4 @@ +using CalamityMod.Dusts; using Microsoft.Xna.Framework; using System; using Terraria; @@ -45,24 +46,27 @@ namespace CalamityMod.Projectiles.Summon { projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; - Main.PlaySound(SoundID.Item20, projectile.position); - for (int num621 = 0; num621 < 5; num621++) + Main.PlaySound(SoundID.Item20, projectile.Center); + for (int i = 0; i < 5; i++) { - int num622 = Dust.NewDust(new Vector2(projectile.Center.X, projectile.Center.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int holy = Dust.NewDust(projectile.Center, projectile.width, projectile.height, (int)CalamityDusts.ProfanedFire, 0f, 0f, 100, default, 2f); + Main.dust[holy].velocity *= 3f; + Main.dust[holy].position = projectile.Center; 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[holy].scale = 0.5f; + Main.dust[holy].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 10; num623++) + for (int j = 0; j < 10; j++) { - int num624 = Dust.NewDust(new Vector2(projectile.Center.X, projectile.Center.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.Center.X, projectile.Center.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; + int fire = Dust.NewDust(projectile.Center, projectile.width, projectile.height, 246, 0f, 0f, 100, default, 3f); + Main.dust[fire].noGravity = true; + Main.dust[fire].velocity *= 5f; + Main.dust[fire].position = projectile.Center; + fire = Dust.NewDust(projectile.Center, projectile.width, projectile.height, 246, 0f, 0f, 100, default, 2f); + Main.dust[fire].velocity *= 2f; + Main.dust[fire].position = projectile.Center; } count += 1f; } @@ -87,13 +91,13 @@ namespace CalamityMod.Projectiles.Summon int target = 0; if (player.HasMinionAttackTargetNPC) { - NPC npc = Main.npc[Main.player[projectile.owner].MinionAttackTargetNPC]; + NPC npc = Main.npc[player.MinionAttackTargetNPC]; if (npc.CanBeChasedBy(projectile, false)) { - float num539 = npc.position.X + (float)(npc.width / 2); - float num540 = npc.position.Y + (float)(npc.height / 2); - float num541 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num539) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num540); - if (num541 < num508 && Collision.CanHit(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) + float num539 = npc.Center.X; + float num540 = npc.Center.Y; + float num541 = Math.Abs(projectile.Center.X - num539) + Math.Abs(projectile.Center.Y - num540); + if (num541 < num508 && Collision.CanHit(projectile.Center, projectile.width, projectile.height, npc.Center, npc.width, npc.height)) { num506 = num539; num507 = num540; @@ -136,21 +140,17 @@ namespace CalamityMod.Projectiles.Summon { projectile.spriteDirection = -1; } - int projectileType = Main.rand.Next(2); - if (projectileType == 0) - { - projectileType = ModContent.ProjectileType(); - } - else - { - projectileType = ModContent.ProjectileType(); - } - float num403 = Main.rand.Next(20, 30); //modify the speed the projectile are shot. Lower number = slower projectile. + int projectileType = Utils.SelectRandom(Main.rand, new int[] + { + ModContent.ProjectileType(), + ModContent.ProjectileType() + }); + float speed = Main.rand.Next(20, 30); //modify the speed the projectile are shot. Lower number = slower projectile. Vector2 vector29 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); float num404 = num516 - vector29.X; float num405 = num517 - vector29.Y; float num406 = (float)Math.Sqrt((double)(num404 * num404 + num405 * num405)); - num406 = num403 / num406; + num406 = speed / num406; num404 *= num406; num405 *= num406; Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, num404, num405, projectileType, projectile.damage, projectile.knockBack, projectile.owner, (float)target, 0f); diff --git a/Projectiles/Summon/RadiantResolutionAura.cs b/Projectiles/Summon/RadiantResolutionAura.cs index cd6bd7719b..4c7a35c685 100644 --- a/Projectiles/Summon/RadiantResolutionAura.cs +++ b/Projectiles/Summon/RadiantResolutionAura.cs @@ -72,7 +72,7 @@ namespace CalamityMod.Projectiles.Summon float allocatedSlots = projectile.ai[0]; projectile.rotation += MathHelper.ToRadians(3f) + MathHelper.ToRadians(allocatedSlots * 0.85f); - int radiantOrbDamage = (int)(projectile.damage * Math.Log(allocatedSlots + 1f, 1.414214)); + int radiantOrbDamage = (int)(projectile.damage * Math.Log(allocatedSlots + 1f, 1.75)); int radiantOrbAppearRate = (int)(124 * Math.Pow(0.9, allocatedSlots)); if (radiantOrbAppearRate < 7) diff --git a/Projectiles/Summon/SandElementalMinion.cs b/Projectiles/Summon/SandElementalMinion.cs index 803cb848d5..36bc62dd9e 100644 --- a/Projectiles/Summon/SandElementalMinion.cs +++ b/Projectiles/Summon/SandElementalMinion.cs @@ -241,11 +241,16 @@ namespace CalamityMod.Projectiles.Summon projectile.ai[1] = 0f; projectile.netUpdate = true; } + + // Prevent firing immediately + if (projectile.localAI[0] < 120f) + projectile.localAI[0] += 1f; + if (projectile.ai[0] == 0f) { float scaleFactor3 = 11f; int num658 = ModContent.ProjectileType(); - if (flag25 && projectile.ai[1] == 0f) + if (flag25 && projectile.ai[1] == 0f && projectile.localAI[0] >= 120f) { projectile.ai[1] += 1f; if (Main.myPlayer == projectile.owner && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, vector46, 0, 0)) diff --git a/Projectiles/Summon/SandnadoMinion.cs b/Projectiles/Summon/SandnadoMinion.cs index 059388b415..0e6118b2db 100644 --- a/Projectiles/Summon/SandnadoMinion.cs +++ b/Projectiles/Summon/SandnadoMinion.cs @@ -79,7 +79,7 @@ namespace CalamityMod.Projectiles.Summon } projectile.MinionAntiClump(0.1f); Vector2 vector = projectile.position; - float num10 = 1200f; + float num10 = 1800f; bool flag = false; if (Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) { @@ -133,10 +133,10 @@ namespace CalamityMod.Projectiles.Summon } } } - float num16 = 1000f; + float num16 = 1200f; if (flag) { - num16 = 2500f; + num16 = 3000f; } if (Vector2.Distance(player.Center, projectile.Center) > num16) { @@ -191,8 +191,9 @@ namespace CalamityMod.Projectiles.Summon } if (num23 > 2000f) { - projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); - projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.width / 2); + projectile.position.X = player.Center.X - (float)(projectile.width / 2); + projectile.position.Y = player.Center.Y - (float)(projectile.width / 2); + projectile.netUpdate = true; } if (Math.Abs(vector6.X) > 40f || Math.Abs(vector6.Y) > 10f) { @@ -242,7 +243,7 @@ namespace CalamityMod.Projectiles.Summon projectile.ai[1] += 1f; } } - if (projectile.ai[1] > 60f) + if (projectile.ai[1] > 75f) { projectile.ai[1] = 0f; projectile.netUpdate = true; diff --git a/Projectiles/Summon/SiriusMinion.cs b/Projectiles/Summon/SiriusMinion.cs index 3631108e70..44c0368aaf 100644 --- a/Projectiles/Summon/SiriusMinion.cs +++ b/Projectiles/Summon/SiriusMinion.cs @@ -150,14 +150,8 @@ namespace CalamityMod.Projectiles.Summon } } - public override Color? GetAlpha(Color lightColor) - { - return new Color(200, 200, 200, 200); - } + public override Color? GetAlpha(Color lightColor) => new Color(200, 200, 200, 200); - public override bool CanDamage() - { - return false; - } + public override bool CanDamage() => false; } } diff --git a/Projectiles/Summon/WaterElementalMinion.cs b/Projectiles/Summon/WaterElementalMinion.cs index e306f656ce..76041204bb 100644 --- a/Projectiles/Summon/WaterElementalMinion.cs +++ b/Projectiles/Summon/WaterElementalMinion.cs @@ -90,8 +90,8 @@ namespace CalamityMod.Projectiles.Summon projectile.position.Y = player.Center.Y - (float)(projectile.height / 2) + player.gfxOffY - 180f; if (player.gravDir == -1f) { - projectile.position.Y = projectile.position.Y + 360f; - projectile.rotation = 3.14f; + projectile.position.Y += 360f; + projectile.rotation = MathHelper.Pi; } else { @@ -101,6 +101,10 @@ namespace CalamityMod.Projectiles.Summon projectile.position.Y = (float)(int)projectile.position.Y; if (projectile.owner == Main.myPlayer) { + // Prevent firing immediately + if (projectile.localAI[0] < 120f) + projectile.localAI[0] += 1f; + if (projectile.ai[0] != 0f) { projectile.ai[0] -= 1f; @@ -145,7 +149,7 @@ namespace CalamityMod.Projectiles.Summon } } } - if (flag18) + if (flag18 && projectile.localAI[0] >= 120f) { float num516 = num506; float num517 = num507; diff --git a/Projectiles/Typeless/AstralSpray.cs b/Projectiles/Typeless/AstralSpray.cs index cde6a93d77..e698101cd7 100644 --- a/Projectiles/Typeless/AstralSpray.cs +++ b/Projectiles/Typeless/AstralSpray.cs @@ -1,7 +1,7 @@ - using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Typeless { @@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Typeless public override bool PreAI() { - if (projectile.owner == Main.myPlayer) + if (projectile.owner == Main.myPlayer/* && Main.netMode != NetmodeID.MultiplayerClient*/) { int x = (int)(projectile.Center.X / 16f); int y = (int)(projectile.Center.Y / 16f); diff --git a/Projectiles/Typeless/SabatonSlam.cs b/Projectiles/Typeless/SabatonSlam.cs index d3706be6c3..83fefd68d1 100644 --- a/Projectiles/Typeless/SabatonSlam.cs +++ b/Projectiles/Typeless/SabatonSlam.cs @@ -1,8 +1,8 @@ +using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Terraria; -using Terraria.ModLoader; -using CalamityMod.Dusts; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Typeless { @@ -11,7 +11,7 @@ namespace CalamityMod.Projectiles.Typeless public override void SetDefaults() { projectile.width = 10; - projectile.height = 50; + projectile.height = 35; projectile.friendly = true; projectile.timeLeft = 300; projectile.tileCollide = true; @@ -31,12 +31,15 @@ namespace CalamityMod.Projectiles.Typeless public override bool OnTileCollide(Vector2 oldVelocity) { - //Spawns the shockwave - Projectile.NewProjectile(projectile.position.X + 25, projectile.position.Y + 25, 0f, 0f, ModContent.ProjectileType(), 300, 12, projectile.owner); - Main.PlaySound(SoundID.Item14, projectile.position); Player player = Main.player[projectile.owner]; - player.Calamity().gSabatonFall = 0; - projectile.Kill(); + //Spawns the shockwave + if (Main.myPlayer == projectile.owner) + { + Projectile.NewProjectile(projectile.position.X + 25, projectile.position.Y + 25, 0f, 0f, ModContent.ProjectileType(), (int)(300 * player.AverageDamage()), 12, projectile.owner); + Main.PlaySound(SoundID.Item14, projectile.position); + player.Calamity().gSabatonFall = 0; + projectile.Kill(); + } //Pretty things for (int dustexplode = 0; dustexplode < 360; dustexplode++) { diff --git a/Projectiles/Typeless/StarStruckWaterBottle.cs b/Projectiles/Typeless/StarStruckWaterBottle.cs index c68aca2b40..2f45c6cbb8 100644 --- a/Projectiles/Typeless/StarStruckWaterBottle.cs +++ b/Projectiles/Typeless/StarStruckWaterBottle.cs @@ -38,10 +38,10 @@ namespace CalamityMod.Projectiles.Typeless { Main.PlaySound(SoundID.Shatter, (int) projectile.position.X, (int) projectile.position.Y, 1, 1f, 0.0f); for (int index = 0; index < 5; ++index) - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 13, 0f, 0f, 0, new Color(), 1f); + Dust.NewDust(projectile.position, projectile.width, projectile.height, 13, 0f, 0f, 0, new Color(), 1f); for (int index1 = 0; index1 < 30; ++index1) { - int index2 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, ModContent.DustType(), 0f, -2f, 0, new Color(), 1.1f); + int index2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, ModContent.DustType(), 0f, -2f, 0, new Color(), 1.1f); Dust dust = Main.dust[index2]; dust.alpha = 100; dust.velocity.X *= 1.5f; diff --git a/Projectiles/Typeless/WaterConvertor.cs b/Projectiles/Typeless/WaterConvertor.cs index c0d20765af..63ec125038 100644 --- a/Projectiles/Typeless/WaterConvertor.cs +++ b/Projectiles/Typeless/WaterConvertor.cs @@ -1,5 +1,6 @@ using CalamityMod.World; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Typeless { @@ -28,7 +29,7 @@ namespace CalamityMod.Projectiles.Typeless public void ConvertShit(Projectile projectile) { - if (projectile.owner == Main.myPlayer) + if (projectile.owner == Main.myPlayer/* && Main.netMode != NetmodeID.MultiplayerClient*/) { int x = (int)(projectile.Center.X / 16f); int y = (int)(projectile.Center.Y / 16f); diff --git a/Sounds/Item/PwnagehammerHoming.cs b/Sounds/Item/PwnagehammerHoming.cs new file mode 100644 index 0000000000..341f6d9b99 --- /dev/null +++ b/Sounds/Item/PwnagehammerHoming.cs @@ -0,0 +1,18 @@ +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.Item +{ + public class PwnagehammerHoming : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} diff --git a/Sounds/Item/PwnagehammerHoming.ogg b/Sounds/Item/PwnagehammerHoming.ogg new file mode 100644 index 0000000000..808b8619cf Binary files /dev/null and b/Sounds/Item/PwnagehammerHoming.ogg differ diff --git a/Sounds/Item/PwnagehammerSound.cs b/Sounds/Item/PwnagehammerSound.cs new file mode 100644 index 0000000000..7bc2da6813 --- /dev/null +++ b/Sounds/Item/PwnagehammerSound.cs @@ -0,0 +1,18 @@ +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.Item +{ + public class PwnagehammerSound : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} diff --git a/Sounds/Item/PwnagehammerSound.ogg b/Sounds/Item/PwnagehammerSound.ogg new file mode 100644 index 0000000000..d27268a073 Binary files /dev/null and b/Sounds/Item/PwnagehammerSound.ogg differ diff --git a/Utilities/CalamityUtils.cs b/Utilities/CalamityUtils.cs index 30ed3cb883..873c5f4bff 100644 --- a/Utilities/CalamityUtils.cs +++ b/Utilities/CalamityUtils.cs @@ -371,8 +371,9 @@ namespace CalamityMod /// /// The position where we wish to check for nearby NPCs /// Maximum amount of pixels to check around the origin + /// Whether to ignore tiles when finding a target or not /// Whether bosses should be prioritized in targetting or not - public static NPC ClosestNPCAt(this Vector2 origin, float maxDistanceToCheck, bool bossPriority = false) + public static NPC ClosestNPCAt(this Vector2 origin, float maxDistanceToCheck, bool ignoreTiles = true, bool bossPriority = false) { NPC closestTarget = null; float distance = maxDistanceToCheck; @@ -381,14 +382,20 @@ namespace CalamityMod bool bossFound = false; for (int index = 0; index < Main.npc.Length; index++) { - //if we've found a valid boss target, ignore ALL targets which aren't bosses. - if (bossFound && !Main.npc[index].boss) + // If we've found a valid boss target, ignore ALL targets which aren't bosses. + if (bossFound && !(Main.npc[index].boss || Main.npc[index].type == NPCID.WallofFleshEye)) continue; if (Main.npc[index].CanBeChasedBy(null, false)) { - if (Vector2.Distance(origin, Main.npc[index].Center) < distance) + float extraDistance = (Main.npc[index].width / 2) + (Main.npc[index].height / 2); + + bool canHit = true; + if (extraDistance < distance && !ignoreTiles) + canHit = Collision.CanHit(origin, 1, 1, Main.npc[index].Center, 1, 1); + + if (Vector2.Distance(origin, Main.npc[index].Center) < (distance + extraDistance) && canHit) { - if (Main.npc[index].boss) + if (Main.npc[index].boss || Main.npc[index].type == NPCID.WallofFleshEye) bossFound = true; distance = Vector2.Distance(origin, Main.npc[index].Center); closestTarget = Main.npc[index]; @@ -402,7 +409,13 @@ namespace CalamityMod { if (Main.npc[index].CanBeChasedBy(null, false)) { - if (Vector2.Distance(origin, Main.npc[index].Center) < distance) + float extraDistance = (Main.npc[index].width / 2) + (Main.npc[index].height / 2); + + bool canHit = true; + if (extraDistance < distance && !ignoreTiles) + canHit = Collision.CanHit(origin, 1, 1, Main.npc[index].Center, 1, 1); + + if (Vector2.Distance(origin, Main.npc[index].Center) < (distance + extraDistance) && canHit) { distance = Vector2.Distance(origin, Main.npc[index].Center); closestTarget = Main.npc[index]; @@ -418,13 +431,14 @@ namespace CalamityMod /// The position where we wish to check for nearby NPCs /// Maximum amount of pixels to check around the origin /// Owner of the minion - public static NPC MinionHoming(this Vector2 origin, float maxDistanceToCheck, Player owner) + /// Whether to ignore tiles when finding a target or not + public static NPC MinionHoming(this Vector2 origin, float maxDistanceToCheck, Player owner, bool ignoreTiles = true) { if (owner.HasMinionAttackTargetNPC) { return Main.npc[owner.MinionAttackTargetNPC]; } - return ClosestNPCAt(origin, maxDistanceToCheck); + return ClosestNPCAt(origin, maxDistanceToCheck, ignoreTiles); } /// @@ -743,6 +757,10 @@ namespace CalamityMod #region Projectile Utilities public static int CountProjectiles(int Type) => Main.projectile.Count(proj => proj.type == Type && proj.active); + public static int CountHookProj() => Main.projectile.Count(proj => Main.projHook[proj.type] && proj.ai[0] == 2f && proj.active && proj.owner == Main.myPlayer); + + public static bool IsSummon(this Projectile proj) => proj.minion || proj.sentry || CalamityMod.projectileMinionList.Contains(proj.type) || ProjectileID.Sets.MinionShot[proj.type] || ProjectileID.Sets.SentryShot[proj.type]; + public static void KillAllHostileProjectiles() { for (int x = 0; x < Main.maxProjectiles; x++) diff --git a/World/Abyss.cs b/World/Abyss.cs index 802985206d..e74b91323e 100644 --- a/World/Abyss.cs +++ b/World/Abyss.cs @@ -665,19 +665,53 @@ namespace CalamityMod.World #endregion #region Removal of stupid Tiles above the Sea + + public static List OtherTilesForSulphSeaToDestroy = new List() + { + TileID.PalmTree, + TileID.Sunflower, + TileID.CorruptThorns, + TileID.CrimtaneThorns, + TileID.CorruptGrass, + TileID.CorruptPlants, + TileID.Stalactite, + TileID.ImmatureHerbs, + TileID.MatureHerbs, + }; + + public static List WallsForSulphSeaToDestroy = new List() + { + WallID.Dirt, + WallID.DirtUnsafe, + WallID.DirtUnsafe1, + WallID.DirtUnsafe2, + WallID.DirtUnsafe3, + WallID.DirtUnsafe4, + WallID.Cave6Unsafe, // Rocky dirt wall + WallID.GrassUnsafe, + WallID.CorruptGrassUnsafe, + WallID.EbonstoneUnsafe, + WallID.CrimstoneUnsafe, + }; public static void RemoveStupidTilesAboveSea() { for (int x = 0; x < BiomeWidth; x++) { int trueX = CalamityWorld.abyssSide ? x : Main.maxTilesX - x; - for (int y = YStart - 100; y < YStart + 60; y++) + for (int y = YStart - 140; y < YStart + 80; y++) { - if (YStartWhitelist.Contains(CalamityUtils.ParanoidTileRetrieval(trueX, y).type)) + int type = CalamityUtils.ParanoidTileRetrieval(trueX, y).type; + if (YStartWhitelist.Contains(type) || + OtherTilesForSulphSeaToDestroy.Contains(type)) { if (Main.tile[trueX, y] == null) Main.tile[trueX, y] = new Tile(); Main.tile[trueX, y].active(false); } + if (WallsForSulphSeaToDestroy.Contains(Main.tile[trueX, y].wall)) + { + Main.tile[trueX, y].wall = 0; + } } } } @@ -723,11 +757,9 @@ namespace CalamityMod.World public static void DetermineYStart() { int maxHeight = 0; - for (int i = 0; i < BiomeWidth - 18; i++) + for (int i = 40; i < BiomeWidth + 30; i++) { - int xCheck = CalamityWorld.abyssSide ? - BiomeWidth - i : - Main.maxTilesX - BiomeWidth + i; + int xCheck = CalamityWorld.abyssSide ? i : Main.maxTilesX - i; int YStart = (int)WorldGen.worldSurfaceLow - 20; // 30 tiles below the absolute lowest a floating island can spawn while (!Main.tile[xCheck, YStart].active() || !YStartWhitelist.Contains(Main.tile[xCheck, YStart].type)) { diff --git a/World/CalamityWorld.cs b/World/CalamityWorld.cs index 78b91179df..2c3a6791c7 100644 --- a/World/CalamityWorld.cs +++ b/World/CalamityWorld.cs @@ -60,6 +60,8 @@ namespace CalamityMod.World public static bool dragonScalesBought = false; private const int saveVersion = 0; public static int ArmoredDiggerSpawnCooldown = 0; + public static int MoneyStolenByBandit = 0; + public static int Reforges; //Boss Rush public static bool bossRushActive = false; //Whether Boss Rush is active or not @@ -383,6 +385,12 @@ namespace CalamityMod.World }, { "acidRainPoints", acidRainPoints + }, + { + "Reforges", Reforges + }, + { + "MoneyStolenByBandit", MoneyStolenByBandit } }; } @@ -447,6 +455,8 @@ namespace CalamityMod.World abyssChasmBottom = tag.GetInt("abyssChasmBottom"); acidRainPoints = tag.GetInt("acidRainPoints"); + Reforges = tag.GetInt("Reforges"); + MoneyStolenByBandit = tag.GetInt("MoneyStolenByBandit"); } #endregion @@ -456,6 +466,8 @@ namespace CalamityMod.World int loadVersion = reader.ReadInt32(); abyssChasmBottom = reader.ReadInt32(); acidRainPoints = reader.ReadInt32(); + Reforges = reader.ReadInt32(); + MoneyStolenByBandit = reader.ReadInt32(); if (loadVersion == 0) { @@ -641,6 +653,8 @@ namespace CalamityMod.World writer.Write(flags8); writer.Write(abyssChasmBottom); writer.Write(acidRainPoints); + writer.Write(Reforges); + writer.Write(MoneyStolenByBandit); } #endregion @@ -730,6 +744,8 @@ namespace CalamityMod.World abyssChasmBottom = reader.ReadInt32(); acidRainPoints = reader.ReadInt32(); + Reforges = reader.ReadInt32(); + MoneyStolenByBandit = reader.ReadInt32(); } #endregion @@ -1681,7 +1697,7 @@ namespace CalamityMod.World } } - if (death && !CalamityPlayer.areThereAnyDamnBosses && !Main.snowMoon && !Main.pumpkinMoon && !DD2Event.Ongoing && player.statLifeMax2 >= 300) //does not occur while a boss is alive or during certain events + if (death && !CalamityPlayer.areThereAnyDamnBosses && !Main.snowMoon && !Main.pumpkinMoon && !DD2Event.Ongoing && player.statLifeMax2 >= 300 && !WorldGen.spawnEye && WorldGen.spawnHardBoss <= 0) //does not occur while a boss is alive or during certain events { if (bossSpawnCountdown <= 0 && deathBossSpawnCooldown <= 0) // Check for countdown and cooldown being 0 {