diff --git a/Buffs/Potions/BaguetteBuff.cs b/Buffs/Potions/BaguetteBuff.cs new file mode 100644 index 0000000000..e798ca216e --- /dev/null +++ b/Buffs/Potions/BaguetteBuff.cs @@ -0,0 +1,23 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.Potions +{ + public class BaguetteBuff : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Baguette"); + Description.SetDefault("If only I knew... ~Cirrus"); + Main.debuff[Type] = false; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = false; + longerExpertDebuff = false; + } + + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().baguette = true; + } + } +} \ No newline at end of file diff --git a/Buffs/Potions/BaguetteBuff.png b/Buffs/Potions/BaguetteBuff.png new file mode 100644 index 0000000000..e714108f42 Binary files /dev/null and b/Buffs/Potions/BaguetteBuff.png differ diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index c387f8a456..8051352913 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -81,6 +81,8 @@ namespace CalamityMod.CalPlayer public int minionSlotStat = 0; public int lifeRegenStat = 0; public int manaRegenStat = 0; + public int ammoReductionRanged = 0; + public int ammoReductionRogue = 0; public int armorPenetrationStat = 0; public int wingFlightTimeStat = 0; public int adrenalineChargeStat = 0; @@ -118,8 +120,6 @@ namespace CalamityMod.CalPlayer public bool playRogueStealthSound = false; public bool playFullRageSound = true; public bool playFullAdrenalineSound = true; - public bool playAdrenalineBurnoutSound = true; - public bool playFullAdrenalineBurnoutSound = true; // Proficiency public int meleeLevel = 0; @@ -193,9 +193,6 @@ namespace CalamityMod.CalPlayer // Adrenaline public int adrenalineMax = 10000; - public int adrenalineMaxTimer = 300; - public int adrenalineDmgDown = 600; - public float adrenalineDmgMult = 1f; public int adrenaline; public int adrenalineCD; public bool adrenalineMode = false; @@ -371,6 +368,9 @@ namespace CalamityMod.CalPlayer public bool dynamoStemCells = false; public bool etherealExtorter = false; public bool blazingCore = false; + public bool voltaicJelly = false; + public bool jellyChargedBattery = false; + public float jellyDmg; //public bool dukeScales = false; public bool sandWaifu = false; public bool sandBoobWaifu = false; @@ -578,6 +578,7 @@ namespace CalamityMod.CalPlayer public bool draconicSurge = false; public int draconicSurgeCooldown = 0; public bool tesla = false; + public bool baguette = false; public bool vodka = false; public bool redWine = false; public bool grapeBeer = false; @@ -1161,6 +1162,8 @@ namespace CalamityMod.CalPlayer etherealExtorter = false; //dukeScales = false; blazingCore = false; + voltaicJelly = false; + jellyChargedBattery = false; veneratedLocket = false; daedalusReflect = false; @@ -1302,6 +1305,7 @@ namespace CalamityMod.CalPlayer profanedRage = false; draconicSurge = false; tesla = false; + baguette = false; trippy = false; amidiasBlessing = false; yPower = false; @@ -1441,9 +1445,6 @@ namespace CalamityMod.CalPlayer galileoCooldown = 0; stress = 0; adrenaline = 0; - adrenalineMaxTimer = 300; - adrenalineDmgDown = 600; - adrenalineDmgMult = 1f; raiderStack = 0; raiderCooldown = 0; gSabatonFall = 0; @@ -1559,6 +1560,7 @@ namespace CalamityMod.CalPlayer holyWrath = false; profanedRage = false; tesla = false; + baguette = false; draconicSurge = false; draconicSurgeCooldown = 0; yPower = false; @@ -2304,7 +2306,7 @@ namespace CalamityMod.CalPlayer player.AddBuff(ModContent.BuffType(), 300); } } - if (CalamityMod.AdrenalineHotKey.JustPressed) + if (CalamityMod.AdrenalineHotKey.JustPressed && Config.AdrenalineAndRage && CalamityWorld.revenge) { if (adrenaline == adrenalineMax && !adrenalineMode) { @@ -4277,8 +4279,7 @@ namespace CalamityMod.CalPlayer { if (item.melee) { - double damageMultAdr = 1.5 * (double)adrenalineDmgMult; - damageMult += damageMultAdr; + damageMult += 1.5; } } } @@ -4541,7 +4542,7 @@ namespace CalamityMod.CalPlayer { damageMult += 0.33; } - if (CalamityWorld.revenge) + if (CalamityWorld.revenge && Config.AdrenalineAndRage) { bool DHorHoD = draedonsHeart || heartOfDarkness; if (rageMode && adrenalineMode) @@ -4567,8 +4568,7 @@ namespace CalamityMod.CalPlayer { if (hasClassType) { - double damageMultAdr = 1.5 * (double)adrenalineDmgMult; - damageMult += damageMultAdr; + damageMult += 1.5; } } } @@ -5524,7 +5524,7 @@ namespace CalamityMod.CalPlayer } // Fearmonger set provides 15% multiplicative DR that ignores caps during the Holiday Moons. // To prevent abuse, this effect does not work if there are any bosses alive. - if(fearmongerSet && !areThereAnyDamnBosses && (Main.pumpkinMoon || Main.snowMoon)) + if (fearmongerSet && !areThereAnyDamnBosses && (Main.pumpkinMoon || Main.snowMoon)) { damage = (int)(damage * 0.85f); } @@ -5540,8 +5540,15 @@ namespace CalamityMod.CalPlayer { if (!CalamityWorld.downedBossAny) damage = (int)((double)damage * 0.8); + + if (Config.AdrenalineAndRage) + { + if (adrenaline == adrenalineMax && !adrenalineMode) + damage = (int)((double)damage * 0.5); + } } - if (player.mount.Active && (player.mount.Type == ModContent.MountType() || player.mount.Type == ModContent.MountType()) && Math.Abs(player.velocity.X) > player.mount.RunSpeed / 2f) + if (player.mount.Active && (player.mount.Type == ModContent.MountType() || player.mount.Type == ModContent.MountType()) + && Math.Abs(player.velocity.X) > player.mount.RunSpeed / 2f) { damage = (int)((double)damage * 0.9); } @@ -5583,21 +5590,24 @@ namespace CalamityMod.CalPlayer modStealth = 1f; if (player.whoAmI == Main.myPlayer) { - if (rageMode) - { - stress = 0; - if (player.FindBuffIndex(ModContent.BuffType()) > -1) - player.ClearBuff(ModContent.BuffType()); - } + if (Config.AdrenalineAndRage && CalamityWorld.revenge) + { + if (rageMode) + { + stress = 0; + if (player.FindBuffIndex(ModContent.BuffType()) > -1) + player.ClearBuff(ModContent.BuffType()); + } + if (!adrenalineMode) + { + adrenaline = 0; + } + } if (amidiasBlessing) { player.ClearBuff(ModContent.BuffType()); Main.PlaySound(2, (int)player.position.X, (int)player.position.Y, 96); } - if (!adrenalineMode && adrenaline != adrenalineMax) - { - adrenaline = 0; - } if ((gShell || fabledTortoise) && !player.panic) { player.AddBuff(ModContent.BuffType(), 300); diff --git a/CalPlayer/CalamityPlayerLifeRegen.cs b/CalPlayer/CalamityPlayerLifeRegen.cs index 48aec96df5..7fd16481c8 100644 --- a/CalPlayer/CalamityPlayerLifeRegen.cs +++ b/CalPlayer/CalamityPlayerLifeRegen.cs @@ -170,6 +170,8 @@ namespace CalamityMod.CalPlayer { modPlayer.alcoholPoisonLevel++; player.lifeRegen -= 1; + if (modPlayer.baguette) + player.lifeRegen -= 3; } if (modPlayer.grapeBeer) { diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index 0cdf39e717..221ffbfe1d 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -168,47 +168,6 @@ namespace CalamityMod.CalPlayer player.AddBuff(ModContent.BuffType(), 18000); } - // Play Adrenaline burnout sounds that happen the more time you wait while having max Adrenaline - if (modPlayer.adrenaline >= modPlayer.adrenalineMax) - { - modPlayer.adrenalineMaxTimer--; - if (modPlayer.adrenalineMaxTimer <= 0) - { - if (modPlayer.playAdrenalineBurnoutSound) - { - modPlayer.playAdrenalineBurnoutSound = false; - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/AdrenalineBurnout1"), (int)player.position.X, (int)player.position.Y); - } - - modPlayer.adrenalineDmgDown--; - if (modPlayer.adrenalineDmgDown < 0) - { - if (modPlayer.playFullAdrenalineBurnoutSound) - { - modPlayer.playFullAdrenalineBurnoutSound = false; - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/AdrenalineBurnout2"), (int)player.position.X, (int)player.position.Y); - } - modPlayer.adrenalineDmgDown = 0; - } - modPlayer.adrenalineMaxTimer = 0; - } - } - - // Reset Adrenaline burnout variables - else if (!modPlayer.adrenalineMode && modPlayer.adrenaline <= 0) - { - modPlayer.playAdrenalineBurnoutSound = true; - modPlayer.playFullAdrenalineBurnoutSound = true; - modPlayer.adrenalineDmgDown = 600; - modPlayer.adrenalineMaxTimer = 300; - modPlayer.adrenalineDmgMult = 1f; - } - - // Reduce Adrenaline Mode damage based on burnout - modPlayer.adrenalineDmgMult = 0.1f * (float)(modPlayer.adrenalineDmgDown / 60); - if (modPlayer.adrenalineDmgMult < 0.33f) - modPlayer.adrenalineDmgMult = 0.33f; - // Amount of Adrenaline gained per 'tick' int adrenalineGain = 0; bool SCalAlive = NPC.AnyNPCs(ModContent.NPCType()); @@ -486,6 +445,8 @@ namespace CalamityMod.CalPlayer modPlayer.plaguedFuelPackCooldown--; if (modPlayer.plaguedFuelPackDash > 0) modPlayer.plaguedFuelPackDash--; + if (modPlayer.jellyDmg > 0f) + modPlayer.jellyDmg -= 1f; if (modPlayer.ataxiaDmg > 0f) modPlayer.ataxiaDmg -= 1.5f; if (modPlayer.ataxiaDmg < 0f) @@ -2806,6 +2767,15 @@ namespace CalamityMod.CalPlayer modPlayer.critStats[1] = player.rangedCrit; modPlayer.critStats[2] = player.magicCrit; modPlayer.critStats[3] = modPlayer.throwingCrit; + modPlayer.ammoReductionRanged = (int)(100f * + (player.ammoBox ? 0.8f : 1f) * + (player.ammoPotion ? 0.8f : 1f) * + (player.ammoCost80 ? 0.8f : 1f) * + (player.ammoCost75 ? 0.75f : 1f)); + modPlayer.ammoReductionRogue = (int)(100f * + (modPlayer.throwingAmmoCost75 ? 0.75f : 1f) * + (modPlayer.throwingAmmoCost66 ? 0.66f : 1f) * + (modPlayer.throwingAmmoCost50 ? 0.5f : 1f)); modPlayer.defenseStat = player.statDefense; modPlayer.DRStat = (int)(player.endurance * 100f); modPlayer.meleeSpeedStat = (int)((1f - player.meleeSpeed) * (100f / player.meleeSpeed)); diff --git a/Items/Accessories/JellyChargedBattery.cs b/Items/Accessories/JellyChargedBattery.cs new file mode 100644 index 0000000000..24ae399c7d --- /dev/null +++ b/Items/Accessories/JellyChargedBattery.cs @@ -0,0 +1,43 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Accessories +{ + public class JellyChargedBattery : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Jelly-Charged Battery"); + Tooltip.SetDefault("+1 max minions and 10% minion damage\n" + + "Minion attacks spawn orbs of energy and inflict Electrified"); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 22; + item.value = Item.buyPrice(0, 2, 0, 0); + item.accessory = true; + item.rare = 2; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + player.Calamity().voltaicJelly = true; + player.Calamity().jellyChargedBattery = true; + player.maxMinions ++; + player.minionDamage += 0.1f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddTile(TileID.TinkerersWorkbench); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Accessories/JellyChargedBattery.png b/Items/Accessories/JellyChargedBattery.png new file mode 100644 index 0000000000..e389aad9f4 Binary files /dev/null and b/Items/Accessories/JellyChargedBattery.png differ diff --git a/Items/Accessories/StatMeter.cs b/Items/Accessories/StatMeter.cs index 02f3c77f79..c07acc07d6 100644 --- a/Items/Accessories/StatMeter.cs +++ b/Items/Accessories/StatMeter.cs @@ -31,6 +31,8 @@ namespace CalamityMod.Items.Accessories int manaCost = modPlayer.manaCostStat; int rogueVelocity = modPlayer.rogueVelocityStat; int minionSlots = modPlayer.minionSlotStat; + int ammoConsumption = modPlayer.ammoReductionRanged; + int rogueConsumption = modPlayer.ammoReductionRogue; int lifeRegen = modPlayer.lifeRegenStat; int manaRegen = modPlayer.manaRegenStat; int armorPenetration = modPlayer.armorPenetrationStat; @@ -52,11 +54,12 @@ namespace CalamityMod.Items.Accessories "Melee Damage: " + modPlayer.damageStats[0] + "% | Melee Crit Chance: " + modPlayer.critStats[0] + "%\n" + "Melee Speed Boost: " + meleeSpeed + "%\n\n" + "Ranged Damage: " + modPlayer.damageStats[1] + "% | Ranged Crit Chance: " + modPlayer.critStats[1] + "%\n\n" + + "Ammo Consumption Chance: " + modPlayer.ammoReductionRanged + "%\n" + "Magic Damage: " + modPlayer.damageStats[2] + "% | Magic Crit Chance: " + modPlayer.critStats[2] + "%\n" + "Mana Usage: " + manaCost + "% | Mana Regen: " + manaRegen + "\n\n" + "Minion Damage: " + modPlayer.damageStats[3] + "% | Minion Slots: " + minionSlots + "\n\n" + "Rogue Damage: " + modPlayer.damageStats[4] + "% | Rogue Crit Chance: " + modPlayer.critStats[3] + "%\n" + - "Rogue Velocity Boost: " + rogueVelocity + "%\n\n" + + "Rogue Velocity Boost: " + rogueVelocity + "% | Rogue Weapon Consumption Chance: " + modPlayer.ammoReductionRogue + "%\n\n" + "Defense: " + defense + " | DR: " + DR + "%\n" + "Life Regen: " + lifeRegen + " | Armor Penetration: " + armorPenetration + "\n" + "Wing Flight Time: " + wingFlightTime + " | Movement Speed Boost: " + moveSpeed + "%\n\n" + @@ -81,11 +84,12 @@ namespace CalamityMod.Items.Accessories line2.text = "Melee Damage: " + modPlayer.damageStats[0] + "% | Melee Crit Chance: " + modPlayer.critStats[0] + "%\n" + "Melee Speed Boost: " + meleeSpeed + "%\n\n" + "Ranged Damage: " + modPlayer.damageStats[1] + "% | Ranged Crit Chance: " + modPlayer.critStats[1] + "%\n\n" + + "Ammo Consumption Chance: " + modPlayer.ammoReductionRanged + "%\n" + "Magic Damage: " + modPlayer.damageStats[2] + "% | Magic Crit Chance: " + modPlayer.critStats[2] + "%\n" + "Mana Usage: " + manaCost + "% | Mana Regen: " + manaRegen + "\n\n" + "Minion Damage: " + modPlayer.damageStats[3] + "% | Minion Slots: " + minionSlots + "\n\n" + "Rogue Damage: " + modPlayer.damageStats[4] + "% | Rogue Crit Chance: " + modPlayer.critStats[3] + "%\n" + - "Rogue Velocity Boost: " + rogueVelocity + "%\n\n" + + "Rogue Velocity Boost: " + rogueVelocity + "% | Rogue Weapon Consumption Chance: " + modPlayer.ammoReductionRogue + "%\n\n" + "Defense: " + defense + " | DR: " + DR + "%\n" + "Life Regen: " + lifeRegen + " | Armor Penetration: " + armorPenetration + "\n" + "Wing Flight Time: " + wingFlightTime + " | Movement Speed Boost: " + moveSpeed + "%\n\n" + diff --git a/Items/Accessories/VoltaicJelly.cs b/Items/Accessories/VoltaicJelly.cs new file mode 100644 index 0000000000..6d2d9aa06a --- /dev/null +++ b/Items/Accessories/VoltaicJelly.cs @@ -0,0 +1,31 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Accessories +{ + public class VoltaicJelly : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Voltaic Jelly"); + Tooltip.SetDefault("+1 max minions\n" + + "Minion attacks inflict Electrified"); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 22; + item.value = Item.buyPrice(0, 2, 0, 0); + item.accessory = true; + item.rare = 2; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + player.Calamity().voltaicJelly = true; + player.maxMinions ++; + } + } +} diff --git a/Items/Accessories/VoltaicJelly.png b/Items/Accessories/VoltaicJelly.png new file mode 100644 index 0000000000..65597b8bad Binary files /dev/null and b/Items/Accessories/VoltaicJelly.png differ diff --git a/Items/Accessories/WulfrumBattery.cs b/Items/Accessories/WulfrumBattery.cs new file mode 100644 index 0000000000..cb3c294c11 --- /dev/null +++ b/Items/Accessories/WulfrumBattery.cs @@ -0,0 +1,29 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Accessories +{ + public class WulfrumBattery : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Wulfrum Battery"); + Tooltip.SetDefault("7% increased summon damage"); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 22; + item.value = Item.buyPrice(0, 1, 0, 0); + item.accessory = true; + item.rare = 1; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + player.minionDamage += 0.07f; + } + } +} diff --git a/Items/Accessories/WulfrumBattery.png b/Items/Accessories/WulfrumBattery.png new file mode 100644 index 0000000000..3bc19a4875 Binary files /dev/null and b/Items/Accessories/WulfrumBattery.png differ diff --git a/Items/Armor/StatigelMask.cs b/Items/Armor/StatigelMask.cs index 6b3dcd6fa0..1167cf4cc6 100644 --- a/Items/Armor/StatigelMask.cs +++ b/Items/Armor/StatigelMask.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Armor public override void SetStaticDefaults() { DisplayName.SetDefault("Statigel Mask"); - Tooltip.SetDefault("10% increased rogue damage and 33% chance to not consume rogue items\n" + + Tooltip.SetDefault("10% increased rogue damage and 34% chance to not consume rogue items\n" + "7% increased rogue critical strike chance and 12% increased movement speed"); } diff --git a/Items/Armor/XerocCuisses.cs b/Items/Armor/XerocCuisses.cs index 6fac4d72ec..78a8171871 100644 --- a/Items/Armor/XerocCuisses.cs +++ b/Items/Armor/XerocCuisses.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Armor item.width = 18; item.height = 18; item.value = Item.buyPrice(0, 24, 0, 0); - item.rare = 9; + item.rare = 10; item.defense = 24; } diff --git a/Items/Armor/XerocMask.cs b/Items/Armor/XerocMask.cs index 12a2412850..3e4e6cae64 100644 --- a/Items/Armor/XerocMask.cs +++ b/Items/Armor/XerocMask.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Armor item.width = 18; item.height = 18; item.value = Item.buyPrice(0, 40, 0, 0); - item.rare = 9; + item.rare = 10; item.defense = 20; //71 } diff --git a/Items/Armor/XerocPlateMail.cs b/Items/Armor/XerocPlateMail.cs index a5c74abd50..98fc0c6407 100644 --- a/Items/Armor/XerocPlateMail.cs +++ b/Items/Armor/XerocPlateMail.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Armor item.width = 18; item.height = 18; item.value = Item.buyPrice(0, 32, 0, 0); - item.rare = 9; + item.rare = 10; item.defense = 27; } diff --git a/Items/Potions/Alcohol/RedWine.cs b/Items/Potions/Alcohol/RedWine.cs index 24c4a9dbbb..9f4effa5e2 100644 --- a/Items/Potions/Alcohol/RedWine.cs +++ b/Items/Potions/Alcohol/RedWine.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.Alcohol; +using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -36,10 +37,30 @@ Too dry for my taste"); return player.FindBuffIndex(BuffID.PotionSickness) == -1; } - public override bool UseItem(Player 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); - return true; + } + + // 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 new file mode 100644 index 0000000000..5a35497766 --- /dev/null +++ b/Items/Potions/Baguette.cs @@ -0,0 +1,50 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Buffs.Potions; + +namespace CalamityMod.Items.Potions +{ + public class Baguette : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Baguette"); + Tooltip.SetDefault("Minor improvements to all stats for 20 minutes\n" + + "Boosts the effects of Red Wine\n" + + "[c/FCE391:je suis Monte]"); + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.useTurn = true; + item.maxStack = 30; + item.useAnimation = 17; + item.useTime = 17; + item.rare = 1; + item.useStyle = 2; + item.UseSound = SoundID.Item2; + item.consumable = true; + item.value = Item.buyPrice(0, 0, 50, 0); + item.buffType = ModContent.BuffType(); + item.buffTime = 18000; + item.Calamity().postMoonLordRarity = 21; + } + + public override void OnConsumeItem(Player player) + { + player.AddBuff(BuffID.WellFed, 72000); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.Hay, 10); + recipe.AddTile(TileID.Furnaces); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} \ No newline at end of file diff --git a/Items/Potions/Baguette.png b/Items/Potions/Baguette.png new file mode 100644 index 0000000000..82450f4989 Binary files /dev/null and b/Items/Potions/Baguette.png differ diff --git a/Items/Weapons/Ranged/AcesHigh.cs b/Items/Weapons/Ranged/AcesHigh.cs new file mode 100644 index 0000000000..b899938b09 --- /dev/null +++ b/Items/Weapons/Ranged/AcesHigh.cs @@ -0,0 +1,86 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Projectiles.Ranged; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Ranged +{ + public class AcesHigh : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ace's High"); + Tooltip.SetDefault("Fires a string of cards with varying effects based on card type\n" + + "Hearts grant lifesteal. Spades pierce and ignore immunity frames.\n" + + "Diamonds explode. Clubs split into three."); + } + + public override void SetDefaults() + { + item.damage = 999; + item.ranged = true; + item.width = 48; + item.height = 30; + item.useTime = 3; + item.reuseDelay = 8; + item.useAnimation = 12; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 6f; + item.value = Item.buyPrice(2, 50, 0, 0); + item.rare = 10; + item.UseSound = SoundID.Item36; + item.autoReuse = true; + item.shootSpeed = 24f; + item.shoot = ModContent.ProjectileType(); + item.useAmmo = 97; + item.Calamity().postMoonLordRarity = 21; + } + + public override Vector2? HoldoutOffset() + { + return new Vector2(-5, 0); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType(), 52); + recipe.AddIngredient(ModContent.ItemType(), 6); + recipe.AddTile(ModContent.TileType()); + 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) + { + int card = ModContent.ProjectileType(); + switch (Main.rand.Next(4)) + { + case 0: + card = ModContent.ProjectileType(); + break; + case 1: + card = ModContent.ProjectileType(); + break; + case 2: + card = ModContent.ProjectileType(); + break; + case 3: + card = ModContent.ProjectileType(); + break; + default: + break; + } + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, card, damage, knockBack, player.whoAmI, 0.0f, 0.0f); + return false; + } + } +} diff --git a/Items/Weapons/Ranged/AcesHigh.png b/Items/Weapons/Ranged/AcesHigh.png new file mode 100644 index 0000000000..d4a74bb7ba Binary files /dev/null and b/Items/Weapons/Ranged/AcesHigh.png differ diff --git a/Items/Weapons/Ranged/ClaretCannon.cs b/Items/Weapons/Ranged/ClaretCannon.cs index fb03083d94..0b2f0dbb5b 100644 --- a/Items/Weapons/Ranged/ClaretCannon.cs +++ b/Items/Weapons/Ranged/ClaretCannon.cs @@ -39,7 +39,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override Vector2? HoldoutOffset() { - return new Vector2(0, -5); + return new Vector2(-5, 0); } public override void AddRecipes() diff --git a/Items/Weapons/Ranged/MagnomalyCannon.cs b/Items/Weapons/Ranged/MagnomalyCannon.cs index 6203417bf3..edd77f00ab 100644 --- a/Items/Weapons/Ranged/MagnomalyCannon.cs +++ b/Items/Weapons/Ranged/MagnomalyCannon.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 1301; + item.damage = 1401; item.ranged = true; item.width = 84; item.height = 30; diff --git a/Items/Weapons/Rogue/Hypothermia.cs b/Items/Weapons/Rogue/Hypothermia.cs new file mode 100644 index 0000000000..d13ff5538d --- /dev/null +++ b/Items/Weapons/Rogue/Hypothermia.cs @@ -0,0 +1,96 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Rogue; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Rogue +{ + public class Hypothermia : RogueWeapon + { + private int counter = 0; + private bool justStealthStriked = false; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Hypothermia"); + Tooltip.SetDefault("Fires a constant barrage of black ice shards\n" + + "Stealth strikes launch a chain short ranged ice chunks that shatter into ice shards"); + } + + public override void SafeSetDefaults() + { + item.width = 46; + item.height = 32; + item.autoReuse = true; + item.noUseGraphic = true; + item.noMelee = true; + item.useStyle = ItemUseStyleID.SwingThrow; + item.UseSound = SoundID.Item9; + item.value = Item.buyPrice(1, 80, 0, 0); + item.rare = 10; + + item.damage = 549; + item.useAnimation = 21; + item.useTime = 3; + item.crit = 16; + item.knockBack = 3f; + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 8f; + + item.Calamity().postMoonLordRarity = 14; + item.Calamity().rogue = true; + } + + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + counter++; + if (counter >= 7) + counter = 0; + + if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike + { + int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); + Main.projectile[stealth].Calamity().stealthStrike = true; + justStealthStriked = true; + return false; + } + if (justStealthStriked == true) //this is Ben, no I don't know how what I did translates to what happened in game but we're rolling with it + { + if (counter == 1 || counter == 2 || counter == 3 || counter == 4 || counter == 5 || counter == 6) + { + if (counter == 6) + { + justStealthStriked = false; + } + return false; + } + } + else + { + int num6 = Main.rand.Next(1, 3); + for (int index = 0; index < num6; ++index) + { + 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, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); + } + } + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 6); + recipe.AddIngredient(ModContent.ItemType(), 24); + recipe.AddIngredient(ModContent.ItemType(), 6); + recipe.AddTile(ModContent.TileType()); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/Rogue/Hypothermia.png b/Items/Weapons/Rogue/Hypothermia.png new file mode 100644 index 0000000000..3eec7e2301 Binary files /dev/null and b/Items/Weapons/Rogue/Hypothermia.png differ diff --git a/Items/Weapons/Rogue/RogueWeapon.cs b/Items/Weapons/Rogue/RogueWeapon.cs index f4dc73825b..f088ae1b35 100644 --- a/Items/Weapons/Rogue/RogueWeapon.cs +++ b/Items/Weapons/Rogue/RogueWeapon.cs @@ -31,6 +31,7 @@ namespace CalamityMod.Items.Weapons.Rogue { crit = item.crit + player.Calamity().throwingCrit; } + public override float UseTimeMultiplier(Player player) { float rogueAS = 1f; diff --git a/Items/Weapons/Rogue/Supernova.cs b/Items/Weapons/Rogue/Supernova.cs index b75aa31dc9..2c94805a36 100644 --- a/Items/Weapons/Rogue/Supernova.cs +++ b/Items/Weapons/Rogue/Supernova.cs @@ -21,7 +21,7 @@ Stealth strikes release energy as they fly"); public override void SafeSetDefaults() { item.width = 34; - item.damage = 1299; + item.damage = 1349; item.noMelee = true; item.noUseGraphic = true; item.useAnimation = 24; diff --git a/Items/Weapons/Summon/LanternoftheSoul.cs b/Items/Weapons/Summon/LanternoftheSoul.cs index 099220453d..cba56d8f19 100644 --- a/Items/Weapons/Summon/LanternoftheSoul.cs +++ b/Items/Weapons/Summon/LanternoftheSoul.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Weapons.Summon { public override void SetStaticDefaults() { - DisplayName.SetDefault("Lantern of the Soul"); + DisplayName.SetDefault("Guidelight of Oblivion"); Tooltip.SetDefault("Summons a lantern turret to fight for you"); } diff --git a/Items/Weapons/Summon/StaffoftheMechworm.cs b/Items/Weapons/Summon/StaffoftheMechworm.cs index f2c44fe0f2..6fad1cc5eb 100644 --- a/Items/Weapons/Summon/StaffoftheMechworm.cs +++ b/Items/Weapons/Summon/StaffoftheMechworm.cs @@ -128,14 +128,17 @@ namespace CalamityMod.Items.Weapons.Summon vector2.X = (float)Main.mouseX + Main.screenPosition.X; vector2.Y = (float)Main.mouseY + Main.screenPosition.Y; int curr = Projectile.NewProjectile(vector2.X, vector2.Y, velX, velY, ModContent.ProjectileType(), damage, knockBack, owner); + int head2 = curr; int prev = curr; curr = Projectile.NewProjectile(vector2.X, vector2.Y, velX, velY, ModContent.ProjectileType(), damage, knockBack, owner, (float)prev); + Main.projectile[curr].identity = head2; prev = curr; curr = Projectile.NewProjectile(vector2.X, vector2.Y, velX, velY, ModContent.ProjectileType(), damage, knockBack, owner, (float)prev); Main.projectile[prev].localAI[1] = (float)curr; Main.projectile[prev].netUpdate = true; + Main.projectile[curr].identity = head2; prev = curr; curr = Projectile.NewProjectile(vector2.X, vector2.Y, velX, velY, ModContent.ProjectileType(), damage, knockBack, owner, (float)prev); @@ -144,18 +147,21 @@ namespace CalamityMod.Items.Weapons.Summon } else if (head != -1 && tail != -1) { - int body = Projectile.NewProjectile(vector2.X, vector2.Y, velX, velY, ModContent.ProjectileType(), damage, knockBack, owner, Main.projectile[tail].ai[0]); + float uuid = (float)Projectile.GetByUUID(Main.myPlayer, Main.projectile[tail].ai[0]); + int body = Projectile.NewProjectile(vector2.X, vector2.Y, velX, velY, ModContent.ProjectileType(), damage, knockBack, owner, uuid); int back = Projectile.NewProjectile(vector2.X, vector2.Y, velX, velY, ModContent.ProjectileType(), damage, knockBack, owner, (float)body); Main.projectile[body].localAI[1] = (float)back; Main.projectile[body].ai[1] = 1f; Main.projectile[body].netUpdate = true; + Main.projectile[body].identity = head; Main.projectile[back].localAI[1] = (float)tail; Main.projectile[back].netUpdate = true; Main.projectile[back].ai[1] = 1f; + Main.projectile[body].identity = head; - Main.projectile[tail].ai[0] = (float)back; + Main.projectile[tail].ai[0] = Main.projectile[body].projUUID; Main.projectile[tail].netUpdate = true; Main.projectile[tail].ai[1] = 1f; } diff --git a/NPCs/CalamityAI.cs b/NPCs/CalamityAI.cs index bc51d8be7b..e0091ab5e8 100644 --- a/NPCs/CalamityAI.cs +++ b/NPCs/CalamityAI.cs @@ -24,6 +24,8 @@ namespace CalamityMod.NPCs public static void AquaticScourgeAI(NPC npc, Mod mod, bool head) { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; + bool death = CalamityWorld.death || CalamityWorld.bossRushActive; // Adjust hostility and stats if (npc.justHit || (double)npc.life <= (double)npc.lifeMax * 0.99 || CalamityWorld.bossRushActive || @@ -52,7 +54,7 @@ namespace CalamityMod.NPCs // Circular movement bool doSpiral = false; - if (head && calamityGlobalNPC.newAI[0] == 1f && calamityGlobalNPC.newAI[2] == 1f && (CalamityWorld.revenge || CalamityWorld.bossRushActive)) + if (head && calamityGlobalNPC.newAI[0] == 1f && calamityGlobalNPC.newAI[2] == 1f && revenge) { float ai3 = 600f; calamityGlobalNPC.newAI[3] += 1f; @@ -151,7 +153,7 @@ namespace CalamityMod.NPCs if (Main.player[npc.target].gravDir == -1f) npc.localAI[0] += 2f; - if (npc.localAI[0] >= (CalamityWorld.bossRushActive ? 300f : (CalamityWorld.revenge ? 360f : 420f))) + if (npc.localAI[0] >= (CalamityWorld.bossRushActive ? 300f : (revenge ? 360f : 420f))) { int npcPosX = (int)(npc.position.X + (float)(npc.width / 2)) / 16; int npcPosY = (int)(npc.position.Y + (float)(npc.height / 2)) / 16; @@ -181,7 +183,7 @@ namespace CalamityMod.NPCs double offsetAngleBoom; int iBoom; int damageBoom = Main.expertMode ? 23 : 28; - float velocity = CalamityWorld.revenge ? 7.5f : 6.5f; + float velocity = revenge ? 7.5f : 6.5f; if (CalamityWorld.bossRushActive) velocity = 11f; @@ -382,7 +384,7 @@ namespace CalamityMod.NPCs if (calamityGlobalNPC.newAI[0] == 1f) { - num188 = CalamityWorld.revenge ? 15f : 13f; + num188 = revenge ? 15f : 13f; num189 = 0.16f; if (notOcean) { @@ -597,6 +599,7 @@ namespace CalamityMod.NPCs bool provy = CalamityWorld.downedProvidence && !CalamityWorld.bossRushActive; bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; + bool death = CalamityWorld.death || CalamityWorld.bossRushActive; bool calamity = modPlayer.ZoneCalamity; // Reset defense @@ -640,11 +643,12 @@ namespace CalamityMod.NPCs speed = 12f; else if (!calamity) speed = 7f; - else if (CalamityWorld.death) + else if (death) speed = 6f; else if (revenge) speed = 5.5f; - speed += 2f * (1f - lifeRatio); + float speedBoost = death ? 2f : 2f * (1f - lifeRatio); + speed += speedBoost; // Variables for target location relative to npc location float xDistance = player.Center.X - vectorCenter.X; @@ -779,7 +783,7 @@ namespace CalamityMod.NPCs if (npc.ai[1] % 30f == 29f) shootProjectile = true; } - else if (lifeRatio < 0.5f || CalamityWorld.death) + else if (lifeRatio < 0.5f || death) { if (npc.ai[1] % 35f == 34f) shootProjectile = true; @@ -798,7 +802,8 @@ namespace CalamityMod.NPCs projectileSpeed += 1f; if (!calamity) projectileSpeed += 2f; - projectileSpeed += 3f * (1f - lifeRatio); + float projectileSpeedBoost = death ? 3f : 3f * (1f - lifeRatio); + projectileSpeed += projectileSpeedBoost; float num742 = CalamityWorld.bossRushActive ? 6f : 4f; float num743 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vectorCenter.X; @@ -900,10 +905,11 @@ namespace CalamityMod.NPCs npc.chaseable = false; if (Main.netMode != NetmodeID.MultiplayerClient) { - npc.localAI[0] += 1f + 2f * (1f - lifeRatio); + float shootBoost = death ? 2f : 2f * (1f - lifeRatio); + npc.localAI[0] += 1f + shootBoost; if (calamityGlobalNPC.enraged > 0 || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) npc.localAI[0] += 2f; - if (CalamityWorld.death || !calamity) + if (death || !calamity) npc.localAI[0] += 1f; if (npc.localAI[0] >= 120f) @@ -1010,6 +1016,7 @@ namespace CalamityMod.NPCs } // Variables for increasing difficulty + bool death = CalamityWorld.death || CalamityWorld.bossRushActive; bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; bool dayTime = Main.dayTime && !CalamityWorld.bossRushActive; @@ -1242,11 +1249,10 @@ namespace CalamityMod.NPCs { if (!brotherAlive) { - npc.localAI[1] += 1f * (1f - lifeRatio); + float shootBoost = death ? 1f : 1f * (1f - lifeRatio); + npc.localAI[1] += shootBoost; if (revenge) npc.localAI[1] += 0.5f; - if (CalamityWorld.death || CalamityWorld.bossRushActive) - npc.localAI[1] += 0.5f; } if (npc.localAI[1] > 180f) @@ -1368,8 +1374,6 @@ namespace CalamityMod.NPCs { if (revenge) npc.localAI[1] += 0.5f; - if (CalamityWorld.death || CalamityWorld.bossRushActive) - npc.localAI[1] += 0.5f; if (calamityGlobalNPC.enraged > 0 || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) npc.localAI[1] += 0.5f; if (expertMode) @@ -1948,21 +1952,22 @@ namespace CalamityMod.NPCs // Percent life remaining float lifeRatio = (float)npc.life / (float)npc.lifeMax; - // Phases - bool phase2 = lifeRatio < 0.75f || CalamityWorld.bossRushActive; - bool phase3 = lifeRatio < 0.5f || CalamityWorld.bossRushActive; - // Variables bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; - int shootBuff = (int)(2f * (1f - lifeRatio)); + bool death = CalamityWorld.death || CalamityWorld.bossRushActive; + int shootBuff = death ? 1 : (int)(2f * (1f - lifeRatio)); float shootTimer = 1f + ((float)shootBuff); bool dayTime = Main.dayTime; Player player = Main.player[npc.target]; npc.spriteDirection = (npc.direction > 0) ? 1 : -1; - // Despawn - if (!player.active || player.dead || dayTime) + // Phases + bool phase2 = lifeRatio < 0.75f || death; + bool phase3 = lifeRatio < 0.5f || death; + + // Despawn + if (!player.active || player.dead || dayTime) { npc.TargetClosest(false); player = Main.player[npc.target]; @@ -2102,8 +2107,9 @@ namespace CalamityMod.NPCs // Walk else if (npc.ai[0] == 2f) { - // Set walking speed - float num823 = (CalamityWorld.bossRushActive ? 8f : 5f) + (3f * (1f - lifeRatio)); + // Set walking speed + float speedBoost = death ? 3f : 3f * (1f - lifeRatio); + float num823 = (CalamityWorld.bossRushActive ? 8f : 5f) + speedBoost; // Set walking direction if (Math.Abs(npc.Center.X - player.Center.X) < 200f) @@ -2195,7 +2201,8 @@ namespace CalamityMod.NPCs // Set jump velocity, reset and set AI to next phase (Stomp) npc.TargetClosest(true); - float velocityX = (CalamityWorld.bossRushActive ? 9f : 6f) + (6f * (1f - lifeRatio)); + float velocityBoost = death ? 6f : 6f * (1f - lifeRatio); + float velocityX = (CalamityWorld.bossRushActive ? 9f : 6f) + velocityBoost; npc.velocity.X = velocityX * (float)npc.direction; if (revenge) @@ -2261,7 +2268,8 @@ namespace CalamityMod.NPCs if (player.position.Y > npc.position.Y + (float)npc.height) { - float fallSpeed = 0.8f + (0.8f * (1f - lifeRatio)); + float fallSpeedBoost = death ? 0.8f : 0.8f * (1f - lifeRatio); + float fallSpeed = 0.8f + fallSpeedBoost; npc.velocity.Y += fallSpeed; } } @@ -2272,7 +2280,8 @@ namespace CalamityMod.NPCs else if (npc.direction > 0) npc.velocity.X += 0.2f; - float num626 = (CalamityWorld.bossRushActive ? 12f : 9f) + (6f * (1f - lifeRatio)); + float velocityBoost = death ? 6f : 6f * (1f - lifeRatio); + float num626 = (CalamityWorld.bossRushActive ? 12f : 9f) + velocityBoost; if (npc.velocity.X < -num626) npc.velocity.X = -num626; if (npc.velocity.X > num626) @@ -2429,6 +2438,7 @@ namespace CalamityMod.NPCs // Difficulty variables bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; + bool death = CalamityWorld.death || CalamityWorld.bossRushActive; // Emit light Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); @@ -2599,11 +2609,6 @@ namespace CalamityMod.NPCs // Speed and turn speed float speedLimit = revenge ? 7f : 6f; float turnSpeedLimit = revenge ? 0.11f : 0.1f; - if (CalamityWorld.death || CalamityWorld.bossRushActive) - { - speedLimit = 8f; - turnSpeedLimit = 0.12f; - } if (CalamityWorld.bossRushActive) { speedLimit *= 1.5f; @@ -2611,8 +2616,8 @@ namespace CalamityMod.NPCs } // Speed and turn speed boosts based on remaining HP - float speedBoost = speedLimit * (1f - (float)mainDeusHPRatio); - float turnSpeedBoost = turnSpeedLimit * (1f - (float)mainDeusHPRatio); + float speedBoost = death ? speedLimit : speedLimit * (1f - (float)mainDeusHPRatio); + float turnSpeedBoost = death ? turnSpeedLimit : turnSpeedLimit * (1f - (float)mainDeusHPRatio); if (Main.player[npc.target].gravDir == -1f) { speedBoost = speedLimit; @@ -2778,13 +2783,13 @@ namespace CalamityMod.NPCs if (npc.type == ModContent.NPCType() && Main.netMode != NetmodeID.MultiplayerClient) { int shootTime = 4; - if ((double)npc.life <= (double)npc.lifeMax * 0.65 || CalamityWorld.bossRushActive || Main.player[npc.target].gravDir == -1f) + if ((double)npc.life <= (double)npc.lifeMax * 0.65 || death || Main.player[npc.target].gravDir == -1f) { - shootTime += CalamityWorld.death ? 4 : 2; + shootTime += death ? 4 : 2; } - if ((double)npc.life <= (double)npc.lifeMax * 0.3 || CalamityWorld.bossRushActive || Main.player[npc.target].gravDir == -1f) + if ((double)npc.life <= (double)npc.lifeMax * 0.3 || death || Main.player[npc.target].gravDir == -1f) { - shootTime += CalamityWorld.death ? 6 : 2; + shootTime += death ? 6 : 2; } npc.localAI[0] += (float)Main.rand.Next(shootTime); if (npc.localAI[0] >= (float)Main.rand.Next(1400, 20000)) @@ -2794,14 +2799,14 @@ namespace CalamityMod.NPCs if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) { float num941 = revenge ? 14f : 13f; - if (CalamityWorld.death) - { - num941 = 16f; - } if (CalamityWorld.bossRushActive) { num941 = 24f; } + else if (death) + { + num941 = 16f; + } if (Main.player[npc.target].gravDir == -1f) { num941 *= 2f; @@ -2885,8 +2890,8 @@ namespace CalamityMod.NPCs if (head) { // Spawn mine probes - float firstProbeSpawnThreshold = ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 0.9f : 0.66f); - float secondProbeSpawnThreshold = ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 0.8f : 0.33f); + float firstProbeSpawnThreshold = death ? 0.9f : 0.66f; + float secondProbeSpawnThreshold = death ? 0.8f : 0.33f; if (deusHPRatio <= firstProbeSpawnThreshold) { @@ -2922,13 +2927,10 @@ namespace CalamityMod.NPCs // Velocity variables float speedAdd = expertMode ? 0.06f : 0.045f; float turnSpeedAdd = expertMode ? 0.04f : 0.03f; - if (CalamityWorld.death || CalamityWorld.bossRushActive) - { - speedAdd *= 1.25f; - turnSpeedAdd *= 1.25f; - } - float newSpeed = 0.12f + speedAdd * (1f - deusHPRatio); - float newTurnSpeed = 0.08f + turnSpeedAdd * (1f - deusHPRatio); + float newSpeedBoost = death ? speedAdd : speedAdd * (1f - deusHPRatio); + float newTurnSpeedBoost = death ? turnSpeedAdd : turnSpeedAdd * (1f - deusHPRatio); + float newSpeed = 0.12f + newSpeedBoost; + float newTurnSpeed = 0.08f + newTurnSpeedBoost; // Movement variables int num180 = (int)(npc.position.X / 16f) - 1; @@ -3186,6 +3188,7 @@ namespace CalamityMod.NPCs int lifePercentage = (int)(100.0 * lifeRatio); bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; + bool death = CalamityWorld.death || CalamityWorld.bossRushActive; CalamityGlobalNPC.voidBoss = npc.whoAmI; Vector2 vector = npc.Center; @@ -3280,8 +3283,6 @@ namespace CalamityMod.NPCs { calamityGlobalNPC.newAI[1] += expertMode ? 2f : 1f; calamityGlobalNPC.newAI[1] += calamityGlobalNPC.newAI[2]; - if (CalamityWorld.death || CalamityWorld.bossRushActive) - calamityGlobalNPC.newAI[1] += 1f; if (calamityGlobalNPC.enraged > 0 || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) calamityGlobalNPC.newAI[1] += 2f; @@ -3312,7 +3313,7 @@ namespace CalamityMod.NPCs if (revenge) { int damage = expertMode ? 50 : 60; - if (lifePercentage < 50 || CalamityWorld.death || CalamityWorld.bossRushActive || !player.ZoneDungeon) + if (lifePercentage < 50 || death || !player.ZoneDungeon) { for (int i = 0; i < 12; i++) { @@ -3413,6 +3414,7 @@ namespace CalamityMod.NPCs // Variables Player player = Main.player[npc.target]; bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; + bool death = CalamityWorld.death || CalamityWorld.bossRushActive; Vector2 vector = npc.Center; // Percent life remaining @@ -3421,16 +3423,16 @@ namespace CalamityMod.NPCs // Phases float mult = 1f + (revenge ? 0.25f : 0f) + - ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 0.25f : 0f); + (death ? 0.25f : 0f); bool phase2 = lifeRatio < 0.5f * mult; bool phase3 = lifeRatio < 0.1f * mult; // Max spawn amount int num1305 = revenge ? 4 : 3; - if (CalamityWorld.death || CalamityWorld.bossRushActive) + if (death) num1305 = 5; if (phase2) - num1305 = 2; + num1305 = death ? 3 : 2; // Don't collide with tiles, disable gravity npc.noTileCollide = false; diff --git a/NPCs/CalamityGlobalAI.cs b/NPCs/CalamityGlobalAI.cs index dd3afe7747..1e171366c3 100644 --- a/NPCs/CalamityGlobalAI.cs +++ b/NPCs/CalamityGlobalAI.cs @@ -121,12 +121,13 @@ namespace CalamityMod.NPCs bool flag8 = false; bool flag9 = false; npc.aiAction = 0; + bool death = CalamityWorld.death || CalamityWorld.bossRushActive; - // Percent life remaining - float lifeRatio = (float)npc.life / (float)npc.lifeMax; + // Percent life remaining + float lifeRatio = (float)npc.life / (float)npc.lifeMax; // Phases based on life percentage - bool phase2 = lifeRatio < 0.5f || CalamityWorld.death || CalamityWorld.bossRushActive; + bool phase2 = lifeRatio < 0.5f || death; // Spawn crystal in phase 2 if (phase2 && !NPC.AnyNPCs(ModContent.NPCType())) @@ -179,7 +180,7 @@ namespace CalamityMod.NPCs npc.velocity.Y += 0.1f; // Activate teleport - if (!Main.player[npc.target].dead && npc.ai[2] >= ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 240f : 300f) && npc.ai[1] < 5f && npc.velocity.Y == 0f) + if (!Main.player[npc.target].dead && npc.ai[2] >= 300f && npc.ai[1] < 5f && npc.velocity.Y == 0f) { npc.ai[2] = 0f; npc.ai[0] = 0f; @@ -364,20 +365,18 @@ namespace CalamityMod.NPCs npc.ai[0] += 2f; if (CalamityWorld.bossRushActive) npc.ai[0] += 9f; - else if (CalamityWorld.death) - npc.ai[0] += 4f; else { - if ((double)npc.life < (double)npc.lifeMax * 0.8) + if ((double)npc.life < (double)npc.lifeMax * 0.8 || death) npc.ai[0] += 1f; - if ((double)npc.life < (double)npc.lifeMax * 0.6) + if ((double)npc.life < (double)npc.lifeMax * 0.6 || death) npc.ai[0] += 1f; - if ((double)npc.life < (double)npc.lifeMax * 0.4) + if ((double)npc.life < (double)npc.lifeMax * 0.4 || death) npc.ai[0] += 2f; } - if ((double)npc.life < (double)npc.lifeMax * 0.2 || CalamityWorld.bossRushActive) + if ((double)npc.life < (double)npc.lifeMax * 0.2 || death) npc.ai[0] += 3f; - if ((double)npc.life < (double)npc.lifeMax * 0.1 || CalamityWorld.bossRushActive) + if ((double)npc.life < (double)npc.lifeMax * 0.1 || death) npc.ai[0] += 4f; if (npc.ai[0] >= 0f) @@ -550,11 +549,11 @@ namespace CalamityMod.NPCs // Percent life remaining float lifeRatio = (float)npc.life / (float)npc.lifeMax; - - bool phase2 = lifeRatio < 0.85f || CalamityWorld.death || CalamityWorld.bossRushActive; - bool phase3 = lifeRatio < ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 0.9f : 0.75f); - bool phase4 = lifeRatio < ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 0.8f : 0.65f); - bool phase5 = lifeRatio < ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 0.7f : 0.5f); + bool death = CalamityWorld.death || CalamityWorld.bossRushActive; + bool phase2 = lifeRatio < 0.85f || death; + bool phase3 = lifeRatio < 0.75f || death; + bool phase4 = lifeRatio < 0.65f || death; + bool phase5 = lifeRatio < 0.5f || death; if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) npc.TargetClosest(true); @@ -884,8 +883,8 @@ namespace CalamityMod.NPCs if (npc.ai[1] == 0f) { - float num37 = ((enraged || configBossRushBoost) ? 8f : 5.5f) + ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 5f : 3.5f) * (0.85f - lifeRatio); - float num38 = ((enraged || configBossRushBoost) ? 0.09f : 0.06f) + ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 0.04f : 0.025f) * (0.85f - lifeRatio); + float num37 = ((enraged || configBossRushBoost) ? 8f : 5.5f) + 3.5f * (0.85f - lifeRatio); + float num38 = ((enraged || configBossRushBoost) ? 0.09f : 0.06f) + 0.025f * (0.85f - lifeRatio); if (CalamityWorld.bossRushActive) { num37 *= 2f; @@ -962,7 +961,7 @@ namespace CalamityMod.NPCs Main.PlaySound(36, (int)npc.position.X, (int)npc.position.Y, 0, 1f, 0f); npc.rotation = num8; - float num42 = ((enraged || configBossRushBoost) ? 9.5f : 6.2f) + ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 6f : 4f) * (0.85f - lifeRatio); + float num42 = ((enraged || configBossRushBoost) ? 9.5f : 6.2f) + 4f * (0.85f - lifeRatio); if (npc.ai[3] == 1f) num42 *= 1.15f; if (npc.ai[3] == 2f) @@ -987,7 +986,7 @@ namespace CalamityMod.NPCs else if (npc.ai[1] == 2f) { - float num46 = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 70f : 60f; + float num46 = 60f; npc.ai[2] += 1f; if (npc.ai[2] >= num46) @@ -1001,7 +1000,7 @@ namespace CalamityMod.NPCs else npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) - 1.57f; - int num47 = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 70 : 80; + int num47 = 80; if (npc.ai[2] >= (float)num47) { npc.ai[3] += 1f; @@ -1044,7 +1043,8 @@ namespace CalamityMod.NPCs else if (Main.netMode != NetmodeID.MultiplayerClient) { npc.TargetClosest(true); - float num48 = ((enraged || configBossRushBoost) ? 26f : 18f) + ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 5f : 3.5f) * (0.7f - lifeRatio); + float speedBoost = death ? 2.45f : 3.5f * (0.7f - lifeRatio); + float num48 = ((enraged || configBossRushBoost) ? 26f : 18f) + speedBoost; if (CalamityWorld.bossRushActive) num48 *= 1.5f; @@ -1162,8 +1162,10 @@ namespace CalamityMod.NPCs else if (npc.ai[1] == 5f) { float num62 = 600f; - float num63 = ((enraged || configBossRushBoost) ? 12f : 8f) + ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 6f : 4f) * (0.4f - lifeRatio); - float num64 = ((enraged || configBossRushBoost) ? 0.4f : 0.25f) + ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 0.15f : 0.1f) * (0.4f - lifeRatio); + float speedBoost = death ? 2f : 4f * (0.5f - lifeRatio); + float speedBoost2 = death ? 0.05f : 0.1f * (0.5f - lifeRatio); + float num63 = ((enraged || configBossRushBoost) ? 12f : 8f) + speedBoost; + float num64 = ((enraged || configBossRushBoost) ? 0.4f : 0.25f) + speedBoost2; if (CalamityWorld.bossRushActive) { num63 *= 2f; @@ -1294,7 +1296,8 @@ namespace CalamityMod.NPCs if (Main.netMode != NetmodeID.MultiplayerClient) { npc.TargetClosest(true); - float num48 = ((enraged || configBossRushBoost) ? 26f : 18f) + ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 6f : 4f) * (0.4f - lifeRatio); + float speedBoost = death ? 2f : 4f * (0.5f - lifeRatio); + float num48 = ((enraged || configBossRushBoost) ? 26f : 18f) + speedBoost; if (CalamityWorld.bossRushActive) num48 *= 1.5f; @@ -1363,9 +1366,10 @@ namespace CalamityMod.NPCs { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); bool configBossRushBoost = Config.BossRushXerocCurse && CalamityWorld.bossRushActive; + bool death = CalamityWorld.death || CalamityWorld.bossRushActive; // Total body segments - float totalSegments = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 73f : 63f; + float totalSegments = death ? 73f : 63f; // Count segments remaining float segmentCount = (float)(NPC.CountNPCS(NPCID.EaterofWorldsHead) + NPC.CountNPCS(NPCID.EaterofWorldsBody) + NPC.CountNPCS(NPCID.EaterofWorldsTail)); // 2f to 65f @@ -1374,10 +1378,10 @@ namespace CalamityMod.NPCs float lifeRatio = segmentCount / (totalSegments + 2); // Phases - bool phase2 = lifeRatio < 0.9f || CalamityWorld.bossRushActive; - bool phase3 = lifeRatio < 0.75f || CalamityWorld.bossRushActive; - bool phase4 = lifeRatio < 0.4f || CalamityWorld.bossRushActive; - bool phase5 = lifeRatio < 0.1f; + bool phase2 = lifeRatio < 0.9f || death; + bool phase3 = lifeRatio < 0.75f || death; + bool phase4 = lifeRatio < 0.4f || death; + bool phase5 = lifeRatio < 0.1f || (death && lifeRatio < 0.33f); // Damage if (phase4 && npc.type == NPCID.EaterofWorldsHead) @@ -1402,7 +1406,8 @@ namespace CalamityMod.NPCs { calamityGlobalNPC.newAI[0] += 1f; float timer = 90f; - timer += lifeRatio * 180f; + float shootBoost = death ? 18f : lifeRatio * 180f; + timer += shootBoost; if (calamityGlobalNPC.newAI[0] >= timer && phase3) { @@ -1578,7 +1583,7 @@ namespace CalamityMod.NPCs if (!flag2 && npc.type == NPCID.EaterofWorldsHead) { Rectangle rectangle = new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height); - int num35 = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 750 : 850; + int num35 = 850; if (CalamityWorld.bossRushActive) num35 /= 2; @@ -1599,9 +1604,11 @@ namespace CalamityMod.NPCs flag2 = true; } - // Velocity and acceleration - float num37 = ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 13f : 12f) + 2.4f * (1f - lifeRatio); - float num38 = ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 0.16f : 0.15f) + 0.03f * (1f - lifeRatio); + // Velocity and acceleration + float velocityBoost = death ? 2.4f : 2.4f * (1f - lifeRatio); + float accelerationBoost = death ? 0.03f : 0.03f * (1f - lifeRatio); + float num37 = 12f + velocityBoost; + float num38 = 0.15f + accelerationBoost; if (phase5) { @@ -1900,11 +1907,12 @@ namespace CalamityMod.NPCs // Percent life remaining float lifeRatio = (float)npc.life / (float)npc.lifeMax; - // Phases based on HP - bool phase2 = lifeRatio < 0.85f || CalamityWorld.death || CalamityWorld.bossRushActive; - bool phase3 = lifeRatio < ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 0.9f : 0.7f); - bool phase4 = lifeRatio < ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 0.7f : 0.5f); - bool phase5 = lifeRatio < ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 0.5f : 0.3f); + // Phases based on HP + bool death = CalamityWorld.death || CalamityWorld.bossRushActive; + bool phase2 = lifeRatio < 0.85f || death; + bool phase3 = lifeRatio < 0.7f || death; + bool phase4 = lifeRatio < 0.5f || death; + bool phase5 = lifeRatio < 0.3f || death; bool spinning = npc.ai[0] == -4f; // Gain defense while spinning @@ -1933,7 +1941,8 @@ namespace CalamityMod.NPCs float num795 = Main.player[npc.target].Center.X - vector98.X; float num796 = Main.player[npc.target].Center.Y - vector98.Y; float num797 = (float)Math.Sqrt((double)(num795 * num795 + num796 * num796)); - float num798 = 8f + (2f * (1f - lifeRatio)); + float velocityBoost = death ? 2f : 2f * (1f - lifeRatio); + float num798 = 8f + velocityBoost; if (CalamityWorld.bossRushActive) num798 *= 2f; @@ -1955,7 +1964,8 @@ namespace CalamityMod.NPCs // Teleport if (npc.ai[1] >= 115f) { - npc.knockBackResist = 0.45f - (0.45f * (1f - lifeRatio)); + float knockBackResistBoost = death ? 0.44f : 0.45f * (1f - lifeRatio); + npc.knockBackResist = 0.45f - knockBackResistBoost; npc.ai[0] = -7f; npc.ai[1] = 0f; @@ -1985,14 +1995,17 @@ namespace CalamityMod.NPCs if (phase5) spin = true; - // Velocity and knockback - if (spin) - { - npc.knockBackResist = 0f; - npc.velocity = Vector2.Normalize(Main.player[npc.target].Center - npc.Center) * 24f; - } - else - npc.knockBackResist = 0.45f - (0.45f * (1f - lifeRatio)); + // Velocity and knockback + if (spin) + { + npc.knockBackResist = 0f; + npc.velocity = Vector2.Normalize(Main.player[npc.target].Center - npc.Center) * 24f; + } + else + { + float knockBackResistBoost = death ? 0.44f : 0.45f * (1f - lifeRatio); + npc.knockBackResist = 0.45f - knockBackResistBoost; + } npc.ai[0] = !spin ? -7f : -4f; npc.ai[1] = !spin ? 0f : (playerLocation < 0 ? 1f : -1f); @@ -2088,11 +2101,14 @@ namespace CalamityMod.NPCs if (phase5) charge = true; - // Adjust knockback - if (charge) - npc.knockBackResist = 0f; - else - npc.knockBackResist = 0.45f - (0.45f * (1f - lifeRatio)); + // Adjust knockback + if (charge) + npc.knockBackResist = 0f; + else + { + float knockBackResistBoost = death ? 0.44f : 0.45f * (1f - lifeRatio); + npc.knockBackResist = 0.45f - knockBackResistBoost; + } npc.ai[0] = charge ? -6f : -5f; npc.ai[1] = 0f; @@ -2105,9 +2121,12 @@ namespace CalamityMod.NPCs // Pick teleport location else if (npc.ai[0] == -1f || npc.ai[0] == -7f) { - // Adjust knockback - if (npc.ai[0] == -1f) - npc.knockBackResist = 0.45f - (0.45f * (1f - lifeRatio)); + // Adjust knockback + if (npc.ai[0] == -1f) + { + float knockBackResistBoost = death ? 0.44f : 0.45f * (1f - lifeRatio); + npc.knockBackResist = 0.45f - knockBackResistBoost; + } if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -2125,7 +2144,8 @@ namespace CalamityMod.NPCs npc.localAI[1] += 1f; - int random = 5 - (int)(5f * (1f - lifeRatio)); + int randomReduction = death ? 4 : (int)(5f * (1f - lifeRatio)); + int random = 5 - randomReduction; if (npc.justHit) npc.localAI[1] -= (float)Main.rand.Next(random); @@ -2294,7 +2314,7 @@ namespace CalamityMod.NPCs // Teleport location npc.localAI[1] += 1f + ((float)creeperScale * 0.1f); - if (npc.localAI[1] >= ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 240f : 300f)) + if (npc.localAI[1] >= 300f) { npc.localAI[1] = 0f; npc.TargetClosest(true); @@ -2412,7 +2432,7 @@ namespace CalamityMod.NPCs float num812 = Main.npc[NPC.crimsonBoss].Center.X - vector100.X; float num813 = Main.npc[NPC.crimsonBoss].Center.Y - vector100.Y; float num814 = (float)Math.Sqrt((double)(num812 * num812 + num813 * num813)); - float velocity = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 10f : 9f; + float velocity = 9f; if (CalamityWorld.bossRushActive) velocity *= 2f; @@ -2481,6 +2501,7 @@ namespace CalamityMod.NPCs public static bool BuffedQueenBeeAI(NPC npc, Mod mod) { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + bool death = CalamityWorld.death || CalamityWorld.bossRushActive; // Increase bee spawn rate during bee spawning phase based on number of players near the boss int playerNearBoss = 0; @@ -2499,8 +2520,16 @@ namespace CalamityMod.NPCs // Boost defense and damage as health decreases int statBoost = (int)(20f * (1f - (float)npc.life / (float)npc.lifeMax)); - npc.defense = npc.defDefense + statBoost; - npc.damage = npc.defDamage + statBoost; + if (death) + { + npc.defense = npc.defDefense + 20; + npc.damage = npc.defDamage + 20; + } + else + { + npc.defense = npc.defDefense + statBoost; + npc.damage = npc.defDamage + statBoost; + } // Get a target if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) @@ -2559,7 +2588,7 @@ namespace CalamityMod.NPCs { // Number of charges int chargeAmt = 2; - if (npc.life < npc.lifeMax / 3 || enrage) + if (npc.life < npc.lifeMax / 3 || death || enrage) chargeAmt++; // Switch to a random phase if chargeAmt has been exceeded @@ -2581,23 +2610,22 @@ namespace CalamityMod.NPCs npc.localAI[0] = 1f; npc.ai[1] += 1f; npc.ai[2] = 0f; + float speed = 16f; if (CalamityWorld.bossRushActive) speed += 12f; else if (enrage) speed += 8f; - else if (CalamityWorld.death) - speed += 6f; else { - if ((double)npc.life < (double)npc.lifeMax * 0.75) + if ((double)npc.life < (double)npc.lifeMax * 0.75 || death) speed += 2f; - if ((double)npc.life < (double)npc.lifeMax * 0.5) + if ((double)npc.life < (double)npc.lifeMax * 0.5 || death) speed += 2f; - if ((double)npc.life < (double)npc.lifeMax * 0.25) + if ((double)npc.life < (double)npc.lifeMax * 0.25 || death) speed += 2f; } - if ((double)npc.life < (double)npc.lifeMax * 0.1) + if ((double)npc.life < (double)npc.lifeMax * 0.1 || death) speed += 2f; // Get target location @@ -2619,40 +2647,30 @@ namespace CalamityMod.NPCs npc.localAI[0] = 0f; float num602 = 12f; float num603 = 0.15f; - if (CalamityWorld.bossRushActive) - { - num602 *= 1.5f; - num603 *= 1.5f; - } - else if (enrage) + if (enrage) { num602 += 6f; num603 += 0.2f; } - else if (CalamityWorld.death) - { - num602 += 4f; - num603 += 0.15f; - } else { - if ((double)npc.life < (double)npc.lifeMax * 0.75) + if ((double)npc.life < (double)npc.lifeMax * 0.75 || death) { num602 += 1f; num603 += 0.05f; } - if ((double)npc.life < (double)npc.lifeMax * 0.5) + if ((double)npc.life < (double)npc.lifeMax * 0.5 || death) { num602 += 1f; num603 += 0.05f; } - if ((double)npc.life < (double)npc.lifeMax * 0.25) + if ((double)npc.life < (double)npc.lifeMax * 0.25 || death) { num602 += 2f; num603 += 0.05f; } } - if ((double)npc.life < (double)npc.lifeMax * 0.1 || CalamityWorld.bossRushActive) + if ((double)npc.life < (double)npc.lifeMax * 0.1 || death) { num602 += 2f; num603 += 0.1f; @@ -2703,12 +2721,10 @@ namespace CalamityMod.NPCs int num604 = 500; if (enrage) num604 = 225; - else if ((double)npc.life < (double)npc.lifeMax * 0.33) + else if ((double)npc.life < (double)npc.lifeMax * 0.33 || death) num604 = 300; else if ((double)npc.life < (double)npc.lifeMax * 0.66) num604 = 450; - if (CalamityWorld.death || CalamityWorld.bossRushActive) - num604 -= 25; // Get which side of the player the boss is on int num605 = 1; @@ -2730,17 +2746,17 @@ namespace CalamityMod.NPCs npc.localAI[0] = 0f; npc.velocity *= 0.9f; float num606 = 0.1f; - if (npc.life < npc.lifeMax / 2 || CalamityWorld.death || CalamityWorld.bossRushActive || enrage) + if (npc.life < npc.lifeMax / 2 || death || enrage) { npc.velocity *= 0.9f; num606 += 0.05f; } - if (npc.life < npc.lifeMax / 3 || CalamityWorld.death || CalamityWorld.bossRushActive || enrage) + if (npc.life < npc.lifeMax / 3 || death || enrage) { npc.velocity *= 0.9f; num606 += 0.05f; } - if (npc.life < npc.lifeMax / 5 || CalamityWorld.bossRushActive) + if (npc.life < npc.lifeMax / 5 || death || enrage) { npc.velocity *= 0.9f; num606 += 0.05f; @@ -2774,7 +2790,7 @@ namespace CalamityMod.NPCs float num611 = (float)Math.Sqrt((double)(num609 * num609 + num610 * num610)); // Go to bee spawn phase - if (num611 < (CalamityWorld.death ? 400f : 300f)) + if (num611 < (death ? 400f : 300f)) { npc.ai[0] = 1f; npc.ai[1] = 0f; @@ -2826,13 +2842,13 @@ namespace CalamityMod.NPCs // Bee spawn timer npc.ai[1] += 1f; npc.ai[1] += (float)(playerNearBoss / 2); - if ((double)npc.life < (double)npc.lifeMax * 0.75) + if ((double)npc.life < (double)npc.lifeMax * 0.75 || death) npc.ai[1] += 0.25f; - if ((double)npc.life < (double)npc.lifeMax * 0.5) + if ((double)npc.life < (double)npc.lifeMax * 0.5 || death) npc.ai[1] += 0.25f; - if ((double)npc.life < (double)npc.lifeMax * 0.25) + if ((double)npc.life < (double)npc.lifeMax * 0.25 || death) npc.ai[1] += 0.25f; - if ((double)npc.life < (double)npc.lifeMax * 0.1) + if ((double)npc.life < (double)npc.lifeMax * 0.1 || death) npc.ai[1] += 0.25f; bool spawnBee = false; @@ -2851,10 +2867,10 @@ namespace CalamityMod.NPCs { int hornetAmt = CalamityMod.hornetList.Count; int spawnType = Main.rand.Next(210, 212); - if (npc.life < (double)npc.lifeMax * 0.66 || CalamityWorld.death) + if (npc.life < (double)npc.lifeMax * 0.66 || death) spawnType = 210; - int random = CalamityWorld.death ? 5 : 6; + int random = death ? 5 : 6; if (Main.rand.Next(random) == 0) spawnType = CalamityMod.hornetList[Main.rand.Next(hornetAmt)]; @@ -2933,12 +2949,12 @@ namespace CalamityMod.NPCs // Stinger fire counter npc.ai[1] += 1f; bool shoot = false; - if ((double)npc.life < (double)npc.lifeMax * 0.33 || enrage) + if ((double)npc.life < (double)npc.lifeMax * 0.33 || death || enrage) { if (npc.ai[1] % 15f == 14f) shoot = true; } - else if (npc.life < (double)npc.lifeMax * 0.66 || CalamityWorld.death) + else if (npc.life < (double)npc.lifeMax * 0.66) { if (npc.ai[1] % 25f == 24f) shoot = true; @@ -2953,10 +2969,8 @@ namespace CalamityMod.NPCs if (Main.netMode != NetmodeID.MultiplayerClient) { float num624 = CalamityWorld.bossRushActive ? 16f : 12f; - if ((double)npc.life < (double)npc.lifeMax * 0.33 || enrage || CalamityWorld.bossRushActive) + if ((double)npc.life < (double)npc.lifeMax * 0.33 || enrage || death) num624 += 3f; - if (CalamityWorld.death || CalamityWorld.bossRushActive) - num624 += 1f; float num625 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector78.X; float num626 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector78.Y; @@ -3049,9 +3063,8 @@ namespace CalamityMod.NPCs ModLoader.GetMod("FargowiltasSouls").Call("FargoSoulsAI", npc.whoAmI); if (Main.netMode == NetmodeID.Server) - { NetMessage.SendData(23, -1, -1, null, npc.whoAmI, 0f, 0f, 0f, 0, 0, 0); - } + npc.netSpam = 5; return false; @@ -3063,12 +3076,13 @@ namespace CalamityMod.NPCs { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); bool configBossRushBoost = Config.BossRushXerocCurse && CalamityWorld.bossRushActive; + bool death = CalamityWorld.death || CalamityWorld.bossRushActive; // Percent life remaining float lifeRatio = (float)npc.life / (float)npc.lifeMax; // Phases - bool phase2 = lifeRatio < 0.33f; + bool phase2 = lifeRatio < 0.33f || death; // Set defense npc.defense = npc.defDefense; @@ -3196,10 +3210,10 @@ namespace CalamityMod.NPCs } // Teleport after a certain time - // If hands are dead: 7 seconds in rev, 5.6 seconds in death - // If hands are not dead: 14 seconds in rev, 9.3 seconds in death - // If hands are dead in phase 2: 4.7 seconds in rev, 4 seconds in death - npc.ai[3] += ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 1.25f : 1f) + ((phase2 && handsDead) ? 0.5f : 0f) - (handsDead ? 0f : 0.5f); + // If hands are dead: 7 seconds + // If hands are not dead: 14 seconds + // If hands are dead in phase 2: 4.7 seconds + npc.ai[3] += 1f + ((phase2 && handsDead) ? 0.5f : 0f) - (handsDead ? 0f : 0.5f); // Dust to show teleport int ai3 = (int)npc.ai[3]; // 0 to 30, and -60 @@ -3328,8 +3342,9 @@ namespace CalamityMod.NPCs npc.damage = npc.defDamage; calamityGlobalNPC.newAI[1] += 1f; - npc.ai[2] += 1f + (3f * (1f - lifeRatio)); - if (npc.ai[2] >= ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 510f : 600f)) + float phaseChangeRateBoost = death ? 3f : 3f * (1f - lifeRatio); + npc.ai[2] += 1f + phaseChangeRateBoost; + if (npc.ai[2] >= 600f) { npc.ai[2] = 0f; npc.ai[1] = 1f; @@ -3340,10 +3355,10 @@ namespace CalamityMod.NPCs npc.rotation = npc.velocity.X / 15f; - float num169 = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 0.05f : 0.04f; - float num170 = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 3f : 3.5f; - float num171 = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 0.1f : 0.08f; - float num172 = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 7.5f : 8.5f; + float num169 = 0.04f; + float num170 = 3.5f; + float num171 = 0.08f; + float num172 = 8.5f; if (CalamityWorld.bossRushActive) { num169 *= 1.5f; @@ -3391,13 +3406,14 @@ namespace CalamityMod.NPCs { npc.defense -= 10; - npc.ai[2] += 1f + (0.5f * (1f - lifeRatio)); + float phaseChangeRateBoost = death ? 0.5f : 0.5f * (1f - lifeRatio); + npc.ai[2] += 1f + phaseChangeRateBoost; calamityGlobalNPC.newAI[1] += 1f; if (calamityGlobalNPC.newAI[1] == 2f) Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 0, 1f, 0f); - if (npc.ai[2] >= ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 240f : 300f)) + if (npc.ai[2] >= 300f) { npc.ai[2] = 0f; npc.ai[1] = 0f; @@ -3413,8 +3429,9 @@ namespace CalamityMod.NPCs // Increase speed while charging npc.damage = (int)((double)npc.defDamage * 1.3); float num176 = CalamityWorld.bossRushActive ? 10f : 4.5f; + float velocityBoost = death ? 1f : 1f - lifeRatio; if (handsDead) - num176 += 1f * (1f - lifeRatio); + num176 += velocityBoost; if (enraged || configBossRushBoost) num176 += 3f; @@ -3628,7 +3645,7 @@ namespace CalamityMod.NPCs num186 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector23.Y; num187 = (float)Math.Sqrt((double)(num185 * num185 + num186 * num186)); - num187 = ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 25f : 23f) / num187; + num187 = 23f / num187; if (CalamityWorld.bossRushActive) num187 *= 1.5f; @@ -3666,7 +3683,7 @@ namespace CalamityMod.NPCs num189 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector24.Y; num190 = (float)Math.Sqrt((double)(num188 * num188 + num189 * num189)); - num190 = ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 26f : 24f) / num190; + num190 = 24f / num190; if (CalamityWorld.bossRushActive) num190 *= 1.5f; @@ -3690,6 +3707,7 @@ namespace CalamityMod.NPCs { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); bool configBossRushBoost = Config.BossRushXerocCurse && CalamityWorld.bossRushActive; + bool death = CalamityWorld.death || CalamityWorld.bossRushActive; // Despawn if (npc.position.X < 160f || npc.position.X > (float)((Main.maxTilesX - 10) * 16)) @@ -3707,8 +3725,8 @@ namespace CalamityMod.NPCs float lifeRatio = (float)npc.life / (float)npc.lifeMax; // Phases based on HP - bool phase2 = lifeRatio < 0.66f || CalamityWorld.bossRushActive; - bool phase3 = lifeRatio < 0.33f || CalamityWorld.bossRushActive; + bool phase2 = lifeRatio < 0.66f || death; + bool phase3 = lifeRatio < 0.33f || death; // Start leech spawning based on HP npc.ai[1] += 1f; @@ -3849,7 +3867,7 @@ namespace CalamityMod.NPCs float halfAverageScreenWidth = 960f; float distanceBeforeSlowingDown = 400f; - float timeBeforeEnrage = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 420f : 600f; + float timeBeforeEnrage = 600f; float speedMult = 1f; if (calamityGlobalNPC.newAI[0] < timeBeforeEnrage) @@ -3893,7 +3911,7 @@ namespace CalamityMod.NPCs if (calamityGlobalNPC.newAI[1] == 1f) { // Triple speed - speedMult = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 3.5f : 3.25f; + speedMult = 3.25f; // Return to normal if very close to target if (distanceFromTarget < distanceBeforeSlowingDown) @@ -3906,11 +3924,10 @@ namespace CalamityMod.NPCs if (enraged || configBossRushBoost) speedMult += 0.7f; - else if (CalamityWorld.death || CalamityWorld.bossRushActive) - speedMult += 0.18f; - // NOTE: Max velocity is 8 in expert mode - float velocityX = ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 2.2f : 2f) + (4f * (1f - lifeRatio)); + // NOTE: Max velocity is 8 in expert mode + float velocityBoost = death ? 4f : 4f * (1f - lifeRatio); + float velocityX = 2f + velocityBoost; velocityX *= speedMult; if (CalamityWorld.bossRushActive) velocityX *= 1.5f; @@ -3961,8 +3978,9 @@ namespace CalamityMod.NPCs // Expert hungry respawn over time if (Main.netMode != NetmodeID.MultiplayerClient) { - // Range of 1 to 11 - int chance = (int)(1f + lifeRatio * 10f); + // Range of 1 to 11 + float spawnBoost = death ? 1f : lifeRatio * 10f; + int chance = (int)(1f + spawnBoost); // Range of 1 to 121 chance *= chance; @@ -4063,6 +4081,7 @@ namespace CalamityMod.NPCs { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); bool configBossRushBoost = Config.BossRushXerocCurse && CalamityWorld.bossRushActive; + bool death = CalamityWorld.death || CalamityWorld.bossRushActive; // Despawn if (Main.wof < 0) @@ -4139,7 +4158,8 @@ namespace CalamityMod.NPCs // Percent life remaining float lifeRatio = (float)Main.npc[Main.wof].life / (float)Main.npc[Main.wof].lifeMax; - npc.localAI[1] += 1f + (4f * (1f - lifeRatio)); + float shootBoost = death ? 4f : 4f * (1f - lifeRatio); + npc.localAI[1] += 1f + shootBoost; if (npc.localAI[2] == 0f) { @@ -4149,7 +4169,7 @@ namespace CalamityMod.NPCs npc.localAI[1] = 0f; } } - else if (npc.localAI[1] > ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 39f : 45f) && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + else if (npc.localAI[1] > 45f && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) { npc.localAI[1] = 0f; npc.localAI[2] += 1f; @@ -4158,8 +4178,8 @@ namespace CalamityMod.NPCs if (flag30) { - bool phase2 = lifeRatio < 0.5 || CalamityWorld.bossRushActive; - float velocity = ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 10f : 9f) + (4f * (1f - lifeRatio)); + bool phase2 = lifeRatio < 0.5 || death; + float velocity = 9f + shootBoost; if (CalamityWorld.bossRushActive) velocity *= 1.5f; @@ -4192,9 +4212,10 @@ namespace CalamityMod.NPCs { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); bool configBossRushBoost = Config.BossRushXerocCurse && CalamityWorld.bossRushActive; + bool death = CalamityWorld.death || CalamityWorld.bossRushActive; - // 8 seconds of reistance to prevent spawn killing - if (calamityGlobalNPC.newAI[1] < 480f) + // 8 seconds of reistance to prevent spawn killing + if (calamityGlobalNPC.newAI[1] < 480f) calamityGlobalNPC.newAI[1] += 1f; // Enrage variable if player is flying upside down @@ -4204,8 +4225,8 @@ namespace CalamityMod.NPCs float lifeRatio = (float)npc.life / (float)npc.lifeMax; // Phases based on life percentage - bool phase2 = lifeRatio < 0.66f; - bool phase3 = lifeRatio < 0.33f; + bool phase2 = lifeRatio < 0.66f || death; + bool phase3 = lifeRatio < 0.33f || death; // Set worm variable for worms if (npc.ai[3] > 0f) @@ -4257,8 +4278,8 @@ namespace CalamityMod.NPCs // Gain more defense as health lowers with a max of 30, lose defense if probe has been launched if (npc.ai[2] == 0f) { - int defenseUp = (int)(30f * (1f - lifeRatio)); - npc.defense = npc.defDefense + defenseUp; + int defenseBoost = death ? 30 : (int)(30f * (1f - lifeRatio)); + npc.defense = npc.defDefense + defenseBoost; } else npc.defense = npc.defDefense - 10; @@ -4311,7 +4332,7 @@ namespace CalamityMod.NPCs shootTime += 1; calamityGlobalNPC.newAI[0] += (float)Main.rand.Next(shootTime); - int randomCount = (CalamityWorld.death || CalamityWorld.bossRushActive) ? Main.rand.Next(1260, 23400) : Main.rand.Next(1330, 24700); + int randomCount = Main.rand.Next(1330, 24700); if (calamityGlobalNPC.newAI[0] >= (float)randomCount) { @@ -4332,10 +4353,10 @@ namespace CalamityMod.NPCs projectileSpeed = 10f; // Increase laser speed as health drops - if (phase2 || CalamityWorld.bossRushActive) - projectileSpeed += (CalamityWorld.death || CalamityWorld.bossRushActive) ? 0.33f : 0.25f; - if (phase3 || CalamityWorld.bossRushActive) - projectileSpeed += (CalamityWorld.death || CalamityWorld.bossRushActive) ? 0.33f : 0.25f; + if (phase2) + projectileSpeed += 0.25f; + if (phase3) + projectileSpeed += 0.25f; if (CalamityWorld.bossRushActive) projectileSpeed *= 1.25f; @@ -4429,7 +4450,8 @@ namespace CalamityMod.NPCs { Rectangle rectangle = new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height); int num16 = targetFloatingUp ? 50 : 1000; - int height = 2000 - (int)((targetFloatingUp ? 850f : 700f) * (1f - lifeRatio)); + int heightReduction = death ? (targetFloatingUp ? 850 : 700) : (int)((targetFloatingUp ? 850f : 700f) * (1f - lifeRatio)); + int height = 2000 - heightReduction; bool flag3 = true; if (npc.position.Y > Main.player[npc.target].position.Y) @@ -4476,11 +4498,14 @@ namespace CalamityMod.NPCs } } } - fallSpeed += ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 6f : 5f) * (1f - lifeRatio); + float fallSpeedBoost = death ? 5f : 5f * (1f - lifeRatio); + fallSpeed += fallSpeedBoost; - // Speed and movement - float speed = ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 0.11f : 0.1f) + ((targetFloatingUp ? 0.2f : 0.1f) * (1f - lifeRatio)); - float turnSpeed = ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 0.165f : 0.15f) + ((targetFloatingUp ? 0.3f : 0.15f) * (1f - lifeRatio)); + // Speed and movement + float speedBoost = death ? (targetFloatingUp ? 0.2f : 0.1f) : ((targetFloatingUp ? 0.2f : 0.1f) * (1f - lifeRatio)); + float turnSpeedBoost = death ? (targetFloatingUp ? 0.3f : 0.15f) : ((targetFloatingUp ? 0.3f : 0.15f) * (1f - lifeRatio)); + float speed = 0.1f + speedBoost; + float turnSpeed = 0.15f + turnSpeedBoost; if (CalamityWorld.bossRushActive) { speed *= 1.5f; @@ -4676,9 +4701,10 @@ namespace CalamityMod.NPCs { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); bool configBossRushBoost = Config.BossRushXerocCurse && CalamityWorld.bossRushActive; + bool death = CalamityWorld.death || CalamityWorld.bossRushActive; - // Enrage variable if player is floating upside down - bool targetFloatingUp = Main.player[npc.target].gravDir == -1f; + // Enrage variable if player is floating upside down + bool targetFloatingUp = Main.player[npc.target].gravDir == -1f; // Easier to send info to Spazmatism CalamityGlobalNPC.laserEye = npc.whoAmI; @@ -4688,7 +4714,7 @@ namespace CalamityMod.NPCs if (CalamityGlobalNPC.fireEye != -1) spazAlive = Main.npc[CalamityGlobalNPC.fireEye].active; - bool enrage = (double)npc.life < (double)npc.lifeMax * 0.25 || CalamityWorld.bossRushActive; + bool enrage = (double)npc.life < (double)npc.lifeMax * 0.25 || death; // I'm not commenting this entire fucking thing, already did spaz, I'm not doing ret if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) @@ -4901,8 +4927,7 @@ namespace CalamityMod.NPCs } // Enter phase 2 earlier - double healthMult = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 0.85 : 0.7; - if ((double)npc.life < (double)npc.lifeMax * healthMult || targetFloatingUp) + if ((double)npc.life < (double)npc.lifeMax * 0.7 || targetFloatingUp || death) { npc.ai[0] = 1f; npc.ai[1] = 0f; @@ -5358,9 +5383,10 @@ namespace CalamityMod.NPCs { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); bool configBossRushBoost = Config.BossRushXerocCurse && CalamityWorld.bossRushActive; + bool death = CalamityWorld.death || CalamityWorld.bossRushActive; - // Enrage variable if player is floating upside down - bool targetFloatingUp = Main.player[npc.target].gravDir == -1f; + // Enrage variable if player is floating upside down + bool targetFloatingUp = Main.player[npc.target].gravDir == -1f; // Easier to send info to Retinazer CalamityGlobalNPC.fireEye = npc.whoAmI; @@ -5370,7 +5396,7 @@ namespace CalamityMod.NPCs if (CalamityGlobalNPC.laserEye != -1) retAlive = Main.npc[CalamityGlobalNPC.laserEye].active; - bool enrage = (double)npc.life < (double)npc.lifeMax * 0.25 || CalamityWorld.bossRushActive; + bool enrage = (double)npc.life < (double)npc.lifeMax * 0.25 || death; // Get a target if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) @@ -5565,7 +5591,7 @@ namespace CalamityMod.NPCs { npc.ai[2] += 1f; - float timeBeforeSlowDown = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 15f : 12f; + float timeBeforeSlowDown = 12f; if (npc.ai[2] >= timeBeforeSlowDown) { // Slow down @@ -5580,7 +5606,7 @@ namespace CalamityMod.NPCs npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) - 1.57f; // Charge 8 times - float chargeTime = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 35f : 38f; + float chargeTime = 38f; if (npc.ai[2] >= chargeTime) { // Reset AI array and go to cursed fireball phase @@ -5599,8 +5625,7 @@ namespace CalamityMod.NPCs } // Enter phase 2 earlier - double healthMult = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 0.85 : 0.7; - if ((double)npc.life < (double)npc.lifeMax * healthMult || targetFloatingUp) + if ((double)npc.life < (double)npc.lifeMax * 0.7 || targetFloatingUp || death) { // Reset AI array and go to transition phase npc.ai[0] = 1f; @@ -5826,7 +5851,7 @@ namespace CalamityMod.NPCs // Set rotation and velocity npc.rotation = num420; - float num450 = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 17f : 16.75f; + float num450 = 16.75f; // Enrage if (targetFloatingUp) @@ -6109,9 +6134,10 @@ namespace CalamityMod.NPCs { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); bool configBossRushBoost = Config.BossRushXerocCurse && CalamityWorld.bossRushActive; + bool death = CalamityWorld.death || CalamityWorld.bossRushActive; - // Enrage variable if player is floating upside down - bool targetFloatingUp = Main.player[npc.target].gravDir == -1f; + // Enrage variable if player is floating upside down + bool targetFloatingUp = Main.player[npc.target].gravDir == -1f; // Spawn arms if (npc.ai[0] == 0f && Main.netMode != NetmodeID.MultiplayerClient) @@ -6186,8 +6212,8 @@ namespace CalamityMod.NPCs npc.defense = 9999; // Phases - bool phase2 = (double)npc.life < (double)npc.lifeMax * 0.66; - bool phase3 = (double)npc.life < (double)npc.lifeMax * 0.33; + bool phase2 = (double)npc.life < (double)npc.lifeMax * 0.66 || (death && allArmsDead); + bool phase3 = (double)npc.life < (double)npc.lifeMax * 0.33 || (death && allArmsDead); // Despawn if (Main.player[npc.target].dead || Math.Abs(npc.position.X - Main.player[npc.target].position.X) > 6000f || Math.Abs(npc.position.Y - Main.player[npc.target].position.Y) > 6000f) @@ -6252,7 +6278,7 @@ namespace CalamityMod.NPCs if (phase3) npc.localAI[1] += 1f; - if (npc.localAI[1] >= ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 450f : 480f)) + if (npc.localAI[1] >= 480f) { npc.localAI[1] = 0f; Vector2 shootFromVector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); @@ -6282,7 +6308,7 @@ namespace CalamityMod.NPCs if (phase3) npc.localAI[2] += 1f; - if (npc.localAI[2] >= ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 215f : 240f)) + if (npc.localAI[2] >= 240f) { npc.localAI[2] = 0f; float num502 = CalamityWorld.bossRushActive ? 12f : 8f; @@ -6381,7 +6407,7 @@ namespace CalamityMod.NPCs if (phase2) { npc.localAI[1] += 1f; - if (npc.localAI[1] >= ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 39f : 45f)) + if (npc.localAI[1] >= 45f) { npc.localAI[1] = 0f; Vector2 shootFromVector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); @@ -6409,7 +6435,7 @@ namespace CalamityMod.NPCs Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 0, 1f, 0f); // Spin for 3 seconds then return to floating phase - float phaseTimer = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 150f : 180f; + float phaseTimer = 180f; if (phase2 && !phase3) phaseTimer += 120f; @@ -6476,7 +6502,7 @@ namespace CalamityMod.NPCs if (Main.netMode != NetmodeID.MultiplayerClient) { npc.localAI[0] += 1f; - if (npc.localAI[0] >= ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 54f : 60f)) + if (npc.localAI[0] >= 60f) { npc.localAI[0] = 0f; Vector2 vector16 = npc.Center; @@ -6750,7 +6776,7 @@ namespace CalamityMod.NPCs if (!sawAlive) npc.ai[3] += 1f; - if (npc.ai[3] >= ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 680f : 800f)) + if (npc.ai[3] >= 800f) { npc.localAI[0] = 0f; npc.ai[2] = 1f; @@ -6840,7 +6866,7 @@ namespace CalamityMod.NPCs // Go to phase 1 after 2 seconds (change this as each arm dies to stay in this phase for longer) npc.ai[3] += 1f; - float timeLimit = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 150f : 135f; + float timeLimit = 135f; float timeMult = 1.882075f; if (!cannonAlive) timeLimit *= timeMult; @@ -6995,7 +7021,7 @@ namespace CalamityMod.NPCs if (!sawAlive) npc.ai[3] += 1f; - if (npc.ai[3] >= ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 680f : 800f)) + if (npc.ai[3] >= 800f) { npc.localAI[0] = 0f; npc.ai[2] = 1f; @@ -7009,7 +7035,7 @@ namespace CalamityMod.NPCs // Go to phase 1 after 2 seconds (change this as each arm dies to stay in this phase for longer) npc.ai[3] += 1f; - float timeLimit = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 145f : 120f; + float timeLimit = 120f; float timeMult = 1.882075f; if (!laserAlive) timeLimit *= timeMult; @@ -7308,7 +7334,7 @@ namespace CalamityMod.NPCs if (!sawAlive) npc.ai[3] += 1f; - if (npc.ai[3] >= ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 540f : 600f)) + if (npc.ai[3] >= 600f) { npc.ai[2] += 1f; npc.ai[3] = 0f; @@ -7611,7 +7637,7 @@ namespace CalamityMod.NPCs if (!viceAlive) npc.ai[3] += 1f; - if (npc.ai[3] >= ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 165f : 180f)) + if (npc.ai[3] >= 180f) { npc.ai[2] += 1f; npc.ai[3] = 0f; @@ -7791,13 +7817,14 @@ namespace CalamityMod.NPCs public static bool BuffedPlanteraAI(NPC npc, bool enraged, Mod mod) { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + bool death = CalamityWorld.death || CalamityWorld.bossRushActive; - // Percent life remaining - float lifeRatio = (float)npc.life / (float)npc.lifeMax; + // Percent life remaining + float lifeRatio = (float)npc.life / (float)npc.lifeMax; // Phases based on HP bool phase2 = lifeRatio <= 0.5f; - bool phase3 = lifeRatio < 0.25f; + bool phase3 = lifeRatio < 0.25f || death; // Variables and target bool enrage = false; @@ -7915,12 +7942,6 @@ namespace CalamityMod.NPCs acceleration = 0.15f; } - if (CalamityWorld.death || CalamityWorld.bossRushActive) - { - velocity += 1f; - acceleration += 0.01f; - } - if (CalamityWorld.bossRushActive) { velocity *= 1.5f; @@ -7974,8 +7995,6 @@ namespace CalamityMod.NPCs float maxDistanceFromHooks = enrage ? 850f : 550f; if (phase3) maxDistanceFromHooks += 150f; - if (CalamityWorld.death || CalamityWorld.bossRushActive) - maxDistanceFromHooks += 50f; if (num738 >= maxDistanceFromHooks) { @@ -8056,7 +8075,8 @@ namespace CalamityMod.NPCs // Fire projectiles if (Main.netMode != NetmodeID.MultiplayerClient) { - npc.localAI[1] += 1f + (8f * (1f - lifeRatio)); + float shootBoost = death ? 8f : 8f * (1f - lifeRatio); + npc.localAI[1] += 1f + shootBoost; if (enrage) { @@ -8067,7 +8087,7 @@ namespace CalamityMod.NPCs npc.localAI[3] = 1f; } - if (npc.localAI[1] >= ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 65f : 75f)) + if (npc.localAI[1] >= 75f) { npc.localAI[1] = 0f; bool canHit = Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height); @@ -8089,13 +8109,13 @@ namespace CalamityMod.NPCs int damage = 24; int projectileType = ProjectileID.SeedPlantera; - if (lifeRatio < 0.9f && Main.rand.NextBool(2)) + if ((lifeRatio < 0.9f || death) && Main.rand.NextBool(2)) { damage = 30; npc.localAI[1] = -30f; projectileType = ProjectileID.PoisonSeedPlantera; } - else if (lifeRatio < 0.8f && Main.rand.NextBool(4)) + else if ((lifeRatio < 0.8f || death) && Main.rand.NextBool(4)) { int thornBallCount = 0; for (int i = 0; i < 1000; i++) @@ -8167,10 +8187,11 @@ namespace CalamityMod.NPCs npc.localAI[2] = 1f; } - // Spawn spores - npc.localAI[1] += 1f + (8f * (0.5f - lifeRatio)); + // Spawn spores + float spawnBoost = death ? 4f : 8f * (0.5f - lifeRatio); + npc.localAI[1] += 1f + spawnBoost; - if (npc.localAI[1] >= ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 300f : 360f)) + if (npc.localAI[1] >= 360f) { float num757 = CalamityWorld.bossRushActive ? 12f : 8f; Vector2 vector94 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); @@ -8204,7 +8225,7 @@ namespace CalamityMod.NPCs else npc.localAI[3] += (nearbyActiveTiles > 300 ? 1f : 5f) + (float)(tentacleScale - 1); - if (npc.localAI[3] >= ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 330f : 360f)) + if (npc.localAI[3] >= 360f) { Vector2 vector93 = new Vector2(npc.Center.X, npc.Center.Y); @@ -8243,9 +8264,10 @@ namespace CalamityMod.NPCs // Fire spread of spore clouds if (tentaclesDead) { - calamityGlobalNPC.newAI[0] += 1f + (2f * (0.5f - lifeRatio)); + float shootBoost = death ? 1f : 2f * (0.5f - lifeRatio); + calamityGlobalNPC.newAI[0] += 1f + shootBoost; - if (calamityGlobalNPC.newAI[0] >= ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 270f : 300f)) + if (calamityGlobalNPC.newAI[0] >= 300f) { Main.PlaySound(SoundID.Item20, npc.position); @@ -8344,9 +8366,10 @@ namespace CalamityMod.NPCs // Variables bool enrage = false; bool despawn = false; + bool death = CalamityWorld.death || CalamityWorld.bossRushActive; - // Despawn if Plantera is gone - if (NPC.plantBoss < 0) + // Despawn if Plantera is gone + if (NPC.plantBoss < 0) { npc.StrikeNPCNoInteraction(9999, 0f, 0, false, false, false); npc.netUpdate = true; @@ -8383,12 +8406,11 @@ namespace CalamityMod.NPCs if (npc.ai[0] == 0f || npc.ai[1] == 0f) npc.localAI[0] = 0f; - // Timer dictating whether to pick a new location or not - npc.localAI[0] -= (CalamityWorld.bossRushActive ? 4f : 1f) + (2f * (1f - lifeRatio)); + // Timer dictating whether to pick a new location or not + float moveBoost = death ? 2f : 2f * (1f - lifeRatio); + npc.localAI[0] -= (CalamityWorld.bossRushActive ? 4f : 1f) + moveBoost; if (enrage) npc.localAI[0] -= 6f; - if (CalamityWorld.death || CalamityWorld.bossRushActive) - npc.localAI[0] -= 0.5f; // Set timer to new amount if a different hook is currently moving if (!despawn && npc.localAI[0] <= 0f && npc.ai[0] != 0f) @@ -8452,10 +8474,9 @@ namespace CalamityMod.NPCs // Movement to new location if (npc.ai[0] > 0f && npc.ai[1] > 0f) { - // Hook movement velocity - float velocity = (CalamityWorld.bossRushActive ? 10f : 7f) + (3f * (1f - lifeRatio)); - if (CalamityWorld.death || CalamityWorld.bossRushActive) - velocity += 1f; + // Hook movement velocity + float velocityBoost = death ? 3f : 3f * (1f - lifeRatio); + float velocity = (CalamityWorld.bossRushActive ? 10f : 7f) + velocityBoost; if (enrage) velocity *= 2f; if (despawn) @@ -8489,8 +8510,10 @@ namespace CalamityMod.NPCs public static bool BuffedPlanterasTentacleAI(NPC npc, Mod mod) { - // Despawn if Plantera is gone - if (NPC.plantBoss < 0) + bool death = CalamityWorld.death || CalamityWorld.bossRushActive; + + // Despawn if Plantera is gone + if (NPC.plantBoss < 0) { npc.StrikeNPCNoInteraction(9999, 0f, 0, false, false, false); npc.netUpdate = true; @@ -8520,10 +8543,8 @@ namespace CalamityMod.NPCs // Velocity and acceleration float num779 = CalamityWorld.bossRushActive ? 1f : 0.5f; - float num781 = 1f - (float)npc.life / (float)npc.lifeMax; + float num781 = death ? 1f : 1f - (float)npc.life / (float)npc.lifeMax; float num780 = (CalamityWorld.bossRushActive ? 300f : 200f) + (num781 * 50f); - if (CalamityWorld.death || CalamityWorld.bossRushActive) - num780 += 25f; // Despawn if Plantera is gone if (!Main.npc[num778].active || NPC.plantBoss < 0) @@ -8601,13 +8622,14 @@ namespace CalamityMod.NPCs // Percent life remaining float lifeRatio = (float)npc.life / (float)npc.lifeMax; - // Phases - bool phase2 = lifeRatio < 0.75f; - bool phase3 = lifeRatio < 0.5f; - bool phase4 = lifeRatio < 0.25f; + // Phases + bool death = CalamityWorld.death || CalamityWorld.bossRushActive; + bool phase2 = lifeRatio < 0.75f || death; + bool phase3 = lifeRatio < 0.5f || death; + bool phase4 = lifeRatio < 0.25f || death; - // Spawn parts - if (npc.localAI[0] == 0f && Main.netMode != NetmodeID.MultiplayerClient) + // Spawn parts + if (npc.localAI[0] == 0f && Main.netMode != NetmodeID.MultiplayerClient) { npc.localAI[0] = 1f; NPC.NewNPC((int)npc.Center.X - 84, (int)npc.Center.Y - 9, NPCID.GolemFistLeft, 0, 0f, 0f, 0f, 0f, 255); @@ -8757,7 +8779,7 @@ namespace CalamityMod.NPCs if (npc.ai[1] > 0f) { npc.ai[1] += 1f; - if (enrage || CalamityWorld.death) + if (enrage || death) npc.ai[1] += 18f; else { @@ -8779,7 +8801,8 @@ namespace CalamityMod.NPCs // Set jump velocity npc.TargetClosest(true); - float velocityX = 4f + (8f * (1f - lifeRatio)); + float velocityBoost = death ? 8f : 8f * (1f - lifeRatio); + float velocityX = 4f + velocityBoost; if (enrage) velocityX *= 1.5f; @@ -8881,7 +8904,8 @@ namespace CalamityMod.NPCs if (Main.player[npc.target].position.Y > npc.position.Y + (float)npc.height) { - float fallSpeed = 0.2f + (0.8f * (1f - lifeRatio)); + float fallSpeedBoost = death ? 0.8f : 0.8f * (1f - lifeRatio); + float fallSpeed = 0.2f + fallSpeedBoost; if (enrage) fallSpeed *= 1.5f; @@ -8895,7 +8919,8 @@ namespace CalamityMod.NPCs else if (npc.direction > 0) npc.velocity.X += 0.2f; - float num648 = 3f + (6f * (1f - lifeRatio)); + float velocityBoost = death ? 6f : 6f * (1f - lifeRatio); + float num648 = 3f + velocityBoost; if (enrage) num648 *= 1.5f; @@ -8942,6 +8967,8 @@ namespace CalamityMod.NPCs // Percent life remaining float lifeRatio = (float)npc.life / (float)npc.lifeMax; + bool death = CalamityWorld.death || CalamityWorld.bossRushActive; + // Count body parts bool flag41 = NPC.AnyNPCs(NPCID.GolemFistLeft); bool flag42 = NPC.AnyNPCs(NPCID.GolemFistRight); @@ -9044,8 +9071,9 @@ namespace CalamityMod.NPCs else npc.localAI[1] = 0f; - // Fireballs - npc.ai[1] += 1f + (2f * (1f - lifeRatio)); + // Fireballs + float shootBoost = death ? 2f : 2f * (1f - lifeRatio); + npc.ai[1] += 1f + shootBoost; int num662 = 240; if (npc.ai[1] < 20f || npc.ai[1] > (float)(num662 - 20)) @@ -9072,8 +9100,9 @@ namespace CalamityMod.NPCs Projectile.NewProjectile(vector82.X, vector82.Y, num664, num665, ProjectileID.Fireball, 37, 0f, Main.myPlayer, 0f, 0f); } - // Lasers - npc.ai[2] += 1f + (3f * (1f - lifeRatio)); + // Lasers + float shootBoost2 = death ? 3f : 3f * (1f - lifeRatio); + npc.ai[2] += 1f + shootBoost2; if (enrage) npc.ai[2] += 4f; if (!Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1)) @@ -9178,10 +9207,11 @@ namespace CalamityMod.NPCs float golemLifeRatio = (float)Main.npc[NPC.golemBoss].life / (float)Main.npc[NPC.golemBoss].lifeMax; float combinedRatio = lifeRatio + golemLifeRatio; - // Phases - bool phase2 = lifeRatio < 0.7f || golemLifeRatio < 0.85f || CalamityWorld.death || CalamityWorld.bossRushActive; - bool phase3 = lifeRatio < 0.4f || golemLifeRatio < 0.7f || CalamityWorld.death || CalamityWorld.bossRushActive; - bool phase4 = lifeRatio < 0.1f || golemLifeRatio < 0.55f || CalamityWorld.death || CalamityWorld.bossRushActive; + // Phases + bool death = CalamityWorld.death || CalamityWorld.bossRushActive; + bool phase2 = lifeRatio < 0.7f || golemLifeRatio < 0.85f || death; + bool phase3 = lifeRatio < 0.4f || golemLifeRatio < 0.7f || death; + bool phase4 = lifeRatio < 0.1f || golemLifeRatio < 0.55f || death; // Float through tiles or not bool flag44 = false; @@ -9357,8 +9387,9 @@ namespace CalamityMod.NPCs } } - // Fireballs - npc.ai[1] += 1f + (2f * (2f - (lifeRatio + golemLifeRatio))); + // Fireballs + float shootBoost = death ? 4f : 2f * (2f - (lifeRatio + golemLifeRatio)); + npc.ai[1] += 1f + shootBoost; int num705 = 360; if (npc.ai[1] < 20f || npc.ai[1] > (float)(num705 - 20)) @@ -9398,7 +9429,7 @@ namespace CalamityMod.NPCs } // Lasers - npc.ai[2] += 1f + (2f * (2f - (lifeRatio + golemLifeRatio))); + npc.ai[2] += 1f + shootBoost; if (!Collision.CanHit(Main.npc[NPC.golemBoss].Center, 1, 1, Main.player[npc.target].Center, 1, 1)) npc.ai[2] += 8f; @@ -9414,7 +9445,7 @@ namespace CalamityMod.NPCs else if (num713 == 1) vector89.X += 14f; - float num714 = 5f + (2f * (2f - (lifeRatio + golemLifeRatio))); + float num714 = 5f + shootBoost; float num717 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector89.X; float num718 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector89.Y; float num719 = (float)Math.Sqrt((double)(num717 * num717 + num718 * num718)); @@ -9432,6 +9463,7 @@ namespace CalamityMod.NPCs } } } + NetMessage.SendData(23, -1, -1, null, npc.whoAmI, 0f, 0f, 0f, 0, 0, 0); if (ModLoader.GetMod("FargowiltasSouls") != null) @@ -9448,8 +9480,9 @@ namespace CalamityMod.NPCs // Variables float num = 0.6f * Main.damageMultiplier; - bool phase2 = (double)npc.life <= (double)npc.lifeMax * 0.66; - bool phase3 = (double)npc.life <= (double)npc.lifeMax * ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 0.33 : 0.2); + bool death = CalamityWorld.death || CalamityWorld.bossRushActive; + bool phase2 = (double)npc.life <= (double)npc.lifeMax * 0.66 || death; + bool phase3 = (double)npc.life <= (double)npc.lifeMax * (death ? 0.33 : 0.2); bool phase2AI = npc.ai[0] > 4f; bool phase3AI = npc.ai[0] > 9f; bool charging = npc.ai[3] < 10f; @@ -10509,11 +10542,12 @@ namespace CalamityMod.NPCs // Percent life remaining float lifeRatio = (float)npc.life / (float)npc.lifeMax; - // Phases - bool phase2 = lifeRatio < 0.8f; - bool phase3 = lifeRatio < 0.6f; - bool phase4 = lifeRatio < 0.4f; - bool phase5 = lifeRatio < 0.2f; + // Phases + bool death = CalamityWorld.death || CalamityWorld.bossRushActive; + bool phase2 = lifeRatio < 0.8f || death; + bool phase3 = lifeRatio < 0.6f || death; + bool phase4 = lifeRatio < 0.4f || (death && lifeRatio < 0.7f); + bool phase5 = lifeRatio < 0.2f || (death && lifeRatio < 0.4f); // Variables bool isCultist = npc.type == NPCID.CultistBoss; @@ -10529,11 +10563,11 @@ namespace CalamityMod.NPCs (phase4 ? 5 : 0) - (phase5 ? 5 : 0); - float iceMistSpeed = CalamityWorld.death ? 6.5f : 6f; + float iceMistSpeed = death ? 6.5f : 6f; int fireballFireRate = 12; - float fireballSpeed = (CalamityWorld.death ? 7f : 6.5f) - (isCultist ? 0f : 3f); + float fireballSpeed = (death ? 7f : 6.5f) - (isCultist ? 0f : 3f); int lightningOrbFireRate = 40 - (phase2 ? 5 : 0) - @@ -11420,7 +11454,7 @@ namespace CalamityMod.NPCs vec4 = new Vector2((float)npc.direction, 0f); } Vector2 vector18 = npc.Center + new Vector2((float)(npc.direction * 30), 12f); - float scaleFactor = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 11f : 10f; + float scaleFactor = 10f; if (CalamityWorld.bossRushActive) scaleFactor *= 1.5f; @@ -11540,24 +11574,25 @@ namespace CalamityMod.NPCs public static bool BuffedAncientDoomAI(NPC npc, Mod mod) { - npc.damage = npc.defDamage = 0; + bool death = CalamityWorld.death || CalamityWorld.bossRushActive; + npc.damage = npc.defDamage = 0; float num1496 = 420f; float num1497 = 120f; int num1498 = 1; float value57 = 0f; float value58 = 1f; - float num1499 = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 5.5f : 5f; + float num1499 = 5f; if (CalamityWorld.bossRushActive) num1499 *= 1.5f; bool flag110 = npc.ai[1] < 0f || !Main.npc[(int)npc.ai[0]].active; if (Main.npc[(int)npc.ai[0]].type == NPCID.CultistBoss) { - if (Main.npc[(int)npc.ai[0]].life < Main.npc[(int)npc.ai[0]].lifeMax / 2) + if (Main.npc[(int)npc.ai[0]].life < Main.npc[(int)npc.ai[0]].lifeMax / 2 || death) { num1498 = 2; } - if (Main.npc[(int)npc.ai[0]].life < Main.npc[(int)npc.ai[0]].lifeMax / 4) + if (Main.npc[(int)npc.ai[0]].life < Main.npc[(int)npc.ai[0]].lifeMax / 4 || death) { num1498 = 3; } @@ -11632,7 +11667,9 @@ namespace CalamityMod.NPCs #region Buffed Moon Lord AI public static bool BuffedMoonLordAI(NPC npc, bool enraged, Mod mod) { - if (npc.type == NPCID.MoonLordCore) + bool death = CalamityWorld.death || CalamityWorld.bossRushActive; + + if (npc.type == NPCID.MoonLordCore) { // Play a random Moon Lord sound if (npc.ai[0] != -1f && npc.ai[0] != 2f && Main.rand.NextBool(200)) @@ -12232,8 +12269,8 @@ namespace CalamityMod.NPCs else if (num1207 < num1208 - 15f) { float rotation = CalamityWorld.bossRushActive ? 480f : 510f; - if (calamityGlobalNPC.newAI[0] == 1f) - rotation -= 60f; + if (calamityGlobalNPC.newAI[0] == 1f || death) + rotation -= 60f; if (num1207 == 180f && Main.netMode != NetmodeID.MultiplayerClient) { @@ -12736,7 +12773,7 @@ namespace CalamityMod.NPCs } // Heal limits - int num1273 = CalamityWorld.death ? 1500 : 1250; + int num1273 = death ? 1500 : 1250; if (CalamityWorld.bossRushActive) num1273 *= 10; diff --git a/NPCs/Crabulon/CrabulonIdle.cs b/NPCs/Crabulon/CrabulonIdle.cs index a0cb29247a..560b29612a 100644 --- a/NPCs/Crabulon/CrabulonIdle.cs +++ b/NPCs/Crabulon/CrabulonIdle.cs @@ -73,7 +73,8 @@ namespace CalamityMod.NPCs.Crabulon { Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0f, 0.5f, 1f); Player player = Main.player[npc.target]; - bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; + bool death = CalamityWorld.death || CalamityWorld.bossRushActive; + bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; npc.spriteDirection = (npc.direction > 0) ? 1 : -1; if (!player.active || player.dead) @@ -113,12 +114,12 @@ namespace CalamityMod.NPCs.Crabulon npc.localAI[3] += 2f; num352 += 3; } - if ((double)npc.life < (double)npc.lifeMax * 0.5 || CalamityWorld.bossRushActive) + if ((double)npc.life < (double)npc.lifeMax * 0.5 || death) { npc.localAI[3] += 1f; num352 += 2; } - if ((double)npc.life < (double)npc.lifeMax * 0.1 || CalamityWorld.bossRushActive) + if ((double)npc.life < (double)npc.lifeMax * 0.1 || death) { npc.localAI[3] += 2f; num352 += 3; @@ -148,21 +149,16 @@ namespace CalamityMod.NPCs.Crabulon num354 += 3; num353 += 3f; } - if ((double)npc.life < (double)npc.lifeMax * 0.5 || CalamityWorld.bossRushActive) + if ((double)npc.life < (double)npc.lifeMax * 0.5 || death) { num354++; num353 += 1f; } - if ((double)npc.life < (double)npc.lifeMax * 0.1 || CalamityWorld.bossRushActive) + if ((double)npc.life < (double)npc.lifeMax * 0.1 || death) { num354++; num353 += 1f; } - if (CalamityWorld.death || CalamityWorld.bossRushActive) - { - num354 += 3; - num353 += 1f; - } vector34 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); num349 = player.position.X + (float)player.width * 0.5f - vector34.X; num350 = player.position.Y + (float)player.height * 0.5f - vector34.Y; @@ -214,9 +210,9 @@ namespace CalamityMod.NPCs.Crabulon { float num823 = 1.25f; bool flag51 = false; - if ((double)npc.life < (double)npc.lifeMax * 0.5) + if ((double)npc.life < (double)npc.lifeMax * 0.5 || death) num823 = 1.5f; - if ((double)npc.life < (double)npc.lifeMax * 0.1) + if ((double)npc.life < (double)npc.lifeMax * 0.1 || death) num823 = 2f; if (CalamityWorld.bossRushActive) num823 = 12f; @@ -333,11 +329,11 @@ namespace CalamityMod.NPCs.Crabulon break; } } - if (npc.life < npc.lifeMax / 2 || CalamityWorld.bossRushActive) + if (npc.life < npc.lifeMax / 2 || death) { npc.ai[1] += (!revenge ? 4f : 1f); } - if (npc.life < npc.lifeMax / 4 || CalamityWorld.bossRushActive) + if (npc.life < npc.lifeMax / 4 || death) { npc.ai[1] += (!revenge ? 4f : 1f); } @@ -467,15 +463,11 @@ namespace CalamityMod.NPCs.Crabulon { num626 += 3f; } - if (CalamityWorld.death || CalamityWorld.bossRushActive) - { - num626 += 2f; - } - if (npc.life < npc.lifeMax / 2 || CalamityWorld.bossRushActive) + if (npc.life < npc.lifeMax / 2 || death) { num626 += 1f; } - if (npc.life < npc.lifeMax / 10 || CalamityWorld.bossRushActive) + if (npc.life < npc.lifeMax / 10 || death) { num626 += 1f; } diff --git a/NPCs/Cryogen/Cryogen.cs b/NPCs/Cryogen/Cryogen.cs index ca881e204e..ec84b95ddd 100644 --- a/NPCs/Cryogen/Cryogen.cs +++ b/NPCs/Cryogen/Cryogen.cs @@ -112,7 +112,8 @@ namespace CalamityMod.NPCs.Cryogen bool isChill = player.ZoneSnow; bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; - double multAdd = revenge ? 0.1 : 0D; + bool death = CalamityWorld.death || CalamityWorld.bossRushActive; + double multAdd = revenge ? 0.1 : 0D; npc.TargetClosest(true); if (npc.ai[2] == 0f && npc.localAI[1] == 0f && Main.netMode != NetmodeID.MultiplayerClient && (npc.ai[0] < 4f || CalamityWorld.bossRushActive)) //spawn shield for phase 0 1 2 3, not 4 5 6 @@ -176,9 +177,6 @@ namespace CalamityMod.NPCs.Cryogen if (Main.netMode != NetmodeID.MultiplayerClient && expertMode && (npc.ai[0] < 5f || !revenge || (double)npc.life >= (double)npc.lifeMax * 0.15)) { time++; - if (CalamityWorld.death || CalamityWorld.bossRushActive) - time++; - if (time >= 600) { Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); @@ -236,7 +234,7 @@ namespace CalamityMod.NPCs.Cryogen float num1244 = player.Center.Y - vector142.Y; float num1245 = (float)Math.Sqrt((double)(num1243 * num1243 + num1244 * num1244)); float num1246 = isChill ? 4f : 8f; - if (CalamityWorld.death) + if (death) { num1246 = isChill ? 5f : 10f; } @@ -250,7 +248,8 @@ namespace CalamityMod.NPCs.Cryogen npc.velocity.X = (npc.velocity.X * 50f + num1243) / 51f; npc.velocity.Y = (npc.velocity.Y * 50f + num1244) / 51f; - if ((double)npc.life < (double)npc.lifeMax * (0.83 + multAdd)) + double HPMult = death ? 0.95 : 0.83 + multAdd; + if ((double)npc.life < (double)npc.lifeMax * HPMult) { npc.ai[0] = 1f; npc.localAI[0] = 0f; @@ -290,7 +289,7 @@ namespace CalamityMod.NPCs.Cryogen float velocity = isChill ? 7.5f : 4f; float acceleration = isChill ? 0.1f : 0.15f; - if (CalamityWorld.death) + if (death) velocity = isChill ? 7f : 3.5f; if (CalamityWorld.bossRushActive) { @@ -357,7 +356,8 @@ namespace CalamityMod.NPCs.Cryogen } } - if ((double)npc.life < (double)npc.lifeMax * (0.66 + multAdd)) + double HPMult = death ? 0.8 : 0.66 + multAdd; + if ((double)npc.life < (double)npc.lifeMax * HPMult) { npc.ai[0] = 2f; npc.localAI[0] = 0f; @@ -435,7 +435,7 @@ namespace CalamityMod.NPCs.Cryogen float num1244 = player.Center.Y - vector142.Y; float num1245 = (float)Math.Sqrt((double)(num1243 * num1243 + num1244 * num1244)); float num1246 = isChill ? 6f : 12f; - if (CalamityWorld.death) + if (death) { num1246 = isChill ? 7f : 14f; } @@ -449,7 +449,8 @@ namespace CalamityMod.NPCs.Cryogen npc.velocity.X = (npc.velocity.X * 50f + num1243) / 51f; npc.velocity.Y = (npc.velocity.Y * 50f + num1244) / 51f; - if ((double)npc.life < (double)npc.lifeMax * (0.49 + multAdd)) + double HPMult = death ? 0.7 : 0.49 + multAdd; + if ((double)npc.life < (double)npc.lifeMax * HPMult) { npc.ai[0] = 3f; npc.localAI[0] = 0f; @@ -501,7 +502,7 @@ namespace CalamityMod.NPCs.Cryogen float velocity = isChill ? 7.5f : 4f; float acceleration = isChill ? 0.1f : 0.15f; - if (CalamityWorld.death) + if (death) velocity = isChill ? 7f : 3.5f; if (CalamityWorld.bossRushActive) { @@ -568,7 +569,8 @@ namespace CalamityMod.NPCs.Cryogen } } - if ((double)npc.life < (double)npc.lifeMax * (0.32 + multAdd)) + double HPMult = death ? 0.55 : 0.32 + multAdd; + if ((double)npc.life < (double)npc.lifeMax * HPMult) { npc.ai[0] = 4f; npc.localAI[0] = 0f; @@ -705,7 +707,8 @@ namespace CalamityMod.NPCs.Cryogen } } - if ((double)npc.life < (double)npc.lifeMax * (0.15 + multAdd)) + double HPMult = death ? 0.4 : 0.15 + multAdd; + if ((double)npc.life < (double)npc.lifeMax * HPMult) { Main.PlaySound(4, (int)npc.position.X, (int)npc.position.Y, 15); drawAltTexture = true; @@ -758,7 +761,8 @@ namespace CalamityMod.NPCs.Cryogen { npc.damage = (int)((float)npc.defDamage * 1.5f); - if (revenge && (double)npc.life < (double)npc.lifeMax * 0.15) + double HPMult = death ? 0.25 : 0.15; + if (revenge && (double)npc.life < (double)npc.lifeMax * HPMult) { if (npc.ai[1] == 60f) npc.velocity = Vector2.Normalize(player.Center - npc.Center) * (CalamityWorld.bossRushActive ? 30f : (isChill ? 18f : 24f)); @@ -806,7 +810,7 @@ namespace CalamityMod.NPCs.Cryogen num1374 *= num1376; iceShard--; - if ((double)npc.life < (double)npc.lifeMax * (0.1 + multAdd) || CalamityWorld.death || CalamityWorld.bossRushActive) + if ((double)npc.life < (double)npc.lifeMax * (0.1 + multAdd) || death) { if (num1375 < 170f || iceShard > 0) { @@ -860,7 +864,7 @@ namespace CalamityMod.NPCs.Cryogen else { time++; - if (time >= 60) + if (time >= 75) { Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); float spread = 45f * 0.0174f; @@ -908,7 +912,7 @@ namespace CalamityMod.NPCs.Cryogen float velocity = isChill ? 6f : 3f; float acceleration = isChill ? 0.2f : 0.3f; - if (CalamityWorld.death) + if (death) velocity = isChill ? 5f : 2.5f; if (CalamityWorld.bossRushActive) { @@ -959,7 +963,7 @@ namespace CalamityMod.NPCs.Cryogen } } - if (!revenge || (double)npc.life >= (double)npc.lifeMax * 0.15) + if (!revenge || (double)npc.life >= (double)npc.lifeMax * (death ? 0.25 : 0.15)) { if (npc.ai[3] == 0f && npc.life > 0) { diff --git a/NPCs/DevourerofGods/DevourerofGodsTailS.cs b/NPCs/DevourerofGods/DevourerofGodsTailS.cs index c60a9e7288..e7202bd231 100644 --- a/NPCs/DevourerofGods/DevourerofGodsTailS.cs +++ b/NPCs/DevourerofGods/DevourerofGodsTailS.cs @@ -89,6 +89,10 @@ namespace CalamityMod.NPCs.DevourerofGods { npc.dontTakeDamage = Main.npc[(int)npc.ai[2]].dontTakeDamage; } + if (Main.npc[(int)npc.ai[2]].dontTakeDamage) + { + invinceTime = 240; + } if (npc.ai[3] > 0f) { npc.realLife = (int)npc.ai[3]; diff --git a/NPCs/NormalNPCs/WulfrumDrone.cs b/NPCs/NormalNPCs/WulfrumDrone.cs index 82395fea93..b1dbf24a31 100644 --- a/NPCs/NormalNPCs/WulfrumDrone.cs +++ b/NPCs/NormalNPCs/WulfrumDrone.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Materials; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Placeables.Banners; using Terraria; using Terraria.ID; @@ -69,11 +70,9 @@ namespace CalamityMod.NPCs.NormalNPCs public override void NPCLoot() { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType(), Main.rand.Next(1, 4)); - if (Main.expertMode && Main.rand.NextBool(2)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType()); - } + DropHelper.DropItem(npc, ModContent.ItemType(), 1, 3); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), Main.expertMode, 1, 1); + DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); } } } diff --git a/NPCs/SunkenSea/EutrophicRay.cs b/NPCs/SunkenSea/EutrophicRay.cs index 60e9ddfcc6..ce6c517c5f 100644 --- a/NPCs/SunkenSea/EutrophicRay.cs +++ b/NPCs/SunkenSea/EutrophicRay.cs @@ -194,10 +194,7 @@ namespace CalamityMod.NPCs.SunkenSea public override void NPCLoot() { - if (Main.rand.NextBool(3)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType()); - } + DropHelper.DropItemChance(npc, ModContent.ItemType(), 3); } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/SunkenSea/GhostBell.cs b/NPCs/SunkenSea/GhostBell.cs index 7f987e3d0d..04d318b656 100644 --- a/NPCs/SunkenSea/GhostBell.cs +++ b/NPCs/SunkenSea/GhostBell.cs @@ -1,10 +1,12 @@ using CalamityMod.Items.Placeables.Banners; +using CalamityMod.Items.Accessories; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.NPCs.SunkenSea { public class GhostBell : ModNPC @@ -157,5 +159,10 @@ namespace CalamityMod.NPCs.SunkenSea } } } + + public override void NPCLoot() + { + DropHelper.DropItemChance(npc, ModContent.ItemType(), 5); + } } } diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index 367d304199..15a2665d76 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -7,6 +7,7 @@ using CalamityMod.Projectiles.Healing; using CalamityMod.Projectiles.Magic; using CalamityMod.Projectiles.Melee; using CalamityMod.Projectiles.Rogue; +using CalamityMod.Projectiles.Summon; using CalamityMod.Projectiles.Typeless; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -1511,6 +1512,64 @@ namespace CalamityMod.Projectiles target.AddBuff(BuffID.ShadowFlame, 300); } + if (Main.player[projectile.owner].Calamity().voltaicJelly) + { + target.AddBuff(BuffID.Electrified, 60); + } + + if (Main.player[projectile.owner].Calamity().jellyChargedBattery) + { + if (Main.player[projectile.owner].Calamity().jellyDmg <= 0) + { + int num = projectile.damage / 2; + Main.player[projectile.owner].Calamity().jellyDmg += (float)num; + int[] array = new int[200]; + int num3 = 0; + int num4 = 0; + for (int i = 0; i < 200; i++) + { + if (Main.npc[i].CanBeChasedBy(projectile, false)) + { + float num5 = Math.Abs(Main.npc[i].position.X + (float)(Main.npc[i].width / 2) - projectile.position.X + (float)(projectile.width / 2)) + Math.Abs(Main.npc[i].position.Y + (float)(Main.npc[i].height / 2) - projectile.position.Y + (float)(projectile.height / 2)); + if (num5 < 800f) + { + if (Collision.CanHit(projectile.position, 1, 1, Main.npc[i].position, Main.npc[i].width, Main.npc[i].height) && num5 > 50f) + { + array[num4] = i; + num4++; + } + else if (num4 == 0) + { + array[num3] = i; + num3++; + } + } + } + } + if (num3 == 0 && num4 == 0) + { + return; + } + int num6; + if (num4 > 0) + { + num6 = array[Main.rand.Next(num4)]; + } + else + { + num6 = array[Main.rand.Next(num3)]; + } + float num7 = 15f; + float num8 = (float)Main.rand.Next(-100, 101); + float num9 = (float)Main.rand.Next(-100, 101); + float num10 = (float)Math.Sqrt((double)(num8 * num8 + num9 * num9)); + num10 = num7 / num10; + num8 *= num10; + num9 *= num10; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, num8, num9, ModContent.ProjectileType(), (int)((double)num * 1.2), 0f, projectile.owner, (float)num6, 0f); + } + } + // Fearmonger set's colossal life regeneration CalamityPlayer modPlayer = Main.player[projectile.owner].Calamity(); if(modPlayer.fearmongerSet) @@ -1575,13 +1634,6 @@ namespace CalamityMod.Projectiles } #endregion - /*#ModifyHitPlayer - public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) - { - target.Calamity().lastProjectileHit = ModContent.ProjectileType(); - } - #endregion*/ - #region CanDamage public override bool CanDamage(Projectile projectile) { diff --git a/Projectiles/Pets/RotomPet.cs b/Projectiles/Pets/RotomPet.cs index 85d7d49b96..4d63575440 100644 --- a/Projectiles/Pets/RotomPet.cs +++ b/Projectiles/Pets/RotomPet.cs @@ -165,11 +165,13 @@ namespace CalamityMod.Projectiles.Pets projectile.velocity.Y = projectile.velocity.Y - num16 * 2f; } } + projectile.rotation = projectile.velocity.X * 0.05f; if ((double) projectile.velocity.X > 0.25) projectile.spriteDirection = projectile.direction = 1; else if ((double) projectile.velocity.X < -0.25) projectile.spriteDirection = projectile.direction = -1; + projectile.frameCounter++; if (projectile.frameCounter > 6) { @@ -237,7 +239,7 @@ namespace CalamityMod.Projectiles.Pets num406 = num403 / num406; num404 *= num406; num405 *= num406; - Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 93); + //Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 93); Projectile.NewProjectile(projectile.Center.X - 4f, projectile.Center.Y, num404, num405, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); projectile.ai[0] = 50f; } diff --git a/Projectiles/Ranged/CardClub.cs b/Projectiles/Ranged/CardClub.cs new file mode 100644 index 0000000000..eb678fdc8b --- /dev/null +++ b/Projectiles/Ranged/CardClub.cs @@ -0,0 +1,73 @@ +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Ranged +{ + public class CardClub : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Club"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } + + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.friendly = true; + projectile.alpha = 255; + projectile.penetrate = 1; + projectile.timeLeft = 600; + projectile.ranged = true; + projectile.extraUpdates = 1; + projectile.aiStyle = 1; + aiType = ProjectileID.Bullet; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.5f / 255f, (255 - projectile.alpha) * 0f / 255f, (255 - projectile.alpha) * 0f / 255f); + projectile.rotation -= (MathHelper.ToRadians(90) * projectile.direction); + projectile.spriteDirection = projectile.direction; + if (Main.rand.NextBool(2)) + { + int num137 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), 1, 1, 30, 0f, 0f, 0, default, 0.5f); + Main.dust[num137].velocity *= 0f; + Main.dust[num137].noGravity = true; + } + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); + Main.PlaySound(0, (int)projectile.position.X, (int)projectile.position.Y, 1, 1f, 0f); + return true; + } + + public override void Kill(int timeLeft) + { + for (int i = -8; i <= 8; i += 8) + { + Vector2 perturbedSpeed = new Vector2(projectile.velocity.X, projectile.velocity.Y).RotatedBy(MathHelper.ToRadians(i)); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, ModContent.ProjectileType(), projectile.damage / 2, 0f, projectile.owner, 0f, 0f); + } + Main.PlaySound(SoundID.Item110, projectile.Center); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 360); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + } +} diff --git a/Projectiles/Ranged/CardClub.png b/Projectiles/Ranged/CardClub.png new file mode 100644 index 0000000000..18181393ac Binary files /dev/null and b/Projectiles/Ranged/CardClub.png differ diff --git a/Projectiles/Ranged/CardClubSplit.cs b/Projectiles/Ranged/CardClubSplit.cs new file mode 100644 index 0000000000..c388a6f01e --- /dev/null +++ b/Projectiles/Ranged/CardClubSplit.cs @@ -0,0 +1,114 @@ +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Ranged +{ + public class CardClubSplit : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Club"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } + + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.friendly = true; + projectile.alpha = 255; + projectile.penetrate = 1; + projectile.timeLeft = 600; + projectile.ranged = true; + projectile.extraUpdates = 1; + projectile.aiStyle = 1; + aiType = ProjectileID.Bullet; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.5f / 255f, (255 - projectile.alpha) * 0f / 255f, (255 - projectile.alpha) * 0f / 255f); + projectile.rotation -= (MathHelper.ToRadians(90) * projectile.direction); + projectile.spriteDirection = projectile.direction; + if (Main.rand.NextBool(2)) + { + int num137 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), 1, 1, 30, 0f, 0f, 0, default, 0.5f); + Main.dust[num137].velocity *= 0f; + Main.dust[num137].noGravity = true; + } + + if (projectile.alpha < 128) + { + float pcx = projectile.Center.X; + float pcy = projectile.Center.Y; + float var1 = 800f; + bool flag = false; + for (int npcvar = 0; npcvar < Main.npc.Length; npcvar++) + { + if (Main.npc[npcvar].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[npcvar].Center, 1, 1)) + { + float var2 = Main.npc[npcvar].position.X + (Main.npc[npcvar].width / 2); + float var3 = Main.npc[npcvar].position.Y + (Main.npc[npcvar].height / 2); + float var4 = Math.Abs(projectile.position.X + (projectile.width / 2) - var2) + Math.Abs(projectile.position.Y + (projectile.height / 2) - var3); + if (var4 < var1) + { + var1 = var4; + pcx = var2; + pcy = var3; + flag = true; + } + } + } + if (flag) + { + float homingstrenght = 12f; + Vector2 vector1 = new Vector2(projectile.position.X + projectile.width * 0.5f, projectile.position.Y + projectile.height * 0.5f); + float var6 = pcx - vector1.X; + float var7 = pcy - vector1.Y; + float var8 = (float)Math.Sqrt(var6 * var6 + var7 * var7); + var8 = homingstrenght / var8; + var6 *= var8; + var7 *= var8; + projectile.velocity.X = (projectile.velocity.X * 20f + var6) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + var7) / 21f; + } + } + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); + Main.PlaySound(0, (int)projectile.position.X, (int)projectile.position.Y, 1, 1f, 0f); + return true; + } + + public override void Kill(int timeLeft) + { + for (int k = 0; k < 2; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 30, projectile.oldVelocity.X * 0.15f, projectile.oldVelocity.Y * 0.15f); + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 360); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + + public override bool CanDamage() + { + return projectile.alpha < 128; + } + } +} diff --git a/Projectiles/Ranged/CardClubSplit.png b/Projectiles/Ranged/CardClubSplit.png new file mode 100644 index 0000000000..18181393ac Binary files /dev/null and b/Projectiles/Ranged/CardClubSplit.png differ diff --git a/Projectiles/Ranged/CardDiamond.cs b/Projectiles/Ranged/CardDiamond.cs new file mode 100644 index 0000000000..a13744c7ea --- /dev/null +++ b/Projectiles/Ranged/CardDiamond.cs @@ -0,0 +1,124 @@ +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Ranged +{ + public class CardDiamond : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Diamond"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } + + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.friendly = true; + projectile.alpha = 255; + projectile.penetrate = 1; + projectile.timeLeft = 600; + projectile.ranged = true; + projectile.extraUpdates = 1; + projectile.aiStyle = 1; + aiType = ProjectileID.Bullet; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.5f / 255f, (255 - projectile.alpha) * 0f / 255f, (255 - projectile.alpha) * 0f / 255f); + projectile.rotation -= (MathHelper.ToRadians(90) * projectile.direction); + projectile.spriteDirection = projectile.direction; + if (Main.rand.NextBool(2)) + { + int num137 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), 1, 1, 30, 0f, 0f, 0, default, 0.5f); + Main.dust[num137].velocity *= 0f; + Main.dust[num137].noGravity = true; + } + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); + Main.PlaySound(0, (int)projectile.position.X, (int)projectile.position.Y, 1, 1f, 0f); + return true; + } + + public override void Kill(int timeLeft) + { + projectile.position = projectile.Center; + projectile.width = projectile.height = 50; + 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(); + Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 14); + for (int num621 = 0; num621 < 10; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 30, 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 < 15; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 30, 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, 30, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + for (int num625 = 0; num625 < 10; num625++) + { + float scaleFactor10 = 0.33f; + if (num625 == 1) + { + scaleFactor10 = 0.66f; + } + if (num625 == 2) + { + scaleFactor10 = 1f; + } + int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + Gore gore = Main.gore[num626]; + gore.velocity *= scaleFactor10; + gore.velocity.X += 1f; + gore.velocity.Y += 1f; + num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + gore.velocity *= scaleFactor10; + gore.velocity.X -= 1f; + gore.velocity.Y += 1f; + num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + gore.velocity *= scaleFactor10; + gore.velocity.X += 1f; + gore.velocity.Y -= 1f; + num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); + gore.velocity *= scaleFactor10; + gore.velocity.X -= 1f; + gore.velocity.Y -= 1f; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 360); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + } +} diff --git a/Projectiles/Ranged/CardDiamond.png b/Projectiles/Ranged/CardDiamond.png new file mode 100644 index 0000000000..098f48ae0b Binary files /dev/null and b/Projectiles/Ranged/CardDiamond.png differ diff --git a/Projectiles/Ranged/CardHeart.cs b/Projectiles/Ranged/CardHeart.cs new file mode 100644 index 0000000000..f023af6d53 --- /dev/null +++ b/Projectiles/Ranged/CardHeart.cs @@ -0,0 +1,78 @@ +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Ranged +{ + public class CardHeart : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Heart"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } + + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.friendly = true; + projectile.alpha = 255; + projectile.penetrate = 1; + projectile.timeLeft = 600; + projectile.ranged = true; + projectile.extraUpdates = 1; + projectile.aiStyle = 1; + aiType = ProjectileID.Bullet; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.5f / 255f, (255 - projectile.alpha) * 0f / 255f, (255 - projectile.alpha) * 0f / 255f); + projectile.rotation -= (MathHelper.ToRadians(90) * projectile.direction); + projectile.spriteDirection = projectile.direction; + if (Main.rand.NextBool(2)) + { + int num137 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), 1, 1, 30, 0f, 0f, 0, default, 0.5f); + Main.dust[num137].velocity *= 0f; + Main.dust[num137].noGravity = true; + } + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); + Main.PlaySound(0, (int)projectile.position.X, (int)projectile.position.Y, 1, 1f, 0f); + return true; + } + + public override void Kill(int timeLeft) + { + for (int k = 0; k < 2; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 30, projectile.oldVelocity.X * 0.15f, projectile.oldVelocity.Y * 0.15f); + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 360); + if (target.type == NPCID.TargetDummy) + { + return; + } + Player player = Main.player[projectile.owner]; + player.statLife += 1; + player.HealEffect(1); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + } +} diff --git a/Projectiles/Ranged/CardHeart.png b/Projectiles/Ranged/CardHeart.png new file mode 100644 index 0000000000..98ab11bef0 Binary files /dev/null and b/Projectiles/Ranged/CardHeart.png differ diff --git a/Projectiles/Ranged/CardSpade.cs b/Projectiles/Ranged/CardSpade.cs new file mode 100644 index 0000000000..c468dbdd4e --- /dev/null +++ b/Projectiles/Ranged/CardSpade.cs @@ -0,0 +1,73 @@ +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Ranged +{ + public class CardSpade : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Spade"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } + + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.friendly = true; + projectile.alpha = 255; + projectile.penetrate = -1; + projectile.timeLeft = 600; + projectile.ranged = true; + projectile.extraUpdates = 1; + projectile.aiStyle = 1; + aiType = ProjectileID.Bullet; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 4; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.5f / 255f, (255 - projectile.alpha) * 0f / 255f, (255 - projectile.alpha) * 0f / 255f); + projectile.rotation -= (MathHelper.ToRadians(90) * projectile.direction); + projectile.spriteDirection = projectile.direction; + if (Main.rand.NextBool(2)) + { + int num137 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), 1, 1, 30, 0f, 0f, 0, default, 0.5f); + Main.dust[num137].velocity *= 0f; + Main.dust[num137].noGravity = true; + } + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); + Main.PlaySound(0, (int)projectile.position.X, (int)projectile.position.Y, 1, 1f, 0f); + return true; + } + + public override void Kill(int timeLeft) + { + for (int k = 0; k < 2; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 30, projectile.oldVelocity.X * 0.15f, projectile.oldVelocity.Y * 0.15f); + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 360); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + } +} diff --git a/Projectiles/Ranged/CardSpade.png b/Projectiles/Ranged/CardSpade.png new file mode 100644 index 0000000000..c3347f8684 Binary files /dev/null and b/Projectiles/Ranged/CardSpade.png differ diff --git a/Projectiles/Ranged/MagnomalyRocket.cs b/Projectiles/Ranged/MagnomalyRocket.cs index acdb6f4045..534be0b674 100644 --- a/Projectiles/Ranged/MagnomalyRocket.cs +++ b/Projectiles/Ranged/MagnomalyRocket.cs @@ -202,8 +202,8 @@ namespace CalamityMod.Projectiles.Ranged for (int i = 0; i < 4; i++) { double offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - int proj1 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), projectile.damage / 5, projectile.knockBack / 5, projectile.owner, 0f, 1f); - int proj2 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), projectile.damage / 5, projectile.knockBack / 5, projectile.owner, 0f, 1f); + int proj1 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), projectile.damage / 4, projectile.knockBack / 4, projectile.owner, 0f, 1f); + int proj2 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), projectile.damage / 4, projectile.knockBack / 4, projectile.owner, 0f, 1f); } target.AddBuff(ModContent.BuffType(), 30); target.AddBuff(ModContent.BuffType(), 120); diff --git a/Projectiles/Rogue/HypothermiaChunk.cs b/Projectiles/Rogue/HypothermiaChunk.cs new file mode 100644 index 0000000000..31163095d0 --- /dev/null +++ b/Projectiles/Rogue/HypothermiaChunk.cs @@ -0,0 +1,87 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; + +namespace CalamityMod.Projectiles.Rogue +{ + public class HypothermiaChunk : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ice Chunk"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } + + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.timeLeft = 80; + projectile.extraUpdates = 3; + projectile.ignoreWater = true; + projectile.Calamity().rogue = true; + projectile.tileCollide = false; + } + + public override void AI() + { + //Rotation + projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); + projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); + + Lighting.AddLight(projectile.Center, 0.1f, 0f, 0.5f); + if (projectile.ai[0] < 0.2f) + { + projectile.ai[0] += 0.1f; + } + else + { + projectile.tileCollide = true; + } + + if (Main.rand.Next(10) == 0) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 191, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f, 0, default, 0.8f); + } + } + + public override void Kill(int timeLeft) + { + for (int i = 0; i <= 3; i++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 191, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f, 0, default, 0.8f); + } + if (projectile.owner == Main.myPlayer) + { + for (int num252 = 0; num252 < 3; num252++) + { + Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + while (value15.X == 0f && value15.Y == 0f) + { + value15 = 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; + int shard = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value15.X, value15.Y, ModContent.ProjectileType(), (int)((float)projectile.damage * 0.75f), projectile.knockBack * 0.75f, Main.myPlayer, Main.rand.Next(0,4), 1f); + } + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Frostburn, 300); + } + + 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/HypothermiaChunk.png b/Projectiles/Rogue/HypothermiaChunk.png new file mode 100644 index 0000000000..1d150539a4 Binary files /dev/null and b/Projectiles/Rogue/HypothermiaChunk.png differ diff --git a/Projectiles/Rogue/HypothermiaShard.cs b/Projectiles/Rogue/HypothermiaShard.cs new file mode 100644 index 0000000000..de4796b2b4 --- /dev/null +++ b/Projectiles/Rogue/HypothermiaShard.cs @@ -0,0 +1,101 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class HypothermiaShard : ModProjectile + { + private float counter = 0f; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ice Shard"); + } + + public override void SetDefaults() + { + projectile.width = 6; + projectile.height = 6; + projectile.scale = 1f; + projectile.friendly = true; + projectile.alpha = 50; + projectile.penetrate = 1; + projectile.timeLeft = 600; + projectile.Calamity().rogue = true; + projectile.extraUpdates = 3; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, 0.1f, 0f, 0.5f); + projectile.rotation += projectile.velocity.X * 0.2f; + counter += 0.25f; + if (Main.rand.NextBool(10)) + { + int num300 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 191, 0f, 0f, 0, default, 0.8f); + Main.dust[num300].noGravity = true; + Main.dust[num300].velocity *= 0.2f; + } + projectile.velocity *= 0.996f; + if (counter > 100f) + { + projectile.scale -= 0.05f; + if ((double)projectile.scale <= 0.2) + { + projectile.scale = 0.2f; + projectile.Kill(); + } + projectile.width = (int)(6f * projectile.scale); + projectile.height = (int)(6f * projectile.scale); + } + } + + 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 void Kill(int timeLeft) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 191, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f, 0, default, 0.8f); + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Frostburn, 120); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + //Changes the texture of the projectile + Texture2D texture = Main.projectileTexture[projectile.type]; + if (projectile.ai[0] == 1f) + { + texture = ModContent.GetTexture("CalamityMod/Projectiles/Rogue/HypothermiaShard2"); + } + if (projectile.ai[0] == 2f) + { + texture = ModContent.GetTexture("CalamityMod/Projectiles/Rogue/HypothermiaShard3"); + } + if (projectile.ai[0] == 3f) + { + texture = ModContent.GetTexture("CalamityMod/Projectiles/Rogue/HypothermiaShard4"); + } + Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition, new Rectangle?(new Rectangle(0, 0, texture.Width, texture.Height)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2(texture.Width / 2f, texture.Height / 2f), projectile.scale, SpriteEffects.None, 0f); + return false; + } + } +} diff --git a/Projectiles/Rogue/HypothermiaShard.png b/Projectiles/Rogue/HypothermiaShard.png new file mode 100644 index 0000000000..064750d2ad Binary files /dev/null and b/Projectiles/Rogue/HypothermiaShard.png differ diff --git a/Projectiles/Rogue/HypothermiaShard2.png b/Projectiles/Rogue/HypothermiaShard2.png new file mode 100644 index 0000000000..1227456976 Binary files /dev/null and b/Projectiles/Rogue/HypothermiaShard2.png differ diff --git a/Projectiles/Rogue/HypothermiaShard3.png b/Projectiles/Rogue/HypothermiaShard3.png new file mode 100644 index 0000000000..f4f5ad31b3 Binary files /dev/null and b/Projectiles/Rogue/HypothermiaShard3.png differ diff --git a/Projectiles/Rogue/HypothermiaShard4.png b/Projectiles/Rogue/HypothermiaShard4.png new file mode 100644 index 0000000000..26912bb127 Binary files /dev/null and b/Projectiles/Rogue/HypothermiaShard4.png differ diff --git a/Projectiles/Rogue/JawsProjectile.cs b/Projectiles/Rogue/JawsProjectile.cs index a695c112b8..020ad9086e 100644 --- a/Projectiles/Rogue/JawsProjectile.cs +++ b/Projectiles/Rogue/JawsProjectile.cs @@ -65,10 +65,7 @@ namespace CalamityMod.Projectiles.Rogue int num988 = 15; bool flag54 = false; bool flag55 = false; - float[] var_2_2CB4E_cp_0 = projectile.localAI; - int var_2_2CB4E_cp_1 = 0; - float num73 = var_2_2CB4E_cp_0[var_2_2CB4E_cp_1]; - var_2_2CB4E_cp_0[var_2_2CB4E_cp_1] = num73 + 1f; + projectile.localAI[0] += 1f; if (projectile.localAI[0] % 30f == 0f) { flag55 = true; diff --git a/Projectiles/Rogue/LeviathanTooth.cs b/Projectiles/Rogue/LeviathanTooth.cs index 291ae41594..98c992d595 100644 --- a/Projectiles/Rogue/LeviathanTooth.cs +++ b/Projectiles/Rogue/LeviathanTooth.cs @@ -49,10 +49,7 @@ namespace CalamityMod.Projectiles.Rogue int num988 = 15; bool flag54 = false; bool flag55 = false; - float[] var_2_2CB4E_cp_0 = projectile.localAI; - int var_2_2CB4E_cp_1 = 0; - float num73 = var_2_2CB4E_cp_0[var_2_2CB4E_cp_1]; - var_2_2CB4E_cp_0[var_2_2CB4E_cp_1] = num73 + 1f; + projectile.localAI[0] += 1f; if (projectile.localAI[0] % 30f == 0f) { flag55 = true; diff --git a/Projectiles/Rogue/LeviathanTooth2.cs b/Projectiles/Rogue/LeviathanTooth2.cs index f0c91daf55..0d1feb5bc3 100644 --- a/Projectiles/Rogue/LeviathanTooth2.cs +++ b/Projectiles/Rogue/LeviathanTooth2.cs @@ -49,10 +49,7 @@ namespace CalamityMod.Projectiles.Rogue int num988 = 15; bool flag54 = false; bool flag55 = false; - float[] var_2_2CB4E_cp_0 = projectile.localAI; - int var_2_2CB4E_cp_1 = 0; - float num73 = var_2_2CB4E_cp_0[var_2_2CB4E_cp_1]; - var_2_2CB4E_cp_0[var_2_2CB4E_cp_1] = num73 + 1f; + projectile.localAI[0] += 1f; if (projectile.localAI[0] % 30f == 0f) { flag55 = true; diff --git a/Projectiles/Rogue/LeviathanTooth3.cs b/Projectiles/Rogue/LeviathanTooth3.cs index 8edb699761..bc4bb757fa 100644 --- a/Projectiles/Rogue/LeviathanTooth3.cs +++ b/Projectiles/Rogue/LeviathanTooth3.cs @@ -49,10 +49,7 @@ namespace CalamityMod.Projectiles.Rogue int num988 = 15; bool flag54 = false; bool flag55 = false; - float[] var_2_2CB4E_cp_0 = projectile.localAI; - int var_2_2CB4E_cp_1 = 0; - float num73 = var_2_2CB4E_cp_0[var_2_2CB4E_cp_1]; - var_2_2CB4E_cp_0[var_2_2CB4E_cp_1] = num73 + 1f; + projectile.localAI[0] += 1f; if (projectile.localAI[0] % 30f == 0f) { flag55 = true; diff --git a/Projectiles/Rogue/LionfishProj.cs b/Projectiles/Rogue/LionfishProj.cs index c88d8060f9..18fe2c12ff 100644 --- a/Projectiles/Rogue/LionfishProj.cs +++ b/Projectiles/Rogue/LionfishProj.cs @@ -38,10 +38,7 @@ namespace CalamityMod.Projectiles.Rogue } if (projectile.ai[0] == 0f) { - float[] var_2_2CA48_cp_0 = projectile.ai; - int var_2_2CA48_cp_1 = 1; - float num73 = var_2_2CA48_cp_0[var_2_2CA48_cp_1]; - var_2_2CA48_cp_0[var_2_2CA48_cp_1] = num73 + 1f; + projectile.ai[1] += 1f; if (projectile.ai[1] >= 45f) { float num986 = 0.98f; @@ -67,10 +64,7 @@ namespace CalamityMod.Projectiles.Rogue int num988 = 15; bool flag54 = false; bool flag55 = false; - float[] var_2_2CB4E_cp_0 = projectile.localAI; - int var_2_2CB4E_cp_1 = 0; - float num73 = var_2_2CB4E_cp_0[var_2_2CB4E_cp_1]; - var_2_2CB4E_cp_0[var_2_2CB4E_cp_1] = num73 + 1f; + projectile.localAI[0] += 1f; if (projectile.localAI[0] % 30f == 0f) { flag55 = true; diff --git a/Projectiles/Rogue/ShatteredSunKnife.cs b/Projectiles/Rogue/ShatteredSunKnife.cs index 72f6a40d4c..4847326c39 100644 --- a/Projectiles/Rogue/ShatteredSunKnife.cs +++ b/Projectiles/Rogue/ShatteredSunKnife.cs @@ -58,7 +58,7 @@ namespace CalamityMod.Projectiles.Rogue for (int i = 0; i < numProj; i++) { Vector2 perturbedspeed = new Vector2(projectile.velocity.X, projectile.velocity.Y + Main.rand.Next(-3, 4)).RotatedBy(MathHelper.ToRadians(spread)); - int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedspeed.X * 0.2f, perturbedspeed.Y * 0.2f, ModContent.ProjectileType(), (int)((double)projectile.damage * 1.5), 1f, projectile.owner, 0f, 0f); + int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedspeed.X * 0.2f, perturbedspeed.Y * 0.2f, ModContent.ProjectileType(), (int)((double)projectile.damage * 0.5), 1f, projectile.owner, 0f, 0f); Main.projectile[proj].Calamity().stealthStrike = projectile.Calamity().stealthStrike; spread -= Main.rand.Next(2, 6); } diff --git a/Projectiles/Rogue/StickyBol.cs b/Projectiles/Rogue/StickyBol.cs index afaf467e7e..c42fce74e2 100644 --- a/Projectiles/Rogue/StickyBol.cs +++ b/Projectiles/Rogue/StickyBol.cs @@ -41,10 +41,7 @@ namespace CalamityMod.Projectiles.Rogue int num988 = 15; bool flag54 = false; bool flag55 = false; - float[] var_2_2CB4E_cp_0 = projectile.localAI; - int var_2_2CB4E_cp_1 = 0; - float num73 = var_2_2CB4E_cp_0[var_2_2CB4E_cp_1]; - var_2_2CB4E_cp_0[var_2_2CB4E_cp_1] = num73 + 1f; + projectile.localAI[0] += 1f; if (projectile.localAI[0] % 30f == 0f) { flag55 = true; diff --git a/Projectiles/Rogue/SupernovaBomb.cs b/Projectiles/Rogue/SupernovaBomb.cs index 2a765c4096..98959ed258 100644 --- a/Projectiles/Rogue/SupernovaBomb.cs +++ b/Projectiles/Rogue/SupernovaBomb.cs @@ -102,7 +102,7 @@ namespace CalamityMod.Projectiles.Rogue } 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.5), 0f, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value15.X, value15.Y, ModContent.ProjectileType(), (int)((double)projectile.damage * 0.6), 0f, projectile.owner, 0f, 0f); } float spread = 60f * 0.0174f; double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; @@ -112,8 +112,8 @@ namespace CalamityMod.Projectiles.Rogue for (i = 0; i < 3; i++) { offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 2f), (float)(Math.Cos(offsetAngle) * 2f), ModContent.ProjectileType(), (int)((double)projectile.damage * 0.4), projectile.knockBack, projectile.owner, 0f, 0f); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 2f), (float)(-Math.Cos(offsetAngle) * 2f), ModContent.ProjectileType(), (int)((double)projectile.damage * 0.4), projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 2f), (float)(Math.Cos(offsetAngle) * 2f), ModContent.ProjectileType(), (int)((double)projectile.damage * 0.5), projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 2f), (float)(-Math.Cos(offsetAngle) * 2f), ModContent.ProjectileType(), (int)((double)projectile.damage * 0.5), projectile.knockBack, projectile.owner, 0f, 0f); } } diff --git a/Projectiles/Rogue/SupernovaBoom.cs b/Projectiles/Rogue/SupernovaBoom.cs index d6caa1311b..1fefd543c7 100644 --- a/Projectiles/Rogue/SupernovaBoom.cs +++ b/Projectiles/Rogue/SupernovaBoom.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.penetrate = -1; projectile.timeLeft = 5; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 1; + projectile.localNPCHitCooldown = 0; } public override void AI() diff --git a/Projectiles/Rogue/TurbulanceProjectile.cs b/Projectiles/Rogue/TurbulanceProjectile.cs index eb6a4e7283..336f48e222 100644 --- a/Projectiles/Rogue/TurbulanceProjectile.cs +++ b/Projectiles/Rogue/TurbulanceProjectile.cs @@ -80,33 +80,16 @@ namespace CalamityMod.Projectiles.Rogue { if (projectile.owner == Main.myPlayer) { - if (crit) //homing + for (int num252 = 0; num252 < 4; num252++) { - for (int num252 = 0; num252 < 4; num252++) + Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + while (value15.X == 0f && value15.Y == 0f) { - Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - while (value15.X == 0f && value15.Y == 0f) - { - value15 = 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, ModContent.ProjectileType(), projectile.damage / 3, projectile.knockBack / 3, Main.myPlayer, 0f, 1f); - } - } - else //not homing - { - for (int num252 = 0; num252 < 4; num252++) - { - Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - while (value15.X == 0f && value15.Y == 0f) - { - value15 = 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, ModContent.ProjectileType(), projectile.damage / 3, projectile.knockBack / 3, Main.myPlayer, 0f, 0f); + value15 = 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, ModContent.ProjectileType(), projectile.damage / 3, projectile.knockBack / 3, Main.myPlayer, 0f, (crit ? 1f /*homing*/: 0f/*not homing*/)); } } } diff --git a/Projectiles/Summon/DreadmineTurret.cs b/Projectiles/Summon/DreadmineTurret.cs index 40799af0d4..2587c71af8 100644 --- a/Projectiles/Summon/DreadmineTurret.cs +++ b/Projectiles/Summon/DreadmineTurret.cs @@ -1,6 +1,7 @@ using Microsoft.Xna.Framework; using System; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Summon { @@ -12,6 +13,7 @@ namespace CalamityMod.Projectiles.Summon { DisplayName.SetDefault("Dreadmine Turret"); Main.projFrames[projectile.type] = 2; + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; } public override void SetDefaults() diff --git a/Projectiles/Summon/EnergyOrb.cs b/Projectiles/Summon/EnergyOrb.cs new file mode 100644 index 0000000000..bd8bf4ad79 --- /dev/null +++ b/Projectiles/Summon/EnergyOrb.cs @@ -0,0 +1,81 @@ +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon +{ + public class EnergyOrb : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Energy Orb"); + } + + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.alpha = 100; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.tileCollide = false; + projectile.timeLeft = 200; + projectile.minion = true; + } + + public override void AI() + { + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 4f) + { + for (int num468 = 0; num468 < 1; num468++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 132, 0f, 0f, 100, default, 1f); + if (Main.rand.Next(6) != 0) + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 400f; + bool flag17 = false; + for (int num475 = 0; num475 < Main.npc.Length; num475++) + { + if (Main.npc[num475].CanBeChasedBy(projectile, false)) + { + float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); + float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + if (num478 < num474) + { + num474 = num478; + num472 = num476; + num473 = num477; + flag17 = true; + } + } + } + if (flag17) + { + float num483 = 10f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = num472 - vector35.X; + float num485 = num473 - vector35.Y; + float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + num486 = num483 / num486; + num484 *= num486; + num485 *= num486; + projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Electrified, 120); + } + } +} diff --git a/Projectiles/Summon/EnergyOrb.png b/Projectiles/Summon/EnergyOrb.png new file mode 100644 index 0000000000..479a56ea6c Binary files /dev/null and b/Projectiles/Summon/EnergyOrb.png differ diff --git a/Projectiles/Summon/Hive.cs b/Projectiles/Summon/Hive.cs index 4df4872d23..e06e6c786e 100644 --- a/Projectiles/Summon/Hive.cs +++ b/Projectiles/Summon/Hive.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Summon { @@ -10,6 +11,7 @@ namespace CalamityMod.Projectiles.Summon { DisplayName.SetDefault("Hive"); Main.projFrames[projectile.type] = 6; + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; } public override void SetDefaults() diff --git a/Projectiles/Summon/LanternSoul.cs b/Projectiles/Summon/LanternSoul.cs index 5614f44c37..15adccf180 100644 --- a/Projectiles/Summon/LanternSoul.cs +++ b/Projectiles/Summon/LanternSoul.cs @@ -1,6 +1,7 @@ using Microsoft.Xna.Framework; using System; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Summon { @@ -11,6 +12,7 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Lantern"); + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; } public override void SetDefaults() diff --git a/Projectiles/Summon/MechwormBody.cs b/Projectiles/Summon/MechwormBody.cs index 4de9f5960d..fbbc4e0c43 100644 --- a/Projectiles/Summon/MechwormBody.cs +++ b/Projectiles/Summon/MechwormBody.cs @@ -16,6 +16,7 @@ namespace CalamityMod.Projectiles.Summon { DisplayName.SetDefault("Mechworm"); ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + ProjectileID.Sets.NeedsUUID[projectile.type] = true; } public override void SetDefaults() @@ -97,7 +98,6 @@ namespace CalamityMod.Projectiles.Summon } } value68 = Main.projectile[chase].Center; - Vector2 arg_2DE6A_0 = Main.projectile[chase].velocity; num1064 = Main.projectile[chase].rotation; scaleFactor18 = MathHelper.Clamp(Main.projectile[chase].scale, 0f, 50f); scaleFactor17 = 16f; diff --git a/Projectiles/Summon/MechwormBody2.cs b/Projectiles/Summon/MechwormBody2.cs index ed9f836338..1e637f7a92 100644 --- a/Projectiles/Summon/MechwormBody2.cs +++ b/Projectiles/Summon/MechwormBody2.cs @@ -16,6 +16,7 @@ namespace CalamityMod.Projectiles.Summon { DisplayName.SetDefault("Mechworm"); ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + ProjectileID.Sets.NeedsUUID[projectile.type] = true; } public override void SetDefaults() diff --git a/Projectiles/Summon/MechwormHead.cs b/Projectiles/Summon/MechwormHead.cs index 1e22b54a7c..8abc0dd6e4 100644 --- a/Projectiles/Summon/MechwormHead.cs +++ b/Projectiles/Summon/MechwormHead.cs @@ -19,6 +19,7 @@ namespace CalamityMod.Projectiles.Summon DisplayName.SetDefault("Mechworm"); ProjectileID.Sets.MinionSacrificable[projectile.type] = true; ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + ProjectileID.Sets.NeedsUUID[projectile.type] = true; } public override void SetDefaults() diff --git a/Projectiles/Summon/MechwormTail.cs b/Projectiles/Summon/MechwormTail.cs index 4c89873cac..cfe7a43cae 100644 --- a/Projectiles/Summon/MechwormTail.cs +++ b/Projectiles/Summon/MechwormTail.cs @@ -16,6 +16,7 @@ namespace CalamityMod.Projectiles.Summon { DisplayName.SetDefault("Mechworm"); ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + ProjectileID.Sets.NeedsUUID[projectile.type] = true; } public override void SetDefaults() @@ -73,34 +74,30 @@ namespace CalamityMod.Projectiles.Summon projectile.ai[1] = 0f; projectile.netUpdate = true; } - int chase = (int)projectile.ai[0]; float num1064; float scaleFactor17; float scaleFactor18; - if (chase >= 0 && Main.projectile[chase].active) + int byUUID = Projectile.GetByUUID(projectile.owner, (int)projectile.ai[0]); + if (byUUID >= 0 && Main.projectile[byUUID].active && (Main.projectile[byUUID].type == ModContent.ProjectileType() || + Main.projectile[byUUID].type == ModContent.ProjectileType() || + Main.projectile[byUUID].type == ModContent.ProjectileType())) { - //Delete the player's mechworm if it's attaching to something weird - if (Main.projectile[chase].type != ModContent.ProjectileType() && - Main.projectile[chase].type != ModContent.ProjectileType()) + value68 = Main.projectile[byUUID].Center; + num1064 = Main.projectile[byUUID].rotation; + float num1063 = MathHelper.Clamp(Main.projectile[byUUID].scale, 0f, 50f); + scaleFactor17 = 16f; + scaleFactor18 = num1063; + Main.projectile[byUUID].localAI[0] = projectile.localAI[0] + 1f; + if (Main.projectile[byUUID].type != ModContent.ProjectileType()) { - for (int i = 0; i < Main.projectile.Length; i++) - { - if (Main.projectile[i].active && Main.projectile[i].owner == projectile.owner && - (Main.projectile[i].type == ModContent.ProjectileType() || - Main.projectile[i].type == ModContent.ProjectileType() || - Main.projectile[i].type == ModContent.ProjectileType() || - Main.projectile[i].type == ModContent.ProjectileType())) - { - Main.projectile[i].Kill(); - } - } + Main.projectile[byUUID].localAI[1] = (float)projectile.whoAmI; + } + if (projectile.owner == Main.myPlayer && Main.projectile[byUUID].type == ModContent.ProjectileType() && projectile.type == ModContent.ProjectileType()) + { + Main.projectile[byUUID].Kill(); + projectile.Kill(); + return; } - value68 = Main.projectile[chase].Center; - Vector2 arg_2DE6A_0 = Main.projectile[chase].velocity; - num1064 = Main.projectile[chase].rotation; - scaleFactor18 = MathHelper.Clamp(Main.projectile[chase].scale, 0f, 50f); - scaleFactor17 = 6f; - Main.projectile[chase].localAI[0] = projectile.localAI[0] + 1f; } else { diff --git a/Projectiles/Summon/Spikecrag.cs b/Projectiles/Summon/Spikecrag.cs index 49c2f4af62..10dfc94d79 100644 --- a/Projectiles/Summon/Spikecrag.cs +++ b/Projectiles/Summon/Spikecrag.cs @@ -1,6 +1,7 @@ using Microsoft.Xna.Framework; using System; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Summon { @@ -11,6 +12,7 @@ namespace CalamityMod.Projectiles.Summon { DisplayName.SetDefault("Spikecrag"); Main.projFrames[projectile.type] = 4; + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; } public override void SetDefaults()